fix(push): chunk git push so stacks > 20 branches don't fail#735
Conversation
Current Aviator status
This PR was merged using Aviator.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
✅ FlexReview StatusCommon Owner:
Review SLO: |
There was a problem hiding this comment.
Code Review
This pull request introduces a chunking mechanism for git push operations to avoid exceeding GitHub's limit of 20 ref updates per push. The implementation splits the push candidates into smaller batches, ensuring each batch remains atomic. I have no feedback to provide as the changes correctly address the identified issue.
…-co#638) GitHub limits a single git push to 20 ref updates. When users have a stack with more than 20 PRs, av sync fails because it pushes every candidate branch in a single git push --atomic invocation. The issue reporter was working around this by manually pushing a few branches to drop under 20 before letting av sync finish. Split pushCandidates into chunks of gitPushChunkSize (20) and run git push --atomic --force-with-lease=... once per chunk. Each chunk is still atomic on its own, so a single chunk's lease check failure still rolls back that chunk. Cross-chunk atomicity is intentionally relaxed to make >20-branch stacks pushable at all. No tests in this package today; the chunking math is straightforward and exercised by every existing av sync against a >0-branch stack.
4208ba4 to
226c18f
Compare
Summary
Closes #638.
av syncfails when a stack has more than 20 PRs because GitHub rejects pushes with more than 20 ref updates. The reporter's workaround was manually pushing a few branches to drop under 20 before lettingav syncfinish.This splits
pushCandidatesinto chunks of 20 and runsgit push --atomic --force-with-lease=...once per chunk. Each chunk is still atomic on its own; only the whole-operation atomicity is relaxed, which is the intended trade-off (no other way to make >20-branch stacks pushable at all).Files
internal/gh/ghui/push.go:gitPushChunkSize = 20constant with a comment pointing at Batch updates (hitting gh branch update limits) #638.runGitPushnow loopsstart += gitPushChunkSizeovervm.pushCandidates, building per-chunkpushArgsand callingvm.repo.Runonce per chunk. Each chunk includes its own--atomicand per-branch--force-with-lease=so safety guarantees inside a chunk are unchanged.Verification
go build ./...clean.go vet ./...clean.go test ./internal/gh/ghui/...passes (no test files in this package, returns "no test files").internal/gh/ghui/push.go:553(mapToRemoteTrackingBranch undefined) reproduces onmasterwithout these changes and is not introduced by this PR.Test plan
go build ./...clean.--atomic+--force-with-lease=, preserving safety inside the chunk.av syncon a stack with > 20 PRs and confirm all branches push without the GitHub limit error (no fixture in this repo's tests).Notes