FE-778: Offer Sweep toggles on ad-hoc scenarios in the experiment drawer - #9624
Conversation
… open The form's language session synced to the worker on every state identity change; run-mode hosts rebuild an equal state per render, and each sync republished diagnostics, which re-rendered the hosts: a loop that held the canvas at 9 fps for as long as Simulation Settings showed a scenario. The session now follows the definition's content. The simulation provider was excluded from React Compiler by a throw inside initialize's try/catch, so every render handed out new identities for all derived values; the compile-or-throw step moved to a helper. The worker reuses the net's own diagnostics across session-only syncs, and the client drops publishes that change nothing. Run-mode hosts reseed on scenario content, not object identity, so a node drag no longer remounts the form. Place totals and slot labels index the state once per render.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview The ad-hoc form gains a Experiment creation passes
Docs describe sweep selections on ad-hoc forms and experiment configuration. Reviewed by Cursor Bugbot for commit e67244d. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4070dcb. Configure here.
There was a problem hiding this comment.
🟡 Changes recommended
Three moderate issues affect sweep controls, invalid retained selections, and computed-state preview accuracy.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds parameter sweep support for ad-hoc and saved scenarios in Petrinaut’s experiment drawer, behind the relevant feature flags.
Changes:
- Adds numeric Sweep controls and range handling.
- Compiles ad-hoc selections into labeled sweep axes.
- Updates experiment UI, tests, documentation, and release metadata.
Unresolved findings:
- Moderate: Computed-state parameters incorrectly expose nonfunctional Sweep toggles.
- Moderate: Changing a swept variable to a nonnumeric type can leave an uncleared selection that prevents execution.
- Moderate: Computed-state previews use defaults rather than values represented by active sweep ranges.
File summaries
| File | Description |
|---|---|
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/shared/surface-frame.tsx |
Supports labeled axis options. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/sweep-surface.tsx |
Uses friendly labels in sweep readouts. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/sweep-navigator.tsx |
Displays friendly axis labels. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/experiment-scenario-run.tsx |
Enables saved-scenario sweep inputs. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/experiment-scenario-run.test.tsx |
Updates run-component tests. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/experiment-scenario-inputs.ts |
Converts run-form values into fixed or ranged inputs. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/experiment-scenario-inputs.test.ts |
Tests fixed and ranged input conversion. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/create-experiment-drawer.tsx |
Integrates sweep controls and summaries. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/create-experiment-drawer.test.tsx |
Tests feature-flagged drawer controls. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/variable-rows.tsx |
Adds numeric variable Sweep toggles. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/value-editor.tsx |
Displays Min and Max sweep bounds. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/token-table.tsx |
Adds consumer-specific row actions. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/scenario-parameter-rows.tsx |
Adds saved-scenario Sweep toggles. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/parameter-rows.tsx |
Adds parameter Sweep toggles. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/form-context.ts |
Defines sweep selection behavior. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/ad-hoc-scenario-form.tsx |
Supports the sweep form consumer mode. |
libs/@hashintel/petrinaut/src/ui/components/ad-hoc-scenario-form/ad-hoc-scenario-form.test.tsx |
Tests numeric-only sweep controls. |
libs/@hashintel/petrinaut/src/react/experiments/provider/create-experiment.ts |
Compiles ad-hoc sweep scenarios. |
libs/@hashintel/petrinaut/src/react/experiments/provider.tsx |
Starts sessions with compiled sweep axes. |
libs/@hashintel/petrinaut/src/react/experiments/provider.test.tsx |
Tests ad-hoc sweep compilation. |
libs/@hashintel/petrinaut/src/react/experiments/parameter-grid.ts |
Builds labeled ad-hoc sweep axes. |
libs/@hashintel/petrinaut/src/react/experiments/parameter-grid.test.ts |
Tests axis generation and validation. |
libs/@hashintel/petrinaut/src/react/experiments/context.ts |
Extends experiment creation input. |
libs/@hashintel/petrinaut/docs/experiments.md |
Documents experiment sweep behavior. |
libs/@hashintel/petrinaut/docs/ad-hoc-scenarios.md |
Documents ad-hoc sweep selections. |
.changeset/adhoc-experiment-sweeps.md |
Records the Petrinaut release change. |
Review details
- Files reviewed: 26/26 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
af8f30f to
1cd0e12
Compare
…th and pin the content reseed
1cd0e12 to
12a4be4
Compare
With Parameter sweeps on, the ad-hoc form in the create-experiment drawer renders in a sweep selection: every numeric value slot carries a Sweep toggle that opens Min and Max bounds, and a saved scenario shown through the form offers the same toggle on each numeric scenario parameter, as the classic rows do. Each selection synthesizes to a generated scenario parameter whose domain becomes a sweep axis, labelled with the value's path in the navigator and the surface.
The summary line that names the swept parameters rendered only under the classic scenario rows; the ad-hoc form and a saved scenario shown through it get the same line.
12a4be4 to
e67244d
Compare

Important
Experimental
Behind the Ad-hoc scenarios and Parameter sweeps feature flags.
Summary
Before this PR, the create-experiment drawer offered a Sweep toggle on the classic scenario parameter rows only. With ad-hoc scenarios enabled the drawer shows every scenario through the ad-hoc form, and the form had no such toggle: neither an inline definition nor a saved scenario shown through it could be swept.
The form gains a sweep selection. Every numeric value carries a Sweep toggle that opens Min and Max bounds, a saved scenario's numeric parameters carry the same toggle in the run-mode rows, and each selection becomes a swept parameter of the experiment. Generated parameters show under the value's path in the sweep navigator and the surface.
9624.mp4
Links
Changes
Ad-hoc form
sweepjoins the form's selectionsExperiments
Review fixes
Test coverage
parameter-grid.test.ts:provider.test.tsx:experiment-scenario-inputs.test.ts:ad-hoc-scenario-form.test.tsx,create-experiment-drawer.test.tsx:ad-hoc-scenario-form.test.tsx, review fixes:experiment-scenario-run.test.tsx, review fixes:How to test