FE-1547: Isolate the contour and sweep components with dedicated stories - #9421
Draft
kube wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
kube
force-pushed
the
cf/fe-1547-isolate-the-contour-and-sweep-components-with-dedicated
branch
from
August 29, 2026 02:43
17c06dd to
ac0dd0f
Compare
kube
changed the base branch from
cf/fe-1546-stream-range-sweeps-as-one-stochastic-simulation-over-the
to
cf/fe-1549-randomize-sweep-parameter-draws-with-a-seed-derived-shift
August 29, 2026 02:47
3 tasks
kube
force-pushed
the
cf/fe-1547-isolate-the-contour-and-sweep-components-with-dedicated
branch
from
August 30, 2026 13:08
ac0dd0f to
e5d4275
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🌟 What is the purpose of this PR?
Isolates the contour plot and the sweep navigator as self-contained components, so each state and flow (streaming fill, markers, range/point selection, saturation) can be exercised in Storybook against fake providers, without a running optimizer. Stacked on #9419.
🔗 Related links
🔍 What does this change?
ContourSurface(src/ui/components/contour-surface.tsx): a purely presentational filled-contour canvas. Callers hand it grid-indexed values and optional ring markers; clicks come back as fractions of the plot area. It knows nothing about parameters, experiments, or optimizations.SweepSurfaceandOptimizationSurfacenow renderContourSurfaceinstead of owning their own canvas, raster, and paint effect; the optimization surface projects its trials intoContourSurfaceMarkers (best trial emphasized) during render.distributionStatsmodule (src/react/experiments/distribution-stats.ts) with unit tests, replacing the optimization surface's local copy.SweepNavigatorfromExperimentsContext: it now takesaxes,selection,status, andonSelectionChangeas props, and the experiment drawer wires the context in.ContourSurface(empty, sparse, dense, markers, timer-driven streaming, click reporting),SweepNavigator(ranges, points, mixed, sampling, refining, saturated — all with live sliders),SweepSurface(streaming, slow sampling, no data), andOptimizationSurface(no trials, streaming trials, complete, log-scale, many parameters) over a validated supply-chain study manifest whose fake trials and fake local compute share one synthetic objective, so trial rings land on the contour.FakeExperimentsProvideraccepts per-story overrides forsampleSweepCellandsampleDetachedObjective.OptimizationSurfacestories: the fake local compute resolves batches at CPU-like cost (scaling with runs) or at near-constant GPU-like cost, to exercise both streaming profiles (the GPU pace previews the planned WebGPU path for point batches).SweepNavigatorstory wired to a fake sweep session over the SIR Seasonal Flu scenario: an "Infected" metric timeline streams below the sliders, a committed move restarts the stream for the new selection, and a range selection widens the run distribution the way per-run parameter draws do.ExperimentMetricTimelinestories: frames streaming in one at a time, whole distributions re-arriving sharper at each refinement rung, a complete run, and the empty state — backed by a deterministic SIR-ish frame generator (sirInfectedFrame) in the story fixtures.SweepNavigatorstories, "Real compute on CPU" and "Real compute on GPU (points)": the navigator runs against the realExperimentsProvider, simulating a genuine sweep in browser workers over a story-only SIR scenario whose swept parameters feed the transition rates throughparameterOverrides(the stock scenarios' parameters only shape the initial marking, which a range holds at its midpoint). The GPU story shows the real backend routing — range selections fall back to the CPU pool (per-run parameter draws cannot run on the GPU) and collapsing both parameters to points hands the batches to the GPU.runCount(up to 100 000 — the refinement ladder already climbs ×5/×2 past 1000),maxTime, anddt; changing one restarts the experiment with the new settings.ExperimentMetricTimelineaccepts atimeDomainto pin its x axis (the experiment drawer pins[0, maxTime], so charts no longer rescale while frames stream in or after a selection change) and alabelthat keeps its full-size shell — header, fixed-height plot area with a "Waiting for metric data" overlay, footer — while no frames exist, so streams and re-streams cause no layout shift.Slider(coincidentRangeSliderthumbs trapped the drag on the upper one, which could not move left), and slider moves commit per quantized step during the drag instead of on release, so compute follows the thumb. Fixes the dsSlidertreating value 0 as unset.useElementSizeto follow an element that mounts after the first render: it observed only what the ref held on mount, so a chart mounting once its first frame arrived stayed permanently blank.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🐾 Next steps
🛡 What tests cover this?
distribution-stats.test.ts(mean/median/empty-frame cases).sweep-session.test.tsandparameter-grid.test.tscover the sampling the surfaces feed on; the full petrinaut unit suite passes.❓ How to test this?
yarn workspace @hashintel/petrinaut dev(oryarn dev:petrinaut-optimization --storybook).📹 Demo
(screenshots to be attached)
🤖 Generated with Claude Code