Skip to content

fix(e2e): retry lock verification read to handle auto_init race - #1614

Merged
ralphbean merged 1 commit into
mainfrom
fix/e2e-lock-auto-init-race
Jun 1, 2026
Merged

fix(e2e): retry lock verification read to handle auto_init race#1614
ralphbean merged 1 commit into
mainfrom
fix/e2e-lock-auto-init-race

Conversation

@ralphbean

Copy link
Copy Markdown
Member

Summary

  • GitHub's auto_init creates a default README.md asynchronously when a repo is created
  • Our CreateOrUpdateFile overwrites it, but the verification read can briefly return the stale auto-init content (# e2e-lock) instead of our run ID
  • This caused tryCreateLock to think it lost the lock race when it had actually won
  • Now retries the verification read up to 5 times with linear backoff, logging each mismatch

Depends on #1612 — based on fix/e2e-lock-debug.

Test plan

  • go test -tags e2e ./e2e/admin/ -run TestAcquire passes
  • make go-test passes
  • make lint passes

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown

Site preview

Preview: https://1f3a1d03-site.fullsend-ai.workers.dev

Commit: 29b66f675bf8d4b011af3660a08db595e82e4534

@fullsend-ai-review

fullsend-ai-review Bot commented May 27, 2026

Copy link
Copy Markdown

Review

Findings

No findings.

The retry loop correctly handles the auto_init race condition with proper context cancellation support, linear backoff (2–5s waits), and clear diagnostic logging at each attempt. The for i := range 5 syntax is fine for Go 1.22+. The extra GetFileContent call after the loop is necessary since content is scoped inside the loop body, and discarding the error is acceptable for a log-only read in e2e test infrastructure.

Previous run

Review

Findings

No findings.

The retry loop correctly handles the auto_init race condition with proper context cancellation support, linear backoff (2–5s waits), and clear diagnostic logging at each attempt. The for i := range 5 syntax is fine for Go 1.22+. The extra GetFileContent call after the loop is necessary since content is scoped inside the loop body, and discarding the error is acceptable for a log-only read in e2e test infrastructure.

Previous run

Review

Findings

No findings.

The retry loop correctly handles the auto_init race condition with proper context cancellation support, linear backoff (2–5s waits), and clear diagnostic logging at each attempt. The for i := range 5 syntax is fine for Go 1.26. The extra GetFileContent call after the loop is necessary since content is scoped inside the loop body, and discarding the error is acceptable for a log-only read in e2e test infrastructure.

Previous run

Review

Findings

No findings.

The retry loop correctly handles the auto_init race condition with proper context cancellation support, linear backoff (2–5s waits), and clear diagnostic logging at each attempt. The for i := range 5 syntax is fine for Go 1.22+. The extra GetFileContent call after the loop is necessary since content is scoped inside the loop body, and discarding the error is acceptable for a log-only read in e2e test infrastructure.

Previous run (2)

Review

Findings

No findings.

The retry loop correctly handles the auto_init race condition with proper context cancellation support, linear backoff (2–5s waits), and clear diagnostic logging at each attempt. The for i := range 5 syntax is fine for Go 1.26. The extra GetFileContent call after the loop is necessary since content is scoped inside the loop body, and discarding the error is acceptable for a log-only read in e2e test infrastructure.

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label May 27, 2026
@ralphbean
ralphbean changed the base branch from fix/e2e-lock-debug to main May 27, 2026 19:22
@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge and removed ready-for-merge All reviewers approved — ready to merge labels May 28, 2026
GitHub's auto_init creates a default README.md asynchronously when a
repo is created. Our CreateOrUpdateFile overwrites it, but GitHub's
eventual consistency can briefly serve the stale auto_init content
("# e2e-lock") on subsequent reads.

This caused tryCreateLock to think it lost the lock race when it had
actually won — the verification read returned auto_init content
instead of our run ID.

Retry the verification read up to 5 times with linear backoff,
logging each mismatch so the auto_init race is visible in CI logs.

Signed-off-by: Ryan Bean <rbean@redhat.com>
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ralph Bean <rbean@redhat.com>
@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge and removed ready-for-merge All reviewers approved — ready to merge labels May 29, 2026
@ralphbean
ralphbean added this pull request to the merge queue Jun 1, 2026
Merged via the queue into main with commit de04c5c Jun 1, 2026
12 checks passed
@ralphbean
ralphbean deleted the fix/e2e-lock-auto-init-race branch June 1, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge All reviewers approved — ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants