Repository navigation
perf(cursor-approve): drop the full-history clone from the checkout axes - #463
Conversation
Both PR-head checkouts in cursor-axis-base.yml (the Cursor `axis` job and `axis-direct`) cloned every branch and tag with fetch-depth: 0, which took 1.5-10 minutes per axis on a large monorepo caller, often longer than the review itself. Only the merge base needs history. - Check out commit_sha at depth 1, then run the shared scripts/check-pr-size/fetch-history.sh (already used by cursor-review's diff-size job and pr-size.yml) to fetch BASE_SHA and commit_sha back to a merge base it can vouch for, failing the job with an ::error:: otherwise. - Render prompt resolves merge-base(BASE_SHA, commit_sha) with no fallback, instead of merge-base(origin/<base_ref>, commit_sha) falling back to BASE_SHA. origin/<base_ref> no longer exists in a narrowed checkout; the result is the same commit unless the base branch has since absorbed the PR's own commits, and it now matches the compare API the no-checkout axes use. - New test_axis_checkout.py pins depth 1, the fetch step's order and inputs, and the no-fallback merge base. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50. Or wait 44 minutes for your next included review. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Fetch merge-base history .github/workflows/cursor-axis-base.yml, scripts/check-pr-size/fetch-history.sh, docs/callers/cursor-approve.md, .github/cursor-approve/tests/test_axis_checkout.py |
Both runner jobs use depth-1 checkouts and fetch history using the pull request base SHA, head SHA, and GitHub token. The documentation and shared-script comment are updated. Tests check checkout settings, fetch ordering and inputs, and the checkout gate. |
Compute merge base for rendering .github/workflows/cursor-axis-base.yml, .github/cursor-approve/tests/test_axis_checkout.py |
Both prompt-rendering steps compute the merge base from BASE_SHA and COMMIT_SHA. They no longer use origin/$BASE_REF or fall back to BASE_SHA. Tests check the merge-base command and the absence of that fallback. |
Sequence Diagram(s)
sequenceDiagram
participant Runner as Cursor or direct runner
participant Checkout as Checkout step
participant Fetch as fetch-history.sh
participant Prompt as Prompt rendering
Runner->>Checkout: Checkout PR head with fetch-depth 1
Checkout->>Fetch: Pass base SHA, head SHA, and GitHub token
Fetch-->>Runner: Fetch merge-base history
Runner->>Prompt: Pass BASE_SHA and COMMIT_SHA
Prompt->>Prompt: Compute merge base
Suggested reviewers: mattmillerai
Priority:
Merge Risk: 
Minimal · previous review e7609
-
No merge-blocking issue is established from the available evidence.
Pre-merge checks: 
2
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
✨ Simplify code
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
…header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @wei-hai.
Found 2 finding(s).
| Severity | Count |
|---|---|
| 🟢 Low | 2 |
Panel: 6/6 reviewers contributed findings.
…ndary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The checkout axes in
cursor-axis-base.yml(the Cursoraxisjob andaxis-direct) cloned the caller's whole history withfetch-depth: 0. On a large monorepo caller that took 90–631s per axis, often longer than the review itself, though only the merge base needs history.Both checkouts are now depth 1, followed by the shared
scripts/check-pr-size/fetch-history.sh, the same narrowed fetch #433 gave the panel's diff-size job. It fetchesBASE_SHAandcommit_shaback to a merge base it can vouch for, or fails the job with an::error::. The prompt now usesmerge-base(BASE_SHA, commit_sha)with no silent fallback, sinceorigin/<base_ref>no longer exists in a narrowed checkout. Head, merge base and diff are the same as before. The one exception is a base branch that has since absorbed commits from the PR head's history (the PR's own commits, or a branch both merged); there the result now matches the compare API the no-checkout axes already use.flowchart LR subgraph Before a1[checkout fetch-depth 0] --> b1["merge-base(origin/base, head) or BASE_SHA"] end subgraph After a2[checkout depth 1] --> f2[fetch-history.sh: BASE + head until merge base is vouched] --> b2["merge-base(BASE_SHA, head) or fail"] endValidation: new
test_axis_checkout.pypins depth 1, the fetch step's order and inputs, and the no-fallback merge base. The cursor-approve, cursor-review, workflow-pins and public-repo-hygiene suites pass, and so doesfetch-history-test.sh. actionlint and zizmor show no new findings.Risk: the axis agent's
git log/blamenow reaches at least 100 commits back from the head and base, and always past the merge base, but no longer the full history. That's the same trade-off #433 made for the panel.🤖 Generated with Claude Code