FE-1500: add Preview quick simulation and compact timeline - #9361
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview The preview adds a header Quick Simulation popover (shared scenario controls), a bottom playback bar (reused editor Simulation stack changes: injectable compiler and Reviewed by Cursor Bugbot for commit cf9e73c. Bugbot is set up for automated code reviews on this repo. Configure here. |
f40fdea to
1498756
Compare
1498756 to
c9ddd26
Compare
c9ddd26 to
33257bc
Compare
33257bc to
7b6cd41
Compare
99f5b63 to
98f28e3
Compare
98f28e3 to
8f66f47
Compare
8f66f47 to
f217c44
Compare
f217c44 to
305c7b5
Compare
|
Semgrep found 3 Detected a call to Semgrep found 1 Ensure that the regex used to compare with user supplied input is safe from regular expression denial of service. |
There was a problem hiding this comment.
🟡 Changes recommended
Preflight validation does not detect mismatched HIR artifacts as documented, and required-scenario normalization lacks integration coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds optional precompiled Quick Simulation support to the embedded Petrinaut preview.
Changes:
- Adds scenario configuration, playback controls, and compact timeline.
- Introduces compiler injection, required-scenario normalization, and initial playback speed.
- Adds tests, user documentation, and a package changeset.
File summaries
| File | Description |
|---|---|
.changeset/petrinaut-preview-quick-simulation.md |
Records the publishable feature. |
libs/@hashintel/petrinaut/docs/preview.md |
Documents Quick Simulation. |
src/react/index.ts |
Exports simulation APIs. |
src/react/petrinaut-provider-layers.tsx |
Threads initial playback speed. |
src/react/playback/provider.tsx |
Initializes configured playback speed. |
src/react/playback/provider.test.tsx |
Tests initial speed. |
src/react/simulation/provider.tsx |
Adds compiler injection and scenario policy. |
src/react/simulation/provider.test.ts |
Tests scenario selection helper. |
src/react/simulation/use-scenario-hir.ts |
Supports injected HIR requests. |
src/ui/preview/index.ts |
Exports Quick Simulation type. |
src/ui/preview/navigation-adapter.ts |
Pins preview navigation mode. |
src/ui/preview/navigation-adapter.test.ts |
Tests simulation mode pinning. |
src/ui/preview/petrinaut-preview.tsx |
Composes Quick Simulation providers and UI. |
src/ui/preview/preview-quick-simulation-controls.tsx |
Adds compact controls and timeline. |
src/ui/preview/preview-quick-simulation-controls.test.tsx |
Tests timeline expansion. |
src/ui/preview/quick-simulation.ts |
Defines validation and compiler adapter. |
src/ui/preview/quick-simulation.test.ts |
Tests Quick Simulation helpers. |
src/ui/views/Editor/panels/BottomPanel/subviews/simulation-timeline/content.tsx |
Extracts reusable timeline content. |
src/ui/views/Editor/panels/BottomPanel/subviews/simulation-timeline/main.tsx |
Uses extracted timeline. |
src/ui/views/Editor/panels/SimulateView/experiments/experiment-scenario-run.tsx |
Adopts the HIR options API. |
Review details
- Files reviewed: 20/20 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| export const validatePreviewQuickSimulation = ( | ||
| definition: Pick<SDCPN, "scenarios">, | ||
| quickSimulation: Pick<PetrinautPreviewQuickSimulation, "scenarioHirById">, | ||
| ): void => { |
| useEffect(() => { | ||
| if ( | ||
| const shouldNormalizeRequiredScenario = | ||
| requireScenario && | ||
| effectiveSelectedScenarioId !== null && | ||
| requestedScenarioId !== effectiveSelectedScenarioId; |
| import { ActiveNetContext } from "../../react/state/active-net-context"; | ||
| import { UserSettingsContext } from "../../react/state/user-settings-context"; | ||
| import { SimulationControls } from "../views/Editor/components/BottomBar/simulation-controls"; | ||
| import { SimulationTimeline } from "../views/Editor/panels/BottomPanel/subviews/simulation-timeline/content"; |
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 c5d89e5. Configure here.

Summary
Before this PR,
PetrinautPreviewshowed a static marking. Running a scenario needed the full editor with its language server, because the simulation provider lowered scenario code through the language client alone.PetrinautPreviewgains an optional Quick Simulation mode. The host passes precompiled HIR artifacts and bounded run settings; the preview gains scenario configuration, compact playback controls, and a timeline that expands above the playback bar while frames exist. No language tooling is mounted.9360.mp4
Links
Changes
Simulation provider
SimulationProvideraccepts acompilerand aninitialConfigurationuseScenarioHirtakes an options objectrequireScenarioresolves missing or stale selections to the model's first scenarioPlaybackProvideraccepts aninitialSpeedPreview
quickSimulationprop onPetrinautPreviewSimulationTimelineextracted from the editor's timeline chart with ashowLegendpropKnown issues
validatePreviewQuickSimulationthrows during render when artifacts do not match the modelTest coverage
quick-simulation.test.ts:react/simulation/provider.test.ts:preview-quick-simulation-controls.test.tsx:react/playback/provider.test.tsx,navigation-adapter.test.ts:How to test
<PetrinautPreview quickSimulation={...} />with artifacts fromyarn workspace @apps/petrinaut-website examples:generate