Skip to content

FE-1718: Polish experiment creation, results, and optimizer controls - #9725

Merged
kube merged 22 commits into
codex/fe-1716-experiment-scenario-viewsfrom
codex/fe-1718-experiment-creation-polish
Sep 16, 2026
Merged

kube merged 22 commits into
codex/fe-1716-experiment-scenario-viewsfrom
codex/fe-1718-experiment-creation-polish

Conversation

@kube

@kube kube commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Experiment creation and results now share a simpler workflow. Built-in and saved metrics display derived names, custom metrics keep editable names, and objective controls sit within metric cards. Constraints separate Parameters and State into compact groups with their own Add actions, inline delete controls, and the pass threshold in the State header. GPU compute, parameter sweeps, and in-browser optimization are available without feature flags; the empty Simulation settings page is removed.

Sweeps start idle by default. Check Start optimizer immediately during creation, or choose Parameters → Optimize later. Results keep the name, status, and progress in the header, with configuration and search information in Details.

Demo: choose a place metric, enter a state constraint as an expression, create an idle sweep, then optimize and return to the best parameter values.

fe-1718--create-and-optimize-verified.mp4

Links

Blocked by

Changes

Creation

  • Place and transition metrics derive their names from the selected item; saved metrics show their saved name as read-only text
  • The metric picker supports switching between saved metrics, custom code, and built-in metrics while retaining the custom draft
  • The objective metric has a purple highlight and compact, shaded direction controls
  • Parameter and state conditions have separate groups, short context hints, compact Add actions, and delete controls beside each editor
  • The pass threshold sits in the State header; parameter expressions stay on one line and state editors grow as needed, with completion and validation
  • State conditions accept boolean expressions with an implicit return and optional trailing semicolons; existing code bodies still work, and placeholders use dot access
  • Keyboard navigation covers sections, fields, metric cards, constraint editors, and footer actions; removing a constraint restores focus within its group
  • Invalid interval bounds explain disabled submission beside the creation button

Optimization and results

  • Sweep consistently selects an interval; Start optimizer immediately is unchecked by default
  • Parameters → Optimize selects a metric, direction, and step count for a later search, using the same validation as creation
  • Stop ends the search and unlocks manual exploration; a later start replaces the settled study after the replacement registers
  • Later searches use the experiment's model snapshot, constraints, fixed values, and execution settings
  • Parameter sliders choose one value, show readable names and small min/max captions, and wrap in narrow panels
  • Details contains the scenario, sampling limit, timing, backend, batches, and search summary
  • Parameters → Optimizer keeps the best parameter values beside objective history; View best restores all values together after the search stops or finishes
  • Sensitivity analysis sorts by descending Share, preserving tied order, correlations, and confidence indicators
  • Saved simulation flags are discarded, GPU availability follows browser/model support, and optimizer controls follow the host capability
  • User and architecture documentation and package patch changesets cover the combined behavior

Next steps

Reusing an existing experiment's configuration remains follow-up work in FE-1718.

Test coverage

Creation tests cover default manual startup, opting in and out, immediate startup, metric selection, names, objective controls, and validation. Results and optimizer tests cover late startup, failed startup, settled-study replacement, Stop, control locking, and model snapshots. Constraint tests cover expressions with trailing semicolons and comments, explicit-body forms, separate-statement diagnostics, boolean validation, source positions, autocomplete, and compiled pass/fail evaluation. Results tests also cover waiting, running, stopped, completed, and failed searches; best-value retention; locked controls; and restoring every parameter in one selection. Existing suites cover slider selections, progress, Details, and sensitivity ordering.

The rebased combined branch passed build, unit-test, TypeScript, and lint checks on the complete feature set. Formatting passed across 231 changed files. Architecture validation and the documentation site build also passed. Local test runs needed isolated retries for load-related timeouts, a dependency rebuild during an import, and an intermittent fake-timer assertion in unchanged website code; those retries passed. The final constraint and URL corrections passed 106 focused tests locally. A redundant local aggregate run was stopped after resource-related timeouts; the current-head CI package and unit checks passed independently.

Browser checks used the rebuilt website and a real in-browser optimizer. They verified idle creation, keyboard access and validation in the Optimize prompt, Stop followed by keyboard slider exploration, a replacement search, immediate startup, and read-only saved metric names with reversible metric selection. After flag removal, a fresh preview tab verified the General / Viewport / Labs settings navigation, keyboard access, GPU and Sweep availability, and unchecked optimizer startup with no settings changes; the console reported no errors. Grouped constraints were also checked at normal and narrow panel widths with reverse type insertion, multiple state conditions, multiline code, Tab / Escape, and keyboard deletion restoring focus within the group. The rebuilt expression editor showed a dot-access placeholder without return, accepted both expression and multiline body forms, rejected a non-boolean result, and moved from the editor to its remove button with Tab; the console was clear.

