strategy: clean up shadow branches after a partial migrated-ref push · Entire

strategy: clean up shadow branches after a partial migrated-ref push

5b89783→main·

Soph·1w ago·1 file·+5 added/-4 removed

PushQueuedCheckpointRefs returned before cleanupPushedShadowBranches whenever flush returned an error — but the diverged path returns an error even when some refs pushed successfully. So a "push now" that partially succeeds left the landed refs' shadow branches uncleaned, unlike the pre-push path, which always runs cleanup after flush. Run cleanup unconditionally after flush for parity; it is best-effort and a no-op when nothing pushed.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

01KWY7RMYDFVJART4FKV3FT0KSView transcript

Changes

1

186 unmodified lines

187
188
189
190
191
192
190
191
192
193
194
194
195
196
197
198

186 unmodified lines

return 0, errors.New("checkpoint policy does not allow pushing checkpoint refs; refs stay queued")
    }
pushed, err := flushCheckpointRefsQueue(ctx, repo, ps.pushTarget())
    if err != nil {
        return pushed, err
    }
    // Clean up even on a partial/failed flush: a diverged batch can push some
    // refs and still return an error, and the shadow branches for the refs that
    // *did* land must still be cleaned up — parity with the pre-push path, which
    // always runs cleanup after flush regardless of its error.
    cleanupPushedShadowBranches(ctx)
    return pushed, nil
    return pushed, err
// flushCheckpointRefsQueue drains the push-discovery queue and batch-pushes the

Mcmd/entire/cli/strategy/manual_commit_push.go+5/-4