Commit Graph
1 Commits
Author SHA1 Message Date
kamilkrzywda 4f8e3534ff refactor(#74) P5: add registry contract + golden-prompt tests
Adds server/abilities/registry.test.ts, the safety net for the refactor:

- GOLDEN PROMPTS: the refactored engine's system prompt (both tool
  variants) and user prompt are asserted BYTE-IDENTICAL to the committed
  fixtures in server/abilities/goldens/ (captured in P1 from the
  pre-refactor engine). The state builder the goldens were captured from
  is re-embedded here, with a REGEN_GOLDENS=1 mode to rewrite the
  fixtures after an intentional prompt change (verified a no-op — the
  refactored output is exactly stable).
- REGISTRY CONTRACT: ABILITIES is the canonical 8-ability order with 8
  distinct TurnResult fields; each ability's default() equals the
  canonical TurnResult default and is a FRESH value (never a shared
  reference); the default is never "meaningful" while a populated value
  is; the registry declares exactly the durable GameState fields the db
  migration must default (wars/trades/embargoes/industry); the registry
  composes (a hypothetical extra ability appends cleanly to every
  uniform loop); and the engine still re-exports every name its callers
  import from it (backward compatibility).

The throwaway _golden-capture.ts is deleted (its logic is now the
REGEN mode of this test).

Fixes #74
2026-10-16 07:23:11 +00:00