Skip to content

feat(view3d): sound on the PuzlWerk main view (A4b) - #84

Merged
wstein merged 4 commits into
feat/main-view-a4-statefrom
feat/main-view-a4b-sound
Nov 19, 2026
Merged

wstein merged 4 commits into
feat/main-view-a4-statefrom
feat/main-view-a4b-sound

Conversation

@wstein

@wstein wstein commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Purpose: the main view behind ?viewer=puzlwerk gets the Sound toggle and the sound of a finished turn and of a selected wide block, as in the existing view. The default view is unchanged in behavior.
bounded, default-off early integration per owner decision 2026-11-19; not the M1/M2 approval.
Stacked on #83: merge that PR first; merge only with the whole stack.

Changes:

  • turnSound.tsx: the turn sound cookie, the click and cue gains and the Sound button, now used by the existing view and the PuzlWerk toolbar (no copy; useCubeTurns, useCubeGestures, cubeView3D call it).
  • puzlwerkToolbar.tsx, puzlwerkCubeView.tsx: Sound button after Move layers.
  • usePuzlwerkTurns.ts, usePuzlwerkHints.ts: click on a finished turn (gesture, undo, scramble step), cue when a wide block is selected.

Tests (worktree, Node 22.23.4, SwiftShader Chromium):

  • npx vitest run: 2169 passed, 47 failed (known LFS photo files); new: turnSound 7 (button markup, gains, toggle, toolbar order), click tests in usePuzlwerkTurns (none after Reset, Random State, new source, unmount).
  • npm run typecheck, npm run lint, npm run format:check: exit 0.
  • e2e main-view-sound.spec.ts: 4 passed (toggle and cookie, gesture click on/off, scramble and undo clicks, wide cue). With the A4 specs and the other main-view specs: 36 passed; cubeView3D-view, -controls: 29 passed.
  • Mutations: 10 unit and 5 e2e, each fails at its reason. Not run: full mutation sweep, by owner decision.
  • Chunks (npm run build), A4 -> this: index 395.09 -> 395.10 kB, cubeView3D 39.66 -> 38.12 kB, puzlwerkCubeView 788.21 -> 788.43 kB. No viewer code in index or cubeView3D.

Known difference: the click after a drag uses the turn-ms setting, the existing view the settle time of the drag (it only matters below 120 ms). Not verified: real GPU and real audio output (Web Audio is a stand-in in the e2e), owner look.
Blocker: none.
Refs #29
Refs wstein/cubistry#21
No session links.

🤖 Generated with Claude Code

@wstein
wstein force-pushed the feat/main-view-a4b-sound branch from a194994 to b1f4f2d Compare November 19, 2026 12:03
@wstein

