Skip to content

fix: surface remote GitHub base conflicts#27

Merged
dubscode merged 2 commits intomainfrom
codex/fix-remote-base-conflict-visibility
Mar 10, 2026
Merged

fix: surface remote GitHub base conflicts#27
dubscode merged 2 commits intomainfrom
codex/fix-remote-base-conflict-visibility

Conversation

@dubscode
Copy link
Contributor

@dubscode dubscode commented Mar 10, 2026

Summary

  • refresh tracked root branches from origin/<root> before post-merge restacks children
  • surface remote-base-mismatch in dub doctor when the remote PR head is not descended from the GitHub base branch
  • make dub merge-check fail when GitHub still reports the PR as conflicting
  • document the safer recovery and verification flow

Fix Details

  • post-merge now fetches and fast-forwards each tracked root before replaying descendants, and fails explicitly if the trunk cannot be fast-forwarded safely.
  • doctor now checks the remote PR head against the GitHub base branch via baseRefName, so a stale remote base shows up before users trust a false-clean local state.
  • merge-check now verifies GitHub mergeability in addition to stack order.

Verification

  • pnpm checks
  • pnpm typecheck
  • env -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

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.
Copilot AI review requested due to automatic review settings March 10, 2026 04:11
@vercel
Copy link

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
dubstack Skipped Skipped Mar 10, 2026 4:24am

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 from origin/<root> before restacking descendants.
  • Extend dub doctor with a new remote-base-mismatch issue 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.
@dubscode dubscode merged commit 3242fff into main Mar 10, 2026
6 checks passed
@dubscode dubscode deleted the codex/fix-remote-base-conflict-visibility branch March 10, 2026 04:27
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.

2 participants