tests/wreck-slice.spec.js intermittently fails its depth-restoration assertion:
Error: expect(locator).toHaveText(expected) failed
Locator: locator('.wreck-hud dd').first()
Expected: "27 m"
Received: "28.1 m"
at tests/wreck-slice.spec.js:69:55
Observed roughly once per two full npm run test:e2e runs. The spec alone passed 3/3, so it needs the fuller run's timing to surface.
Not a restoration bug
The test compares two different moments rather than one value against itself:
- wreck-slice.spec.js:64 reads the depth off the HUD, which is a rendered snapshot of a particular frame.
- The reload's
pagehide handler (wreck-app.ts:172) then saves the authoritative state, which is still moving.
Buoyancy momentum between those two moments accounts for 27.0 → 28.1 m. Restoration is doing its job; the assertion is racing the simulation.
Why it matters beyond the one test
An intermittently red suite weakens every "CI is green" claim made against it. This was noticed precisely because a green run was being used as evidence that something else was correct.
Suggested direction
Compare like with like — assert against the value that was actually persisted rather than against a HUD frame captured earlier. Options, roughly in order of preference:
- Read the saved payload back and assert the restored state equals it.
- Quiesce the dive before saving (zero vertical velocity, or pin depth) so the two moments cannot diverge.
- Read the authoritative depth rather than the HUD text at line 64, and allow a tolerance that reflects one frame of movement.
Option 1 is the one that actually tests restoration; 2 and 3 mostly make the existing assertion honest.
Not blocking
Split out of #125 deliberately, and confirmed to predate it — reproduced on that PR's branch with its test changes stashed.
tests/wreck-slice.spec.jsintermittently fails its depth-restoration assertion:Observed roughly once per two full
npm run test:e2eruns. The spec alone passed 3/3, so it needs the fuller run's timing to surface.Not a restoration bug
The test compares two different moments rather than one value against itself:
pagehidehandler (wreck-app.ts:172) then saves the authoritative state, which is still moving.Buoyancy momentum between those two moments accounts for 27.0 → 28.1 m. Restoration is doing its job; the assertion is racing the simulation.
Why it matters beyond the one test
An intermittently red suite weakens every "CI is green" claim made against it. This was noticed precisely because a green run was being used as evidence that something else was correct.
Suggested direction
Compare like with like — assert against the value that was actually persisted rather than against a HUD frame captured earlier. Options, roughly in order of preference:
Option 1 is the one that actually tests restoration; 2 and 3 mostly make the existing assertion honest.
Not blocking
Split out of #125 deliberately, and confirmed to predate it — reproduced on that PR's branch with its test changes stashed.