Skip to content

test(server): make the level-test double-answer test deterministic (B-31) - #135

Merged
navidshad merged 1 commit into
devfrom
ml/fix-level-test-race-test
Oct 15, 2026
Merged

navidshad merged 1 commit into
devfrom
ml/fix-level-test-race-test

Conversation

@navidshad

Copy link
Copy Markdown
Contributor

What

The Deploy dev run after #134 failed on level_test/__tests__/level-test.test.ts › "only one answer per question counts" (run 38822899322). The server code is fine; the test was timing-dependent.

The test sends two answers at once and expects only one to count. When the first call finished before the second one read the test, the second answer was correctly taken as the answer to question 2 (the failing run returned index 2 and index 3). The claim on answered only stops two answers that read the same state, which the test did not force.

The test now holds both calls at the (mocked) model until both have arrived there, so both have read the test before either saves, and they always race for the same question. A 2-second fallback keeps it from hanging.

Row: B-31 (test only, no production code).

How it was tested

src/modules/language/level_test: 16 tests pass, 5 runs in a row.

🤖 Generated with Claude Code

…-31)

"only one answer per question counts" sent two answers at once, but when the first one
finished before the second read the test, the second was correctly taken as the answer to
question 2, so the test failed now and then (it blocked a dev deploy). The two calls now
wait at the model until both have read the test, so they always race for the same question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@navidshad
navidshad merged commit de3e235 into dev Oct 15, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.3.0-dev.27 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant