Skip to content

FE-714, FE-713: Show running simulation + notification and prevent closing#8729

Merged
kube merged 7 commits into
mainfrom
cf/experiments-iteration
May 19, 2026
Merged

FE-714, FE-713: Show running simulation + notification and prevent closing#8729
kube merged 7 commits into
mainfrom
cf/experiments-iteration

Conversation

@kube
Copy link
Copy Markdown
Collaborator

@kube kube commented May 18, 2026

🌟 What is the purpose of this PR?

Add the editor UX needed to track long-running Monte Carlo experiments: users can see active runs, navigate to them, avoid accidentally closing the window while they are running, and get completion/error feedback.

🔍 What does this change?

  • Adds experiment tracking UI in Petrinaut, including an Experiments simulate tab backed by shared table styling and focused scenario/metric/experiment subviews.
  • Adds a running experiments popover in the top bar, showing active Monte Carlo runs with status/progress and click-through navigation to the selected experiment.
  • Blocks browser/window close while Monte Carlo experiments are active.
  • Centralizes transient app notifications in NotificationsContext and renders them with Ark UI Toast inside Petrinaut's portal container so design-system variables are preserved.
  • Shows notifications when simulations complete and when Monte Carlo experiments complete or fail.
  • Adds Storybook coverage for SimulateView and the running experiments popover with fake experiment states.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • I am unsure / need advice

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • yarn workspace @hashintel/petrinaut lint:tsc
  • yarn workspace @hashintel/petrinaut test:unit
  • yarn workspace @hashintel/petrinaut lint:eslint

❓ How to test this?

  1. Open Petrinaut and start a Monte Carlo experiment from the Simulate view.
  2. Confirm the top bar shows the running experiment count and the popover lists active experiments.
  3. Click a running experiment from the popover and confirm it opens the experiment details.
  4. Try closing/reloading the page while an experiment is active and confirm the browser blocks accidental close.
  5. Let an experiment complete, or force an error, and confirm a bottom-right toast appears.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

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

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment May 19, 2026 2:58pm
petrinaut Ready Ready Preview, Comment May 19, 2026 2:58pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview May 19, 2026 2:58pm

@cursor
Copy link
Copy Markdown

cursor Bot commented May 18, 2026

PR Summary

Medium Risk
Touches cross-cutting React provider composition and introduces global beforeunload blocking + toast notifications, which can affect app lifecycle/UX if mis-triggered. UI refactors across Simulate views add moderate surface area but are localized to editor tooling.

Overview
Long-running Monte Carlo experiments now surface better UX. The editor top bar shows an Active Experiments popover with per-experiment progress/status and optional click-through that switches to Simulate → Experiments and selects the experiment.

Experiments are safer and more communicative. A new useBlockWindowClose hook blocks beforeunload while any experiment is active (isExperimentActive), and ExperimentsProvider now emits success/error notifications on completion/failure.

Notifications are centralized. Introduces NotificationsContext + NotificationsProvider backed by Ark UI Toast (rendered in the Petrinaut portal container), wires it into PetrinautProvider, and migrates simulation completion messaging off the old SimulationToaster (deleted).

Simulate view UI is refactored and expanded. Adds shared Table/TableStatusBadge, restructures Simulate subviews into dedicated ScenariosView/MetricsView/ExperimentsView with a common SimulateSubviewFrame, and adds Storybook fixtures/stories for SimulateView and the running-experiments popover; drawer footer error badge is generalized to DrawerErrorDisplay.

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

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps > hash.design Affects the `hash.design` design site (app) labels May 18, 2026
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 18, 2026

🤖 Augment PR Summary

Summary: Adds UI + guardrails around active Monte Carlo experiments in Petrinaut.

Changes:

  • Introduces and exports isExperimentActive() to identify initializing/running experiments.
  • Prevents browser close/reload/navigation while an experiment is active via useBlockWindowClose and provider wiring.
  • Adds a RunningExperimentsPopover in the editor top bar to surface active simulations and jump to a selected experiment.
  • Refactors SimulateView into dedicated Scenarios/Metrics/Experiments subviews and reorganizes drawers into feature folders.
  • Adds a reusable Table/TableStatusBadge component for list UIs.
  • Renames the shared drawer footer error summary component to DrawerErrorDisplay and updates usages.
Test Notes: Includes a vitest asserting beforeunload listener registration/removal during an active experiment.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread libs/@hashintel/petrinaut/src/ui/components/popover.tsx
Comment thread libs/@hashintel/petrinaut/src/ui/components/table.tsx Outdated
@kube kube requested a review from CiaranMn May 19, 2026 13:31
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 36ba6da. Configure here.

Comment thread libs/@hashintel/petrinaut/src/react/notifications/provider.tsx
@kube kube added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit b1b9d0f May 19, 2026
43 checks passed
@kube kube deleted the cf/experiments-iteration branch May 19, 2026 15:53
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/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.

2 participants