feat: content-based comment anchoring for carry-forward positioning#296
Merged
tomasz-tomczyk merged 4 commits intomainfrom Apr 17, 2026
Merged
feat: content-based comment anchoring for carry-forward positioning#296tomasz-tomczyk merged 4 commits intomainfrom
tomasz-tomczyk merged 4 commits intomainfrom
Conversation
Store an anchor (full text of commented lines) on every line comment at creation time. During carry-forward between review rounds, verify the LCS-remapped position still matches the anchor text. If it doesn't, search the new file for the anchor and remap there. If the anchor text is gone entirely, mark the comment as drifted. Backend: - Add Anchor and Drifted fields to Comment struct - Auto-populate anchor in AddComment and crit comment CLI - Verify + correct LCS remapping using anchor text in carryForwardComments - Fix git-mode to snapshot PreviousContent and call carryForwardComments (was previously skipped — comments stayed at original line numbers) Frontend: - Show "Drifted" badge on comments where anchor text wasn't found - Collapsible "Original content" section showing the anchor text Integration docs updated for all agents (anchor field, drifted flag). Test infrastructure: carry-forward test scenarios in make test-diff. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace native <details>/<summary> with a custom toggle button: - Rotating chevron with CSS transition - Left-border accent panel using yellow/warning color family - Proper focus-visible keyboard accessibility - Panel hidden when comment card is collapsed - New --drifted-bg and --drifted-border CSS vars in all 4 theme blocks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
400f106 to
af6a379
Compare
The anchorLen in verifyAndCorrectPosition was computed from lcsEnd - lcsStart + 1, which is wrong when LCS maps the start and end lines farther apart than the original span (e.g. lines inserted between them). Use len(strings.Split(anchor, "\n")) instead. Also merge two adjacent lock blocks in handleRoundCompleteGit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
af6a379 to
82260d2
Compare
New anchor and drifted fields in the review file format. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
00a609d to
077a0db
Compare
tomasz-tomczyk
pushed a commit
that referenced
this pull request
Apr 29, 2026
Drop the old focus-picker popover (Working tree / Your stack / Other PRs / Branches) in favour of a narrower, more focused UI inspired by stacked-PR review tools that only handle in-stack navigation. Frontend - New stack breadcrumb in the header: main > #294 > #295 (reviewing) > #296, rendered inline (not a popover). Default-branch click flips diff_scope to full_stack on the current focus; other entries swap focus via /api/focus. Visibility uses stack.length > 1 (not is_stacked) so local-only stacks and Sapling-style commit chains also get the breadcrumb. Long stacks collapse the middle into an ellipsis. - New Working tree pill, visible whenever focus is range in git mode. - Layer/full-stack toggle now appears whenever default_sha is resolved, not only for is_stacked focus. - Other PRs / Remote branches sections deleted from the frontend; backend /api/picker still returns them but the frontend stops consuming them. - focus-changed SSE handler fixed to parse the wrapper.content payload correctly (the old handler relied on page reloads in tests to mask this). Backend (picker.go) - detectStack adds tier-3 fallback for naked-commit ancestors on the topic chain (commits reachable from HEAD but not the default branch). Uses first-line commit subject as the label so Sapling-style git stacks of unbranched commits surface in the picker. - Topic-chain filter prevents long-lived feature branches from drowning the breadcrumb in default-branch ancestors. CLI - Help text now lists --pr <num|url> and --range <baseSHA>..<headSHA> as the entry points into range mode. Tests - Rewrote focus-picker.rangemode.spec.ts and focus-picker-wt-entry for the breadcrumb. Added breadcrumb-current-marker, breadcrumb-default-branch, breadcrumb-ellipsis, breadcrumb-local-stack, breadcrumb-no-pr specs. - Updated focus-switch.rangemode for the working-tree pill. - loading.filemode + nogit.nogit assert the breadcrumb and pill stay hidden in non-VCS modes. - range-loading header-label test now checks the breadcrumb reviewing marker instead of the removed #focusPickerLabel. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
anchorfield (full text of commented lines) on every line comment at creation timedriftedcarryForwardAllCommentswas called)anchoranddriftedfieldsTest plan
make test-diffnow includes carry-forward test scenarios on ports 3003 (file-mode) and 3004 (git-mode) with 5 comments covering: simple shifts, removed content, rewritten content🤖 Generated with Claude Code