Skip to content

feat(mr): add inline comments and comment editing - #704

Merged
ImLunaHey merged 2 commits into
mainfrom
luna/dep-8714-mr-comments
Nov 17, 2026
Merged

ImLunaHey merged 2 commits into
mainfrom
luna/dep-8714-mr-comments

Conversation

@ImLunaHey

@ImLunaHey ImLunaHey commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge request reviewers can read inline discussions through the CLI but cannot create inline comments or edit their own comments. Extend depot mr comment with MR ID selection and inline line/range anchors, and add mr edit-comment and mr delete-comment. Existing branch-based comments and body/file/stdin input continue to work.

Inline comments require the reviewed head and stored base commit IDs so a changed diff is refused rather than receiving a misplaced comment. mr diff --json exposes anchorBaseOid separately from its comparison base, and comment JSON carries the API's optional canEdit field.

Rollout: deploy https://github.com/depot/api/pull/7060 before releasing this CLI. Comment mutations use existing API methods.

Validation: go test ./..., focused MR tests on CI's Go 1.26.10, build, module verification, and golangci-lint passed. A live smoke test created, edited, and deleted comments on a disposable closed MR, posted an inline range, and verified stale head/base rejection; temporary comments were deleted.

Created with Codex in T3 Code.

Catch up on this pull request in Depot


Note

Medium Risk
Introduces comment create/edit/delete paths tied to revision OIDs and ownership; mistakes could post stale inline anchors or mutate the wrong comment without the new guards and API checks.

Overview
Extends depot mr comment so reviewers can post conversation or inline comments on an open MR (by branch or --id without a checkout). Inline mode requires --path, --side, --line, --head-oid, and --base-oid (optional line range via --start-line), with local validation before any API call and confirmation that the server echoed the requested anchor.

Adds mr edit-comment and mr delete-comment for the caller’s own comments, with optional --id to verify the comment belongs to that MR before update/delete.

mr diff --json now includes anchorBaseOid (the MR’s stored base OID for anchoring) alongside the comparison baseOid, omitted when diffing a specific --commit.

Proto/client types gain optional can_edit on merge request comments. The prior minimal comment implementation is removed from mr.go in favor of the new comments.go module and tests.

Reviewed by Cursor Bugbot for commit b89362d. Bugbot is set up for automated code reviews on this repo. Configure here.

@linear-code

linear-code Bot commented Nov 17, 2026

Copy link
Copy Markdown

DEP-8714

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread pkg/cmd/mr/comments.go Resolved
Comment thread pkg/cmd/mr/diff.go Resolved
cursor[bot]
cursor Bot previously approved these changes Nov 17, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Risk: medium. Approved based on Cursor Bugbot completing successfully with no findings that need human review. Human review is not required for this merge-request comments change.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the latest push and didn't find any new bugs. The follow-up commit addresses both points from my earlier review. The new edit and delete commands and the required API rollout still make a human look worthwhile.

What was reviewed:

  • Comment confirmation now uses sameCommentAnchor, which compares only the anchor fields the CLI sends. A nil anchor and an empty anchor now count as the same, so a plain conversation comment isn't reported as a failure after it posts.
  • mr diff --json now emits anchorBaseOid only when --commit isn't set, and diff_test.go checks that it's absent in --commit mode.
  • Checked the edit-comment/delete-comment flow (authenticate first, then the optional --id ownership and not-deleted check through requireComment) and the anchor flag validation before any API call.
Extended reasoning...

The change adds a new pkg/cmd/mr/comments.go (inline-anchored comments, plus edit-comment and delete-comment subcommands), an anchorBaseOid field in mr diff JSON, and an optional can_edit proto field with a regenerated pb.go. The security-sensitive part is limited to comment mutation by ID. Those calls authenticate first, and the server enforces ownership; the client-side MR check runs only when --id is passed. Commit b89362d fixes both earlier inline findings. Approval isn't given because the change adds new mutating commands that rely on a coordinated API deployment, and the pb.go diff is large.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b89362d. Configure here.

Comment thread pkg/cmd/mr/diff.go Resolved
@cursor
cursor Bot dismissed their stale review November 17, 2026 17:18

Risk: medium. Dismissed this automation's prior approval because Cursor Bugbot reported 1 unresolved finding that needs human attention. Human review is needed and no reviewers were assigned.

@ImLunaHey
ImLunaHey marked this pull request as draft November 17, 2026 17:24
@ImLunaHey
ImLunaHey marked this pull request as ready for review November 17, 2026 17:24

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Cursor Grok 4.6 responding on behalf of Jacob Gillespie

Risk: medium. Approved. Cursor Bugbot was skipped on the current head and its earlier finding is resolved, so this merge-request comments change stays within the approval threshold.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review completed

Nothing new to post: everything this review found is already covered by existing comments on this pull request or didn't merit a separate one.

@ImLunaHey
ImLunaHey merged commit e4c32ea into main Nov 17, 2026
13 checks passed
@ImLunaHey
ImLunaHey deleted the luna/dep-8714-mr-comments branch November 17, 2026 17:38
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