fix: surface remote GitHub base conflicts#27
Merged
Conversation
Refresh tracked trunk refs during post-merge maintenance, surface remote-base mismatch issues in doctor, and make merge-check fail when GitHub still reports a PR as conflicting.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Pull request overview
This PR improves DubStack’s ability to detect and prevent “false clean” stacks when local or remote bases drift from what GitHub is actually evaluating, and tightens merge gating based on GitHub’s conflict/mergeability signals.
Changes:
- Add GitHub PR mergeability query support and use it in
dub merge-check. - In
post-merge, refresh/fast-forward tracked root branches fromorigin/<root>before restacking descendants. - Extend
dub doctorwith a newremote-base-mismatchissue and document recovery/verification steps.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/lib/github.ts | Adds getPrMergeStatusByNumber() to query mergeable + mergeStateStatus via gh. |
| packages/cli/src/lib/github.test.ts | Adds tests for getPrMergeStatusByNumber(). |
| packages/cli/src/commands/post-merge.ts | Fetches and fast-forwards each stack root from origin/<root> before restack. |
| packages/cli/src/commands/post-merge.test.ts | Updates mocks/assertions and adds a fast-forward failure test. |
| packages/cli/src/commands/merge-check.ts | Fails merge-check when GitHub reports conflicting/dirty. |
| packages/cli/src/commands/merge-check.test.ts | Adds coverage for failing on conflicting/dirty mergeability. |
| packages/cli/src/commands/doctor.ts | Adds remote-base-mismatch detection using GitHub baseRefName vs remote ancestry. |
| packages/cli/src/commands/doctor.test.ts | Adds a repro-focused test for remote-base-mismatch. |
| apps/docs/content/docs/commands/doctor.mdx | Documents the new remote-base drift check and recommended recovery flow. |
| README.md | Updates doctor/merge-check docs and troubleshooting guidance. |
| QUICKSTART.md | Updates command descriptions to include GitHub mergeability verification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fetch GitHub base refs before remote-base ancestry checks, surface GitHub query failures in doctor, and require explicitly safe GitHub mergeability states in merge-check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
origin/<root>beforepost-mergerestacks childrenremote-base-mismatchindub doctorwhen the remote PR head is not descended from the GitHub base branchdub merge-checkfail when GitHub still reports the PR as conflictingFix Details
post-mergenow fetches and fast-forwards each tracked root before replaying descendants, and fails explicitly if the trunk cannot be fast-forwarded safely.doctornow checks the remote PR head against the GitHub base branch viabaseRefName, so a stale remote base shows up before users trust a false-clean local state.merge-checknow verifies GitHub mergeability in addition to stack order.Verification
pnpm checkspnpm typecheckenv -u DUBSTACK_BEDROCK_AWS_PROFILE -u DUBSTACK_BEDROCK_AWS_REGION -u DUBSTACK_BEDROCK_MODEL -u DUBSTACK_GEMINI_API_KEY -u DUBSTACK_AI_GATEWAY_API_KEY -u GOOGLE_CLOUD_PROJECT pnpm test