Skip to content

test: probe the write lock from one request at a time - #267

Merged
yujiezhang-ops merged 1 commit into
mainfrom
fix/model-check-lock-test-race
Nov 20, 2026
Merged

yujiezhang-ops merged 1 commit into
mainfrom
fix/model-check-lock-test-race

Conversation

@yujiezhang-ops

Copy link
Copy Markdown
Collaborator

Summary

TestModelCheckRunsWithTheWriteLockReleased fails intermittently. It failed on main at 50e6a5c and on an unrelated pull request, #266.

The test asks, from inside each provider probe, whether writeMu can be taken, by taking it for an instant with TryLock. The protocols are probed concurrently, so one probe's own attempt was sometimes what another probe found held. The test then reported the lock as held during the check when it was not.

The probes in the test now make that attempt one at a time. Only the test changes; the code under test is not at fault and is untouched.

Checked

  • Under go test -race, the test failed 17 times in 300 runs before this change and 0 times in 1000 runs after.
  • go vet ./internal/app/

Not checked

  • The full go test ./... was not rerun locally for this one-file test change; CI runs it.

Test plan

  • go test -race -run TestModelCheckRunsWithTheWriteLockReleased -count=1000 ./internal/app/

🤖 Generated with Claude Code

TestModelCheckRunsWithTheWriteLockReleased asks, from inside each probe,
whether writeMu can be taken, by taking it for an instant. The protocols
are probed concurrently, so one probe's own attempt was sometimes what
another probe found held, and the test reported the lock as held during
the check when it was not.

Under -race it failed 17 times in 300 runs before this change and none in
1000 after. It has failed on main and on an unrelated pull request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@yujiezhang-ops
yujiezhang-ops requested a review from a team November 20, 2026 03:33
@yujiezhang-ops
yujiezhang-ops merged commit ce1162f into main Nov 20, 2026
4 checks passed
@yujiezhang-ops
yujiezhang-ops deleted the fix/model-check-lock-test-race branch November 20, 2026 05:52
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.

1 participant