scene: two quick sky changes build the last sky; Night drift test is exact #57

Merged
void merged 1 commit from void/scene-test-strength into dev 2026-11-10 01:55:22 +00:00
Member

Two test strengthenings you asked for, and the bug the first one found.

Bug (in dev since #55, index.ts). A rebuild read the sky choice before awaiting its key and acted on it after. With Auto at night, setSkyState('day') then setSkyState('dusk') in quick succession left the Day scene live: the last sky built was #95c6ff (Day's ridge top) where #aa91dc (Dusk's) was chosen, and the old test passed because it only counted disposals. Fix: after the key is in hand a rebuild stands down if the choice moved (that change has its own rebuild). No change for the single-change path.

Tests.

  • index.test.ts "keeps only the latest of two quick changes": now asserts the last sky built is the last one chosen (Dusk), it is the live scene (a login reaches it and no other), and every other scene was disposed while the live one was not. It fails on dev's index.ts (expected '#95c6ff' to be '#aa91dc') and passes with the fix.
  • skyTheme.test.ts drift test: exact equality of NIGHT_SKY_LIGHTEST and skyBackdrop('night').lightest (the 1e-6 tolerance let 0.081641 through). Checked: mutating the constant to 0.081643 makes it fail.

Run: vitest src/app/features/scene and src/sky 412/412, prettier and eslint clean on the touched files. No production build; nothing seen rendered.

🤖 Generated with Claude Code

Two test strengthenings you asked for, and the bug the first one found. **Bug (in dev since #55, `index.ts`).** A rebuild read the sky choice before awaiting its key and acted on it after. With Auto at night, `setSkyState('day')` then `setSkyState('dusk')` in quick succession left the **Day** scene live: the last sky built was `#95c6ff` (Day's ridge top) where `#aa91dc` (Dusk's) was chosen, and the old test passed because it only counted disposals. Fix: after the key is in hand a rebuild stands down if the choice moved (that change has its own rebuild). No change for the single-change path. **Tests.** - `index.test.ts` "keeps only the latest of two quick changes": now asserts the last sky built is the last one chosen (Dusk), it is the live scene (a login reaches it and no other), and every other scene was disposed while the live one was not. It fails on dev's `index.ts` (`expected '#95c6ff' to be '#aa91dc'`) and passes with the fix. - `skyTheme.test.ts` drift test: exact equality of `NIGHT_SKY_LIGHTEST` and `skyBackdrop('night').lightest` (the 1e-6 tolerance let 0.081641 through). Checked: mutating the constant to 0.081643 makes it fail. Run: vitest `src/app/features/scene` and `src/sky` 412/412, prettier and eslint clean on the touched files. No production build; nothing seen rendered. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
scene: two quick sky changes build the last sky; the Night drift test is exact
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 2m44s
61f434a32d
A rebuild read the sky choice before awaiting its key and acted on it after, so Day then Dusk in quick
succession left the Day scene live (the old test only counted disposals and passed with the Dusk scene never
built). A rebuild now stands down if the choice moved while it awaited; that change has its own rebuild.
The test asserts the last sky built is the last one chosen, is the live scene (a login reaches it), and that
every other scene was disposed.

The NIGHT_SKY_LIGHTEST drift test compared with a 1e-6 tolerance, so 0.081641 passed; it is now exact equality.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
void merged commit 596f864668 into dev 2026-11-10 01:55:22 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Ratatoskr!57
No description provided.