Skip to content

Retry commit-only ref updates when head moves#11

Open
arpitjain099 wants to merge 1 commit into
cagov:mainfrom
arpitjain099:chore/retry-ref-update-race
Open

Retry commit-only ref updates when head moves#11
arpitjain099 wants to merge 1 commit into
cagov:mainfrom
arpitjain099:chore/retry-ref-update-race

Conversation

@arpitjain099

Copy link
Copy Markdown

Fixes #6\n\nThis handles the race where a commit-only run creates a commit, then PATCHing refs/heads/main fails because someone else moved the branch in between.\n\nI wrapped that ref update in a targeted retry path:\n- if GitHub returns a 422 ref-update conflict, treePush reruns once against the latest branch head\n- the second run rebuilds the commit off the current base instead of forcing the old SHA\n- non-422 errors still fail immediately\n\nVerification I ran locally:\n- node --check github-tree-push-module/index.js\n- a targeted Node harness that simulates a 422 on the first ref update and confirms treePush retries exactly once and rebuilds the commit\n- eslint on the changed file with prettier rule disabled (to avoid unrelated formatting drift in this repo)

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test for commit concurrency errors

1 participant