Skip to content

FE-1883: Resolve legacy entity IDs and display names - #9959

Merged
kube merged 21 commits into
mainfrom
claude/resolve-legacy-entity-ids
Oct 9, 2026
Merged

kube merged 21 commits into
mainfrom
claude/resolve-legacy-entity-ids

Conversation

@kube

@kube kube commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Before this PR, a link that named an item or scenario by an id from before UUID conversion opened the default view: the editor dropped the selection and the Simulate drawer, and the scenario fell back to the first one. Actual mode events, Brunch removal approvals and Brunch draft experiments showed raw ids, which are now UUIDs.

This PR resolves older ids in a location to their converted ids and replaces the location once, so old links and published embeds open the same item. Events, approvals and draft experiments show names. Router integration and oEmbed docs describe how older ids resolve.

Links

Changes

Petrinaut

  • Selection and Simulate resources in a location resolve by id as written, then by converted id

    Ids as written win, since a custom handle may keep ids it never converted.
    Arc ids convert with canonicalizeArcId.
    Items the net lacks in either form are dropped.

  • Editor writes the resolved location back once

    Navigation carries cause normalization.
    Items found as written keep their identity, so an unchanged location causes no navigation.

  • Requested scenario resolves the same way

    An older ?scenario= link opens that scenario instead of the first one.

  • Actual mode events show transition and place names

    An unnamed transition or place shows its id.

Website

  • Brunch removal approvals name the items they remove

    The card reads names from the editor instance through usePetrinautInstance, subnets included.
    An unnamed or missing item shows its id.

  • Arc rows name both ends

    Place and component port ends parse from the arc endpoint key. Transition ends show the transition's name.

  • Brunch draft experiments name the metric that reports an unsupported condition

Review fixes

  • Arc ids in links always convert

    The editor reads every generated arc id as an arc, so arcs skip the as-written check.

  • Older link ids resolve during render

    The editor view's selection cleanup runs before the provider's effect and dropped them.

Test coverage

  • resolve-navigated-ids.test.ts:

    Ids resolve as written or converted, arcs included. Items found as written keep identity, missing ones drop, and experiments pass through.

  • editor-provider.test.tsx:

    An older link's scenario and place reopen with one replace navigation, with selection cleanup mounted.

  • provider.test.ts:

    An older scenario id resolves to its converted id.

  • actual-events.test.tsx:

    Events show names, and an unnamed place shows its id.

  • brunch-mutation-approval.test.tsx:

    Rows name a place and both arc ends, and a missing item shows its id.

  • brunch-draft-experiment-interactive-tool.test.tsx:

    Reporting metric shows its name.

  • Existing Petrinaut and website unit and integration suites

How to test

  • Open Petrinaut preview on Vercel
  • Menu > Load example > SIR Epidemic Model
  • Select Infected place
  • Copy URL
  • Set itemId to older id place__infected
  • Open edited URL

    Expect Infected selected and URL showing its UUID

@kube kube self-assigned this Oct 7, 2026
@vercel

vercel Bot commented Oct 7, 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 Oct 8, 2026 6:46pm UTC
petrinaut Ready Ready Preview Oct 8, 2026 6:46pm UTC
petrinaut-docs Ready Ready Preview Oct 8, 2026 6:46pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 8, 2026 6:46pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/apps labels Oct 7, 2026
@kube
kube added this pull request to stack #9937 October 7, 2026 00:07
@kube
kube force-pushed the claude/resolve-legacy-entity-ids branch from ca85998 to 788ed81 Compare October 7, 2026 01:53
@kube
kube force-pushed the claude/resolve-legacy-entity-ids branch from 788ed81 to c65a331 Compare October 7, 2026 03:07
@kube kube changed the title Resolve older entity ids in links and show names for UUID ids FE-1883: Resolve older entity ids in links and show names for UUID ids Oct 7, 2026
@kube
kube force-pushed the claude/resolve-legacy-entity-ids branch from c65a331 to 141bf77 Compare October 7, 2026 03:35
@kube
kube marked this pull request as ready for review October 7, 2026 03:36
@kube
kube requested a review from a team as a code owner October 7, 2026 03:36
@cursor

cursor Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Navigation normalization touches deep-linking, selection, and simulate routing across the editor; behavior is well-tested but incorrect resolution could mis-open scenarios or selections.

Overview
Legacy deep links and embeds now map pre-UUID ids to the document’s converted ids instead of dropping selection or defaulting simulate state. New resolveNavigatedId / resolveNavigatedItems try ids as written first, then toPetrinautId (arcs via canonicalizeArcId), and drop items that still don’t exist. The editor resolves during render and replaces the URL once (normalization); simulation scenario selection uses the same resolution so older ?scenario= links open the intended scenario.

Human-readable labels replace raw UUIDs in several UIs: Actual mode Events shows transition and place names (id when unnamed); Brunch destructive-edit approval lists removals by document names, including arc endpoints as A → B; draft experiment cards show the reporting metric’s name via exported nameOfMetric.

Docs for Actual mode, router integration, and oEmbed note legacy id resolution.

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

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

CiaranMn
CiaranMn previously approved these changes Oct 8, 2026
kube added 21 commits October 8, 2026 18:42

This branch was successfully deployed

3 active deployments
Preview – petrinaut-docs — 3d714667 Deployed Oct 8, 2026 by vercel[bot]
Preview – hash — 3d714667 Deployed Oct 8, 2026 by vercel[bot]
Preview – petrinaut — 3d714667 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/apps area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

4 participants