Repository navigation
feat(mr): approve exact revisions and withdraw approvals - #703
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
There was a problem hiding this comment.
Stale comment
[!NOTE]
🤖 Cursor Grok 4.6 responding on behalf of Jacob GillespieRisk: 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.Sent by Cursor Approval Agent: Pull Request Router and Approver
There was a problem hiding this comment.
Stale comment
[!NOTE]
🤖 Cursor Grok 4.6 responding on behalf of Jacob GillespieRisk: 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.Sent by Cursor Approval Agent: Pull Request Router and Approver



Clients need to approve and withdraw their own approval without a checkout. Add
depot mr approve --id <id>anddepot 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 approveis refactored into its own command module and extended so reviewers can approve or withdraw without a local checkout, using--idtogether with either--expected-head-oidor--withdraw.Guarded approval calls the new
ApproveMergeRequestAtRevisionAPI (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).requireStatenow 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.