[Repo Assist] Fix needsRebase=true incorrectly set for queued branches in JSON output - #10
Draft
github-actions[bot] wants to merge 1 commit into
Conversation
Branches in the merge queue cannot be rebased. Reporting needsRebase=true for them misleads automation scripts that consume `gh stack view --json` output β a script that rebases when needsRebase=true would fail or corrupt a queued PR. Fix: skip the IsAncestor check when the branch is queued (IsQueued=true), mirroring the existing skip for merged branches. Add TestViewJSON_QueuedBranchNeedsRebaseFalse to cover this invariant. Co-authored-by: Copilot <[email protected]>
20 tasks
Author
|
π€ This is an automated message from Repo Assist. This PR (#10) is superseded by PR #11, which contains the same fix plus additional improvements (it also ensures Once PR #11 is reviewed, this PR (#10) can be safely closed. Sorry for the noise β I created #11 after catching additional cases while working on the fix.
|
25 tasks
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.
π€ This is an automated pull request from Repo Assist, an AI assistant.
Problem
gh stack view --jsonsetsneedsRebase: truefor branches whose PR is currently in the merge queue. This is incorrect: a branch in the merge queue cannot be rebased β doing so would invalidate the queue entry. Any automation script that checksneedsRebaseand acts on it (e.g. by runninggh stack rebase) would fail or silently corrupt the queued PR.Root cause
In
viewJSON(cmd/view.go),NeedsRebasewas skipped for merged branches but not for queued ones:Fix
Mirror the existing merged-branch skip for queued branches:
Test
Added
TestViewJSON_QueuedBranchNeedsRebaseFalseincmd/view_test.go:IsAncestorto returnfalsefor all branches (worst case)needsRebase: falseneedsRebase: trueTest Status
Tests could not be run in this environment (Go 1.25.7 toolchain download requires
sum.golang.org, which is blocked by the firewall). CI will run the full test suite. The change is a single-line predicate addition in a well-understood path with a new test covering the invariant directly.Warning
The following domain was blocked by the firewall during workflow execution:
sum.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.