houserules/packages/chess
Joey Yakimowich-Payne 8f6c666ade
feat(chess/modifiers): add 7 new attr consumers + pre-move check/promotion snapshots
Combines T3 (consumer registrations for the 7 new hook attrs) and T4
(pre-move state snapshots) since both modify apply.ts and gate the
incoming wave of trigger primitives.

T3 — Consumer registrations:
Adds registerAttrConsumer() calls for the 7 trigger hook attrs added
to ChessAttrMap (OnMoveHooks, OnTurnEndHooks, OnPromotionHooks,
OnCheckReceivedHooks, OnCheckDeliveredHooks, OnMovedOntoSquareHooks,
OnCapturedHooks). Without these, the load-time
assertSeedConsumerIntegrity() check would fail loudly when the
upcoming Wave 2 primitives start writing the attrs.

T4 — Pre-move snapshots:
Two new per-engine WeakMaps mirror the existing PRE_MOVE_HP_SNAPSHOTS
lifecycle:
- PRE_MOVE_CHECK_STATE_SNAPSHOTS: per-color royal IDs + their
  attacker IDs at onBeforeMove time, used by the upcoming
  on-check-received (edge-triggered transition into check) and
  on-check-delivered (revealed-attacker discovered check) evaluators.
- PRE_MOVE_PROMOTION_PAWNS: pawn IDs eligible to promote this move
  (white pawns on rank 6, black pawns on rank 1) — feeds the upcoming
  on-promotion evaluator without re-walking the board post-move.

Snapshots populate in onBeforeMove, expose read-only getters
(getPreMoveCheckState, getPreMovePromotionPawns), and clear in
onAfterMove inside try/finally to prevent leaks even if a trigger
evaluator throws. Reuses the engine's existing attackProbe helper
(via PIECE_TYPE_REGISTRY) and getActiveRoyalEntityIds for preset-aware
royal resolution rather than computing check lines from scratch.

Adds 4 new tests in apply.test.ts: snapshot capture, promotion-pawn
flagging, post-move cleanup, and no-leak across 3 sequential moves.
2026-04-21 16:59:32 -06:00
..
docs feat(presets): berolina-pawns en-passant (Parton 1952, both variants) 2026-04-21 11:06:53 -06:00
e2e feat(modifiers): bundle preset activations on profiles + editor Presets tab 2026-04-21 14:03:52 -06:00
public feat(ui): add knight-silhouette favicon, theme-color, and meta description 2026-04-21 13:35:42 -06:00
src feat(chess/modifiers): add 7 new attr consumers + pre-move check/promotion snapshots 2026-04-21 16:59:32 -06:00
tests/fide-games test(chess): replay 5 classic FIDE games; Phase 2 acceptance gate (P2.23) 2026-04-16 15:18:57 -06:00
index.html feat(ui): add knight-silhouette favicon, theme-color, and meta description 2026-04-21 13:35:42 -06:00
package.json feat(engine): modifier profile types 2026-04-18 22:05:58 -06:00
README.md chore(root): scaffold monorepo — Phase 0 complete 2026-04-16 13:32:21 -06:00
RULES.md feat(presets): berolina-pawns en-passant (Parton 1952, both variants) 2026-04-21 11:06:53 -06:00
tsconfig.json test(chess): e2e full-flow scenario; tag Phase 3 (P3.15) 2026-04-16 16:55:28 -06:00
vite.config.ts feat(chess): scaffold Vite + React app (P3.9) 2026-04-16 15:54:32 -06:00
vitest.config.ts refactor(chess/ui): extract ParamField from CustomModifierEditor (no behavior change) 2026-04-21 16:57:42 -06:00

@paratype/chess — custom-rules chess demo