FE-1500: Add example models and the read-only example page - #9362
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview Catalog and runtime loading split lightweight metadata ( Build-time compilation: Shareable URL contract ( Model JSON lives under Reviewed by Cursor Bugbot for commit fd3bc6a. Bugbot is set up for automated code reviews on this repo. Configure here. |
6d3e470 to
8f9df3c
Compare
8f9df3c to
23127ef
Compare
23127ef to
27ef2b0
Compare
27ef2b0 to
43734e1
Compare
2257747 to
bc9fe6e
Compare
bc9fe6e to
6fe3adf
Compare
6fe3adf to
447e7bc
Compare
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 6d45bac. Configure here.

🌟 What is the purpose of this PR?
Publishes seven Petrinaut models as website examples: canonical
/examples/<slug>pages rendering the full Petrinaut component read-only, with the scenario, subnet, and canvas selection encoded in the URL. Examples are embed and deep-link content, so there is no index page:/examplesredirects to/. Stacked on the controlled-navigation PR.🔗 Related links
🔍 What does this change?
src/examples/models. The precompiled HIR runtime artifacts are NOT committed:scripts/generate-example-artifacts.tswrites them to the gitignoredsrc/examples/generated/at build time. A newexamples:generateTurbo task feedsbuild,lint:tsc, andtest:unit, so local builds, CI, and Vercel deploys (which build through Turbo) all generate them;yarn devgenerates before starting Vite./examples/$slugroute rendering<Petrinaut readonly>from an in-memory read-only document handle, and an/examplesredirect to/. (Thereviewpresentation profile that hides — rather than disables — authoring controls arrives later in the stack, in FE-1500: add editor presentation profiles #9425.)example-search.ts: scenario, subnet, and canvas selection. The module is deliberately free of React and of the editor, so the canonical page, the embed page (FE-1500: Add the example embed route #9427), and the oEmbed function (FE-1500: Add oEmbed discovery and framing security #9363) all speak one contract instead of re-deriving it. Validation doubles as normalization, equality is defined as "the canonical query strings agree", and the selection vocabulary comes from@hashintel/petrinaut-core/selection..optional().catch(undefined)schemas, and the"type:id"selection encoding is a bidirectionalz.codec.navigation-search.tskeeps only the projection onto Petrinaut's navigation state. Everything the URL does not carry (mode, Simulate section, drawers) lives in page state through theuseSharedSearchNavigationhook, which keeps the full location in memory and mirrors only its shared projection to the URL, so controls driving non-shared fields never silently snap back.encode(decode(s))is a fixed point (what the embed redirect relies on), and every decodable state survives encode then decode.exampleSlugslist instead of its own copy.env: ["TEST_COVERAGE"]on thetest:unitoverride, which replaces rather than merges with the root task;sharedSearchKeysis module-private, as nothing imported it; hoisteduseSearchout of a JSX prop position; added a test asserting the truck-fleet rewrite initialises every attribute of theTruckandConditionstypes, so a field added to either fails here instead of simulating with a silent default; dropped the/examples*rewrites, now covered by the SPA fallback in FE-1500: Add Petrinaut website routing #9359.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:
turbo.json's have been updated to reflect this🛡 What tests cover this?
catalog.test.ts(every catalog entry loads, every slug has a catalog entry, every scenario has generated HIR, one cached load per example),normalize-example.test.ts(the truck-fleet rewrite fires on the real model; other slugs pass through),example-search.test.ts,example-search.property.test.ts(fast-check contract laws over generated search inputs: decoding never throws, validation is idempotent, selection survives encode then decode, the canonical string re-decodes to the same location),navigation-search.test.ts(state projection),use-shared-search-navigation.test.tsx(in-memory fields survive URL merges; only shared changes write the URL),readonly-example-handle.test.ts.❓ How to test this?
yarn workspace @apps/petrinaut-website dev./examples/gases-1-pn, select items, switch subnets, and pick a scenario.