Skip to content

feat(mr): expose merge request diffs and commit history - #702

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

ImLunaHey merged 2 commits into
mainfrom
luna/dep-8713-mr-diffs

Conversation

@ImLunaHey

@ImLunaHey ImLunaHey commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

T3 Code needs to read Depot merge request changes and commit history to support file review. The CLI currently exposes MR metadata but has no commands for these reads.

Add depot mr diff, mr commits, and mr file using the existing CodeService APIs. Commands accept the current branch, an explicit branch, or --id, and use the MR’s recorded revisions so merged or closed requests retain their historical comparison. Existing commands remain unchanged.

  • mr diff prints a unified diff, with --name-only, --stat, and individual-commit support.
  • JSON diff/history responses expose one page and a continuation token; text output follows all pages.
  • Binary and oversized diffs have explicit status and unavailable line counts. File JSON returns both sides as base64, with a 4 MiB limit per side.

Most of the diff is the CodeService protobuf contract and generated Go bindings. This PR requires no new API endpoint.

Validation: go test ./..., golangci-lint v2.14.0 (0 issues), module verification/tidy, CLI build/help smoke check, formatting, and reproducible protobuf generation passed. Also verified reads against merged MRs and the local T3 integration. Linux/container validation and release packaging remain for CI.

Tracked in DEP-8713.

Created with GPT-6 Astra in Codex.

Catch up on this pull request in Depot


Note

Medium Risk
Adds new authenticated remote-read paths and large generated API bindings, but existing MR commands are unchanged and the new surface is read-only with explicit limits on incomplete or unsafe output.

Overview
Adds depot mr diff, depot mr commits, and depot mr file so the CLI can inspect merge request changes via the CodeService APIs. A shared comparison resolver loads the MR (branch, --id, or current checkout), uses the recorded head/base for historical comparisons on merged/closed MRs, and optionally compares a single commit with --commit against its first parent.

mr diff renders unified patches (or --name-only / --stat), with path filtering, context lines, and JSON paging via nextPageToken. Binary and oversized files are labeled explicitly; text mode errors when a diff is incomplete. mr commits lists commits on the MR branch not reachable from the recorded base. mr file fetches exact changed paths (paged compare + ranged GetBlob) up to 4 MiB per side, with JSON base64 or text output.

Wires api.NewCodeClient() and registers the new subcommands under depot mr. The bulk of the diff vendors the v1beta2 CodeService protobuf/Connect client (and MCP tool options); behavior is covered by new integration-style tests in diff_test.go.

Reviewed by Cursor Bugbot for commit 441deb8. 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-8713

@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 083488b. Configure here.

Comment thread pkg/cmd/mr/mr.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

Risk: medium. Left a non-blocking comment. Cursor Bugbot reported an unresolved high-severity finding on agent-turn access for the new MR read commands, so this is not approved. 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.

Findings marked 🟡 are optional suggestions and need no follow-up push.

Comment thread pkg/cmd/mr/code_reads.go Resolved
Comment thread pkg/cmd/mr/diff.go Resolved
Comment thread pkg/cmd/mr/code_reads.go Resolved

@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.

Risk: medium. Approved. Cursor Bugbot passed on the current head with no unresolved findings that need human review.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@ImLunaHey
ImLunaHey merged commit b2679b4 into main Nov 17, 2026
13 checks passed
@ImLunaHey
ImLunaHey deleted the luna/dep-8713-mr-diffs branch November 17, 2026 14:24
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