T08 iter 1: scenario runner executes; GROUND setup and Select step

Replaces the RunOutcome::Unimplemented stub with a real runner:

- ScenarioGame trait: games own setup presets and the command
  vocabulary, the runner owns execution, assertions, and determinism.
- K8 double-run: every scenario runs twice on the same seed and fails
  on state-hash divergence.
- K4/K11: applied events go through Envelope into EventLog, so seq
  monotonicity is enforced on the real path, not just in unit tests.
- setup.patch was parsed and silently dropped; the runner now applies
  it generically and errors on a path that does not exist, so a typo
  in a scenario can never pass as a no-op.
- Assertions: dot-path state lookup over objects and arrays, ordered
  event subsequence matching by field subset, exact rejects-set match.

GROUND rules realized: GR-S01..S04 setup (seeded shuffle, deal, Lead,
Surface Problem face up), GR-R02 Select commit, GR-R03 stress gate and
Freedom spend, GR-A13 targeting legality.

cb-sim dispatches by the scenario's game prefix and reports rule
coverage. 3 scenarios pass, 7 rules covered; fmt/clippy/tests green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-07-31 02:14:34 +02:00
parent be52250850
commit a09d76f370
7 changed files with 848 additions and 47 deletions

View file

@ -0,0 +1,35 @@
scenario: ground/gr-r02-select
description: >
Select step: each player commits exactly one face-down Action, and a
second commit from the same player is rejected as a duplicate.
covers: [GR-R02, GR-A13]
provisional: false
seed: 42
setup:
players: 3
preset: standard-3p
commands:
- actor: P1
cmd: select_action
args: { action: ATTACK, target: P2 }
- actor: P2
cmd: select_action
args: { action: SUPPORT, target: P3 }
- actor: P3
cmd: select_action
args: { action: INVESTIGATE, problem: 2 }
# GR-R02: one selection per player per round.
- actor: P1
cmd: select_action
args: { action: GROUND }
expect:
events:
- kind: ActionSelected
player: 0
- kind: ActionSelected
player: 1
state:
"selections.0.action": Attack
"selections.1.action": Support
"selections.2.problem": 2
rejects: [3]

View file

@ -0,0 +1,34 @@
scenario: ground/gr-r03-stress-gate
description: >
Stress gate: at Stress 4 only ATTACK or GROUND may be selected, until
the READY Freedom token is spent, which admits any one Action.
covers: [GR-R03, GR-F03]
provisional: false
seed: 42
setup:
players: 3
preset: standard-3p
patch:
"players.0.stress": 4
commands:
# Gated: SUPPORT is not admitted at Stress 4.
- actor: P1
cmd: select_action
args: { action: SUPPORT, target: P2 }
- actor: P1
cmd: spend_freedom
# The same Action is now legal, and the token reads SPENT.
- actor: P1
cmd: select_action
args: { action: SUPPORT, target: P2 }
expect:
events:
- kind: FreedomSpent
player: 0
- kind: ActionSelected
player: 0
state:
"players.0.stress": 4
"players.0.freedom_ready": false
"selections.0.action": Support
rejects: [0]