fix(server): honor explicit baseBranch before refusing createPullRequest on the default branch #48320
main fromrefs/pull/48320/head·opened View on GitHubProblem#
When a branch needs pushing, pull_request_create checks the push target against the inferred base instead of the requested base. That blocks release PRs from main into another branch and can push commits before the forge rejects a PR whose head and base are the same.
Deterministic repro on origin/main (58c7ed114815d56d1ffdb91780d725051cc343e1)
Run the focused cases in apps/server/src/git/GitManager.test.ts with the regression tests applied to base:
vp test run apps/server/src/git/GitManager.test.ts -t 'createPullRequest honors the explicit base before pushing'
The fixture creates a bare origin with default branch main. For the first case, push main and production at the same initial commit, then commit release.txt on main without pushing. From a thread on that checkout, call pull_request_create with {"title":"Release to production","body":"Body","base":"production"}. The handler forwards base to GitManager.createPullRequest as baseBranch, and an ahead count of one takes the automatic push path. The second case tracks origin/release from release, makes the same unpushed commit, and uses base: "release". The test calls the same server service directly with real Git and no open PRs in the provider fixture.
- Observed:
maintoproductionreturnsGit manager failed in runStackedAction: main is the base branch. Check out a feature branch to create a PR.before pushing;releasetoreleaseadvances the real bare remote'sreleaseref before the forge can reject the PR. - Expected:
maintoproductionpushes and opens againstproduction;releasetoreleaseerrors before moving the remote ref.
Change#
Pass the explicit base into the same-repository pre-push guard and infer the base only if none was given. This fixes the public GitManager.createPullRequest path used by pull_request_create; the private path already honors the override, and the stacked-action caller keeps its existing default behavior.
Scope#
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification#
- Both regression cases failed on base and passed on head. They check the bare remote refs and the source-control provider's create calls, not just the returned status.
vp run check:changedexited 0 with 205 tests passing across 2 files.- Before/after runtime transcript
- Not shown: A live hosted forge, MCP transport and thread linking, or UI behavior. The regression runs the real server service and Git driver with a mocked forge provider.
Authored by GPT-6.2 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
f8de7fbMacroscope's review found this PR approvable — The pre-push check now honors an explicitly selected PR base, matching the base used when creating the PR. Default base selection and existing push safeguards remain unchanged.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
The pull request creation flow now checks the requested base branch when provided. Tests cover cases where the head branch differs from or matches that base.
Changes: Explicit Base Branch Validation
Layer / File(s) Summary Base branch check and tests
apps/server/src/git/GitManager.ts,apps/server/src/git/GitManager.test.tscreatePullRequestpasses the requested base branch to the base check. The check uses it when provided and retains the prior resolution behavior otherwise. Tests cover successful creation for differing branches and rejection when they match.Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers:
stienswout,juliusmarminge
Merge Risk:
Minimal · up tof8de7-
This change makes pull request creation check the base branch the caller requested, rather than an inferred one. It also rejects a head branch that equals the requested base before pushing. No merge-blocking risk is apparent.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the main change: createPullRequest should honor an explicit baseBranch before the default-branch guard refuses the request. It uses a conventional commit prefix and matches the GitMana… Description check The description follows the template sections: Problem, Change, Scope, and Verification. It explains the bug with a deterministic repro and expected versus observed behavior. It names the change, cite… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the main change: createPullRequest should honor an explicit baseBranch before the default-branch guard refuses the request. It uses a conventional commit prefix and matches the GitManager.ts and test changes. It is 94 characters, which is long, but the scope is clear.
Full details: Description check
-
Explanation
The description follows the template sections: Problem, Change, Scope, and Verification. It explains the bug with a deterministic repro and expected versus observed behavior. It names the change, cites the issue scope with a reason for no linked issue, and lists verification with results. It also states what was not checked. The template's final line asks for the model and harness that did the work. The author lists GPT-6.2 Sol (Codex) and Gemini 4 Neon (Antigravity), so that requirement is met. The description is complete, with minor verbosity.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 23edd5b
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6ff795a4-4037-4231-9b5b-0dfee4b9f265
Commits-
Reviewing files that changed from the base of the PR and between 23edd5bf83519a18e85277abc618d79e07447513 and f8de7fb56c988396dc1d8a347c6b8914fb5ce47c.
Files selected for processing: 2-
apps/server/src/git/GitManager.test.tsapps/server/src/git/GitManager.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
-
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes