Skip to content

fix(view3d): old view reports a scramble step that ends after the cube was replaced #85

Open

Description

@wstein

Problem

In the existing 3D view on main (2a84c77), a scramble step that ends after the shown cube was replaced (for example by choosing "Solved cube" during a running scramble) is still reported to the app via onTurnStateChange. The app couples that late report to the new source (src/client/scannerAppView.tsx:483, setTurnedCube({ source: baseCube, … })). The move history stays empty, but the app cube is not the solved cube.

Found in the independent review of #83 (A4, round 2): measured on the old view with 4x4/5x5, turn-ms 200, "Solved cube" clicked during a scramble: the app cube was not solved in 14 of 24 tries (browser, SwiftShader; not measured on real GPU). The new PuzlWerk view in #83 closes the same class with a generation counter; the old view is not part of that PR.

Scope

  • Drop (do not report) a turn that ends after the source, size or shown cube changed in the old view (useCubeTurns and the scramble loop), with a test that fails on the current behaviour.
  • No change to the move or sound behaviour otherwise.

Done when

  • A unit or e2e test reproduces the late report on the current code and passes after the fix (12 or more tries in e2e, or a controllable fake player in unit).
  • The old view's existing tests pass unchanged.

Refs: #83, #29.

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions