Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
PR base-cutoff recovery remains incomplete for fast-forwarded branches, conflict continuation, and queued parents, leaving valid imported-stack rebases vulnerable to failure.
3 open issues
What changed in this PR
Addresses #598 by using GitHub’s recorded PR base SHA to recover stale rebase boundaries when a parent branch has advanced, helping rebase and sync restack imported branches.
Changes:
- Reads
baseRefOidthrough existing PR queries without additional API requests. - Refreshes recorded cutoffs using parent-name and existing ancestry checks.
- Adds regression coverage for imported stacks, parent mismatches, and API-field propagation.
| File | Description |
|---|---|
| internal/github/github.go | Fetches and exposes PR base SHAs. |
| internal/github/github_test.go | Verifies base SHA query and response propagation. |
| cmd/utils.go | Applies PR-derived cutoff refreshes during PR synchronization. |
| cmd/utils_test.go | Tests base adoption and preservation when parent names differ. |
| cmd/rebase_test.go | Tests imported-stack rebasing after a parent advances without a usable fork point. |
Review effort: Max
| } | ||
|
|
||
| func updateBaseFromPR(s *stack.Stack, b *stack.BranchRef, pr *github.PullRequest) { | ||
| if b.IsMerged() || pr.BaseRefOID == "" || pr.BaseRefName != s.ActiveBaseBranch(b.Branch) { |
Comment on lines
+703
to
+704
| if canUpdateBase(pr.BaseRefOID, b.Branch, b.Base) { | ||
| b.Base = pr.BaseRefOID |
Comment on lines
+703
to
+704
| if canUpdateBase(pr.BaseRefOID, b.Branch, b.Base) { | ||
| b.Base = pr.BaseRefOID |
This branch has not been deployed
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.

Fixes #598: recover the previous rebase boundary when a parent branch has advanced and local tracking is stale. Uses GitHub's recorded PR base SHA without weakening existing cutoff safety checks.
Functionality and user impact
rebaseandsynccan restack imported branches even when the local parent reflog cannot supply the old base.Key areas to review
internal/github/github.goreadsbaseRefOidin the existing PR queries.updateBaseFromPRincmd/utils.goreusescanUpdateBase; the rebase resolver itself is unchanged.cmd/rebase_test.gocovers an imported stack with an advanced parent and no usable local fork point. The metadata tests cover parent mismatches and API-field propagation.