Skip to content

Commit d985618

Browse files
committed
include full list (including merged PRs) in PUT request to stacks API
1 parent 691f469 commit d985618

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

cmd/submit.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,11 @@ func clearPendingModifyState(cfg *config.Config, gitDir string) {
426426
// This is a best-effort operation: failures are reported as warnings but do
427427
// not cause the submit command to fail (the PRs are already created).
428428
func syncStack(cfg *config.Config, client github.ClientOps, s *stack.Stack) {
429-
// Collect PR numbers in stack order (bottom to top).
429+
// Collect PR numbers in stack order (bottom to top), including merged PRs.
430+
// The API expects the full list — omitting merged PRs causes a
431+
// "Stack contents have changed" rejection.
430432
var prNumbers []int
431433
for _, b := range s.Branches {
432-
if b.IsMerged() {
433-
continue
434-
}
435434
if b.PullRequest != nil {
436435
prNumbers = append(prNumbers, b.PullRequest.Number)
437436
}

cmd/submit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ func TestSyncStack_SkippedForSinglePR(t *testing.T) {
730730
assert.False(t, updateCalled, "UpdateStack should not be called with fewer than 2 PRs")
731731
}
732732

733-
func TestSyncStack_SkipsMergedBranches(t *testing.T) {
733+
func TestSyncStack_IncludesMergedBranches(t *testing.T) {
734734
s := &stack.Stack{
735735
Trunk: stack.BranchRef{Branch: "main"},
736736
Branches: []stack.BranchRef{
@@ -752,7 +752,7 @@ func TestSyncStack_SkipsMergedBranches(t *testing.T) {
752752
syncStack(cfg, mock, s)
753753
cfg.Err.Close()
754754

755-
assert.Equal(t, []int{11, 12}, gotNumbers, "should only include non-merged PRs")
755+
assert.Equal(t, []int{10, 11, 12}, gotNumbers, "should include merged PRs to keep API in sync")
756756
}
757757

758758
func TestSyncStack_SkipsBranchesWithoutPR(t *testing.T) {

0 commit comments

Comments
 (0)