Skip to content

Fail closed on deletion-only line attribution - #62

Merged
hzw0813 merged 3 commits into
mainfrom
fix/deletion-only-line-attribution
Aug 15, 2026
Merged

Fail closed on deletion-only line attribution#62
hzw0813 merged 3 commits into
mainfrom
fix/deletion-only-line-attribution

Conversation

@hzw0813

@hzw0813 hzw0813 commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • reconcile zero-context current-side hunk spans with Git numstat additions before attributing current changed symbols or call sites
  • fail closed when a deletion-only hunk's zero-length new-side range is represented only by Git's neighboring-line anchor
  • add an end-to-end regression proving an unchanged symbol/call on that anchor is no longer reported as changed
  • emit an explicit limitation when current-line attribution is withheld
  • regenerate tracked dist and document the fix

Why

Git encodes a deletion-only zero-context hunk such as @@ -2 +1,0 @@ with a zero-length new-side range anchored at current line 1. ProofDiff's DiffHunk representation currently stores that as newRange: { start: 1, end: 1 }. Direct interval matching therefore treated the unchanged current line 1 as changed, which could falsely report both a parser-observed call and a current symbol as part of the change.

The fix does not guess which anchor is real code. It validates that the sum of reconstructed current-side hunk spans exactly matches Git's numstat additions; if not, current changed-symbol/call attribution is withheld and the limitation is reported. This preserves existing coverage's fail-closed philosophy without changing the public hunk schema.

Verification

  • independently reproduced Git's @@ -2 +1,0 @@ deletion-only shape with an unchanged call on the anchor line
  • regression asserts the exact hunk shape reaches analysis, while changedSymbols and changedCalls remain empty
  • full npm test passed
  • clean npm run clean && npm run build passed
  • git diff --check passed
  • generated dist refreshed
  • temporary updater workflow removed from the final diff

@hzw0813
hzw0813 merged commit a8cbddf into main Aug 15, 2026
13 checks passed
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