Skip to content

feat: extend comment carry-forward to code files#324

Merged
tomasz-tomczyk merged 2 commits intomainfrom
feat/carry-forward-code-files
Apr 21, 2026
Merged

feat: extend comment carry-forward to code files#324
tomasz-tomczyk merged 2 commits intomainfrom
feat/carry-forward-code-files

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

@tomasz-tomczyk tomasz-tomczyk commented Apr 21, 2026

Summary

  • carryForwardComments() only processed markdown files — code files fell through to carryForwardAllComments() which copied at original positions with zero remapping
  • Unified carryForwardFileComments now handles all file types with LCS + anchor verification
  • Old-side comments (referencing base ref) are preserved at original positions (base ref is stable across rounds)
  • Fixed AddComment to extract anchor from base ref for old-side comments via git show

Review

  • Code review: passed (old-side comment corruption bug caught and fixed)
  • TDD verified: all 7 new tests fail without fix, pass with fix

Test plan

🤖 Generated with Claude Code

carryForwardComments() only processed markdown files, leaving code files
to fall through to carryForwardAllComments() which copies at original
positions with zero remapping. This meant code file comments pointed to
wrong lines after agent edits, and comments on deleted lines became
invisible.

- Unified carryForwardFileComments handles all file types with LCS line
  mapping + anchor verification (previously markdown-only)
- Snapshot PreviousContent for all files with comments, not just markdown
- Fix old-side anchor extraction: read from base ref via git show instead
  of working tree (which doesn't contain deleted lines)
- Add fileContentAtRef() helper for reading file content at a git ref

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rward

Old-side comments reference the base ref (stable across rounds), not the
working tree. Running them through LCS remapping produced meaningless
results and incorrectly marked them as drifted.

- Skip LCS remapping and anchor correction for old-side comments
- Add test for old-side comment position preservation
- Fix stale comment about "anchor-only search"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tomasz-tomczyk tomasz-tomczyk merged commit 3a554bf into main Apr 21, 2026
4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the feat/carry-forward-code-files branch April 21, 2026 15:05
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