fix(diff): surface same-severity in-place finding changes as [CHANGED]#47
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
diffReportsidentified 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. amediumrewritten into a differentmedium— 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: truewould 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 tomessagefor reports that predate signatures). If it differs, surface the finding with a[CHANGED]prefix. Severity decreases remain out of the delta as improvements.Tests
[CHANGED][CHANGED]All 121 tests pass;
dist/rebuilt and committed.🤖 Generated with Claude Code