The Best Parameters Storybook examples cover waiting, running, stopped, and completed searches. Manual checks verified the compact and wide layouts, preserved best values during exploration, and keyboard activation of View best.

How to test

Metric cards and keyboard navigation

  • Open Simulate → Experiments → Create and add a Place tokens or Transition firing metric

    The name follows the selection.

  • Switch to a saved metric, then Custom code, then back

    Saved names are read-only. Only Custom code has an editable name.

  • Navigate the form with Tab, arrow keys, and Escape
  • Select a swept scenario parameter and add parameter and state constraints without changing settings
  • Enter a state expression such as state.places.Queue.count <= 10 using a place from the model

    It validates without return. A code body such as const count = state.places.Queue.count; return count <= 10; also works.

  • Check Start optimizer immediately, add a second metric, and change the objective

    The selected metric has a purple highlight and compact direction controls.

Manual and immediate optimization

  • Create a sweep with at least one metric and Start optimizer immediately unchecked

    The results open idle with midpoint slider values and an Optimize action.

  • Open Parameters → Optimize and choose the metric, direction, and steps
  • Start the search, then choose Stop

    Progress shows optimization steps, sliders lock during the search, and Stop restores manual control.

  • Move both parameter sliders, then choose View best

    All parameters return to the best evaluated point and its results. The saved best values stay visible while exploring other points.

  • Move a slider and start another search
  • Open Details and inspect the sampling budget and search summary
  • Create another sweep with Start optimizer immediately checked

    Optimization starts as its results open.

Pre-Merge Checklist

Publishing

  • Modifies an npm-publishable library and includes a patch changeset

Documentation

  • Required user and architecture documentation changes are included

Turbo Graph

  • Does not affect the execution graph

@kube
kube added this pull request to stack #9699 September 15, 2026 00:43
@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Sep 16, 2026 8:57pm UTC
petrinaut Ready Ready Preview Sep 16, 2026 8:57pm UTC
petrinaut-docs Ready Ready Preview Sep 16, 2026 8:57pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 16, 2026 8:57pm UTC

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 labels Sep 15, 2026
@kube kube self-assigned this Sep 15, 2026
@kube kube changed the title codex/fe 1718 experiment creation polish FE-1718: Polish Experiment and Optimization creation Sep 15, 2026
@kube
kube removed this pull request from stack #9699 September 15, 2026 01:16
@kube
kube force-pushed the codex/fe-1718-experiment-creation-polish branch from 694d65b to c9e1393 Compare September 15, 2026 01:17
@kube
kube added this pull request to stack #9730 September 15, 2026 01:18
@kube
kube removed this pull request from stack #9730 September 15, 2026 02:00
@kube
kube force-pushed the codex/fe-1718-experiment-creation-polish branch from c9e1393 to 8907f84 Compare September 15, 2026 02:01
@kube
kube added this pull request to stack #9731 September 15, 2026 02:02
@kube
kube removed this pull request from stack #9731 September 15, 2026 02:30
@kube
kube force-pushed the codex/fe-1718-experiment-creation-polish branch from 8907f84 to ad30c2e Compare September 15, 2026 02:30
@kube
kube added this pull request to stack #9733 September 15, 2026 02:31
@cursor

cursor Bot commented Sep 16, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches experiment lifecycle, optimization connection, and constraint compilation/LSP—user-facing workflow changes with broad doc and test coverage but meaningful behavior shifts for existing saved settings and sweep defaults.

Overview
Makes GPU experiments, parameter sweeps, and in-browser optimization always available by removing the Simulation settings tab and persisted flags (webGpuEnabled, enableParameterSweeps, enableInBrowserOptimization). The host optimizer connects on the first study instead of gating on a user toggle; deep links to settings=simulation no longer open that section.

Reworks experiment creation and results UX: sweeps default to midpoint slider values and idle sampling until you move controls; optimization is opt-in via Start optimizer immediately or Parameters → Optimize later. Experiments store a model definition snapshot for later optimization. Results use a simpler header plus Details, single-value sliders with readable names, View best, and refined sensitivity ordering.

State constraints can be authored as boolean expressions (e.g. state.places.Queue.count <= 10) with optional trailing semicolons; Petrinaut wraps them with an implicit return in lowering, LSP virtual files, and lint. Multi-statement bodies still require an explicit final return.

Supporting fixes include constraint/metric editor keyboard behavior (Escape in Monaco), collapsible section aria-expanded, and migration that strips retired settings keys from localStorage.

Reviewed by Cursor Bugbot for commit e77dec1. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread libs/@hashintel/petrinaut-core/src/hir/lower-typescript.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread libs/@hashintel/petrinaut-core/src/hir/user-code-form.ts
CiaranMn
CiaranMn previously approved these changes Sep 16, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e77dec1. Configure here.

Comment thread libs/@hashintel/petrinaut/src/ui/components/section.tsx Outdated
@hash-release hash-release Bot mentioned this pull request Sep 16, 2026
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/apps area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants