Skip to content

fix(diff): surface same-severity in-place finding changes as [CHANGED]#47

Merged
Conalh merged 1 commit into
mainfrom
pr1-diff-changed-detection
May 29, 2026
Merged

fix(diff): surface same-severity in-place finding changes as [CHANGED]#47
Conalh merged 1 commit into
mainfrom
pr1-diff-changed-detection

Conversation

@Conalh
Copy link
Copy Markdown
Owner

@Conalh Conalh commented May 29, 2026

Problem

diffReports identified a finding purely by its (kind, subject, file) natural key and only included it in the PR delta when the severity rank increased ([WORSENED]). A finding mutated in place at the same kind/subject/file and the same severity — e.g. a medium rewritten into a different medium — matched the key exactly and was silently dropped as pre-existing.

This undercut the core promise: "gate only on findings introduced or worsened by this PR." A PR could turn one same-severity violation into a different same-severity violation (e.g. an MCP server's command rewritten to something else at the same risk tier) and diff: true would treat it as unchanged.

The repo already computes a content-derived signature (subject + file + normalized message) for exactly this purpose — it just wasn't consulted in diff mode.

Fix

When the natural key matches and severity did not increase, compare the content identity (signature, falling back to message for reports that predate signatures). If it differs, surface the finding with a [CHANGED] prefix. Severity decreases remain out of the delta as improvements.

Tests

  • same kind/subject/file + same severity + different message → [CHANGED]
  • same severity + changed signature → [CHANGED]
  • same severity + identical signature → stays out of the delta

All 121 tests pass; dist/ rebuilt and committed.

🤖 Generated with Claude Code

diffReports keyed findings on (kind, subject, file) and only included a
finding in the PR delta when its severity rank increased. A finding
mutated in place at the same kind/subject/file and the same severity
(e.g. a medium rewritten into a different medium) matched the natural
key and was silently dropped as pre-existing — undercutting the "gate
only on findings introduced or worsened by this PR" promise.

Compare content identity (signature, falling back to message for
reports that predate signatures) when the natural key matches and
severity did not increase, and surface a genuine change as [CHANGED].
Severity decreases remain out of the delta as improvements.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Conalh Conalh merged commit 42aaefb into main May 29, 2026
5 checks passed
@Conalh Conalh deleted the pr1-diff-changed-detection branch May 29, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant