FE-1513: Contour plot over two swept parameters, navigable in real time - #9369
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
e937d32 to
cb2b00d
Compare
cb2b00d to
e09a224
Compare
e09a224 to
c9d777c
Compare
c9d777c to
383d025
Compare
PR SummaryMedium Risk Overview Compute and session: Rendering: New pure Reviewed by Cursor Bugbot for commit 72ce138. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
🟡 Changes recommended
Initialization, cache refresh, cancellation, sampling order, and accessibility issues affect core behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a live contour surface for multi-parameter sweeps, backed by progressive background sampling.
Changes:
- Adds contour interpolation, rendering, navigation, and controls.
- Extends sweep sessions with serialized background sampling.
- Adds tests, fixtures, user documentation, and architecture documentation.
File summaries
| File | Description |
|---|---|
.changeset/sweep-surface-contour.md |
Records the Petrinaut patch release. |
libs/@hashintel/petrinaut/docs/experiments.md |
Documents the surface view. |
libs/@hashintel/petrinaut/src/react/experiments/context.ts |
Exposes background cell sampling. |
libs/@hashintel/petrinaut/src/react/experiments/contour-grid.ts |
Implements contour mathematics and ordering. |
libs/@hashintel/petrinaut/src/react/experiments/contour-grid.test.ts |
Tests contour utilities. |
libs/@hashintel/petrinaut/src/react/experiments/provider.tsx |
Connects sampling to compute backends. |
libs/@hashintel/petrinaut/src/react/experiments/sweep-session.ts |
Adds the background sampling lane. |
libs/@hashintel/petrinaut/src/react/experiments/sweep-session.test.ts |
Tests background sampling behavior. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/create-experiment-drawer.test.tsx |
Updates the test context fixture. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/experiments-story-fixtures.tsx |
Adds a synthetic contour data source. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/sweep-surface.tsx |
Implements the interactive canvas surface. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/view-experiment-drawer.tsx |
Adds the Surface drawer section. |
libs/@local/petrinaut-arch-docs/content/diagrams/sweep-surface-feed.d2 |
Diagrams the sampling flow. |
libs/@local/petrinaut-arch-docs/content/experiments/sweep-surface.mdx |
Documents the surface architecture. |
Review details
Suppressed comments (2)
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/view-experiment-drawer.tsx:403
Sectionkeeps collapsed content mounted by default (src/ui/components/section.tsx:172,198,226-227), so collapsing Surface leaves this component's sampling effect running through the whole grid. SetunmountOnCollapseso closing the section actually stops the background walk.
collapsible
defaultOpen
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/view-experiment-drawer.tsx:405
ExperimentsViewpasses different selected records through the same drawer instance (experiments-view.tsx:152-156), whileSweepSurfaceinitializes its axis and metric IDs only on first mount. Switching directly between experiments can retain IDs absent from the new experiment, making all three controls invalid and leaving the surface blank. Remount this stateful component per experiment.
<SweepSurface experiment={experiment} />
- Files reviewed: 14/14 changed files
- Comments generated: 5
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
sampleCell brings any combination up to a minimum run count off the navigator's lane: serialized single-worker batches on the same seed ladder, folding into the same cache, so a sampled cell and a visited cell are the same thing. Also fixes the navigator lane never calling handle.start() — the test fakes were hand-driven and hid it; they now refuse to stream before start.
An Optuna-style filled contour of one metric's final value over two swept parameters. The view walks the grid coarse-to-fine through the background lane, so the surface's shape appears within the first few sampled combinations and sharpens as cells land; the pure module (IDW interpolation, marching squares, the Blues ramp) is tested apart from the canvas. Clicking the surface moves the navigator; the fixed parameters' navigator values slice the grid, and changing them restarts the walk.
User guide, architecture page with the sampling-feed diagram, and the changeset; the surface's axis and metric selects become compact inline controls.
bd3ba63 to
72ce138
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 72ce138. Configure here.

Important
Experimental
Behind the Parameter sweeps feature flag.
Summary
Before this PR, a sweep's results drawer shows one combination at a time. Navigator selects it and its metric charts stream. There is no view of a metric across the swept grid.
A sweep with two or more swept parameters gains a Surface section under its metrics: a filled contour of one metric's final value over two chosen parameters, in the style of Optuna's
plot_contour. Every other parameter is held at its navigator value. Plot fills in live as the view walks the X×Y grid coarse-to-fine at 8 runs per combination. Clicking the surface moves the navigator to the nearest combination, whose ladder then refines it.Links
Changes
UI
sweep-surface.tsxadds pickers, canvas, click-to-navigate, and captionsampleSweepCell(experimentId, values, minRuns)Contour grid and sampling
react/experiments/contour-grid.tsholds the surface mathsreact/experiments/sweep-session.tsgains a background sampling lanehandle.start()Test coverage
contour-grid.test.ts, 10 tests:sweep-session.test.ts, two new tests:How to test