feat(thressgame-coverage): Wave 5 (7 imperative primitives)
- T21: place-piece — calls engine.spawnPiece on resolved square - T22: destroy-piece — retracts piece facts; enqueues on-captured - T23: move-piece — updates Position + HasMoved; enqueues on-move + on-moved-onto-square - T24: swap-pieces — atomic Position swap; enqueues 2 on-move events - T25: convert-piece-type — changes PieceType; enqueues on-promotion (with previous-equality short-circuit) - T26: set-piece-attr — generic attr insert (parity descriptors use heavily); lifetime field accepted but ignored in V1 - T27: cancel-capture — sets CaptureCancelled flag on GAME_ENTITY; rejects outside on-captured context T20 test fix: synthetic suppressTriggers test moved from 'swap-pieces' kind (T24 took it) to 'spawn-marker-pair' (Wave 6 / T29 territory). Registry: 26 -> 33 primitives. Tests: 2120 -> 2225 (+105). bun run check exit 0.
This commit is contained in:
parent
70a7c50613
commit
e290f350ad
22 changed files with 2922 additions and 19 deletions
|
|
@ -1169,7 +1169,7 @@ Max Concurrent: 8 (Waves 5+6+7+9 overlap)
|
|||
|
||||
> **WAVE 5 PRIMITIVES TEMPLATE NOTE**: Tasks 21-27 are imperative piece-mutation primitives. Each follows the same template: create `<kind>.ts` (~50-80 lines), add `paramsSchema`, register in registry, add to PrimitiveKind union in types.ts, add side-effect import in index.ts, add SAMPLE_PARAMS entry in `ParamField.snapshot.test.tsx`, add narrate.ts entry, add palette category. Each ships with a co-located test (5+ assertions). **Each task is one atomic commit.**
|
||||
|
||||
- [ ] 21. place-piece primitive
|
||||
- [x] 21. place-piece primitive
|
||||
|
||||
**What to do**:
|
||||
- kind: "place-piece", schema: `{ pieceType: PieceType, color: Color | { ctx-attr } | { $var }, square: Square | { $var } | { ctx-build }, replaceExisting: boolean (default false) }`
|
||||
|
|
@ -1197,7 +1197,7 @@ Max Concurrent: 8 (Waves 5+6+7+9 overlap)
|
|||
|
||||
**Commit**: YES — `feat(chess): place-piece imperative primitive`
|
||||
|
||||
- [ ] 22. destroy-piece primitive
|
||||
- [x] 22. destroy-piece primitive
|
||||
|
||||
**What to do**: kind: "destroy-piece", schema: `{ target: TargetResolver | { $var } }`. apply(): resolve target → for each entity → retract all piece facts via `engine.session.retract(id, attr)` for piece attrs (PieceType, Color, Position, HasMoved, Hp, etc.). Special-case: if target is king, no-op (kings invulnerable to destroy-piece by convention; on-captured handled separately)
|
||||
**Must NOT do**: destroy markers (filter EntityKind === "piece"); destroy GAME_ENTITY
|
||||
|
|
@ -1208,7 +1208,7 @@ Max Concurrent: 8 (Waves 5+6+7+9 overlap)
|
|||
**QA Scenarios**: `bun test destroy-piece.test.ts` → `.sisyphus/evidence/task-22-destroy-piece.txt`
|
||||
**Commit**: YES — `feat(chess): destroy-piece imperative primitive`
|
||||
|
||||
- [ ] 23. move-piece primitive
|
||||
- [x] 23. move-piece primitive
|
||||
|
||||
**What to do**: kind: "move-piece", schema: `{ from: Square | { $var }, to: Square | { $var }, allowCapture: boolean (default false) }`. apply(): if `from` empty → no-op; if `to` occupied and !allowCapture → no-op; if `to` occupied and allowCapture → enqueue on-captured event via T15 deferred queue, then move; update Position via session.insert
|
||||
**Must NOT do**: bypass check detection (use raw fact updates; check resolution happens at next move-gen)
|
||||
|
|
@ -1219,7 +1219,7 @@ Max Concurrent: 8 (Waves 5+6+7+9 overlap)
|
|||
**QA Scenarios**: `bun test move-piece.test.ts` → `.sisyphus/evidence/task-23-move-piece.txt`
|
||||
**Commit**: YES — `feat(chess): move-piece imperative primitive`
|
||||
|
||||
- [ ] 24. swap-pieces primitive
|
||||
- [x] 24. swap-pieces primitive
|
||||
|
||||
**What to do**: kind: "swap-pieces", schema: `{ a: Square | { $var }, b: Square | { $var } }`. apply(): get pieces at a + b; insert positions swapped; both Position attrs updated atomically
|
||||
**Must NOT do**: swap with markers (skip if EntityKind !== piece on either side)
|
||||
|
|
@ -1230,7 +1230,7 @@ Max Concurrent: 8 (Waves 5+6+7+9 overlap)
|
|||
**QA Scenarios**: `bun test swap-pieces.test.ts` → `.sisyphus/evidence/task-24-swap-pieces.txt`
|
||||
**Commit**: YES — `feat(chess): swap-pieces imperative primitive`
|
||||
|
||||
- [ ] 25. convert-piece-type primitive
|
||||
- [x] 25. convert-piece-type primitive
|
||||
|
||||
**What to do**: kind: "convert-piece-type", schema: `{ target: TargetResolver | { $var }, newType: PieceType | { $var } }`. apply(): for each resolved target, retract PieceType, insert newType. Preserves Color, Position, HasMoved, all custom attrs
|
||||
**Must NOT do**: convert-to-king (special-case rejected; document)
|
||||
|
|
@ -1241,7 +1241,7 @@ Max Concurrent: 8 (Waves 5+6+7+9 overlap)
|
|||
**QA Scenarios**: `bun test convert-piece-type.test.ts` → `.sisyphus/evidence/task-25-convert.txt`
|
||||
**Commit**: YES — `feat(chess): convert-piece-type imperative primitive`
|
||||
|
||||
- [ ] 26. set-piece-attr primitive (generic, with target binding)
|
||||
- [x] 26. set-piece-attr primitive (generic, with target binding)
|
||||
|
||||
**What to do**: kind: "set-piece-attr", schema: `{ target: TargetResolver | { $var }, attr: string, value: unknown | { $var } | { ctx-attr } }`. apply(): resolve target, attr, value; insert fact. Validates attr is in ChessAttrMap
|
||||
**Must NOT do**: set on markers; allow attr name not in ChessAttrMap
|
||||
|
|
@ -1252,7 +1252,7 @@ Max Concurrent: 8 (Waves 5+6+7+9 overlap)
|
|||
**QA Scenarios**: `bun test set-piece-attr.test.ts` → `.sisyphus/evidence/task-26-set-piece-attr.txt`
|
||||
**Commit**: YES — `feat(chess): set-piece-attr generic mutator`
|
||||
|
||||
- [ ] 27. cancel-capture primitive
|
||||
- [x] 27. cancel-capture primitive
|
||||
|
||||
**What to do**: kind: "cancel-capture", schema: `{}` (no params; reads event from ctx). apply(): assert `ctx.event.kind === "capture"` → restore defender by reverting all retractions performed during capture. Implementation: integration preset records pre-capture defender facts in PRESET_STATE_ENTITY; cancel-capture reads + restores. If no capture event in ctx → throw.
|
||||
**Must NOT do**: revert if event kind ≠ capture; allow at top level (validator rejects)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue