Skip to content

feat(mr): approve exact revisions and withdraw approvals - #703

Merged
ImLunaHey merged 4 commits into
mainfrom
luna/dep-8712-guarded-approval
Nov 17, 2026
Merged

ImLunaHey merged 4 commits into
mainfrom
luna/dep-8712-guarded-approval

Conversation

@ImLunaHey

@ImLunaHey ImLunaHey commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Clients need to approve and withdraw their own approval without a checkout. Add depot mr approve --id <id> and depot mr approve --id <id> --withdraw, including explicit org/repository selection. The optional --expected-head-oid <oid> flag works with either an ID or a branch when callers want to approve only the revision they reviewed.

Guarded approvals use the new revision-checking RPC and never fall back when a server cannot enforce the guard. Existing depot mr approve [branch] behavior and the approval JSON shape remain compatible; branch selection also supports the new guard and withdrawal flags.

Depends on depot/api#7051: deploy the API before merging/releasing this CLI change. Tracks DEP-8712.

Validation: full go test ./..., golangci-lint, module verification, and CLI build pass. Command tests cover guarded and legacy approvals, withdrawal, invalid flags, identity mismatches, and unsupported servers without fallback.

Created with GPT-6 Astra in Codex.

Catch up on this pull request in Depot


Note

Medium Risk
Touches merge-request approval workflows and a new API RPC; incorrect validation or fallback behavior could approve the wrong revision, though the change adds strict guards and tests.

Overview
depot mr approve is refactored into its own command module and extended so reviewers can approve or withdraw without a local checkout, using --id together with either --expected-head-oid or --withdraw.

Guarded approval calls the new ApproveMergeRequestAtRevision API (proto + Connect client). If the server returns Unimplemented, the CLI errors explicitly and does not fall back to approving the current head. Responses are validated (MR/repo match, open state where required, head OID matches the guard). requireState now formats state errors without a branch name when the MR is selected by ID.

Tests cover guarded and unguarded approve, withdrawal, bad flags, API refusals, identity mismatches, and no-fallback behavior.

Reviewed by Cursor Bugbot for commit fe902ca. 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-8712

@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 found no issues

No high-confidence issues detected in this change.

@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 95ff0ed. Configure here.

Comment thread pkg/cmd/mr/approve.go Resolved

@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

[!NOTE]
🤖 Cursor Grok 4.6 responding on behalf of Jacob Gillespie

Risk: medium. Left a non-blocking comment because Cursor Bugbot reported one unresolved finding (low-severity closed-MR error text when approving by --id). Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@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

[!NOTE]
🤖 Cursor Grok 4.6 responding on behalf of Jacob Gillespie

Risk: medium. Left a non-blocking comment because Cursor Bugbot still has one unresolved finding (low-severity closed-MR error text when approving by --id); the latest Bugbot check was skipped. Human review is needed and no reviewers were assigned.

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 found no issues

No high-confidence issues detected in this change.

@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 because Cursor Bugbot passed on the current head and the prior finding is resolved.

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 found no issues

No high-confidence issues detected in this change.

@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 found no issues

No high-confidence issues detected in this change.

@ImLunaHey
ImLunaHey merged commit a5c4d86 into main Nov 17, 2026
13 checks passed
@ImLunaHey
ImLunaHey deleted the luna/dep-8712-guarded-approval branch November 17, 2026 16:13
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