Skip to content

FE-1500: Publish the core example models in the website catalog - #9492

Open
kube wants to merge 1 commit into
claude/petrinaut-website-navigationfrom
claude/petrinaut-core-examples-catalog
Open

FE-1500: Publish the core example models in the website catalog#9492
kube wants to merge 1 commit into
claude/petrinaut-website-navigationfrom
claude/petrinaut-core-examples-catalog

Conversation

@kube

@kube kube commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Before this PR, the website catalog held the JSON model files kept next to the code. The models Petrinaut ships in @hashintel/petrinaut-core/examples were reachable only through the editor's Load example menu, so petrinaut.org had no page to link for them.

Those models join the catalog. /examples/<slug> and /embed/examples/<slug> serve them with the same routes, loaders, generated artifacts, and oEmbed support as the JSON models.

Links

Changes

  • Catalog entries name their source

    model-file is a JSON file next to the catalog. core-example names an export of @hashintel/petrinaut-core/examples.
    The browser loader and the artifact generator resolve a definition through the source.
    The metadata module keeps no runtime import, so the oEmbed function bundle stays small.

  • Core examples get slugs, titles, and safe parameter bounds

    Slugs are deployment-pipeline, probabilistic-satellite-launcher, production-with-machine-failure, sir-epidemic-model, supply-chain-profit-model, and supply-chain-with-disruption.
    Every scenario parameter carries a min, max, and step around its default.

  • Core titles pinned to the core objects

    The oEmbed function reads titles from the metadata, so the catalog repeats each core title and a test compares the copy with the export.

Test coverage

  • catalog.test.ts:

    Every slug has an entry, every scenario parameter has bounds around its default, generated HIR exists per scenario, core titles match their export, loads are cached.

  • oembed-endpoint.test.ts, oembed-discovery.test.ts:

    Existing oEmbed behaviour, unchanged.

How to test

  • Open Petrinaut preview on Vercel
  • Open /examples/sir-epidemic-model

    Expect SIR model with its scenarios in Simulation Settings

  • Open /embed/examples/deployment-pipeline?scenario=scenario__incident_surge

    Expect deployment pipeline with Incident surge selected

@kube kube self-assigned this Sep 2, 2026
@vercel

vercel Bot commented Sep 2, 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 3, 2026 11:10pm UTC
petrinaut Ready Ready Preview Sep 3, 2026 11:10pm UTC
petrinaut-docs Ready Ready Preview Sep 3, 2026 11:10pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 3, 2026 11:10pm UTC

Request Review

@kube
kube force-pushed the claude/petrinaut-core-examples-catalog branch from f717fd7 to f477c49 Compare September 3, 2026 18:44
@kube
kube force-pushed the claude/petrinaut-core-examples-catalog branch from f477c49 to d636386 Compare September 3, 2026 19:03
@kube
kube force-pushed the claude/petrinaut-core-examples-catalog branch from d636386 to cccda61 Compare September 3, 2026 22:20
@kube
kube force-pushed the claude/petrinaut-core-examples-catalog branch from cccda61 to 6eb6e8d Compare September 3, 2026 22:27
@kube
kube marked this pull request as ready for review September 3, 2026 22:29
Copilot AI balanced review requested due to automatic review settings September 3, 2026 22:29
@cursor

cursor Bot commented Sep 3, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
User-facing catalog and loader changes with solid test coverage; no auth or data-path changes, though incorrect parameter bounds could affect embed UI ranges.

Overview
Adds six @hashintel/petrinaut-core/examples models to the public example catalog so they get the same /examples/<slug>, embed, generated HIR, and oEmbed flow as the local JSON models.

Catalog entries now declare an ExampleSource (model-file vs core-example with a typed export name). The artifact generator and loadExample resolve definitions through that source instead of assuming every slug has a JSON file under models/. Metadata in catalog-metadata.ts still has no runtime imports, so lightweight consumers like the oEmbed API only pick up new slugs, titles, and parameter bounds.

Each new slug gets simulation parameter min/max/step bounds; existing JSON-backed entries are tagged with model-file. Tests cover catalog/slug parity, bounds vs defaults, and core catalog titles matching the core export (for oEmbed copy).

Reviewed by Cursor Bugbot for commit 599aa46. 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.

🟢 Approval recommended

The reviewed changes have no unresolved approval-blocking issues.

Pull request overview

Publishes six Petrinaut core examples through the website catalog and embed routes.

Changes:

  • Adds source-aware catalog metadata and core example entries.
  • Loads core definitions and generates their HIR artifacts.
  • Tests loading, bounds, titles, artifacts, and caching.
File summaries
File Description
apps/petrinaut-website/src/examples/catalog.ts Loads definitions according to their catalog source.
apps/petrinaut-website/src/examples/catalog.test.ts Tests core titles and catalog behavior.
apps/petrinaut-website/src/examples/catalog-metadata.ts Defines sources, core metadata, and parameter bounds.
apps/petrinaut-website/scripts/generate-example-artifacts.ts Generates artifacts from JSON files or core exports.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

@kube
kube force-pushed the claude/petrinaut-core-examples-catalog branch from 6eb6e8d to 599aa46 Compare September 3, 2026 22:52
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.

3 participants