wstein commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Review: FINDINGS head=b1f4f2df9f6a80f01273af5886aa6e7aa0b35dc5 patch-id=c9da95dd81d261d7887d45b2f0a886bcd88aaa84 pr=84
Round 1 (stack top). CI run 44520396266 (CI, pull_request): success.
1 medium blocking src/client/view3d/usePuzlwerkTurns.ts:99-103 (from #83 finding 1): unchanged here; same probe on this head: 12 of 24 left a move, and the late step also clicks. Restack after the #83 fix.
2 low nit src/client/view3d/usePuzlwerkTurns.ts:185: the gesture click uses the turn-ms setting; the old view uses the settle duration (useCubeTurns.ts:125, settleTurn), so a quick flick may click louder than in the old view (real audio not checked).
3 low nit PR text: "turnSound 12" (the file has 7 tests; 12 with puzlwerkToolbar); index is 395.12 kB in both builds, not 395.09/395.10.
range-diff dcdf98e...a194994 against 1f27dee...b1f4f2d: both A4b commits "=", b1f4f2d new.
Old view: toolbar outerHTML at 4x4 equal to main 2a84c77 in 4 states; turnSound.tsx keeps cookie, gains and button markup; useCubeTurns/useCubeGestures read the same values.
Chunks: setPlayTarget, beginPreview, puzlwerk.appearance only in puzlwerkCubeView; shared chunk TurnFeel.gen now named randomState (13.68 kB), loaded with its importer via __vite__mapDeps; preloads unchanged; no new serial stage.
Mutations unit 11: 8 killed (click generation, scramble/undo click, click on refused, click after Reset, wide gain, click gain, aria-pressed); drag click, wide cue and toggle cookie survive unit tests and fail in e2e main-view-sound.
Checks: typecheck, lint, format:check, typos, git diff --check: exit 0; vitest 2165 passed / 47 failed (same 47 LFS fixtures); usePuzlwerkTurns 14, puzlwerkPlay 5, turnSound 7, puzlwerkToolbar 5 passed.
e2e: main-view-state+sound 15, bars+flag+hints 20, cubeView3D-view+controls 29 passed; Reset/Random State probe 0/16.
Commits Conventional, author/committer = config, Co-Authored-By, no session links; PR text 24 lines, one Blocker line.
Not checked: real audio (Web Audio stand-in only), real GPU, owner look.

wstein and others added 4 commits November 19, 2026 13:01
The turn sound setting, its gains and the Sound button move into
turnSound.tsx and are used by the existing view and by the PuzlWerk
toolbar, so both show the same button and store the same cookie.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A finished turn (gesture, undo, scramble step) clicks and a selected wide
block plays the cue, with the gains of the existing view and only while
the Sound toggle is on. The e2e spec counts the sounds a Web Audio
stand-in receives.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The click sounds once for a finished scramble step and an undo, and not for
a turn the player refused or one that ends after Reset, Random State or
unmount.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@wstein
wstein force-pushed the feat/main-view-a4b-sound branch from b1f4f2d to d00c2cb Compare November 19, 2026 13:07
@wstein

wstein commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Review: CLEAR head=d00c2cbd5f9f8b568401280f05e8c7b0b55a15ed patch-id=b779bb5452e97dab4bd92c56cb20085bb720fcfc pr=84
Round 2 (stack top). CI run 44530421362 (CI, pull_request): success.
Round 1 blocking (from #83) fixed here: "Solved cube" probe 0/24, Reset/Random State probe 0/16, scramble through app renders 4 of 4 to 60 moves.
range-diff 1f27dee...b1f4f2d against f3b326e...d00c2cb: commit 2 "=", commits 1 and 3 "!" (context only), d00c2cb adds the click assertion to the same-size source test.
Conflict in puzlwerkCubeView.tsx: the palette/seam check and useTurnSound are both kept, called once each, in a fixed order after usePuzlwerkTurns.
1 low nit src/client/view3d/usePuzlwerkTurns.ts:193: the gesture click uses the turn-ms setting, not the settle time of the old view; listed as "Known difference" in the PR text.
2 low nit PR text: index is 395.12 kB in my build (text 395.10); cubeView3D 38.12 and puzlwerkCubeView 788.43 kB match.
Old view: toolbar outerHTML at 4x4 byte-equal to main 2a84c77 in 4 states; viewer code only in puzlwerkCubeView; no new load stage.
Mutations unit 7: 6 killed (render bump removed incl. click, bump every render, invalidate no-op, dispose guard, generation check, click before generation), 1 survived (#83 finding 1).
Checks: typecheck, lint, format:check, typos, git diff --check: exit 0; vitest 2169 passed / 47 failed (same 47 LFS fixtures); usePuzlwerkTurns 17, puzlwerkPlay 6, turnSound 7, puzlwerkToolbar 5 passed.
e2e: main-view-state+sound 16, bars+flag+hints 20, cubeView3D-view+controls 28 + 1 failed (view.spec.ts:10, old view, load; passed alone).
Commits Conventional, author/committer = config, Co-Authored-By, no session links; PR text 24 lines, one Blocker line.
Not checked: real audio (Web Audio stand-in only), real GPU, owner look.

@wstein
wstein marked this pull request as ready for review November 19, 2026 14:04
@wstein
wstein added this pull request to stack #86 November 19, 2026 14:11
@wstein
wstein merged commit 17f292b into main Nov 19, 2026
2 checks passed
@wstein
wstein deleted the feat/main-view-a4b-sound branch November 19, 2026 14:11
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