houserules/packages/chess
Joey Yakimowich-Payne b2ca2cae23
test(chess): add legacy descriptor backward-compat fixture + round-trip test
Proves that descriptors using ONLY the 15 pre-existing primitive kinds
continue to parse, validate, apply, and serialize byte-identically even
after Wave 2 extended the PrimitiveKind union from 15 to 22 kinds. This
is the critical backward-compat proof: old saved descriptors in every
user library must keep working indefinitely.

Fixture: packages/chess/src/modifiers/custom/__fixtures__/legacy-descriptor.json
- 15 top-level primitives, one per legacy kind (each represented once)
- 5 nested primitives inside on-turn-start / on-capture / on-damaged /
  conditional(then+else) → 20 total nodes, depth 2
- Zero Wave-2 kinds (explicit)

Test: legacy-descriptor.test.ts
- parse: parseCustomModifierDescriptor returns version=1, kind set >= 5,
  every kind in legacy set
- validate: validateCustomDescriptor returns {ok: true}
- apply: asserts expected facts on the fixture pawn after
  applyCustomDescriptor — HpBonus, DirectionAdditions, CaptureFlags,
  ReflectDamagePercent, BlockedMoveTypes, RangeBonus, PromotionOverride,
  AuraSpec, and all four hook arrays (OnTurnStartHooks, OnCaptureHooks,
  OnDamagedHooks, ConditionalHooks)
- round-trip: JSON.parse(JSON.stringify(descriptor)) deep-equals the
  raw fixture JSON

Note: applyCustomDescriptor recursively walks childPrimitives() at
apply time, so nested trigger primitives execute immediately IN
ADDITION to seeding their hook attrs. Expectations reflect this
end-to-end contract (Hp=11 not 10; HpBonus=4 not 2; etc.).

Read approach: fs.readFileSync + import.meta.url (tsconfig lacks
resolveJsonModule).
2026-04-21 18:02:59 -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 test(chess): add legacy descriptor backward-compat fixture + round-trip test 2026-04-21 18:02:59 -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 chore(chess): add @dnd-kit deps for upcoming visual-builder block list 2026-04-21 18:01:41 -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