Skip to content

WIP: assert registration-identity invariants in node state registration - #14405

Closed
mattmillerai wants to merge 9 commits into
matt/be-5050-node-shell-statefrom
matt/be-5048-registration-identity-asserts
Closed

mattmillerai wants to merge 9 commits into
matt/be-5050-node-shell-statefrom
matt/be-5048-registration-identity-asserts

Conversation

@mattmillerai

Copy link
Copy Markdown
Member

STACKED — merging lands on matt/be-5050-node-shell-state (owned by mattmillerai, PR #14257), NOT main. #14257 extracts the registration lifecycle out of LGraphNode.ts into src/core/graph/nodeShell/, which is exactly the code this PR asserts in, so this is stacked on it rather than reimplementing against the pre-move layout. It retargets to feature/ecs-migration automatically once #14257 merges. Ultimate base is feature/ecs-migration, not main — none of this code exists on main.

ELI-5

The node data store is a bag of node states. Three ways a node could quietly go wrong: it could get put in a second bag while its old bag still holds it, it could be taken out with the wrong hand so the bag keeps the old copy, or two copies of the same node could sit in one bag. Nobody noticed any of these when they happened — the screen just drew a node that should not be there. Now each one shouts.

Summary

Turn three silent failure modes in the node-data-store registration lifecycle into assertions, so a regression surfaces at its cause rather than as a ghost node the renderer keeps drawing.

Changes

  • What:
    • registerNodeState asserts the node is not already registered under a different root graph. It overwrote node._graphId unconditionally, and because bucket membership is by state identity, nothing would ever remove the stranded entry from the old bucket.
    • unregisterNodeState captures deleteNode's boolean and asserts it. false means the bucket did not contain node._state — identity drift, e.g. _state reassigned after registration — leaving a state the renderer keeps drawing. _graphId is cleared before the assert so the DEV throw still detaches the node instead of re-throwing on every later attempt.
    • nodeDataStore.registerNode asserts that no different state is already registered for the same (id, graphId). Buckets are identity-keyed Sets, so duplicates coexist instead of overwriting. Per docs/architecture/node-data-store.md this uniqueness is guaranteed upstream by subgraphDeduplication.ts; the assert catches regressions of that guarantee.
  • Breaking: none. assert throws in DEV and reports via the registered reporter otherwise, so production behaviour is unchanged.

Review Focus

Why the store needs an index rather than a scan. Scanning the bucket per registration is O(n²) over a graph load, so each bucket carries a plain Map<string, NodeState> keyed `${graphId}:${id}`, plus a Map<NodeState, string> reverse map. The reverse map exists because LGraphNode.id can change after registration — the store's own doc calls out that "renumbering a registered node cannot strand its entry" precisely because membership is identity-based — so deleteNode must remove the index entry by state identity, not by recomputing the key from possibly-renumbered fields. Covered by unregisters a state that was renumbered after registration.

The same renumbering leaves a stale forward entry pointing at a state whose id has moved on. claimantRenumbered treats that slot as vacant rather than a duplicate, so a later node legitimately taking the freed id does not trip a false assert (frees the id a renumbered state vacated).

Why idempotent re-registration must not assert. registerNodeState re-wraps via reactive(), which returns the cached proxy, so re-registering the same state is an existing legitimate path (see the unregister→register sequences in useNodeReplacement.ts). claimant === raw — compared after toRaw, matching how the reactive Set itself compares — permits it. Covered by accepts a state re-registering itself and tolerates re-registration under the same root graph.

The index is deliberately outside the reactive graph: no consumer reads it, it is only asserted against, so making it reactive would add tracking cost to every registration for nothing.

Tests

Added to src/stores/nodeDataStore.test.ts and src/core/graph/nodeShell/nodeShellState.test.ts (the file #14257 moved the LGraphNode.nodeState.test.ts lifecycle cases into): cross-root re-registration asserts, unregister after _state reassignment asserts, duplicate (id, graphId) distinct-state registration asserts, idempotent same-state re-registration does not assert, same id in a different owning graph does not assert, register→renumber→unregister stays clean, and clearGraph drops the index with the bucket.

Because assert throws in DEV, the existing suite is the false-positive net: pnpm test:unit and pnpm typecheck were run in full.

DrJKL and others added 9 commits July 28, 2026 19:30
Collapses the twelve reviewed slices of the ECS migration into one
commit so the series can be replayed onto main as a unit. Each slice
kept its own review on GitHub:

- ECS: Moving widgets out of the Node data (#13322)
- ECS: Link topology store (single source of truth for link data) (#13436)
- ECS: Reroute chain store with derived link membership (#13449)
- ECS: derive slot floating links; reroute cleanup follow-ups (#13451)
- refactor: read widgeted-input connectivity from linkStore (#13455)
- feat: nodeBadgeStore + badge system (slice A) (#13458)
- refactor: derive badge rows on read, delete the badge store (#13686)
- refactor: host-scoped promoted widget rows (no source traversal) (#13434)
- refactor!: delete the output.links runtime mirror (#13479)
- refactor!: delete the input.link runtime mirror (#13498)
- fix: ECS stack audit fixes (#13528)
- refactor!: make nodeDataStore the source of truth for node shell state (#13963)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`LGraph.clear()` fires `node:before-removed` and `onNodeRemoved`, but not
`node:removed` — only `LGraph.remove()` dispatches that. The error-clearing
hooks listened for `node:removed`, so clearing or switching a workflow left
missing model/media/node errors in their stores and the run button kept the
warning triangle on an empty canvas.

Reverts the automated expectation update that captured that triangle as the
new baseline; the goldens are regenerated once the fix is in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The previous revert rolled these back to the captures taken in the ECS
squash commit, which predate #14177 and so lack both the run-button
warning icon and the graph-toolbar button. Take main's versions as the
baseline instead, leaving only genuinely branch-caused differences for
the regeneration to pick up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
registerNodeState overwrote node._graphId unconditionally, so a node
re-registered under a second root graph stranded its entry in the old
bucket (membership is by state identity; nothing removes it).
unregisterNodeState discarded deleteNode's boolean, so a _state
reassigned after registration left a ghost NodeState the renderer keeps
drawing. Both now assert.

_graphId is cleared before the unregister assert so the DEV throw still
detaches the node rather than re-throwing on every later attempt.
…Shell

Move the app-owned node shell-state lifecycle coordination out of the
litegraph folder into an app-layer module, leaving thin call sites in
litegraph. No behaviour change.

- createNodeShellState / setTrackedNodeState / registerNodeState /
  unregisterNodeState / unregisterAllNodeStates now live in
  src/core/graph/nodeShell/nodeShellState.ts
- attachNodeToStores / releaseGraphStores in nodeShellLifecycle.ts are the
  single calls LGraph.add and LGraph.clear make into the app stores
- LGraphNode no longer imports useNodeDataStore
- the litegraph barrel no longer re-exports the registration functions
The registration functions this branch asserts on moved from LGraphNode.ts
into src/core/graph/nodeShell/. Resolve by taking the extracted layout; the
asserts are re-applied in their new home in the next commit.
Three silent failure modes in the node-data-store registration lifecycle
now fail loudly instead of leaving state the renderer keeps drawing.

registerNodeState overwrote node._graphId unconditionally, so a node
re-registered under a second root graph stranded its entry in the old
bucket (membership is by state identity; nothing removes it).
unregisterNodeState discarded deleteNode's boolean, so a _state
reassigned after registration left a ghost NodeState behind. Both now
assert. _graphId is cleared before the unregister assert so the DEV throw
still detaches the node rather than re-throwing on every later attempt.

nodeDataStore buckets are identity-keyed Sets, so two distinct states for
one (id, graphId) coexist rather than overwriting. registerNode now
asserts against a per-bucket index instead of scanning the Set, which
would be quadratic over a graph load. The index records the key each
state was registered under, so a node renumbered after registration still
unregisters cleanly and frees the id it vacated.
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8c031724-c603-471d-a21a-71979a4a80da

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@mattmillerai mattmillerai added the agent-coded Opened by the agent-work code loop label Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 07/30/2026, 06:30:06 PM UTC

Links

🎭 Playwright: ✅ 1757 passed, 0 failed · 2 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1736 / ❌ 0 / ⚠️ 2 / ⏭️ 5)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

📦 Bundle Size

⏳ Size data collection in progress…

⚡ Performance Report

canvas-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 57.2 MB heap
canvas-mouse-sweep: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 58.6 MB heap
canvas-zoom-sweep: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 73.3 MB heap
dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 55.6 MB heap
large-graph-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 68.9 MB heap
large-graph-pan: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 61.7 MB heap
large-graph-zoom: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 74.1 MB heap
minimap-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 65.7 MB heap
subgraph-dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 55.1 MB heap
subgraph-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 57.1 MB heap
subgraph-mouse-sweep: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 54.1 MB heap
subgraph-transition-enter: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 100ms TBT · 80.6 MB heap
viewport-pan-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 67.4 MB heap
vue-large-graph-idle: · 59.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 157.9 MB heap
vue-large-graph-pan: · 59.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 14ms TBT · 163.5 MB heap
workflow-execution: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 49.3 MB heap

ℹ️ No baseline found — significance unavailable.

Absolute values
Metric Value
canvas-idle: avg frame time 17ms
canvas-idle: p95 frame time 17ms
canvas-idle: layout duration 0ms
canvas-idle: style recalc duration 5ms
canvas-idle: layout count 0
canvas-idle: style recalc count 12
canvas-idle: task duration 341ms
canvas-idle: script duration 14ms
canvas-idle: TBT 0ms
canvas-idle: heap used 57.2 MB
canvas-idle: DOM nodes 23
canvas-idle: event listeners 6
canvas-mouse-sweep: avg frame time 17ms
canvas-mouse-sweep: p95 frame time 17ms
canvas-mouse-sweep: layout duration 2ms
canvas-mouse-sweep: style recalc duration 20ms
canvas-mouse-sweep: layout count 12
canvas-mouse-sweep: style recalc count 73
canvas-mouse-sweep: task duration 549ms
canvas-mouse-sweep: script duration 87ms
canvas-mouse-sweep: TBT 0ms
canvas-mouse-sweep: heap used 58.6 MB
canvas-mouse-sweep: DOM nodes -107
canvas-mouse-sweep: event listeners -73
canvas-zoom-sweep: avg frame time 17ms
canvas-zoom-sweep: p95 frame time 17ms
canvas-zoom-sweep: layout duration 1ms
canvas-zoom-sweep: style recalc duration 10ms
canvas-zoom-sweep: layout count 6
canvas-zoom-sweep: style recalc count 31
canvas-zoom-sweep: task duration 252ms
canvas-zoom-sweep: script duration 14ms
canvas-zoom-sweep: TBT 0ms
canvas-zoom-sweep: heap used 73.3 MB
canvas-zoom-sweep: DOM nodes 79
canvas-zoom-sweep: event listeners 19
dom-widget-clipping: avg frame time 17ms
dom-widget-clipping: p95 frame time 17ms
dom-widget-clipping: layout duration 0ms
dom-widget-clipping: style recalc duration 5ms
dom-widget-clipping: layout count 0
dom-widget-clipping: style recalc count 13
dom-widget-clipping: task duration 245ms
dom-widget-clipping: script duration 44ms
dom-widget-clipping: TBT 0ms
dom-widget-clipping: heap used 55.6 MB
dom-widget-clipping: DOM nodes 22
dom-widget-clipping: event listeners 2
large-graph-idle: avg frame time 17ms
large-graph-idle: p95 frame time 17ms
large-graph-idle: layout duration 0ms
large-graph-idle: style recalc duration 5ms
large-graph-idle: layout count 0
large-graph-idle: style recalc count 11
large-graph-idle: task duration 540ms
large-graph-idle: script duration 137ms
large-graph-idle: TBT 0ms
large-graph-idle: heap used 68.9 MB
large-graph-idle: DOM nodes -274
large-graph-idle: event listeners -147
large-graph-pan: avg frame time 17ms
large-graph-pan: p95 frame time 17ms
large-graph-pan: layout duration 0ms
large-graph-pan: style recalc duration 10ms
large-graph-pan: layout count 0
large-graph-pan: style recalc count 70
large-graph-pan: task duration 1231ms
large-graph-pan: script duration 617ms
large-graph-pan: TBT 0ms
large-graph-pan: heap used 61.7 MB
large-graph-pan: DOM nodes -273
large-graph-pan: event listeners -147
large-graph-zoom: avg frame time 17ms
large-graph-zoom: p95 frame time 17ms
large-graph-zoom: layout duration 6ms
large-graph-zoom: style recalc duration 11ms
large-graph-zoom: layout count 60
large-graph-zoom: style recalc count 67
large-graph-zoom: task duration 1305ms
large-graph-zoom: script duration 630ms
large-graph-zoom: TBT 0ms
large-graph-zoom: heap used 74.1 MB
large-graph-zoom: DOM nodes -131
large-graph-zoom: event listeners -71
minimap-idle: avg frame time 17ms
minimap-idle: p95 frame time 17ms
minimap-idle: layout duration 0ms
minimap-idle: style recalc duration 5ms
minimap-idle: layout count 0
minimap-idle: style recalc count 10
minimap-idle: task duration 526ms
minimap-idle: script duration 132ms
minimap-idle: TBT 0ms
minimap-idle: heap used 65.7 MB
minimap-idle: DOM nodes -273
minimap-idle: event listeners -147
subgraph-dom-widget-clipping: avg frame time 17ms
subgraph-dom-widget-clipping: p95 frame time 17ms
subgraph-dom-widget-clipping: layout duration 0ms
subgraph-dom-widget-clipping: style recalc duration 7ms
subgraph-dom-widget-clipping: layout count 0
subgraph-dom-widget-clipping: style recalc count 49
subgraph-dom-widget-clipping: task duration 266ms
subgraph-dom-widget-clipping: script duration 78ms
subgraph-dom-widget-clipping: TBT 0ms
subgraph-dom-widget-clipping: heap used 55.1 MB
subgraph-dom-widget-clipping: DOM nodes 24
subgraph-dom-widget-clipping: event listeners 8
subgraph-idle: avg frame time 17ms
subgraph-idle: p95 frame time 17ms
subgraph-idle: layout duration 0ms
subgraph-idle: style recalc duration 5ms
subgraph-idle: layout count 0
subgraph-idle: style recalc count 11
subgraph-idle: task duration 328ms
subgraph-idle: script duration 10ms
subgraph-idle: TBT 0ms
subgraph-idle: heap used 57.1 MB
subgraph-idle: DOM nodes -125
subgraph-idle: event listeners -72
subgraph-mouse-sweep: avg frame time 17ms
subgraph-mouse-sweep: p95 frame time 17ms
subgraph-mouse-sweep: layout duration 3ms
subgraph-mouse-sweep: style recalc duration 23ms
subgraph-mouse-sweep: layout count 16
subgraph-mouse-sweep: style recalc count 76
subgraph-mouse-sweep: task duration 545ms
subgraph-mouse-sweep: script duration 65ms
subgraph-mouse-sweep: TBT 0ms
subgraph-mouse-sweep: heap used 54.1 MB
subgraph-mouse-sweep: DOM nodes -105
subgraph-mouse-sweep: event listeners -73
subgraph-transition-enter: avg frame time 17ms
subgraph-transition-enter: p95 frame time 17ms
subgraph-transition-enter: layout duration 7ms
subgraph-transition-enter: style recalc duration 19ms
subgraph-transition-enter: layout count 7
subgraph-transition-enter: style recalc count 10
subgraph-transition-enter: task duration 629ms
subgraph-transition-enter: script duration 23ms
subgraph-transition-enter: TBT 100ms
subgraph-transition-enter: heap used 80.6 MB
subgraph-transition-enter: DOM nodes 13671
subgraph-transition-enter: event listeners 2381
viewport-pan-sweep: avg frame time 17ms
viewport-pan-sweep: p95 frame time 17ms
viewport-pan-sweep: layout duration 0ms
viewport-pan-sweep: style recalc duration 23ms
viewport-pan-sweep: layout count 0
viewport-pan-sweep: style recalc count 250
viewport-pan-sweep: task duration 3839ms
viewport-pan-sweep: script duration 1860ms
viewport-pan-sweep: TBT 0ms
viewport-pan-sweep: heap used 67.4 MB
viewport-pan-sweep: DOM nodes -273
viewport-pan-sweep: event listeners -130
vue-large-graph-idle: avg frame time 17ms
vue-large-graph-idle: p95 frame time 17ms
vue-large-graph-idle: layout duration 0ms
vue-large-graph-idle: style recalc duration 0ms
vue-large-graph-idle: layout count 0
vue-large-graph-idle: style recalc count 0
vue-large-graph-idle: task duration 9675ms
vue-large-graph-idle: script duration 551ms
vue-large-graph-idle: TBT 0ms
vue-large-graph-idle: heap used 157.9 MB
vue-large-graph-idle: DOM nodes -6548
vue-large-graph-idle: event listeners -7474
vue-large-graph-pan: avg frame time 17ms
vue-large-graph-pan: p95 frame time 17ms
vue-large-graph-pan: layout duration 0ms
vue-large-graph-pan: style recalc duration 13ms
vue-large-graph-pan: layout count 0
vue-large-graph-pan: style recalc count 66
vue-large-graph-pan: task duration 12567ms
vue-large-graph-pan: script duration 982ms
vue-large-graph-pan: TBT 14ms
vue-large-graph-pan: heap used 163.5 MB
vue-large-graph-pan: DOM nodes -6548
vue-large-graph-pan: event listeners -7472
workflow-execution: avg frame time 17ms
workflow-execution: p95 frame time 17ms
workflow-execution: layout duration 0ms
workflow-execution: style recalc duration 12ms
workflow-execution: layout count 2
workflow-execution: style recalc count 15
workflow-execution: task duration 86ms
workflow-execution: script duration 7ms
workflow-execution: TBT 0ms
workflow-execution: heap used 49.3 MB
workflow-execution: DOM nodes 127
workflow-execution: event listeners 67
Raw data
{
  "timestamp": "2026-07-30T18:38:49.902Z",
  "gitSha": "26e8009b424208d0b4af74dec464afd9e5464f2f",
  "branch": "matt/be-5048-registration-identity-asserts",
  "measurements": [
    {
      "name": "canvas-idle",
      "durationMs": 2017.721999999992,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 5.4079999999999995,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 376.241,
      "heapDeltaBytes": -22696128,
      "heapUsedBytes": 46214692,
      "domNodes": 22,
      "jsHeapTotalBytes": 19128320,
      "scriptDurationMs": 14.077000000000002,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.670000000000012,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "canvas-idle",
      "durationMs": 2003.3619999999246,
      "styleRecalcs": 12,
      "styleRecalcDurationMs": 5.153,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 306.70799999999997,
      "heapDeltaBytes": 4542520,
      "heapUsedBytes": 73731960,
      "domNodes": 24,
      "jsHeapTotalBytes": 19525632,
      "scriptDurationMs": 12.967999999999998,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1688.5780000000068,
      "styleRecalcs": 74,
      "styleRecalcDurationMs": 19.629,
      "layouts": 12,
      "layoutDurationMs": 1.9989999999999999,
      "taskDurationMs": 528.601,
      "heapDeltaBytes": 1824236,
      "heapUsedBytes": 70872968,
      "domNodes": 58,
      "jsHeapTotalBytes": 20312064,
      "scriptDurationMs": 87.617,
      "eventListeners": 4,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1718.0969999999434,
      "styleRecalcs": 72,
      "styleRecalcDurationMs": 19.386999999999997,
      "layouts": 12,
      "layoutDurationMs": 2.0709999999999997,
      "taskDurationMs": 568.554,
      "heapDeltaBytes": -17185272,
      "heapUsedBytes": 51950640,
      "domNodes": -271,
      "jsHeapTotalBytes": 19390464,
      "scriptDurationMs": 86.97399999999999,
      "eventListeners": -150,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1708.3630000000198,
      "styleRecalcs": 32,
      "styleRecalcDurationMs": 10.973,
      "layouts": 6,
      "layoutDurationMs": 0.608,
      "taskDurationMs": 260.163,
      "heapDeltaBytes": 7667948,
      "heapUsedBytes": 76715884,
      "domNodes": 79,
      "jsHeapTotalBytes": 19787776,
      "scriptDurationMs": 14.34,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1655.1310000000967,
      "styleRecalcs": 30,
      "styleRecalcDurationMs": 9.902999999999999,
      "layouts": 6,
      "layoutDurationMs": 0.44400000000000006,
      "taskDurationMs": 244.61200000000002,
      "heapDeltaBytes": 7918444,
      "heapUsedBytes": 76915420,
      "domNodes": 79,
      "jsHeapTotalBytes": 19525632,
      "scriptDurationMs": 13.557999999999998,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 407.53499999999576,
      "styleRecalcs": 13,
      "styleRecalcDurationMs": 4.673,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 243.591,
      "heapDeltaBytes": -11370592,
      "heapUsedBytes": 57634008,
      "domNodes": 22,
      "jsHeapTotalBytes": 20574208,
      "scriptDurationMs": 43.527,
      "eventListeners": 2,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.663333333333338,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 418.1499999999687,
      "styleRecalcs": 13,
      "styleRecalcDurationMs": 4.571,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 247.14400000000003,
      "heapDeltaBytes": -10147124,
      "heapUsedBytes": 58896280,
      "domNodes": 22,
      "jsHeapTotalBytes": 19787776,
      "scriptDurationMs": 43.97,
      "eventListeners": 2,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.663333333333338,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2018.2869999999866,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 5.442000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 545.678,
      "heapDeltaBytes": 2464928,
      "heapUsedBytes": 72940012,
      "domNodes": -274,
      "jsHeapTotalBytes": 2977792,
      "scriptDurationMs": 138.192,
      "eventListeners": -148,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2020.8030000000008,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 4.506000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 533.491,
      "heapDeltaBytes": 1255368,
      "heapUsedBytes": 71632608,
      "domNodes": -273,
      "jsHeapTotalBytes": 3239936,
      "scriptDurationMs": 135.955,
      "eventListeners": -146,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2154.5790000000125,
      "styleRecalcs": 70,
      "styleRecalcDurationMs": 11.664000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1282.932,
      "heapDeltaBytes": -14876844,
      "heapUsedBytes": 56928996,
      "domNodes": -271,
      "jsHeapTotalBytes": 4026368,
      "scriptDurationMs": 636.692,
      "eventListeners": -146,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2119.02299999997,
      "styleRecalcs": 69,
      "styleRecalcDurationMs": 8.58,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1178.709,
      "heapDeltaBytes": 870036,
      "heapUsedBytes": 72524452,
      "domNodes": -275,
      "jsHeapTotalBytes": 4493312,
      "scriptDurationMs": 597.82,
      "eventListeners": -148,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3190.174999999954,
      "styleRecalcs": 67,
      "styleRecalcDurationMs": 12.825000000000001,
      "layouts": 60,
      "layoutDurationMs": 6.9270000000000005,
      "taskDurationMs": 1387.932,
      "heapDeltaBytes": -9940124,
      "heapUsedBytes": 63481432,
      "domNodes": -276,
      "jsHeapTotalBytes": 8220672,
      "scriptDurationMs": 663.752,
      "eventListeners": -150,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3092.6299999999856,
      "styleRecalcs": 66,
      "styleRecalcDurationMs": 9.399000000000001,
      "layouts": 60,
      "layoutDurationMs": 5.18,
      "taskDurationMs": 1222.5940000000003,
      "heapDeltaBytes": 18195388,
      "heapUsedBytes": 91950200,
      "domNodes": 14,
      "jsHeapTotalBytes": 8970240,
      "scriptDurationMs": 595.3170000000001,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "minimap-idle",
      "durationMs": 2008.542000000034,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 4.879,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 530.4680000000001,
      "heapDeltaBytes": 1539340,
      "heapUsedBytes": 73947756,
      "domNodes": -271,
      "jsHeapTotalBytes": 2977792,
      "scriptDurationMs": 132.247,
      "eventListeners": -148,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "minimap-idle",
      "durationMs": 2016.4119999999457,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 4.641000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 522.153,
      "heapDeltaBytes": -8712436,
      "heapUsedBytes": 63870752,
      "domNodes": -275,
      "jsHeapTotalBytes": 2715648,
      "scriptDurationMs": 132.27800000000002,
      "eventListeners": -146,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 441.26799999997957,
      "styleRecalcs": 49,
      "styleRecalcDurationMs": 7.095000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 264.847,
      "heapDeltaBytes": -11190464,
      "heapUsedBytes": 57643940,
      "domNodes": 24,
      "jsHeapTotalBytes": 21622784,
      "scriptDurationMs": 78.349,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.663333333333338,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 427.11400000007416,
      "styleRecalcs": 49,
      "styleRecalcDurationMs": 6.933,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 267.007,
      "heapDeltaBytes": -11118752,
      "heapUsedBytes": 57926776,
      "domNodes": 24,
      "jsHeapTotalBytes": 21884928,
      "scriptDurationMs": 78.497,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2001.983999999993,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 4.954,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 305.20200000000006,
      "heapDeltaBytes": 3900300,
      "heapUsedBytes": 73070456,
      "domNodes": 22,
      "jsHeapTotalBytes": 19525632,
      "scriptDurationMs": 10.399999999999999,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2001.888000000008,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 5.707,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 350.588,
      "heapDeltaBytes": -22385788,
      "heapUsedBytes": 46746116,
      "domNodes": -271,
      "jsHeapTotalBytes": 19128320,
      "scriptDurationMs": 10.531999999999998,
      "eventListeners": -150,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1727.6640000000043,
      "styleRecalcs": 75,
      "styleRecalcDurationMs": 25.445,
      "layouts": 16,
      "layoutDurationMs": 3.356,
      "taskDurationMs": 602.185,
      "heapDeltaBytes": -20822536,
      "heapUsedBytes": 48324740,
      "domNodes": -273,
      "jsHeapTotalBytes": 19652608,
      "scriptDurationMs": 69.959,
      "eventListeners": -150,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1674.3089999999938,
      "styleRecalcs": 76,
      "styleRecalcDurationMs": 20.103,
      "layouts": 16,
      "layoutDurationMs": 2.1510000000000002,
      "taskDurationMs": 488.654,
      "heapDeltaBytes": -3949596,
      "heapUsedBytes": 65039128,
      "domNodes": 64,
      "jsHeapTotalBytes": 19525632,
      "scriptDurationMs": 60.494,
      "eventListeners": 4,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-transition-enter",
      "durationMs": 849.5419999999285,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 19.116000000000007,
      "layouts": 7,
      "layoutDurationMs": 6.9750000000000005,
      "taskDurationMs": 628.8179999999999,
      "heapDeltaBytes": -1048032,
      "heapUsedBytes": 84501968,
      "domNodes": 13671,
      "jsHeapTotalBytes": 9699328,
      "scriptDurationMs": 23.415000000000006,
      "eventListeners": 2381,
      "totalBlockingTimeMs": 100,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8113.135999999997,
      "styleRecalcs": 250,
      "styleRecalcDurationMs": 25.516,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 3921.589,
      "heapDeltaBytes": -356076,
      "heapUsedBytes": 69824068,
      "domNodes": -273,
      "jsHeapTotalBytes": 6328320,
      "scriptDurationMs": 1899.91,
      "eventListeners": -130,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.670000000000012,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8101.518999999939,
      "styleRecalcs": 250,
      "styleRecalcDurationMs": 21.22,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 3756.772,
      "heapDeltaBytes": 1352020,
      "heapUsedBytes": 71595308,
      "domNodes": -273,
      "jsHeapTotalBytes": 6852608,
      "scriptDurationMs": 1820.8629999999998,
      "eventListeners": -130,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 9475.826999999981,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 9468.693,
      "heapDeltaBytes": -25352976,
      "heapUsedBytes": 165915156,
      "domNodes": -6548,
      "jsHeapTotalBytes": 3731456,
      "scriptDurationMs": 542.4599999999999,
      "eventListeners": -7475,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 17.216666666666665,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 9893.084999999928,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 9881.744,
      "heapDeltaBytes": -30501352,
      "heapUsedBytes": 165293708,
      "domNodes": -6548,
      "jsHeapTotalBytes": 1110016,
      "scriptDurationMs": 559.504,
      "eventListeners": -7473,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 12609.27700000002,
      "styleRecalcs": 65,
      "styleRecalcDurationMs": 13.080000000000009,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 12597.436000000002,
      "heapDeltaBytes": -33125420,
      "heapUsedBytes": 159100420,
      "domNodes": -6548,
      "jsHeapTotalBytes": 2945024,
      "scriptDurationMs": 941.5100000000001,
      "eventListeners": -7473,
      "totalBlockingTimeMs": 1,
      "frameDurationMs": 17.223333333333358,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 12565.977999999974,
      "styleRecalcs": 66,
      "styleRecalcDurationMs": 12.512999999999996,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 12536.035,
      "heapDeltaBytes": -4111444,
      "heapUsedBytes": 183747984,
      "domNodes": -6548,
      "jsHeapTotalBytes": 4431872,
      "scriptDurationMs": 1022.154,
      "eventListeners": -7471,
      "totalBlockingTimeMs": 26,
      "frameDurationMs": 16.66333333333326,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "workflow-execution",
      "durationMs": 426.8680000000131,
      "styleRecalcs": 16,
      "styleRecalcDurationMs": 12.208,
      "layouts": 2,
      "layoutDurationMs": 0.33199999999999996,
      "taskDurationMs": 77.644,
      "heapDeltaBytes": -16185028,
      "heapUsedBytes": 51722608,
      "domNodes": 132,
      "jsHeapTotalBytes": 7204864,
      "scriptDurationMs": 7.029999999999999,
      "eventListeners": 67,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "workflow-execution",
      "durationMs": 431.34600000007595,
      "styleRecalcs": 14,
      "styleRecalcDurationMs": 12.116000000000001,
      "layouts": 2,
      "layoutDurationMs": 0.32300000000000006,
      "taskDurationMs": 94.299,
      "heapDeltaBytes": -15996656,
      "heapUsedBytes": 51726580,
      "domNodes": 121,
      "jsHeapTotalBytes": 7467008,
      "scriptDurationMs": 6.845000000000001,
      "eventListeners": 67,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000273
    }
  ]
}

@mattmillerai mattmillerai added the cursor-review Trigger multi-model Cursor agent review on this PR label Jul 30, 2026
@mattmillerai mattmillerai changed the title feat: assert registration-identity invariants in node state registration WIP: assert registration-identity invariants in node state registration Jul 30, 2026
@mattmillerai

Copy link
Copy Markdown
Member Author

Held as WIP — the store-level duplicate assert is red on real LGraph.configure paths

pnpm test:unit is not green with this change, so it stays a draft. pnpm typecheck passes; eslint/oxfmt on the touched files pass; the targeted specs (nodeDataStore.test.ts, nodeShellState.test.ts, LGraphNode.nodeState.test.ts) pass.

Attributable to this change (must be resolved before ready):

nodeDataStore: duplicate NodeState for node 1 in graph <uuid> throws from registerNode via attachNodeToStores ← LGraph.add ← LGraph.configure in:

  • src/lib/litegraph/src/LGraph.test.ts — deduplicateSubgraphNodeIds (via configure), incl. warns when configuring a host with legacy proxyWidgets and no migration hook is wired, and a case reached through new LGraph(...) (LGraph.ts:476 → configure → add)
  • src/core/graph/subgraph/migration/proxyWidgetMigration.test.ts — runs through LGraph.configure when the migration hook is wired

Two readings, and which one it is decides the fix — I ran out of budget before separating them:

  1. The assert is right and there is a real defect. A configure path registers a second NodeState for a (id, graphId) that a live state still holds — precisely failure mode 3. Because buckets are identity-keyed Sets, today that silently yields two states for one node. If so the fix is upstream (the configure/dedup path must release the prior state), not in the assert.
  2. The assert is over-strict for subgraph-definition registration. If a definition's nodes legitimately re-register under a bucket that already holds an equivalent-but-distinct state, the invariant as specified is wrong for that path and needs narrowing.

The LGraphNode-level asserts (cross-root re-registration, unregister identity drift) did not produce any failure across the suite — 0 occurrences of either message. Only the store-level one is red.

Not attributable — pre-existing/environmental timeouts under a loaded machine: src/lib/litegraph/src/widgets/ColorWidget.test.ts (Hook timed out in 10000ms, fake timers) and src/platform/cloud/onboarding/onboardingCloudRoutes.test.ts (Test timed out in 5000ms, lazy route resolution). Neither touches node state; both are timeouts, not assertion failures. They should be re-confirmed against the base branch rather than taken on my word.

Note on the base: this is stacked on #14257 (matt/be-5050-node-shell-state), which moves registerNodeState/unregisterNodeState out of LGraphNode.ts into src/core/graph/nodeShell/nodeShellState.ts. Building on feature/ecs-migration directly would have conflicted with that already-approved move.

@github-actions github-actions Bot 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.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

Found 6 finding(s).

Severity Count
🟠 High 2
🟡 Medium 3
🟢 Low 1

Panel: 8/8 reviewers contributed findings.

node: LGraphNode
): void {
const rootGraphId = graph.rootGraph.id
assert(

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.

🟠 High — The cross-root guard is placed before the mutations, but assert (src/base/assert.ts) only throws in DEV — in production it logs/reports and returns, so execution falls through to reassign node._state.graphId and re-register under the new root, overwriting _graphId and stranding the original NodeState in the old bucket (memory leak plus a ghost node the old graph keeps rendering). Enforce the invariant with an early return on violation rather than relying on assert. Raised by 5 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, claude-opus-4-8-thinking-max adversarial, claude-opus-4-8-thinking-max edge-case, kimi-k2.7-code adversarial).

const claimantRenumbered =
claimant !== undefined && nodeKey(claimant) !== key

assert(

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.

🟠 High — The duplicate-state guard runs before the index/bucket writes, but assert is non-fatal in production. If a duplicate ever slips past load-time dedup, prod continues past the assert, overwrites byNodeKey[key], and adds the second state via getGraphNodes().add(state), leaving two live NodeStates for the same (graphId, id); guard with an early return instead of a diagnostic-only assert. Raised by 3 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, kimi-k2.7-code adversarial).

const raw = toRaw(state)
const index = getNodeKeyIndex(rootGraphId)
const key = nodeKey(raw)
const claimant = index.byNodeKey.get(key)

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.

🟡 Medium — The index is only updated when a state registers or is deleted, not when its id/graphId is mutated in place. After a live state is renumbered (e.g. 1→42) without being re-registered, byNodeKey.get('graph:42') returns undefined, so registering a different state at 42 sees no claimant and passes the assert — defeating the one-state-per-node invariant even in DEV. The claimantRenumbered branch also overwrites byNodeKey while leaving the renumbered state's stale keyOf entry behind. Raised by 4 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, kimi-k2.7-code edge-case, claude-opus-4-8-thinking-max adversarial).

useNodeDataStore().deleteNode(node._graphId, node._state)
const deleted = useNodeDataStore().deleteNode(node._graphId, node._state)
node._graphId = undefined
assert(

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.

🟡 Medium — clearGraph()/LGraph.clear() deletes the bucket and its nodeKeyIndex but never clears _graphId on the nodes that lived there. A later unregisterNodeState on a retained node (e.g. tearing down a subgraph after the root was cleared) then gets deleted === false and trips this new identity drift assert as a false positive — throwing in DEV/tests (risking interruption of teardown) and reporting to Sentry in prod even though the state was already correctly gone. The symmetric case also false-fires the register guard at line 67 when a cleared node is reused under a new root; this teardown path is untested. Raised by 3 of 8 reviewers (claude-opus-4-8-thinking-max edge-case, gpt-5.6-sol-max edge-case, gemini-3.1-pro adversarial).

if (!node._graphId) return
useNodeDataStore().deleteNode(node._graphId, node._state)
const deleted = useNodeDataStore().deleteNode(node._graphId, node._state)
node._graphId = undefined

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.

🟡 Medium — On genuine identity drift, node._graphId is set to undefined before the assert(deleted), and the assert is non-fatal in production. So prod leaves the stale NodeState registered in the bucket (still rendered) while the node believes it is unregistered; every future unregisterNodeState early-returns at the if (!node._graphId) guard and can never remove it. Raised by 5 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case, kimi-k2.7-code adversarial, kimi-k2.7-code edge-case, claude-opus-4-8-thinking-max adversarial).

}

function nodeKey(state: NodeState): string {
return `${state.graphId}:${state.id}`

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.

🟢 Low — nodeKey joins graphId and id with a raw : and no escaping, so ids containing a colon can collide into one key and either mask a real duplicate or fire a false duplicate assert. Consider a delimiter-safe encoding (e.g. a JSON tuple or length-prefixing); note also that keying by graphId:id is finer-grained than the root-global node-id uniqueness the invariant targets. Raised by 2 of 8 reviewers (gpt-5.6-sol-max edge-case, gemini-3.1-pro adversarial).

@mattmillerai
mattmillerai force-pushed the matt/be-5050-node-shell-state branch from 950e26e to 7ca4449 Compare August 12, 2026 21:41
@mattmillerai

Copy link
Copy Markdown
Member Author

Superseded by #14443, which carries the same BE-5048 assertions further: the invariants moved out of src/stores/nodeDataStore.ts into src/core/graph/nodeShell/nodeShellState.ts alongside the lifecycle extraction in #14257, with broader test coverage.

Closing rather than restacking — this branch was left stranded when feature/ecs-migration was squash-rebased and its parent matt/be-5050-node-shell-state was restacked onto the new head. The pre-restack branch is preserved at backup/matt-restack-pre-20260812/ if anything here is worth recovering.

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

Labels

agent-coded Opened by the agent-work code loop cursor-review Trigger multi-model Cursor agent review on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants