Skip to content

FE-1500: switch the example embed to the Petrinaut preview - #9448

Merged
kube merged 0 commit into
codex/fe-1500-viewer-simulationfrom
claude/fe-1500-embed-preview
Sep 5, 2026
Merged

FE-1500: switch the example embed to the Petrinaut preview#9448
kube merged 0 commit into
codex/fe-1500-viewer-simulationfrom
claude/fe-1500-embed-preview

Conversation

@kube

@kube kube commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Before this PR, /embed/examples/<slug> mounted the full read-only Petrinaut component. Every embed loaded Monaco and the language server to show a model, and offered no way to run it.

The route switches to PetrinautPreview with Quick Simulation. The compact surface loads no language tooling and runs the model's named scenarios from build-time artifacts. The embed URL contract does not change.

9448.mp4

Links

Changes

  • EmbeddedExamplePage lazy-loads PetrinautPreview from @hashintel/petrinaut/preview

    quickSimulation comes from the build-time HIR artifacts via loadExampleRuntime plus the catalog's parameter bounds.
    Step size and horizon use the simulation defaults.

  • Embed route loads the runtime artifacts alongside the model

    Loader resolves loadExample and loadExampleRuntime together.
    Navigation applies applyPreviewNavigationUpdate to the previous search, so the URL carries the same shared subset through the preview-typed codec.

  • validateSharedExampleSearch stays the route's search contract

    A fast-check property asserts the preview codec produces the same search as the shared codec on every generated input, so existing embed URLs keep working.

Test coverage

  • example-search.property.test.ts:

    Preview-codec laws, including the codec-equivalence property that pins the URL contract across the switch.

  • navigation-search.test.ts, example-search.test.ts:

    Existing shared codec laws, unchanged.

How to test

Embed on the Preview

URL contract unchanged

  • Open a scenario, subnet, or itemType and itemId URL from the previous embed

    Expect it to resolve identically

@kube kube self-assigned this Aug 30, 2026
@vercel

vercel Bot commented Aug 30, 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 5, 2026 4:30pm UTC
petrinaut Ready Ready Preview Sep 5, 2026 4:30pm UTC
petrinaut-docs Ready Ready Preview Sep 5, 2026 4:30pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 5, 2026 4:30pm UTC

Request Review

@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 879319c to ee83651 Compare August 30, 2026 03:34
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 30, 2026 03:34 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from ee83651 to 1c805b2 Compare August 30, 2026 17:09
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 30, 2026 17:09 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 1c805b2 to 7e9425b Compare August 30, 2026 17:24
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 30, 2026 17:24 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 7e9425b to f5e9e25 Compare August 31, 2026 01:03
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 01:03 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from f5e9e25 to a3e8a69 Compare August 31, 2026 02:14
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 02:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 11:13 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 7425768 to 1be5d59 Compare August 31, 2026 11:13
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 11:13 Inactive
@semgrep-code-hashintel

Copy link
Copy Markdown

Semgrep found 4 detect-replaceall-sanitization findings:

Detected a call to replaceAll() in an attempt to HTML escape the string value .replaceAll("&", "&amp;") .replaceAll('"', "&quot;") .replaceAll("'", "&#39;") .replaceAll("<", "&lt;"). Manually sanitizing input through a manually built list can be circumvented in many situations, and it's better to use a well known sanitization library such as sanitize-html or DOMPurify.

Semgrep found 1 regex_dos finding:

  • apps/petrinaut-website/src/main/app/brunch-demo/brunch-endpoint.ts

Ensure that the regex used to compare with user supplied input is safe from regular expression denial of service.

@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 1be5d59 to 272d608 Compare August 31, 2026 12:01
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 12:01 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 272d608 to 4438ee5 Compare August 31, 2026 13:11
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 13:11 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 4438ee5 to 9d2da59 Compare August 31, 2026 14:27
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 14:28 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 9d2da59 to 5de56fa Compare August 31, 2026 14:28
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs August 31, 2026 14:28 Inactive
@kube
kube force-pushed the claude/fe-1500-embed-preview branch from 5de56fa to 8e15929 Compare August 31, 2026 14:42
@cursor

cursor Bot commented Sep 5, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Embed behavior and loader/navigation wiring change in a public iframe surface, though URL compatibility is explicitly property-tested against the prior shared search codec.

Overview
/embed/examples/<slug> no longer mounts the full read-only Petrinaut editor (Monaco + language server). It lazy-loads PetrinautPreview with Quick Simulation, driven by build-time HIR runtime artifacts and catalog parameter bounds, while default step size and horizon stay on simulation defaults.

The embed route loader now resolves the model and runtime together (loadExample + loadExampleRuntime). URL navigation uses the preview navigation path (applyPreviewNavigationUpdate) so the same shared query subset still flows through the address bar. validateSharedExampleSearch remains the route’s search contract; a fast-check property asserts preview-codec decoding matches the shared codec so existing scenario / subnet / itemType / itemId embed URLs keep working.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Preview navigation currently removes supported mode, view, and overlay URL parameters.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Switches example embeds from the full editor to the lightweight Petrinaut Preview with Quick Simulation.

Changes:

  • Loads model and runtime artifacts concurrently.
  • Adapts shared URL navigation to Preview state.
  • Adds property-based codec coverage.
File summaries
File Description
embed.examples.$slug.tsx Loads runtime artifacts and wires Preview navigation.
navigation-search.ts Adds Preview search conversion helpers.
example-search.property.test.ts Tests Preview codec behavior.
embedded-example-page.tsx Renders PetrinautPreview with Quick Simulation.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +129 to +132
): SharedExampleSearch =>
navigationStateToPreviewSearch(
update(previewSearchToNavigationState(search)),
);
@kube

kube commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

Not actually merged. A bad rebase from my side briefly pushed this branch at its own base, so GitHub saw no commits between them, marked the PR merged and deleted the branch. Nothing landed in `main`. The branch is restored with its commit and the work continues in #9547.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants