Skip to content

FE-1509: Add the notebook's whole-net graph explorer - #9408

Open
kube wants to merge 1 commit into
claude/fe-1509-notebook-cellsfrom
claude/fe-1509-notebook-explorer
Open

FE-1509: Add the notebook's whole-net graph explorer#9408
kube wants to merge 1 commit into
claude/fe-1509-notebook-cellsfrom
claude/fe-1509-notebook-explorer

Conversation

@kube

@kube kube commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

Third layer of the Notebook view stack, stacked on #9407: the whole-net graph explorer on the right of the notebook, with cycle and initial-place markers, selection highlighting, and an animated focus mode.

🔗 Related links

🔍 What does this change?

  • A resizable right-hand pane drawing the whole net as a layered flow graph of places (pills, with their token type's colour dot) and transitions (boxes), laid out from the arc structure alone — canvas positions are ignored.
  • Selecting a place or transition highlights its dependencies (blue), dependents (orange), and both-direction neighbours (purple); clicking a node selects its cell, revealing its kind in the list if a filter hides it. Cycle members carry tinted dashed rings that light up together on hover, and places needing initial tokens carry a hollow token marker.
  • A focus mode re-layers the graph around the selection by hop distance; unreachable components keep their own layered band below. Re-layouts animate FLIP-style: React renders the target once and a write-only requestAnimationFrame loop interpolates node transforms and edge paths before paint, honouring prefers-reduced-motion and the animations setting.
  • The notebook is one horizontal worksheet flow (FocusStack): the cell list and the connection lists are sibling members, so ArrowLeft at the lists' edge crosses back into the cell list at its remembered row. The connection lists form a single-column useFocusGrid — vertical arrows walk every row across both sections, the pair is one roving tab stop — remounted per selection so the focus memory never points at a vanished row.
  • Below the graph, the selected cell's dependencies and dependents are listed across all five kinds, with a draggable split between graph and lists.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing
    • one patch changeset for the whole stack ships in the top PR

📜 Does this require a change to the docs?

The changes in this PR:

  • are in a state where docs changes are not yet required but will be
    • this is tracked in: the user-docs PR at the top of this stack

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

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • In focus mode the topological cell order keeps following the default layout; focus is a transient lens on the same net.
  • The siphon analysis drops groups overlapping an already-reported one, so an overlapping genuine siphon can go unmarked.

🛡 What tests cover this?

net-graph-animation.test.ts covers the interpolation and layout-signature helpers; the layered and focused layouts are covered by net-graph-layout.test.ts in the layer below. The animation timing and hover behaviour are exercised manually.

❓ How to test this?

  1. In the notebook (flag on, see the PR below), select places and transitions and check the graph highlighting and the lists under it.
  2. Hover a badge in the list or a ringed node in the graph; the whole cycle should light up in both.
  3. Toggle the bullseye focus button and watch the animated re-layout; toggle it back.
  4. Drag the explorer's left edge and the divider above the lists.

📹 Demo

Screenshot pending — to be added before review.

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

vercel Bot commented Aug 28, 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 30, 2026 5:03am
petrinaut Ready Ready Preview Aug 30, 2026 5:03am
petrinaut-docs Ready Ready Preview Aug 30, 2026 5:03am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 30, 2026 5:03am

Request Review

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team labels Aug 28, 2026
@kube
kube force-pushed the claude/fe-1509-notebook-explorer branch from c71e5ae to 8982115 Compare August 28, 2026 18:34
@kube
kube force-pushed the claude/fe-1509-notebook-explorer branch from 8982115 to 55fb649 Compare August 28, 2026 18:44
@kube
kube force-pushed the claude/fe-1509-notebook-explorer branch from 55fb649 to 5ce2a16 Compare August 28, 2026 19:13
@kube
kube force-pushed the claude/fe-1509-notebook-explorer branch from 5ce2a16 to 0e5ac33 Compare August 28, 2026 19:50
@kube
kube force-pushed the claude/fe-1509-notebook-explorer branch 2 times, most recently from b76cc7f to 1cb574e Compare August 28, 2026 21:04
@cursor

cursor Bot commented Aug 29, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Notebook UI-only feature behind the experimental view; no auth, persistence, or execution-path changes.

Overview
Adds a resizable right-hand graph explorer to the experimental Notebook view: a layered SVG of the full net (arc-based layout, not canvas coordinates) plus upstream/downstream connection lists for the selected cell.

Selection and navigation tie the explorer to editor selection: places/transitions get blue/orange/purple highlighting for dependencies, dependents, and bidirectional neighbours; clicking graph nodes or list rows selects the matching cell and can reveal filtered-out kinds. Optional focus mode re-layers the diagram around the selected place or transition.

Layout transitions use a new useNetGraphTransition hook that animates node transforms and edge paths via requestAnimationFrame (honouring user animation settings and prefers-reduced-motion), with unit tests for easing/interpolation helpers.

Keyboard focus wraps the notebook in a horizontal FocusStack so the cell list and explorer connection lists share one worksheet flow; list focus resets per selection via remounting.

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

@kube
kube requested review from CiaranMn and YannisZa August 29, 2026 02:30
Comment thread libs/@hashintel/petrinaut/src/ui/views/Notebook/net-graph.tsx
minSize={MIN_LISTS_HEIGHT}
maxSize={MAX_LISTS_HEIGHT}
label="Resize the connection lists"
/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lists resize handle scrolls away

Medium Severity

The connection-lists pane is both the overflowY: auto scroller and the positioned parent of the top ResizeHandle. Absolute children of a scroll box move with the content, so a long list takes the divider off-screen and overflow can clip the handle sitting at a negative top.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 35f33ad. Configure here.

A resizable right-hand pane drawing the whole net as a layered flow
graph of places and transitions, laid out from the arc structure
alone. Selection highlights dependencies, dependents, and
both-direction neighbours; a focus mode re-layers the graph around the
selection by hop distance, animated FLIP-style by a write-only
requestAnimationFrame loop that runs before paint.

The explorer joins the worksheet focus flow: its connection lists are
a single-column grid (one roving tab stop, remounted per selection),
and a horizontal move at their edge crosses back into the cell list at
its remembered row. Explorer navigation can reveal a filtered-out
kind, so row focus gains a one-shot retry that runs after the reveal
renders.

@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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit eb454db. Configure here.

}
};

frameHandle.current = requestAnimationFrame(drawFrame);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graph animation flashes final layout

Medium Severity

The FLIP invert never lands before paint. useLayoutEffect exists so the first node offset and edge path can be written before the browser paints the target layout, but the first drawFrame is only scheduled with requestAnimationFrame, which runs after that paint. React has already committed nodes at their final x/y and edges at the target d, so a focus-mode toggle flashes the finished graph, then jumps back and plays the move. Because layoutNetGraph returns a new object every render and the effect depends on that object, any notebook re-render mid-flight also cancels the frame and restarts the 340ms clock, snapping edges to the target path again.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit eb454db. Configure here.

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

Labels

area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant