Skip to content

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

Draft
kube wants to merge 6 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 6 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 edits the run's initial state directly, inline — an "Initial state" column between the parameters and the computation settings, with no separate edition step — and the simulation provider compiles that 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, the panel's grid grows a third column, Initial state, hosting AdHocScenarioForm inline — bare (the panel's own small-caps heading grammar, no section chrome) and withVariables={false} (this embedding offers no scenario Variables; the panel's parameter inputs stay the single owner of parameter values, so the form gets no Parameters section either). The column scrolls with the same fade treatment as the parameters list, and a Clear button appears next to its title once the state is non-empty. Selecting a saved scenario collapses the panel back to two columns. The form runs its own LSP session, so expressions type-check live against the net. The earlier "Define initial state" pencil-button drawer is gone (ad-hoc-scenario-drawer.tsx deleted) — no edition step, the form is the settings.

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": the Initial state column appears — define token rows or counts right there, then run the simulation.
  3. Pick a named scenario: the column 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 25, 2026 7:31pm
petrinaut Ready Ready Preview Aug 25, 2026 7:31pm
petrinaut-docs Ready Ready Preview Aug 25, 2026 7:31pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 25, 2026 7:31pm

Request Review

@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 1303f22 to 5bb91a6 Compare August 24, 2026 17:51
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 5bb91a6 to 767f468 Compare August 24, 2026 18:55
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 767f468 to d9d170a Compare August 24, 2026 19:22
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from d9d170a to c21e859 Compare August 24, 2026 21:10
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from c21e859 to 4ef9e82 Compare August 24, 2026 21:58
@kube
kube force-pushed the cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-is branch from 4ef9e82 to fc7a5c6 Compare August 24, 2026 22:13
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