M4: drag own tokens with prediction and rollback #72

Closed
opened 2026-11-20 22:31:45 +01:00 by SirStone · 1 comment
Owner

Part of #63

Goal

Drag any owned token (GM any token) at <= 20 Hz with reqId, final send on release, optimistic sprite, rollback tween.

Acceptance criteria

  • Reducer drag state-machine tests
  • E2e drag persists after reload
  • Forced refusal (wall/step cap) rolls back with a tween
  • Authoritative positions ignored while dragging
  • Rate-limited ack reconciled without corrupting state
  • Pending map dropped on close
  • Standing gate: full devbox run test green on a clean checkout, no test weakened or skipped, and the behaviour above proven at the seam(s) listed under "Proven at".

User stories covered

  • 38 — As a player, I want my dragged token to follow my pointer immediately, so that movement feels direct.
  • 39 — As a player, I want the server to remain the only judge of where my token ends up, so that walls and limits still apply.
  • 40 — As a player, I want a refused move to slide my token back visibly, so that I see it did not happen.
  • 41 — As a player, I want my token not to jump under my finger while I am still dragging, so that a slow ack does not fight me.
  • 42 — As a player, I want a rate-limited move to be dropped quietly and reconciled, so that fast dragging never corrupts my view.
  • 43 — As a GM, I want to drag any token, so that I can move the scene along.

Proven at

drag module, reducer move slice; e2e

Notes

  • Size: M (about one agent session, ~100K tokens). Lane: E (entities, after T8).
Part of #63 ## Goal Drag any owned token (GM any token) at <= 20 Hz with `reqId`, final send on release, optimistic sprite, rollback tween. ## Acceptance criteria - [ ] Reducer drag state-machine tests - [ ] E2e drag persists after reload - [ ] Forced refusal (wall/step cap) rolls back with a tween - [ ] Authoritative positions ignored while dragging - [ ] Rate-limited ack reconciled without corrupting state - [ ] Pending map dropped on close - [ ] Standing gate: full `devbox run test` green on a clean checkout, no test weakened or skipped, and the behaviour above proven at the seam(s) listed under "Proven at". ## User stories covered - 38 — As a player, I want my dragged token to follow my pointer immediately, so that movement feels direct. - 39 — As a player, I want the server to remain the only judge of where my token ends up, so that walls and limits still apply. - 40 — As a player, I want a refused move to slide my token back visibly, so that I see it did not happen. - 41 — As a player, I want my token not to jump under my finger while I am still dragging, so that a slow ack does not fight me. - 42 — As a player, I want a rate-limited move to be dropped quietly and reconciled, so that fast dragging never corrupts my view. - 43 — As a GM, I want to drag any token, so that I can move the scene along. ## Proven at drag module, reducer move slice; e2e ## Notes - Size: M (about one agent session, ~100K tokens). Lane: E (entities, after T8).
SirStone added the ready-for-agentenhancement labels 2026-11-20 22:31:45 +01:00
SirStone added a new dependency 2026-11-20 22:31:46 +01:00
SirStone added a new dependency 2026-11-20 22:31:46 +01:00
Author
Owner

Rebased onto #69 (4534ed6) and merged as d225e95.

AC evidence:

  • reducer drag state machine: client/test/move.test.ts (drag under pointer, nack snap-on-release vs idle tween, newer ack wins, rate-limited drop, close/hello drop pending, hit test) — 134 unit tests green.
  • e2e client/e2e/drag.test.mjs: drag persists after reload; wall refusal rolls back with the tween caught mid-flight; authoritative frames ignored under the finger while the GM moves the token; reconnect mid-drag drops the pending map.
  • #69 integration: drag coordinates go through the camera transform (world -> screen with data-camera + data-zoom), added test at zoom 0.5 and 4; a pointer starting on a controlled token stops the camera listener (no pan, asserted camera unchanged) and an empty-canvas drag still pans; pinch logic untouched.
  • gates (sequential, gentle mode): devbox run test 159/159, devbox run client-test 134/134, devbox run e2e 19/19.
  • nit from #69 fixed: one viewport.ts import in client/src/render/modules/tiles.ts.

No test weakened or skipped.

Rebased onto #69 (4534ed6) and merged as d225e95. AC evidence: - reducer drag state machine: `client/test/move.test.ts` (drag under pointer, nack snap-on-release vs idle tween, newer ack wins, rate-limited drop, close/hello drop pending, hit test) — 134 unit tests green. - e2e `client/e2e/drag.test.mjs`: drag persists after reload; wall refusal rolls back with the tween caught mid-flight; authoritative frames ignored under the finger while the GM moves the token; reconnect mid-drag drops the pending map. - #69 integration: drag coordinates go through the camera transform (world -> screen with `data-camera` + `data-zoom`), added test at zoom 0.5 and 4; a pointer starting on a controlled token stops the camera listener (no pan, asserted camera unchanged) and an empty-canvas drag still pans; pinch logic untouched. - gates (sequential, gentle mode): `devbox run test` 159/159, `devbox run client-test` 134/134, `devbox run e2e` 19/19. - nit from #69 fixed: one `viewport.ts` import in `client/src/render/modules/tiles.ts`. No test weakened or skipped.
Sign in to join this conversation.