Additive 'Create scenario' path (v0.31): the home screen's create-scenario
card opens a ScenarioForm (pick one of 3 light era templates + a free-text
description + an editable, era-prefilled start year) whose 'Generate world'
posts the draft request; the CheckpointReview screen shows the generated
world (per-nation stats/territory/relations + backstory) and the advisor's
checkpoint list as an approve/remove checklist, then the player picks a
nation to lead and finalizes into a saved, playable game. Both LLM steps ride
the scenario client (deterministic stub under LLM_STUB=1); a failure toasts
and stays on the current screen. The turn stub and static presets are
untouched. New e2e covers the full deterministic flow (near-future 2035,
remove checkpoint 3, lead Boreas, finalize, one empty jump) and the 3-template
manifest.
- server/scenario.ts: buildGeneratePrompt / buildRegeneratePrompt, defensive
parseGenerate / parseRegenerate (fence-strip + balanced-object + validate),
generateDraft (draft world + advisor checkpoints) and finalizeWorld (final
world constrained to approved checkpoints -> playable GameState), all over
the injectable LlmClient with a nudge re-send. SCENARIO_* markers for the
stub.
- server/stubScenario.ts: deterministic scenario stub transport (fixed 3-nation
world + checkpoint list; finalize refines stability per approved checkpoint)
+ makeScenarioStubLlmClient. Distinct from and never touching turn stub.ts.
- server/regions.ts: validCountryCodes() accessor (ISO_A3 parents) for draft
territory validation.
- shared/scenario.ts: worldDraftToGameState now guards a dangling playerNationId
(falls back to the first nation) so a finalize that drops it stays playable.
- server/scenario.test.ts: 16 tests (prompt builders, defensive parsing,
generateDraft/finalizeWorld over a fake client + the stub).
Fixes#52