Skip to content

FE-1488: Experiments accept an ad-hoc scenario when none is selected - #9288

Draft
kube wants to merge 2 commits into
cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-isfrom
cf/fe-1488-experiments-accept-an-ad-hoc-scenario
Draft

FE-1488: Experiments accept an ad-hoc scenario when none is selected#9288
kube wants to merge 2 commits into
cf/fe-1487-quick-simulation-runs-an-ad-hoc-scenario-when-none-isfrom
cf/fe-1488-experiments-accept-an-ad-hoc-scenario

Conversation

@kube

@kube kube commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

The second consumer of the ad-hoc scenario form (FE-778): the create-experiment drawer's "No scenario" branch embeds the form, and the experiments provider compiles the result into the experiment's initial marking and parameter values through a scenario generated at experiment start and never persisted. Sits above FE-1487 (#9287) in stack #9286.

Hold merging until the experiment-backend PRs #9178 and #9179 land — this PR touches the same experiments provider.

🔗 Related links

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

🔍 What does this change?

react/experiments/context.ts: CreateExperimentInput gains an optional adHocScenario: AdHocScenarioState | null, ignored when scenarioId is set.

react/experiments/provider.tsx: with no named scenario and an ad-hoc definition, createExperiment synthesizes a scenario with synthesizeAdHocScenario and compiles it through the existing compileScenario path, filling parameterValues and initialMarking exactly as a named scenario does. Synthesis and compilation failures throw with the same source:itemId message format as the named path, so the drawer's footer error shows them. The experiment record's scenarioName becomes "Ad-hoc scenario", which is what the experiments table and the running-experiments popover display.

create-experiment-drawer.tsx: the Scenario section's empty branch renders AdHocScenarioForm (optimizable: false). Unlike the quick-simulation drawer, the form's own Parameters section is active here, because the experiment drawer has no parameter inputs of its own. Left untouched, the form passes nothing and the experiment runs exactly as before. The state resets when the drawer closes.

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?

Two new provider tests: an ad-hoc definition with a variable compiles into the worker's init message (initialMarking["place-queue"] is 6) and stamps scenarioName: "Ad-hoc scenario"; an invalid definition rejects createExperiment before any worker message is sent. The FE-1485 tests cover the synthesis rules themselves.

❓ How to test this?

  1. turbo run test:unit --filter @hashintel/petrinaut
  2. turbo run dev --filter @apps/petrinaut → Simulate → Experiments → Create → set Scenario to "No scenario", define token rows, add a metric, Run.
  3. The experiments table shows "Ad-hoc scenario" in the Scenario column; the net file gains no scenario.

🐾 Next steps

FE-1489 wires the optimization drawer with manifest emission (also held until #9178/#9179).

🤖 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 1:53am
petrinaut Ready Ready Preview Aug 24, 2026 1:53am
petrinaut-docs Ready Ready Preview Aug 24, 2026 1:53am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 24, 2026 1:53am

@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 labels Aug 22, 2026
@kube
kube force-pushed the cf/fe-1488-experiments-accept-an-ad-hoc-scenario branch from 9c0be90 to 7bf4f5f Compare August 23, 2026 14:18
@kube
kube force-pushed the cf/fe-1488-experiments-accept-an-ad-hoc-scenario branch from 7bf4f5f to 4ffa12e Compare August 23, 2026 14:40
@kube
kube force-pushed the cf/fe-1488-experiments-accept-an-ad-hoc-scenario branch from 4ffa12e to cae549d Compare August 23, 2026 15:42
@kube
kube force-pushed the cf/fe-1488-experiments-accept-an-ad-hoc-scenario branch from cae549d to 5490013 Compare August 24, 2026 01:03
@kube
kube force-pushed the cf/fe-1488-experiments-accept-an-ad-hoc-scenario branch from 5490013 to 22b3bd7 Compare August 24, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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