Skip to content

branch comment: Support file and line-range anchors - #1223

Closed
ed-irl wants to merge 8 commits into
branch-comment-commandsfrom
branch-comment-scopes
Closed

branch comment: Support file and line-range anchors#1223
ed-irl wants to merge 8 commits into
branch-comment-commandsfrom
branch-comment-scopes

Conversation

@ed-irl

@ed-irl ed-irl commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Extend immediate gs branch comment add requests from one line to three anchor forms: a whole file, one line, or an inclusive line range.

Parse the command argument into a typed ReviewThreadRange, check the complete postimage anchor with reviewdiff.Patch, and submit line anchors on the right side of the review diff. File anchors use the zero range defined by the forge review API.

The earlier --pr form is removed because review bodies are not returned by ListReviewThreads and overlap ordinary change comments. Staged comments retain their existing single-line syntax until their persistence and lifetime contracts are decided separately.

@ed-irl

ed-irl commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 13fcb5b to ce6c1aa Compare June 2, 2026 20:08
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from 2f2d7a9 to 673dc16 Compare June 2, 2026 20:14
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 5582ec7 to ee1f597 Compare June 2, 2026 22:20
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from 673dc16 to 3c58177 Compare June 2, 2026 22:30
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from ee1f597 to 9f8657d Compare June 8, 2026 10:18
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from 3c58177 to 75e05c0 Compare June 8, 2026 10:19
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 1113e5d to 312db25 Compare June 8, 2026 11:15
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from e46ecf6 to 658c245 Compare June 8, 2026 11:15
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 312db25 to 6ab1da8 Compare June 12, 2026 20:07
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from 658c245 to 9b32be2 Compare June 12, 2026 20:07
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 6ab1da8 to 167cca4 Compare June 13, 2026 13:39
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from 9b32be2 to b8a0e76 Compare June 13, 2026 13:39
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 167cca4 to d049480 Compare June 15, 2026 09:52
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from b8a0e76 to 9bb9a70 Compare June 15, 2026 09:53
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 41864dd to 93682d9 Compare June 19, 2026 01:04
@ed-irl ed-irl changed the title branch comment: support pr and file scope variants feat: add worktree management commands, per-worktree trunks, and worktree-aware filtering Jun 19, 2026
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from 00e9ec6 to ed5caa4 Compare June 19, 2026 01:04
@ed-irl
ed-irl force-pushed the branch-comment-stale branch from 93682d9 to e8e87b4 Compare June 24, 2026 01:32
@ed-irl
ed-irl force-pushed the branch-comment-scopes branch from 62a5aa0 to 204ded0 Compare June 24, 2026 01:32
@abhinav abhinav changed the title feat: add worktree management commands, per-worktree trunks, and worktree-aware filtering branch comment: support pr and file scope variants Aug 12, 2026
@abhinav
abhinav force-pushed the branch-comment-stale branch from e8e87b4 to 4b111e1 Compare August 24, 2026 05:14
@abhinav
abhinav changed the base branch from branch-comment-stale to branch-comment-commands August 24, 2026 05:15
@abhinav
abhinav force-pushed the branch-comment-scopes branch from 204ded0 to 4953073 Compare August 24, 2026 05:15
@abhinav abhinav changed the title branch comment: support pr and file scope variants branch comment: Support file and line-range anchors Aug 24, 2026
@abhinav
abhinav force-pushed the branch-comment-commands branch from 916ca7d to 4de3ce3 Compare August 24, 2026 12:40
@abhinav
abhinav force-pushed the branch-comment-scopes branch from 4953073 to 173edc0 Compare August 24, 2026 12:40
@abhinav
abhinav force-pushed the branch-comment-commands branch from 4de3ce3 to 836926e Compare August 24, 2026 12:46
@abhinav
abhinav force-pushed the branch-comment-scopes branch from 173edc0 to 4a6e992 Compare August 24, 2026 12:48
@abhinav
abhinav force-pushed the branch-comment-commands branch from 836926e to b5b0780 Compare August 30, 2026 17:54
@abhinav
abhinav force-pushed the branch-comment-scopes branch from 4a6e992 to d32a5a7 Compare August 30, 2026 17:54
ed-irl and others added 8 commits August 30, 2026 14:48
Store single-line review comments by branch so branch comment commands can assemble, edit, and submit a review across invocations. Local integer IDs address drafts before the forge assigns review thread and comment IDs.

The persisted shape intentionally retains the original single-line anchor contract. File-level and line-range staging remain a separate design decision.
Add `gs branch comment` for posting and managing review feedback.
The command group can list remote threads,
stage and batch comments into a review,
reply to or edit comments,
and resolve threads.

Forge IDs are opaque values rather than strings.
Recover IDs from `ReviewRepository.ListReviewThreads`
before reply, edit, or resolution operations.
Exercise `gs branch comment` workflows against ShamHub.
The scripts keep command parsing, staged state, diff mapping,
and forge operations inside one end-to-end boundary.

They cover immediate and staged submission,
listing and JSON output,
staged editing,
and review-thread discovery.
Exercise the user-visible outdated status after a later ShamHub revision deletes one anchored line while preserving another. Cover both the human-readable list and extension-facing JSON output.
Branch comment locations are coordinates in the selected branch postimage.
Check single-line anchors against `reviewdiff.Patch` before submission, retain
the requested path and line, and submit them on the right side of the review
diff.

This removes the working-tree mapping and textual side conversion from
immediate and staged submission. Staged state remains single-line; file and
range staging are deferred to their own contract.
Move review-comment management from gs branch comment to the top-level gs
review namespace. Comments and replies now default to local drafts and use
--no-draft for immediate posting. Publish sends drafts as one review, while
list, edit, resolve, and reopen expose the remaining workflows with numeric
draft references.

Keep the draft default fixed and retain the existing ID lifecycle. Persistent
allocation, deletion, configurable defaults, and staged file or range anchors
remain separate review units.
`gs branch comment add` now accepts a file,
an inclusive `file:start-end` range,
or `--pr` for an unanchored review body.
Single-line `file:line` anchors remain supported.

`--pr` uses `SubmitReviewRequest.Body`.
Because `ListReviewThreads` does not return review bodies,
PR-level comments do not appear in `gs branch comment list`.
Accept immediate review comments anchored to a whole file, one line, or an
inclusive line range. Parse those forms into a typed review-thread range and
check the complete anchor against the selected branch patch before
submission.

Drop `--pr` because review bodies are not returned by `ListReviewThreads` and
overlap ordinary change comments. Staged comments retain their existing
single-line syntax until their persistence and lifetime contracts are
decided.
@abhinav
abhinav force-pushed the branch-comment-commands branch from b5b0780 to 8b8bb59 Compare August 30, 2026 22:04
@abhinav
abhinav force-pushed the branch-comment-scopes branch from d32a5a7 to 02e5ccc Compare August 30, 2026 22:04
@abhinav
abhinav force-pushed the branch-comment-commands branch from 8b8bb59 to 31f7350 Compare August 30, 2026 22:25
@abhinav

abhinav commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Folding into #1163

@abhinav abhinav closed this Aug 30, 2026
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.

2 participants