Repository navigation
test(playtest-server): serialise the checkpoint tests' state edits with the fake docker - #1344
Merged
Merged
Conversation
…e docker's lock
The restore test read `start` as the served world where it expected the
checkpoint's. The fake docker rewrites its state file under a flock on every
call, and the checkpoint watcher calls it concurrently with the test. The
test's write_state read and rewrote the same file with no lock, so a fake call
that loaded the state before the edit and saved after it reverted the edit
(a lost update): world_text went back to its default `start`, the next flush
wrote it into the checkpoint, and the restore booted that world.
write_state now holds the same lock and replaces the file atomically. No
assertion changes; the tool (playtest-server.sh) is not at fault, the restore
path copies what the checkpoint holds.
Measured: 30 local runs of the test on the unperturbed tree, 0 reds (the race
window is milliseconds); with the fake holding its loaded state 0.4 s and the
old unlocked write_state, the test reds with the CI message
('start' == 'before the gate'); the same 0.4 s delay with the lock, green.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019qiQFhKtTpTbYnn9NZBbSd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An intermittent red on
test_restore_serves_the_checkpoint_world_and_holds_the_server_to_its_scores(assert 'start' == 'before the gate').Cause: the test's
write_stateread-modified-wrote the fake docker's state file without the flock the fake takes on every call. The checkpoint watcher calls the fake concurrently, so a call that loaded the state before the test's edit and saved after it reverted the edit;world_textfell back tostartand the checkpoint held that world. The tool is correct: restore copies what the checkpoint holds.Fix:
write_statetakes the same lock and replaces the file atomically. No assertion changed.Evidence: 30 runs unperturbed, 0 reds (millisecond window, not reproduced naturally); old
write_stateplus a 0.4 s hold in the fake reds with the CI message; the same hold with the fix is green.🤖 Generated with Claude Code