Skip to content

fix: preserve a live title, flags and colour when serializing missing-node placeholders (BE-8848) - #15719

Merged
mattmillerai merged 6 commits into
matt/fe-1817-serialize-placeholder-sizefrom
matt/be-8848-placeholder-decorations
Aug 27, 2026
Merged

mattmillerai merged 6 commits into
matt/fe-1817-serialize-placeholder-sizefrom
matt/be-8848-placeholder-decorations

Conversation

@mattmillerai

@mattmillerai mattmillerai commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

STACKED — merging lands on matt/fe-1817-serialize-placeholder-size (owned by @mattmillerai, PR #15713), NOT main. Review/merge #15713 first; this PR's diff is only the commit on top.

ELI-5

If ComfyUI can't find a node's code, it draws a grey stand-in and remembers the node's original text so nothing is lost when you install the missing pack later. You could rename that stand-in, colour it, reshape it, collapse it or pin it — and every one of those edits vanished the next time you opened the workflow, because saving replayed the remembered text verbatim. Now your edits stick, and a stand-in you never touched still saves what it loaded.

Summary

serialize()'s missing-node placeholder branch replays last_serialization and overrides only mode/pos (and, on the branch this stacks on, size). This extends that override to every user-decoration field — title, flags, color, bgcolor, boxcolor, shape — so a rename, recolour, reshape, collapse or pin on a placeholder survives save + reload.

Changes

  • What: In the placeholder branch of LGraphNode.serialize(), the live node now wins for title, flags, color, bgcolor, boxcolor and shape. configure() copies those from the file onto the live node at load, so they can only diverge from the file when the user deliberately edited them — live-wins can never lose information the file had.
  • How: the mirrored keys are omitted from the replayed serialization and the live values spread back over it, so "a cleared decoration cannot resurrect the file's recorded value" holds for every key by construction instead of one delete branch at a time. title reuses the normal path's this.title !== this.constructor.title guard so a file with no title does not gain one on round-trip.
  • flags is always emitted. zComfyNode.flags is required and zFlags is a non-nullable object, so round-tripping the absence of flags produced a node the workflow schema rejects — a validation alert, and tryFixLinks repair skipped on the next open. {} faithfully represents "no flags" and is schema-valid. o.flags is cloneObject(this.flags), so pinned and collapsed ride along and the replayed object no longer aliases last_serialization.flags.
  • Not changed: type, inputs, outputs, properties, widgets_values, widgets_values_named still replay from the file — no node definition exists to regenerate them. The widgets_values index asymmetry is separately tracked (Widget values shift by one slot on reload when an earlier widget has serialize === false #15669 / PR fix: restore widgets_values by full widget index (#15669) #15688) and is not bundled here.
  • Breaking: none for consumers. The one serialization difference for an untouched placeholder is that a file which recorded no flags key now round-trips as "flags": {} — deliberate, and the reason LGraph.test.ts.snap's v0.4 fixture gains that key.

Review Focus

Chesterton's-fence check on flags. This flips a field that previously always replayed from the file, so I read the history first. bdf6d4dea2 ("Allow updating position and mode on missing nodes", #6792, AustinMroz) introduced the replay to keep the "last known good" serialization so the node still works once the missing pack is installed, and added pos/mode as the "small and safe changes" that should not be discarded. The decoration fields are the same class — pure decoration that cannot affect whether the node resolves when the pack is reinstalled — so extending the same override is consistent with that intent rather than against it.

The flags-absence round-trip was dropped after review. An earlier revision emitted flags only when the file had one or the live node had a flag to record, to keep the v0.4 fixture snapshot byte-identical. That is the wrong trade: flags is schema-required, so preserving the absence preserves an invalid node. The snapshot now records "flags": {} and the placeholder emits a document the schema accepts.

shape and boxcolor were folded in after review. They were initially scoped out as a separate call about decoration-vs-geometry. They are serialized by the normal path and user-mutable on a placeholder — useNodeCustomization.applyShape (src/composables/graph/useNodeCustomization.ts:113) and LGraphCanvas.onMenuNodeShapes both act on any selected LGraphNode with no has_errors gate — so leaving them out kept the exact data-loss class this PR closes. They are decoration by the same Chesterton's-fence argument as the rest.

Known adjacent gap, not fixed here (follow-up proposed). last_serialization is a load-time snapshot that is never refreshed, and two consumers read it directly rather than through serialize(): useNodeReplacement.replaceWithMapping (src/platform/nodeReplacement/useNodeReplacement.ts:177) applies serialized.title from it, so a renamed placeholder reverts to the file's title once the missing pack is installed; and resizing an expanded placeholder then collapsing it serializes the stale recorded size. Both need a refresh policy that interacts with #15713's deliberate collapsed-size rule, so they are tracked separately rather than bundled.

Provenance

  • Authored by: agent-work loop
  • Verified: pnpm vitest run src/lib/litegraph src/platform src/scripts src/composables — 537 files, 8259 passed, 7 expected-fail, 5 skipped, 0 failed; pnpm typecheck — clean; pnpm lint — 0 errors (3 pre-existing warnings in unrelated files); pnpm format — no changes outside the two edited files. LGraph.test.ts.snap intentionally updated (v0.4 fixture gains "flags": {}); no other snapshot moved.
  • Deviations: Two decisions from the first revision were reversed on review evidence rather than carried forward — the flags-absence guard (it preserved a schema-invalid document) and the exclusion of shape/boxcolor (they are user-mutable on placeholders, so excluding them left the bug open). No test asserts clearing shape, because LGraphNodeProperties instruments shape as an own data property that shadows the prototype accessor, so node.shape = 'default' stores the raw string instead of undefined; that is a pre-existing repo-wide quirk of the legacy string API, and the Vue path (useNodeCustomization) only ever assigns RenderShape enum values, which are all truthy. No screenshots — this is a serialization change with no visual surface.

…-node placeholders

serialize() replays last_serialization for a missing-node placeholder and
previously overrode only mode, pos and size, so a rename, recolour, collapse
or pin on a placeholder was discarded on reload. configure() copies the
file title/flags/color/bgcolor onto the live node at load, so live-wins on
these four fields can only ever carry a deliberate user edit.

Unset decorations are deleted rather than conditionally spread, so clearing
a colour cannot resurrect the one the file recorded, and the flags key is
only emitted when the file had one or the live node has something to say,
which keeps an untouched round-trip byte-identical.
@mattmillerai mattmillerai added the agent-coded Opened by the agent-work code loop label Aug 23, 2026
@mattmillerai
mattmillerai marked this pull request as ready for review August 23, 2026 08:30
@coderabbitai

coderabbitai Bot commented Aug 23, 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: e35bf5e4-5854-4858-b913-59ceba475987

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.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 23, 2026
@github-actions

github-actions Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 08/27/2026, 10:42:24 PM UTC

Links

🎭 Playwright: ✅ 2013 passed, 0 failed

📊 Browser Reports
  • chromium: View Report (✅ 1992 / ❌ 0 / ⚠️ 0 / ⏭️ 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.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 66.8 MB heap
canvas-mouse-sweep: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 63.4 MB heap
canvas-zoom-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 72.8 MB heap
dom-widget-clipping: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 74.8 MB heap
large-graph-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 73.6 MB heap
large-graph-pan: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 82.6 MB heap
large-graph-zoom: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 63.8 MB heap
legacy-node-drag: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 81.6 MB heap
minimap-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 74.2 MB heap
subgraph-dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 61.6 MB heap
subgraph-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 55.7 MB heap
subgraph-mouse-sweep: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 65.8 MB heap
subgraph-transition-enter: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 53ms TBT · 101.2 MB heap
viewport-pan-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 80.6 MB heap
vue-large-graph-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 170.1 MB heap
vue-large-graph-pan: · 58.1 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 180.7 MB heap
workflow-execution: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 69.5 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 6ms
canvas-idle: layout count 0
canvas-idle: style recalc count 11
canvas-idle: task duration 283ms
canvas-idle: script duration 5ms
canvas-idle: TBT 0ms
canvas-idle: heap used 66.8 MB
canvas-idle: DOM nodes -280
canvas-idle: event listeners -183
canvas-mouse-sweep: avg frame time 17ms
canvas-mouse-sweep: p95 frame time 17ms
canvas-mouse-sweep: layout duration 3ms
canvas-mouse-sweep: style recalc duration 24ms
canvas-mouse-sweep: layout count 12
canvas-mouse-sweep: style recalc count 72
canvas-mouse-sweep: task duration 664ms
canvas-mouse-sweep: script duration 84ms
canvas-mouse-sweep: TBT 0ms
canvas-mouse-sweep: heap used 63.4 MB
canvas-mouse-sweep: DOM nodes -279
canvas-mouse-sweep: event listeners -169
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 11ms
canvas-zoom-sweep: layout count 6
canvas-zoom-sweep: style recalc count 31
canvas-zoom-sweep: task duration 197ms
canvas-zoom-sweep: script duration 6ms
canvas-zoom-sweep: TBT 0ms
canvas-zoom-sweep: heap used 72.8 MB
canvas-zoom-sweep: DOM nodes 78
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 6ms
dom-widget-clipping: layout count 0
dom-widget-clipping: style recalc count 15
dom-widget-clipping: task duration 390ms
dom-widget-clipping: script duration 83ms
dom-widget-clipping: TBT 0ms
dom-widget-clipping: heap used 74.8 MB
dom-widget-clipping: DOM nodes 20
dom-widget-clipping: event listeners 1
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 4ms
large-graph-idle: layout count 0
large-graph-idle: style recalc count 7
large-graph-idle: task duration 295ms
large-graph-idle: script duration 18ms
large-graph-idle: TBT 0ms
large-graph-idle: heap used 73.6 MB
large-graph-idle: DOM nodes -266
large-graph-idle: event listeners -153
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 12ms
large-graph-pan: layout count 0
large-graph-pan: style recalc count 69
large-graph-pan: task duration 1409ms
large-graph-pan: script duration 501ms
large-graph-pan: TBT 0ms
large-graph-pan: heap used 82.6 MB
large-graph-pan: DOM nodes -268
large-graph-pan: event listeners -90
large-graph-zoom: avg frame time 17ms
large-graph-zoom: p95 frame time 17ms
large-graph-zoom: layout duration 7ms
large-graph-zoom: style recalc duration 11ms
large-graph-zoom: layout count 60
large-graph-zoom: style recalc count 68
large-graph-zoom: task duration 1391ms
large-graph-zoom: script duration 481ms
large-graph-zoom: TBT 0ms
large-graph-zoom: heap used 63.8 MB
large-graph-zoom: DOM nodes 27
large-graph-zoom: event listeners 9
legacy-node-drag: avg frame time 17ms
legacy-node-drag: p95 frame time 17ms
legacy-node-drag: layout duration 0ms
legacy-node-drag: style recalc duration 6ms
legacy-node-drag: layout count 0
legacy-node-drag: style recalc count 43
legacy-node-drag: task duration 1943ms
legacy-node-drag: script duration 503ms
legacy-node-drag: TBT 0ms
legacy-node-drag: heap used 81.6 MB
legacy-node-drag: DOM nodes 6
legacy-node-drag: event listeners 187
minimap-idle: avg frame time 17ms
minimap-idle: p95 frame time 17ms
minimap-idle: layout duration 0ms
minimap-idle: style recalc duration 3ms
minimap-idle: layout count 0
minimap-idle: style recalc count 6
minimap-idle: task duration 286ms
minimap-idle: script duration 18ms
minimap-idle: TBT 0ms
minimap-idle: heap used 74.2 MB
minimap-idle: DOM nodes -269
minimap-idle: event listeners -152
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 8ms
subgraph-dom-widget-clipping: layout count 0
subgraph-dom-widget-clipping: style recalc count 47
subgraph-dom-widget-clipping: task duration 302ms
subgraph-dom-widget-clipping: script duration 83ms
subgraph-dom-widget-clipping: TBT 0ms
subgraph-dom-widget-clipping: heap used 61.6 MB
subgraph-dom-widget-clipping: DOM nodes 20
subgraph-dom-widget-clipping: event listeners 7
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 10
subgraph-idle: task duration 268ms
subgraph-idle: script duration 4ms
subgraph-idle: TBT 0ms
subgraph-idle: heap used 55.7 MB
subgraph-idle: DOM nodes -296
subgraph-idle: event listeners -199
subgraph-mouse-sweep: avg frame time 17ms
subgraph-mouse-sweep: p95 frame time 17ms
subgraph-mouse-sweep: layout duration 4ms
subgraph-mouse-sweep: style recalc duration 24ms
subgraph-mouse-sweep: layout count 16
subgraph-mouse-sweep: style recalc count 75
subgraph-mouse-sweep: task duration 630ms
subgraph-mouse-sweep: script duration 69ms
subgraph-mouse-sweep: TBT 0ms
subgraph-mouse-sweep: heap used 65.8 MB
subgraph-mouse-sweep: DOM nodes -297
subgraph-mouse-sweep: event listeners -199
subgraph-transition-enter: avg frame time 17ms
subgraph-transition-enter: p95 frame time 17ms
subgraph-transition-enter: layout duration 9ms
subgraph-transition-enter: style recalc duration 20ms
subgraph-transition-enter: layout count 16
subgraph-transition-enter: style recalc count 21
subgraph-transition-enter: task duration 513ms
subgraph-transition-enter: script duration 16ms
subgraph-transition-enter: TBT 53ms
subgraph-transition-enter: heap used 101.2 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 38ms
viewport-pan-sweep: layout count 0
viewport-pan-sweep: style recalc count 250
viewport-pan-sweep: task duration 4973ms
viewport-pan-sweep: script duration 1723ms
viewport-pan-sweep: TBT 0ms
viewport-pan-sweep: heap used 80.6 MB
viewport-pan-sweep: DOM nodes -253
viewport-pan-sweep: event listeners -151
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 9368ms
vue-large-graph-idle: script duration 149ms
vue-large-graph-idle: TBT 0ms
vue-large-graph-idle: heap used 170.1 MB
vue-large-graph-idle: DOM nodes -6548
vue-large-graph-idle: event listeners -7475
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 11ms
vue-large-graph-pan: layout count 0
vue-large-graph-pan: style recalc count 67
vue-large-graph-pan: task duration 12889ms
vue-large-graph-pan: script duration 539ms
vue-large-graph-pan: TBT 0ms
vue-large-graph-pan: heap used 180.7 MB
vue-large-graph-pan: DOM nodes -6548
vue-large-graph-pan: event listeners -7474
workflow-execution: avg frame time 17ms
workflow-execution: p95 frame time 17ms
workflow-execution: layout duration 1ms
workflow-execution: style recalc duration 15ms
workflow-execution: layout count 3
workflow-execution: style recalc count 16
workflow-execution: task duration 73ms
workflow-execution: script duration 5ms
workflow-execution: TBT 0ms
workflow-execution: heap used 69.5 MB
workflow-execution: DOM nodes 130
workflow-execution: event listeners 74
Raw data
{
  "timestamp": "2026-08-26T19:58:28.913Z",
  "gitSha": "2da735531c7831031af3e454e64b7c266a94a8d6",
  "branch": "matt/be-8848-placeholder-decorations",
  "measurements": [
    {
      "name": "canvas-idle",
      "durationMs": 2017.0630000000074,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 6.099,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 283.65200000000004,
      "heapDeltaBytes": 3010000,
      "heapUsedBytes": 73782408,
      "domNodes": -279,
      "jsHeapTotalBytes": 4448256,
      "scriptDurationMs": 5.092,
      "eventListeners": -183,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-idle",
      "durationMs": 1996.467999999993,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 5.196999999999998,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 281.674,
      "heapDeltaBytes": -5006056,
      "heapUsedBytes": 66378316,
      "domNodes": -280,
      "jsHeapTotalBytes": 4186112,
      "scriptDurationMs": 4.946000000000001,
      "eventListeners": -183,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1720.6539999999961,
      "styleRecalcs": 72,
      "styleRecalcDurationMs": 24.205,
      "layouts": 12,
      "layoutDurationMs": 2.884,
      "taskDurationMs": 655.2750000000001,
      "heapDeltaBytes": 2056480,
      "heapUsedBytes": 73281256,
      "domNodes": -278,
      "jsHeapTotalBytes": 5758976,
      "scriptDurationMs": 82.405,
      "eventListeners": -153,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1692.8949999999645,
      "styleRecalcs": 71,
      "styleRecalcDurationMs": 24.628,
      "layouts": 12,
      "layoutDurationMs": 2.924,
      "taskDurationMs": 673.173,
      "heapDeltaBytes": -12264876,
      "heapUsedBytes": 59734908,
      "domNodes": -280,
      "jsHeapTotalBytes": 7593984,
      "scriptDurationMs": 86.285,
      "eventListeners": -185,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1658.348999999987,
      "styleRecalcs": 31,
      "styleRecalcDurationMs": 10.308,
      "layouts": 6,
      "layoutDurationMs": 0.516,
      "taskDurationMs": 196.613,
      "heapDeltaBytes": 4621120,
      "heapUsedBytes": 76395916,
      "domNodes": 78,
      "jsHeapTotalBytes": 4980736,
      "scriptDurationMs": 6.204,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1710.1519999999937,
      "styleRecalcs": 30,
      "styleRecalcDurationMs": 10.776000000000002,
      "layouts": 6,
      "layoutDurationMs": 0.542,
      "taskDurationMs": 197.371,
      "heapDeltaBytes": 4413320,
      "heapUsedBytes": 76358104,
      "domNodes": 77,
      "jsHeapTotalBytes": 5505024,
      "scriptDurationMs": 6.531000000000001,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 534.953999999999,
      "styleRecalcs": 15,
      "styleRecalcDurationMs": 5.944,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 386.654,
      "heapDeltaBytes": 6185636,
      "heapUsedBytes": 78126376,
      "domNodes": 20,
      "jsHeapTotalBytes": 6291456,
      "scriptDurationMs": 81.92399999999999,
      "eventListeners": 0,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 543.7009999999987,
      "styleRecalcs": 14,
      "styleRecalcDurationMs": 5.894,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 393.80899999999997,
      "heapDeltaBytes": 6829888,
      "heapUsedBytes": 78740244,
      "domNodes": 20,
      "jsHeapTotalBytes": 6291456,
      "scriptDurationMs": 84.69,
      "eventListeners": 2,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2017.2939999999926,
      "styleRecalcs": 8,
      "styleRecalcDurationMs": 4.434,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 296.667,
      "heapDeltaBytes": -1178712,
      "heapUsedBytes": 77129052,
      "domNodes": -264,
      "jsHeapTotalBytes": -1880064,
      "scriptDurationMs": 17.479000000000003,
      "eventListeners": -153,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2009.2819999999847,
      "styleRecalcs": 6,
      "styleRecalcDurationMs": 3.0509999999999997,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 293.00000000000006,
      "heapDeltaBytes": -1320532,
      "heapUsedBytes": 77248436,
      "domNodes": -268,
      "jsHeapTotalBytes": -2404352,
      "scriptDurationMs": 18.370000000000005,
      "eventListeners": -153,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2302.2119999999973,
      "styleRecalcs": 70,
      "styleRecalcDurationMs": 12.711,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1435.9599999999998,
      "heapDeltaBytes": 7623584,
      "heapUsedBytes": 87182252,
      "domNodes": -266,
      "jsHeapTotalBytes": 3325952,
      "scriptDurationMs": 511.6959999999999,
      "eventListeners": -183,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2263.9669999999796,
      "styleRecalcs": 67,
      "styleRecalcDurationMs": 10.699999999999998,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1381.307,
      "heapDeltaBytes": 21197624,
      "heapUsedBytes": 86117856,
      "domNodes": -270,
      "jsHeapTotalBytes": 3371008,
      "scriptDurationMs": 489.36899999999997,
      "eventListeners": 4,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3561.036999999999,
      "styleRecalcs": 67,
      "styleRecalcDurationMs": 10.899,
      "layouts": 60,
      "layoutDurationMs": 7.482,
      "taskDurationMs": 1386.4429999999998,
      "heapDeltaBytes": -3752592,
      "heapUsedBytes": 66585132,
      "domNodes": 26,
      "jsHeapTotalBytes": 2359296,
      "scriptDurationMs": 482.21500000000003,
      "eventListeners": 10,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3564.4100000000094,
      "styleRecalcs": 68,
      "styleRecalcDurationMs": 11.056,
      "layouts": 60,
      "layoutDurationMs": 7.318,
      "taskDurationMs": 1396.171,
      "heapDeltaBytes": -2956080,
      "heapUsedBytes": 67234860,
      "domNodes": 28,
      "jsHeapTotalBytes": 2883584,
      "scriptDurationMs": 479.58299999999997,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "legacy-node-drag",
      "durationMs": 3089.6789999999896,
      "styleRecalcs": 43,
      "styleRecalcDurationMs": 5.937000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1926.818,
      "heapDeltaBytes": 16529156,
      "heapUsedBytes": 88048348,
      "domNodes": 6,
      "jsHeapTotalBytes": 1990656,
      "scriptDurationMs": 502.9049999999999,
      "eventListeners": 186,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "legacy-node-drag",
      "durationMs": 3130.957999999964,
      "styleRecalcs": 43,
      "styleRecalcDurationMs": 6.0950000000000015,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1959.455,
      "heapDeltaBytes": 15739328,
      "heapUsedBytes": 83066044,
      "domNodes": 6,
      "jsHeapTotalBytes": 5660672,
      "scriptDurationMs": 503.11800000000005,
      "eventListeners": 188,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "minimap-idle",
      "durationMs": 2005.6490000000053,
      "styleRecalcs": 6,
      "styleRecalcDurationMs": 3.013,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 284.47299999999996,
      "heapDeltaBytes": -2249436,
      "heapUsedBytes": 78097212,
      "domNodes": -269,
      "jsHeapTotalBytes": -2666496,
      "scriptDurationMs": 18.808,
      "eventListeners": -153,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "minimap-idle",
      "durationMs": 2009.253000000001,
      "styleRecalcs": 6,
      "styleRecalcDurationMs": 3.1959999999999993,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 288.369,
      "heapDeltaBytes": -2108812,
      "heapUsedBytes": 77427728,
      "domNodes": -268,
      "jsHeapTotalBytes": -1880064,
      "scriptDurationMs": 17.612000000000002,
      "eventListeners": -151,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 448.76699999997527,
      "styleRecalcs": 47,
      "styleRecalcDurationMs": 8.134,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 299.66299999999995,
      "heapDeltaBytes": -8010084,
      "heapUsedBytes": 64752008,
      "domNodes": 20,
      "jsHeapTotalBytes": 7602176,
      "scriptDurationMs": 81.579,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 465.43499999995674,
      "styleRecalcs": 47,
      "styleRecalcDurationMs": 8.253,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 305.024,
      "heapDeltaBytes": -7946796,
      "heapUsedBytes": 64461212,
      "domNodes": 20,
      "jsHeapTotalBytes": 6029312,
      "scriptDurationMs": 84.49900000000001,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.663333333333338,
      "p95FrameDurationMs": 16.799999999999727
    },
    {
      "name": "subgraph-idle",
      "durationMs": 1993.0500000000109,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 4.9350000000000005,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 270.46400000000006,
      "heapDeltaBytes": -14320040,
      "heapUsedBytes": 58536236,
      "domNodes": -296,
      "jsHeapTotalBytes": 5496832,
      "scriptDurationMs": 4.248,
      "eventListeners": -199,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "subgraph-idle",
      "durationMs": 1992.5810000000297,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 4.885000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 266.34499999999997,
      "heapDeltaBytes": -13871904,
      "heapUsedBytes": 58282928,
      "domNodes": -296,
      "jsHeapTotalBytes": 4448256,
      "scriptDurationMs": 4.038000000000002,
      "eventListeners": -199,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1677.4350000000027,
      "styleRecalcs": 76,
      "styleRecalcDurationMs": 23.779999999999994,
      "layouts": 16,
      "layoutDurationMs": 3.5120000000000005,
      "taskDurationMs": 627.8589999999999,
      "heapDeltaBytes": -3879292,
      "heapUsedBytes": 68944604,
      "domNodes": -296,
      "jsHeapTotalBytes": 5496832,
      "scriptDurationMs": 67.76199999999999,
      "eventListeners": -199,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1677.3829999999634,
      "styleRecalcs": 74,
      "styleRecalcDurationMs": 24.52,
      "layouts": 16,
      "layoutDurationMs": 3.672,
      "taskDurationMs": 631.6460000000001,
      "heapDeltaBytes": -3249592,
      "heapUsedBytes": 69053548,
      "domNodes": -298,
      "jsHeapTotalBytes": 6283264,
      "scriptDurationMs": 69.53099999999999,
      "eventListeners": -199,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-transition-enter",
      "durationMs": 750.2349999999751,
      "styleRecalcs": 21,
      "styleRecalcDurationMs": 19.799000000000003,
      "layouts": 16,
      "layoutDurationMs": 8.52,
      "taskDurationMs": 512.675,
      "heapDeltaBytes": 23445152,
      "heapUsedBytes": 106078512,
      "domNodes": 13671,
      "jsHeapTotalBytes": 10485760,
      "scriptDurationMs": 15.765,
      "eventListeners": 2381,
      "totalBlockingTimeMs": 53,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8404.830000000004,
      "styleRecalcs": 250,
      "styleRecalcDurationMs": 38.282999999999994,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 4976.057,
      "heapDeltaBytes": 9161244,
      "heapUsedBytes": 87444044,
      "domNodes": -264,
      "jsHeapTotalBytes": 1228800,
      "scriptDurationMs": 1717.3229999999999,
      "eventListeners": -135,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8410.942999999974,
      "styleRecalcs": 250,
      "styleRecalcDurationMs": 37.94799999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 4969.268999999999,
      "heapDeltaBytes": 3001460,
      "heapUsedBytes": 81575908,
      "domNodes": -242,
      "jsHeapTotalBytes": 3325952,
      "scriptDurationMs": 1729.485,
      "eventListeners": -167,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.80000000000109
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 10330.134999999984,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 9371.159,
      "heapDeltaBytes": -19188572,
      "heapUsedBytes": 175258744,
      "domNodes": -6548,
      "jsHeapTotalBytes": -4362240,
      "scriptDurationMs": 156.403,
      "eventListeners": -7475,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333338,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 10276.738000000023,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 9365.47,
      "heapDeltaBytes": -33257692,
      "heapUsedBytes": 181491024,
      "domNodes": -6548,
      "jsHeapTotalBytes": -1105920,
      "scriptDurationMs": 140.88899999999998,
      "eventListeners": -7475,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.670000000000012,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 13623.20699999998,
      "styleRecalcs": 68,
      "styleRecalcDurationMs": 11.371999999999993,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 13008.524000000001,
      "heapDeltaBytes": -21265268,
      "heapUsedBytes": 187372208,
      "domNodes": -6548,
      "jsHeapTotalBytes": 716800,
      "scriptDurationMs": 550.488,
      "eventListeners": -7473,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 17.223333333333358,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 13167.805000000044,
      "styleRecalcs": 66,
      "styleRecalcDurationMs": 11.273999999999978,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 12770.321,
      "heapDeltaBytes": -20936128,
      "heapUsedBytes": 191510684,
      "domNodes": -6548,
      "jsHeapTotalBytes": 1929216,
      "scriptDurationMs": 528.164,
      "eventListeners": -7475,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 17.219999999999953,
      "p95FrameDurationMs": 16.80000000000291
    },
    {
      "name": "workflow-execution",
      "durationMs": 439.5560000000387,
      "styleRecalcs": 24,
      "styleRecalcDurationMs": 19.348,
      "layouts": 3,
      "layoutDurationMs": 1.0230000000000001,
      "taskDurationMs": 96.12,
      "heapDeltaBytes": 6064012,
      "heapUsedBytes": 74037856,
      "domNodes": 154,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 6.151999999999999,
      "eventListeners": 99,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "workflow-execution",
      "durationMs": 72.61200000004919,
      "styleRecalcs": 8,
      "styleRecalcDurationMs": 10.742,
      "layouts": 2,
      "layoutDurationMs": 0.48400000000000004,
      "taskDurationMs": 50.644000000000005,
      "heapDeltaBytes": 3658180,
      "heapUsedBytes": 71748484,
      "domNodes": 106,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 3.0729999999999995,
      "eventListeners": 49,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    }
  ]
}

@github-actions github-actions Bot added the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Aug 23, 2026
@mattmillerai mattmillerai added the cursor-review Trigger multi-model Cursor agent review on this PR label Aug 23, 2026

@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 4 finding(s).

Severity Count
🟡 Medium 2
🟢 Low 2

Panel: 8/8 reviewers contributed findings.

Comment thread src/lib/litegraph/src/LGraphNode.ts Resolved
Comment thread src/lib/litegraph/src/LGraphNode.ts Resolved
Comment thread src/lib/litegraph/src/LGraphNode.ts Resolved
Comment thread src/lib/litegraph/src/LGraphNode.ts Resolved
@codecov

codecov Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/lib/litegraph/src/LGraphNode.ts 80.00% 0 Missing and 1 partial ⚠️
@@                             Coverage Diff                             @@
##           matt/fe-1817-serialize-placeholder-size   #15719      +/-   ##
===========================================================================
- Coverage                                    79.49%   79.49%   -0.01%     
===========================================================================
  Files                                         1947     1947              
  Lines                                       118500   118509       +9     
  Branches                                     33531    34004     +473     
===========================================================================
+ Hits                                         94196    94203       +7     
  Misses                                       23803    23803              
- Partials                                       501      503       +2     
Flag Coverage Δ
e2e 66.92% <90.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/nodeReplacement/useNodeReplacement.ts 81.32% <100.00%> (+0.30%) ⬆️
src/lib/litegraph/src/LGraphNode.ts 69.46% <80.00%> (+0.01%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Review follow-up on the placeholder decoration mirror.

shape and boxcolor are serialized by the normal path and are user-mutable on
a placeholder (useNodeCustomization.applyShape and LGraphCanvas
.onMenuNodeShapes act on any selected LGraphNode), so leaving them to replay
from the file dropped those edits on save - the same data loss this branch
sets out to fix. They now join title, color and bgcolor in the live mirror.

The five mirrored keys are omitted from the replayed serialization before the
live values are spread back over it, which replaces the per-key delete chain
and keeps "cleared decorations do not resurrect the recorded value" true for
every key by construction rather than one branch at a time.

flags is required by zComfyNode and zFlags is a non-nullable object, so the
previous absence round-trip emitted a node the workflow schema rejects, which
surfaces as a validation alert and skips tryFixLinks repair on the next open.
An empty object faithfully represents "no flags" and is schema-valid, so the
key is now always emitted; the v0.4 fixture snapshot gains "flags": {}
accordingly. Guarding this.flags with optional chaining also keeps the branch
consistent with the defensive reads elsewhere in the class.
@mattmillerai

Copy link
Copy Markdown
Member Author

🤖 The reviews loop filed Linear follow-up ticket(s) for review thread(s) deferred as out of scope for this PR:

  • BE-8849 — Refresh or bypass the stale last_serialization snapshot so live placeholder edits survive node replacement and collapse — filed as agent-spike (premise unverified)

The following carry agent-spike instead of agent-ok because their reachability claim was not backed by evidence (BE-5378) — the claim is investigated before any code is written, and "the premise does not hold" is a valid, successful outcome:

  • Refresh or bypass the stale last_serialization snapshot so live placeholder edits survive node replacement and collapse — no reachability block in the proposal

…er-size' into matt/be-8848-placeholder-decorations

# Conflicts:
#	src/lib/litegraph/src/LGraphNode.ts
@vercel

vercel Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
comfy-cms Error Error Aug 26, 2026 7:49pm
comfy-ui-frontend-desktop-ui Ready Ready Preview Aug 26, 2026 7:49pm

Request Review

…t node (#15734)

**STACKED — merging lands on `matt/be-8848-placeholder-decorations`
(owned by mattmillerai, #15719), NOT `main`.** #15719 is itself stacked
on #15713. Review and land those first; this PR is behaviour-neutral
without #15719 (it is the change that makes `serialize()` return live
values on a placeholder).

## ELI-5

When a workflow references a node pack you don't have installed, ComfyUI
draws a placeholder in its place. You can rename that placeholder and
give it a colour, same as any node. Later you install the pack, hit
"replace", and the real node appears — but it came back with the title
from the file and no colour at all, quietly throwing away the rename and
the colour you'd applied. This makes the replacement inherit what's
actually on screen.

## Summary

The node-replacement flow read a placeholder's load-time snapshot
instead of the live node, and dropped its colours entirely; both are now
taken from `serialize()` and applied to the replacement.

## Changes

- **What**: `replaceWithMapping` and the default-mapping call in
`src/platform/nodeReplacement/useNodeReplacement.ts` now read
`node.serialize()` rather than `node.last_serialization ??
node.serialize()`. The `?? node.serialize()` arm was dead code — the
placeholder collection filter requires `n.last_serialization` to exist —
so every replacement replayed the file's title, and a rename made after
load was silently lost. Separately, `replaceWithMapping` applied only
`title` from the serialized data; `color`, `bgcolor`, `boxcolor` and
`shape` were serialized but never copied, so a recoloured placeholder
became a default-coloured replacement node. Those four are now applied
alongside `title`.
- **Breaking**: none. Structural fields (`type` / `inputs` / `outputs` /
`properties` / `widgets_values`) are unaffected: only bare `LGraphNode`
instances carry `last_serialization` (verified — all three
placeholder-creation sites use `new LGraphNode(...)`), and that branch
of `serialize()` replays those fields verbatim from
`last_serialization`, overlaying only `mode` / `pos` / `flags` /
decorations (and live `size` when expanded). The mapping and
widget-transfer logic therefore sees identical input.

## Review Focus

- **The riskiest line is dropping the `last_serialization`
short-circuit.** Its safety rests on the claim above: everything
reaching `replaceWithMapping` is a bare `LGraphNode` with
`last_serialization` set, so `serialize()` takes the placeholder branch.
If a subclassed node could ever carry `last_serialization`,
`serialize()` would derive `inputs`/`outputs` from the live (registered)
definition instead of replaying the file's, and the mapping would be
built against the wrong shape. The three creation sites are
`LGraph.configure`, `LGraph`'s subgraph-unpack path, and the API-format
loader in `src/scripts/app.ts` — all `new LGraphNode(...)`.
- **Propagating colours is only correct because nothing assigns them
programmatically as error styling.** Swept for this: `boxcolor` is never
assigned anywhere outside serialization, and `bgcolor` is assigned only
by the Note node and by the explicit user colour pickers. Missing-node
styling rides on the `has_errors` flag, which `replaceWithMapping`
already clears. So a colour present on a placeholder is a colour the
user put there.
- **Scope sweep.** 14 non-test references to `last_serialization` exist
under `src/`. This PR changes 2 (both in the node-replacement flow). The
other 12 are left alone deliberately: 4 are reads that only want `.type`
or the existence check used as the placeholder discriminator
(`missingNodeScan.ts`, `useErrorClearingHooks.ts`, and the two in the
collection filter here), and 8 are the write/definition side
(`LGraph.ts`, `src/scripts/app.ts`, `LGraphNode.ts`).
- **Test-helper change.** `createPlaceholderNode`'s `serialize` stub
previously returned a frozen object literal that ignored the
`last_serialization` the tests mutate after construction. Once the call
site stops reading `last_serialization`, that stub is wrong — every
widget-transfer test would have failed for the wrong reason. It now
derives from `node.last_serialization` plus the node's live fields,
mirroring the real placeholder branch. No existing test's assertions
changed.
- **Coordination**: open PR #14286 rewrites `transferWidgetValue` in
this same file. No functional overlap with these lines; needs a trivial
rebase if it lands first.

## Provenance

- **Authored by:** agent-work loop
- **Verified:** `pnpm vitest run src/platform/nodeReplacement
src/lib/litegraph/test`: 122 passed, 0 failed. `pnpm test:unit`: 16552
passed, 13 failed — 12 of them in
`scripts/cicd/check-binary-size.test.ts`, reproduced identically with
this change stashed (pre-existing, environment-dependent), plus one
5s-timeout flake in a `firstRunTour` test that passed on re-run.
Red-check on the new test: reverting the `serialize()` read alone fails
it on the title, and dropping the four decoration lines alone fails it
on the colour — so it discriminates both halves. `pnpm typecheck`, `pnpm
lint`, `pnpm format`, `pnpm knip`: clean.
- **Deviations:** The new test builds its placeholder with this suite's
existing `fromAny` mock helper rather than a real `LGraphNode` instance;
the file mocks the whole litegraph module, so a real instance is not
constructible there. Verification is the unit suite plus a source sweep
— there is no in-app repro in this run for the full missing-node →
install-pack → replace journey, so the user-visible outcome is asserted
at the composable boundary rather than on screen. The originating
tracker issue and its investigation notes are internal and were not
readable from this environment; the change was implemented from the
specification handed to this run and cross-checked against the code
itself.
**STACKED — merging lands on `matt/be-8848-placeholder-decorations`
(owned by @mattmillerai, PR #15719), NOT `main`.** That branch is itself
stacked on #15713. Do not merge this until both land; it is not "ready
to merge" on its own.

## ELI-5

If a node in your workflow comes from an extension you do not have
installed, the frontend draws a placeholder in its place. Because it has
no node definition to work from, saving the workflow replays whatever
the file said about that node instead of regenerating it. #15713 made an
*expanded* placeholder save its live size, but a *collapsed* one falls
back to the size recorded in the file — and that record was written once
when the workflow loaded and never updated. So: resize a placeholder,
collapse it, save — and the resize was thrown away. This makes
collapsing and expanding both refresh that record, so the size you last
gave the placeholder is the one that gets saved.

## Summary

`collapse()` now keeps a missing-node placeholder's recorded
serialization size and its live size in sync in **both** directions, so
a resize made while expanded survives a collapse-then-save round trip
and is not lost again on the way back out.

## Changes

- **Collapsing** copies the live size into `last_serialization.size`.
#15713's rule is kept intact — a collapsed placeholder still serializes
the *recorded* size, since it has no definition to re-derive an expanded
one from; what changes is that "recorded" now means the last known
expanded size rather than the load-time one.
- **Expanding** restores the live size *from* `last_serialization.size`.
In Vue nodes mode `node.size` is a DOM measurement of whichever card is
rendered (`useLayoutSync.ts:55` writes the ResizeObserver's bounds into
`liteNode.size`), so immediately after an expand it still holds the
collapsed card's dimensions until the next measurement lands a frame
later. Without the restore, a `serialize()` inside that window persisted
the collapsed dimensions, and a second collapse inside it re-recorded
them — destroying the value the refresh exists to preserve.
- Both halves run **before** the `flags.collapsed` flip, so each reads
`node.size` while it still measures the card the node is leaving.
- Two guards remain: `this.constructor === LGraphNode` (mirrors
`serialize()`'s own placeholder test) and `last_serialization?.size !=
null` (preserves #15713's "does not invent a size when the recorded
serialization has none" rule). The `!this.flags.collapsed` guard is gone
— the flag now selects the direction instead of gating the write.
- The record is **replaced** rather than mutated in place, because
`LGraph.configure()` assigns `last_serialization` by reference straight
out of the caller's `data.nodes` (`LGraph.ts:2626`; the dedup clone at
`LGraph.ts:2599` only kicks in for workflows with subgraph definitions).
Writing through it would corrupt a retained caller snapshot, and would
throw if the input were frozen — aborting the collapse before the flag
flipped.
- Six tests in the `missing-node placeholder serialization` block in
`LGraphNode.test.ts`.

## Review Focus

- **The direction switch in `collapse()`.** It is the whole change.
Canvas mode never overwrites `node.size` on collapse, so there the
restore rewrites the values it just recorded and is a no-op; the
asymmetry only exists under Vue nodes.
- **Restoring through the `size` setter** (`this.size =
recordedSerialization.size`) rather than `setSize()`: the setter copies
element-wise (no aliasing with `last_serialization`), guards `length <
2`, and mirrors into the layout store, but does not fire `onResize`.
Since the restore happens while the node is still flagged collapsed,
`LGraphNode.vue`'s `handleLayoutChange` bails out and the DOM is
restored by the existing `isCollapsed` watch's `--node-width-x` stash
instead.
- **Reassigning `last_serialization`.** No reader caches the object
identity — `useNodeReplacement.ts:178`, `missingNodeScan.ts:28`,
`useErrorClearingHooks.ts:236` and the rest read fields at call time —
and the load-time writes that *do* rely on the aliasing (`app.ts:2222`,
`app.ts:2270`, `LGraph.ts:2007`) all run long before any collapse.
- **Second consumer of the refreshed field.** `useNodeReplacement.ts`
uses `node.last_serialization ?? node.serialize()` when swapping a
placeholder for a real node, so a replacement now inherits the last
expanded size rather than the load-time one. That is the intended
direction, but it is worth a look.
- **Incidental fix.** Expanding a placeholder that was *loaded*
collapsed and then saving used to persist the collapsed card
measurement. The restore fixes that too; it predates this PR.

## Sweep

The hook is in `collapse()` only, on the premise that nothing else flips
the flag. Sweeping `flags.collapsed =` across `src/`, `browser_tests/`
and `apps/`: **1** non-test source assignment — the line this change
sits in front of — and **17** assignments across 7 test files, none of
which are product paths and none of which are touched here. All **5**
non-test `.collapse(` call sites (`useNodeEventHandlers.ts`,
`useCoreCommands.ts`, `useSelectedNodeActions.ts`, and two in
`LGraphCanvas.ts`) route through the hook. So the portion deliberately
not covered is the direct-flag path, which exists only in tests.

## Notes and judgment calls

- The plan this came from expected #15713's `keeps the recorded size
while collapsed` test to still set `flags.collapsed` directly, and said
to leave it untouched. #15719 had already rewritten it to call
`collapse(true)`. I left it untouched either way and it still passes —
at collapse time the placeholder's live size *is* the recorded `[140,
60]`, so the refresh is a no-op there — but it no longer documents the
direct-flag edge the plan described. I did not add a replacement test
for that edge, since no product code reaches it (see Sweep).
- The first revision of this PR shipped the collapse half only, and
justified writing to `last_serialization` in place by citing `app.ts` as
precedent. That citation was wrong: the objects `app.ts:2222` and
`app.ts:2270` mutate are constructed at `app.ts:2195`, so that code owns
them. Nothing established the pattern for a borrowed object, hence the
replace.
- Based on `matt/be-8848-placeholder-decorations` rather than `main`
because the added tests assert `flags.collapsed` in the output (#15719)
and reuse the `createPlaceholder` helper (#15713). The production change
itself also composes with today's `main`, where `serialize()`
unconditionally replays `last_serialization.size`.
- No capability is denied or removed by this diff, so the negative-claim
falsification check does not apply.

## Unexercised

- Verification is unit-level. I did not run the Playwright suite or
drive Vue nodes mode in a browser. The Vue-mode measurement timing that
motivates both the before-the-flip capture and the restore is read off
`useLayoutSync.ts` and `LGraphNode.vue` rather than observed live, so
the *width* of the re-measure window is inferred, not bounded
empirically. The fix does not depend on that width — it closes the
window synchronously rather than racing it.
- The read-only investigation this implementation came from lives in an
internal tracker this environment cannot reach, so its findings were
taken as given from the plan text rather than re-derived.

## Provenance

- **Authored by:** agent-work loop
- **Verified:** `pnpm test:unit src/lib/litegraph
src/platform/nodeReplacement src/renderer/core/layout
src/renderer/extensions/vueNodes` — 178 files, 2330 passed / 3
expected-fail / 12 skipped, 0 failed; `pnpm test:unit
src/lib/litegraph/src/LGraphNode.test.ts` — 51 passed; call-site suites
(`useCoreCommands`, `useLoad3d`) — 134 passed; `pnpm typecheck` — clean;
`oxlint`, `oxfmt --check` and lint on both changed files — clean.
Red/green checked on all three new tests: deleting the restore-on-expand
line fails 2 of them with `expected [ 80, 30 ] to deeply equal [ 777,
666 ]`, and reverting the replace to an in-place mutation fails the
third.
- **Deviations:** none of the plan's acceptance criteria were skipped.
Two departures from the plan as written, both explained under "Notes and
judgment calls": the existing-test premise no longer matches, and the
plan scoped only the collapse direction — review found the expand
direction was load-bearing for the same guarantee, so it is included
here rather than deferred.
@mattmillerai
mattmillerai merged commit c5216d5 into matt/fe-1817-serialize-placeholder-size Aug 27, 2026
17 of 18 checks passed
@mattmillerai
mattmillerai deleted the matt/be-8848-placeholder-decorations branch August 27, 2026 22:40
@huang47 huang47 added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026 — with ChatGPT Codex Connector
@huang47 huang47 removed the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026
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 risk:xhigh PR risk grade (advisory shadow check; grader-owned) size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants