Skip to content

reviewdiff: Parse review comment patches - #1162

Merged
abhinav merged 2 commits into
mainfrom
branch-comment-forge
Aug 24, 2026
Merged

reviewdiff: Parse review comment patches#1162
abhinav merged 2 commits into
mainfrom
branch-comment-forge

Conversation

@ed-irl

@ed-irl ed-irl commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Review comment commands need to check postimage anchors before submission, while ShamHub staleness needs to determine whether later revisions delete anchored lines.

Add reviewdiff.Patch, backed by go-gitdiff, to parse a Git patch once and answer file, line, inclusive-range, and source-line deletion queries. A requested range must fit within one postimage fragment, while deletion queries report only lines actually removed from the source side.

The forge API and provider implementations previously carried by this PR are now provided by #1411 through #1417. Staged comment persistence moves to #1163.

@ed-irl

ed-irl commented May 14, 2026

Copy link
Copy Markdown
Collaborator Author

@ed-irl ed-irl added the skip changelog PRs that don't need a changelog. label May 14, 2026
@ed-irl
ed-irl force-pushed the branch-comment-forge branch from c8dd0d1 to 89378af Compare June 2, 2026 18:58
@ed-irl
ed-irl force-pushed the branch-comment-forge branch 3 times, most recently from e17e522 to 47eb920 Compare June 8, 2026 10:18
@ed-irl
ed-irl force-pushed the branch-comment-forge branch 2 times, most recently from febcc09 to 8648c7a Compare June 13, 2026 13:39
@abhinav

abhinav commented Jun 14, 2026

Copy link
Copy Markdown
Owner

working on merging functionality from this stack next

@abhinav
abhinav force-pushed the branch-comment-forge branch from 8648c7a to 0719a4f Compare June 14, 2026 04:05
@abhinav abhinav self-assigned this Jun 14, 2026
@abhinav
abhinav force-pushed the branch-comment-forge branch 2 times, most recently from c8254f9 to dabcd6f Compare June 14, 2026 04:30
abhinav pushed a commit that referenced this pull request Jun 14, 2026
The comments CLI needs a local representation for inline comments that
have been prepared but not submitted to a forge yet.

Staged comments now persist the target path, line range, body,
diff side, and optional thread identifier in the spice state database.
That gives command code a stable state boundary before it batches the
comments into a forge review.

Extracted from #1162
@ed-irl
ed-irl force-pushed the branch-comment-forge branch from dabcd6f to 1d76154 Compare June 15, 2026 09:52
@ed-irl ed-irl changed the title Add inline code review comment support across forges feat(worktree): Add worktree commands, per-worktree trunks, and worktree filtering Jun 19, 2026
@ed-irl
ed-irl force-pushed the branch-comment-forge branch from 1d76154 to 5e57d40 Compare June 19, 2026 01:03
@ed-irl
ed-irl changed the base branch from main to ed-irl/restack-options-param June 24, 2026 01:31
@ed-irl
ed-irl force-pushed the branch-comment-forge branch from 5e57d40 to b382179 Compare June 24, 2026 01:32
@abhinav abhinav changed the title feat(worktree): Add worktree commands, per-worktree trunks, and worktree filtering branch comment: add inline comment support for code review Aug 12, 2026
@abhinav

abhinav commented Aug 23, 2026

Copy link
Copy Markdown
Owner

update: The forge APIs and implementations portions of this PR were extracted, reworked, and merged in #1411, #1412, #1413, #1414, #1415, #1416, and #1417.

ed-irl and others added 2 commits August 23, 2026 09:46
Review comments are entered against working-tree lines,
while forges anchor them to positions in a change diff.
Add `diffmap.Mapper` to bridge those coordinates.

Persist staged comments by branch
so upstack commands can assemble and edit a review before submission.
Review comment anchors need postimage membership before submission, while
ShamHub staleness needs to know whether an old-side line was deleted. The
previous mapper coupled those questions to working-tree coordinates and
always returned the right side.

Parse Git patches into explicit membership and deletion queries. Line ranges
must fit within one postimage fragment, and deletion ranges report only
removed old-side lines. Staged-comment persistence moves to the command
branch that owns its lifecycle.
@abhinav
abhinav changed the base branch from ed-irl/restack-options-param to main August 24, 2026 05:14
@abhinav
abhinav force-pushed the branch-comment-forge branch from b382179 to d2f5157 Compare August 24, 2026 05:14
@abhinav abhinav changed the title branch comment: add inline comment support for code review reviewdiff: Parse review comment patches Aug 24, 2026
@abhinav
abhinav force-pushed the branch-comment-forge branch 2 times, most recently from 9319b93 to d2f5157 Compare August 24, 2026 05:18
@abhinav
abhinav merged commit 6d30b87 into main Aug 24, 2026
37 of 48 checks passed
@abhinav
abhinav deleted the branch-comment-forge branch August 24, 2026 12:40
abhinav added a commit that referenced this pull request Aug 30, 2026
ShamHub review threads record the change head in
`ReviewThread.CommitHash`. When that revision differs from the current
head, compare the two revisions and mark a right-side thread outdated
only when the later patch deletes a line in its inclusive range.

Insertions alone do not stale an anchor. File-level and left-side
threads retain their stored state because their recorded coordinates do
not identify a comparable source range. Explicitly seeded outdated state
still takes precedence, and diff or parsing failures propagate to the
caller.

This builds on the review patch queries from #1162. The user-facing
staleness script is included with the commands in #1163.

---------

Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog PRs that don't need a changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants