Skip to content

FE-1056: Move the handle integration guide into the architecture docs - #8926

Draft
kube wants to merge 5 commits into
mainfrom
petrinaut-sdcpn-input
Draft

FE-1056: Move the handle integration guide into the architecture docs#8926
kube wants to merge 5 commits into
mainfrom
petrinaut-sdcpn-input

Conversation

@kube

@kube kube commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

Gives a host application a documented path to implementing its own PetrinautDocHandle, which is what TOPOS needs to embed Petrinaut in CatCollab (FE-1056). The integration guide moves into the Petrinaut architecture docs, where the build checks its links and layer references. On the code side, SDCPNInput lets hosts author documents without spelling out every extension field.

🔗 Related links

🔍 What does this change?

@hashintel/petrinaut-core

  • New types/sdcpn-input.ts: SDCPNInput is a loose authoring variant of SDCPN, and normalizeSDCPN() fills plain-net defaults. Arcs accept the placeId shorthand or an explicit endpoint (including component ports); subnets, componentInstances, and place isPort pass through. A complete SDCPN remains a valid SDCPNInput, asserted at compile time in the test.
  • createJsonDocHandle accepts SDCPNInput and normalizes internally.
  • Both are exported from the package root; changeset included (patch).

Architecture docs (@local/petrinaut-arch-docs)

  • content/handle/host-integration.mdx, attached to the core.handle layer: the contract, a per-member table of what the editor does with each handle member, the invariants a custom handle must keep (synchronous atomic change(), referentially stable doc(), emit-per-change, stable id), the model-mapping recipe, a worked adapter, the <Petrinaut /> prop table, and capabilities (now five extensions, including subnets). Two diagrams: a sequence of the local/remote event flows and a pipeline of the adapter's write paths.
  • content/handle/contract-gaps.mdx: where the contract under-specifies or misbehaves today (implicit invariants, readiness and lifecycle, local vs remote changes, validation and versioning, history under collaboration), each with the enhancement it calls for, and a sequencing note. Every claim was checked against the current code.
  • Both pages are linked from the docs index and appear under the core.handle layer's Guides section.

Removals

  • libs/@hashintel/petrinaut/INTEGRATION.md is deleted; its content was rewritten into the two pages above. The package READMEs keep a short embedding section and link to the new guide.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)
    • @hashintel/petrinaut-core: patch. The @hashintel/petrinaut change is README and files only, no changeset.

📜 Does this require a change to the docs?

The changes in this PR:

  • require changes to docs which are made as part of this PR

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • The handle interface is experimental. The contract-gaps page documents its current weaknesses; this PR does not fix them.

🐾 Next steps

The enhancements listed in contract-gaps.mdx, cheapest first: TSDoc for the implicit invariants plus a conformance test kit for third-party handles, an error channel and specified readiness semantics, validation shared between file import and handle construction, then local/remote and history semantics alongside the first collaborative backend.

🛡 What tests cover this?

  • types/sdcpn-input.test.ts: default filling, endpoint and subnet passthrough, absent-key preservation for structural equality, idempotence on a complete document, and the compile-time SDCPN-to-SDCPNInput assignability assertion.
  • lint:arch-docs fails the build on unresolved doc:/layer: links, unknown attachTo targets, and missing @diagrams/ components in the new pages.

❓ How to test this?

  1. turbo run test:unit --filter @hashintel/petrinaut-core
  2. yarn workspace @local/petrinaut-arch-docs lint:arch-docs
  3. turbo run dev --filter @apps/petrinaut-docs, then open Architecture → core → handle: both guides appear under "Guides", with the diagrams rendered.

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 16, 2026 3:11am
petrinaut Ready Ready Preview Aug 16, 2026 3:11am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 16, 2026 3:11am

@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 labels Jul 1, 2026
@semgrep-code-hashintel

Copy link
Copy Markdown

Semgrep found 4 path-join-resolve-traversal findings:

Detected possible user input going into a path.join or path.resolve function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first.

View Dataflow Graph
flowchart LR
    classDef invis fill:white, stroke: none
    classDef default fill:#e7f5ff, color:#1c7fd6, stroke: none

    subgraph File0["<b>.claude/setup.mjs</b>"]
        direction LR
        %% Source

        subgraph Source
            direction LR

            v0["<a href=https://github.com/hashintel/hash/blob/3c80fef937ed2cd8869428222504b8915ebc22eb/.claude/setup.mjs#L226 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 226] _0x2912ea</a>"]
        end
        %% Intermediate

        subgraph Traces0[Traces]
            direction TB

            v2["<a href=https://github.com/hashintel/hash/blob/3c80fef937ed2cd8869428222504b8915ebc22eb/.claude/setup.mjs#L226 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 226] _0x2912ea</a>"]
        end
        %% Sink

        subgraph Sink
            direction LR

            v1["<a href=https://github.com/hashintel/hash/blob/3c80fef937ed2cd8869428222504b8915ebc22eb/.claude/setup.mjs#L257 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 257] _0x2912ea</a>"]
        end
    end
    %% Class Assignment
    Source:::invis
    Sink:::invis

    Traces0:::invis
    File0:::invis

    %% Connections

    Source --> Traces0
    Traces0 --> Sink

Loading

@vercel
vercel Bot temporarily deployed to Preview – petrinaut August 4, 2026 10:35 Inactive
@TimDiekmann
TimDiekmann force-pushed the petrinaut-sdcpn-input branch from 3c80fef to 52ee22d Compare August 4, 2026 14:13
@kube
kube force-pushed the petrinaut-sdcpn-input branch from 52ee22d to 00a0fb7 Compare August 16, 2026 02:58
@github-actions github-actions Bot added the type/eng > backend Owned by the @backend team label Aug 16, 2026
@kube kube changed the title FE-1056: Improve Petrinaut Handle + Integration Docs FE-1056: Move the handle integration guide into the architecture docs Aug 16, 2026
@kube kube self-assigned this Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) 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.

1 participant