Skip to content

test(playtest-server): serialise the checkpoint tests' state edits with the fake docker - #1344

Merged
stellarfeline merged 1 commit into
mainfrom
fix/checkpoint-restore-test
Nov 10, 2026
Merged

stellarfeline merged 1 commit into
mainfrom
fix/checkpoint-restore-test

Conversation

@stellarfeline

Copy link
Copy Markdown
Owner

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_state read-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_text fell back to start and the checkpoint held that world. The tool is correct: restore copies what the checkpoint holds.

Fix: write_state takes the same lock and replaces the file atomically. No assertion changed.

Evidence: 30 runs unperturbed, 0 reds (millisecond window, not reproduced naturally); old write_state plus 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

…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
@stellarfeline
stellarfeline merged commit d6b398d into main Nov 10, 2026
39 checks passed
@stellarfeline
stellarfeline deleted the fix/checkpoint-restore-test branch November 10, 2026 21:17
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