feat(gatorwalk-factory): studio Simulate mode: saved scenarios on the engine in the page, walk from here, Copy as scenario (swamp-club #2808) #414

Merged
seth merged 6 commits from cue/2808-gatorwalk-factory-studio into main 2026-10-01 16:34:13 +00:00
Owner

Closes swamp-club #2808.

The studio's Simulate mode, which replaces the read-only Scenarios mode. The page plays every saved scenario of a factory on the real engine, in the browser, and re-runs them whenever the factory's model definition changes on disk. A person can step a work item through by hand from any frame, and copy that walk as a scenario entry for the agent to save. The page never writes.

What it does

  • Plays the saved scenarios (globalArguments.scenarios) with the engine's own runScenario, on load and after every definition event, with a pass/fail per scenario naming each step that did not go as expected. It reads scenarios only through Design mode's loader and event; there is no new route or watch. A reload that fails the schema keeps the last results under the STALE note.
  • Walk from here: from any frame, take an exit (BLOCKED ones too, to see the refusal), approve or decline, override a cycle limit, wait, or record a payload that a saved scenario already uses (#2809 adds generated payloads). A walk is the base's steps up to the frame plus the person's, and it replays on every reload.
  • Copy as scenario: the walk as one entry for globalArguments.scenarios, with expect: { refused } on each refused step and a closing expect: { stage }. It is re-run in the page to say whether it passes.
  • Graph overlay:
    • the current stage glows;
    • visited stages show entry counts, and taken exits show how often they were taken;
    • the current stage's exits are coloured READY, PERSON or BLOCKED, read from gate checks and the cycle limit;
    • a refused move flashes;
    • a token runs along each transition taken, and the view follows the current stage;
    • no motion under reduced motion.
  • Panel: Run (the step, the status as status reports it, and the walk actions), Journal, Metrics (computeMetrics on the scenario clock) and Scenarios.
  • Dock: transport, a tick per step and a ribbon of the stages. Space plays and the arrow keys step, only while no control has focus.

scenario.ts and metrics.ts join the page bundle; the script is 738 KB, under the 800 KB module limit.

Tests

  • simulate_test.ts: the runner, walks, actions, exit states, Copy round trip, overlay and timeline.
  • state_test.ts: a stubbed server, checking a reload re-run, walk replay, a broken file, a step during a reload, a discard during a step, and pause on step.
  • acceptance_test.ts, the issue's acceptance:
    • every example's scenarios play end to end;
    • raising plan's cycle limit on disk makes plan-churn fail at step 16 in the summary and the timeline;
    • a walk branched from plan-churn copies an entry that passes the factory's validate.
  • Headless Chromium over CDP, on a served studio:
    • playback, keys, walk and Copy;
    • an edit on disk shows the failure without a reload;
    • reduced motion;
    • no horizontal scroll at 390px.

Docs

  • README's studio section.
  • A "Simulate mode" section in DESIGN.md.
  • In the skill, what the agent does with a walk copied from the studio (scenarios.md, driving.md).

Follow-ups

  • #2889: a factory whose file is briefly invalid YAML drops off the studio's list.
  • #2891: low findings from the reviews (a stuck Run tab on an unrunnable walk, settling states, and others).

🤖 Generated with Claude Code

Closes swamp-club #2808. The studio's Simulate mode, which replaces the read-only Scenarios mode. The page plays every saved scenario of a factory on the real engine, in the browser, and re-runs them whenever the factory's model definition changes on disk. A person can step a work item through by hand from any frame, and copy that walk as a scenario entry for the agent to save. The page never writes. ## What it does - **Plays the saved scenarios** (`globalArguments.scenarios`) with the engine's own `runScenario`, on load and after every `definition` event, with a pass/fail per scenario naming each step that did not go as expected. It reads scenarios only through Design mode's loader and event; there is no new route or watch. A reload that fails the schema keeps the last results under the STALE note. - **Walk from here:** from any frame, take an exit (BLOCKED ones too, to see the refusal), approve or decline, override a cycle limit, wait, or record a payload that a saved scenario already uses (#2809 adds generated payloads). A walk is the base's steps up to the frame plus the person's, and it replays on every reload. - **Copy as scenario:** the walk as one entry for `globalArguments.scenarios`, with `expect: { refused }` on each refused step and a closing `expect: { stage }`. It is re-run in the page to say whether it passes. - **Graph overlay:** - the current stage glows; - visited stages show entry counts, and taken exits show how often they were taken; - the current stage's exits are coloured READY, PERSON or BLOCKED, read from gate checks and the cycle limit; - a refused move flashes; - a token runs along each transition taken, and the view follows the current stage; - no motion under reduced motion. - **Panel:** Run (the step, the status as `status` reports it, and the walk actions), Journal, Metrics (`computeMetrics` on the scenario clock) and Scenarios. - **Dock:** transport, a tick per step and a ribbon of the stages. Space plays and the arrow keys step, only while no control has focus. `scenario.ts` and `metrics.ts` join the page bundle; the script is 738 KB, under the 800 KB module limit. ## Tests - **`simulate_test.ts`:** the runner, walks, actions, exit states, Copy round trip, overlay and timeline. - **`state_test.ts`:** a stubbed server, checking a reload re-run, walk replay, a broken file, a step during a reload, a discard during a step, and pause on step. - **`acceptance_test.ts`, the issue's acceptance:** - every example's scenarios play end to end; - raising plan's cycle limit on disk makes `plan-churn` fail at step 16 in the summary and the timeline; - a walk branched from `plan-churn` copies an entry that passes the factory's `validate`. - **Headless Chromium over CDP**, on a served studio: - playback, keys, walk and Copy; - an edit on disk shows the failure without a reload; - reduced motion; - no horizontal scroll at 390px. ## Docs - README's studio section. - A "Simulate mode" section in DESIGN.md. - In the skill, what the agent does with a walk copied from the studio (`scenarios.md`, `driving.md`). ## Follow-ups - #2889: a factory whose file is briefly invalid YAML drops off the studio's list. - #2891: low findings from the reviews (a stuck Run tab on an unrunnable walk, settling states, and others). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Simulate replaces the read-only Scenarios mode. It plays every saved scenario
of the factory with the engine's own runScenario, in the browser, on load and
after every definition event, with a pass/fail summary naming each unexpected
step. A load that fails the schema keeps the last results under the STALE note.

From any frame a person can take a step of their own (an exit, approve or
decline, override a cycle limit, wait, or record a payload a saved scenario
uses); the walk is the base scenario's steps up to that frame plus theirs, and
replays on every reload. Copy as scenario gives the walk as one entry for
globalArguments.scenarios, re-run in the page to say whether it passes.

The graph overlays the frame (current stage, entry and exit counts, exit
state, refused move, a token along each transition, camera follow; no motion
under reduced motion); the panel shows the step, status, journal and metrics;
the dock has the transport, a tick per step and the stage ribbon. Scenarios are
read only through Design mode's loader and definition event.

scenario.ts and metrics.ts join the page bundle (737 KB, under the 800 KB
module limit).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
README's studio section and file list, a "Simulate mode" section in
DESIGN.md with the new bundle size, and in the skill what the agent does with
a walk the person copied from the studio.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
From the verification reviews:
- A walk step taken while a reload re-ran the scenarios threw the reload's
  results away. Reloads now only yield to newer reloads, and the walk settles
  by replaying until neither it nor the definition changed under it.
- A step that finished after its walk was discarded still wrote the walk's
  frames and Copy entry; it now leaves nothing behind.
- With a walk open, a scenario failure's step link only jumps when that step
  is before the branch, where the walk's frames are the scenario's.
- formatSeconds no longer shows 60m or 23h 60m.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Cancelling the discard-walk prompt puts the scenario picker back on the
  walk's scenario.
- Leaving Simulate for Design pauses playback; stepping or jumping to a frame
  pauses it too.
- A walk that cannot run says so once, not again on every reload.
- While a new step plays, Copy as scenario waits for it instead of offering
  the previous walk's entry.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
test(gatorwalk-factory): Simulate's acceptance plays as many scenarios as the examples ship (swamp-club #2808)
All checks were successful
CI / Review Integrity (pull_request) Successful in 51s
CI / Validate Attestation (pull_request) Successful in 51s
2d748d0877
#2842 took the swamp-club-swamp-extensions example out of the shipped skill,
so a fixed floor of 20 played scenarios no longer holds. The test now checks
that every saved scenario of every example played and passed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
seth merged commit eb5c0dc6a1 into main 2026-10-01 16:34:13 +00:00
seth deleted branch cue/2808-gatorwalk-factory-studio 2026-10-01 16:34:14 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
swamp-club/swamp-extensions!414
No description provided.