Skip to content

feat(talk): scripted ?demo run on real questions (Tool-Smith opener) - #30

Merged
silver-snoopy merged 15 commits into
mainfrom
feat/scripted-demo-flow
May 30, 2026
Merged

feat(talk): scripted ?demo run on real questions (Tool-Smith opener)#30
silver-snoopy merged 15 commits into
mainfrom
feat/scripted-demo-flow

Conversation

@silver-snoopy

Copy link
Copy Markdown
Owner

What

Adds a scripted, fully-deterministic demo run of the Slay the Cert dungeon, triggered by a ?demo URL query param, over the real question bank (no mock data). It starts at the Tool-Smith boss, grants the full spellbook, and looks identical to normal play (no demo badge). The per-fight answer key is dumped to the console for the live talk.

It also retires the old fake-bank demo (the debug-mode "start demo campaign (fake questions)" button).

Built from an approved spec + plan: docs/superpowers/specs/2026-05-30-scripted-demo-flow-design.md, docs/superpowers/plans/2026-05-30-scripted-demo-flow.md.

How it works

The game was already deterministic from a seed except the one Math.random question pick. The whole feature hinges on closing that gap:

  • ?demo (optional ?demo=<seed>) → HubScene.beginScriptedDemo() starts a first-run campaign with a locked DEMO_SEED = 1 and a fixed boss order (DEMO_BOSS_ORDER, Tool-Smith first), on the real bank.
  • BossFightScene feeds demoRngForFloor(seed, floor) to pickQuestionsForFight only when demoRun is set — normal play stays Math.random.
  • Each fight logs [demo] <boss>: B → C → A → … for cheat-sheet generation.
  • Reuses the existing demoRun no-progression-persist plumbing, so the demo never touches the real save/NG+ progression.

Answer key (seed 1) lives in public/talks/2026-06-03-slay-the-cert/prep/demo-cheat-sheet.md and is pinned by src/scenes/demoKey.test.ts against the live bank.

Retired (deleted)

  • public/data/demo-questions.json (752-line fake bank)
  • src/ui/demoBadge.ts + its 3 scene call sites
  • the debug demo button + beginDemoCampaign() + the realBank swap

Tests / checks

  • npx vitest run119 passing (23 files), incl. the golden answer-key + boss-order-permutation guard.
  • npx tsc --noEmit clean · npm run build clean.

Pre-PR review (/pr-review-toolkit:review-pr)

Four specialized reviewers (code, tests, comments, silent-failure) — no Critical/blocking issues. Hardening applied in response:

  • Golden test pinning the demo answer key to the live bank (turns a silent cheat-sheet-drift-on-stage into a CI failure).
  • Fail-loud throw if demoRun is set but the campaign/seed is lost (was a silent wrong-but-deterministic fallback).
  • Exhaustive spell grant via spellbook keys (drops a hardcoded SpellId list).
  • Comment precision fixes.

Manual verification (for reviewer — interactive, not automatable in CI)

Open …/dungeon/?demo and confirm:

  • Run starts on Tool-Smith; console [demo] keys match the cheat sheet
  • All five spells/lifelines present and castable
  • No (DEMO) badge anywhere (fight / interstitial / complete)
  • Reload ?demo → identical questions
  • No-?demo run is still randomized, no badge, and real save/progression untouched

🤖 Generated with Claude Code

Daniel Sallai and others added 15 commits May 30, 2026 19:45
…ion run

Tool-Smith-first, ?demo-triggered, console answer-key dump. Spec only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… old fake demo

Demo run grants the full spellbook and looks identical to normal play (badge
removed). Graduating this deletes the old fake-bank demo: demo-questions.json,
demoBadge, the debug button, beginDemoCampaign, and the realBank swap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9 bite-sized tasks: seeded RNG export, ?demo helpers, DEMO constants,
beginScriptedDemo + retire fake demo, seeded pick + console key, badge/bank
deletion, seed lock + cheat sheet, manual verify.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Seed 1 chosen for its Tool-Smith opener spread (B C A C C B A) and varied,
audience-readable MCP questions. Cheat sheet lists the per-boss answer key
in pick order for the live talk demo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pre-PR review hardening:
- Golden test (demoKey.test.ts) pins the per-boss answer key against the live
  bank via the real demoRngForFloor→pickQuestionsForFight path, so a bank edit
  that shifts the key fails CI instead of silently invalidating the cheat sheet
  on stage. Also asserts DEMO_BOSS_ORDER is a valid Tool-Smith-first permutation.
- BossFightScene: throw if demoRun is set but the campaign/seed is missing,
  instead of a silent Math.random / seed-0 fallback (wrong-but-deterministic run).
- HubScene: grant spells by iterating the spellbook's own keys (auto-exhaustive
  over SpellId) instead of a hardcoded list.
- Comment precision: per-fight answer dump, no-progression-persist, golden-test
  pointer on the DEMO_SEED rationale.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…g saves

- Continue button: long labels (e.g. "… The Compiler-King, approaching")
  overran the 500px button and clipped the closing paren on the border. Scale
  the label down to the button's inner width.
- writeSave now also skips when demoRun is set. A demo save otherwise survived
  a page reload (the in-memory demoRun flag does not) and leaked into normal
  play as a "Continue" offer — contradicting the demo's no-real-save contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@silver-snoopy
silver-snoopy merged commit bd99eae into main May 30, 2026
1 check passed
@silver-snoopy
silver-snoopy deleted the feat/scripted-demo-flow branch May 30, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant