Skip to content

FE-1487: Quick simulation runs an ad-hoc scenario when none is selected - #9287

Draft
kube wants to merge 2 commits into
cf/fe-1486-ad-hoc-initial-state-and-parameters-form-componentfrom
cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is
Draft

FE-1487: Quick simulation runs an ad-hoc scenario when none is selected#9287
kube wants to merge 2 commits into
cf/fe-1486-ad-hoc-initial-state-and-parameters-form-componentfrom
cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is

Conversation

@kube

@kube kube commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

The first consumer of the ad-hoc scenario form (FE-778): with no scenario selected, the simulation settings panel offers a "Define initial state" drawer, and the simulation provider compiles the drawer's state through a scenario generated at run time. The generated scenario is never persisted into the net file. Sits above FE-1486 (#9285) in stack #9286.

🔗 Related links

  • FE-1487 (internal): this PR
  • FE-778 (internal): the umbrella ticket

🔍 What does this change?

react/simulation/context.ts and provider.tsx:

  • SimulationContext gains adHocScenario: AdHocScenarioState | null and setAdHocScenario. The setter invalidates the current simulation, the same as every other configuration setter.
  • When no named scenario is selected and adHocScenario is set, the provider synthesizes a scenario with synthesizeAdHocScenario and compiles it through the existing compileScenario path. Synthesis errors surface through the existing scenarioCompilationErrors Banner (netParameter errors map to the parameterOverride source, everything else to initialState).
  • The panel's parameter inputs stay the single owner of parameter values: the synthesis context's net parameters carry the panel's current values as defaults, and the form receives no parameters section of its own.

simulation-settings.tsx: with "No scenario" selected, a pencil button next to the scenario picker opens the new drawer.

SimulateView/scenarios/ad-hoc-scenario-drawer.tsx: a large Drawer (the prototype's 860px form width) hosting AdHocScenarioForm with optimizable: false. "Clear" resets the ad-hoc state to none; "Done" closes. The form runs its own LSP session, so expressions type-check live against the net.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s) (patch).

📜 Does this require a change to the docs?

The changes in this PR:

  • add a user-visible surface. The user-guide page ships with the last PR of the stack, once all three consumers exist, so the guide describes the feature once.

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph.

🛡 What tests cover this?

The FE-1485 tests cover synthesis and compilation of everything the drawer can produce. The four extended mock fixtures keep the existing hook, playback, and story tests passing against the widened context.

❓ How to test this?

  1. turbo run dev --filter @apps/petrinaut → open a net → Simulate → simulation settings.
  2. Leave the scenario picker on "No scenario", press the pencil button, define token rows or counts, close, run the simulation.
  3. Pick a named scenario: the drawer button disappears and the named scenario takes over, unchanged.

🐾 Next steps

FE-1488 wires the experiment drawer's no-scenario branch, FE-1489 the optimization drawer with manifest emission (both hold until the experiment-backend PRs #9178/#9179 merge).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 24, 2026 4:57pm
petrinaut Ready Ready Preview Aug 24, 2026 4:57pm
petrinaut-docs Ready Ready Preview Aug 24, 2026 4:57pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 24, 2026 4:57pm

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps > hash.design Affects the `hash.design` design site (app) labels Aug 22, 2026
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 996e8c5 to cb17673 Compare August 23, 2026 14:18
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from cb17673 to eb782f9 Compare August 23, 2026 14:40
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from eb782f9 to b4fc27c Compare August 23, 2026 15:42
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from b4fc27c to 1330ce5 Compare August 24, 2026 01:03
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 1330ce5 to ca3db02 Compare August 24, 2026 01:11
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from ca3db02 to 9b43e00 Compare August 24, 2026 01:45
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 9b43e00 to 9270197 Compare August 24, 2026 10:53
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 9270197 to 93c6300 Compare August 24, 2026 14:59
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 93c6300 to 669e5ee Compare August 24, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash.design Affects the `hash.design` design site (app) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant