Repository navigation
refactor: harden ECS migration boundaries - #15924
Merged
Merged
Conversation
| snapshot | status | changed pixels | | --- | --- | --- | | `tests/copyPaste.spec.ts-snapshots/copied-node-with-link-chromium-linux.png` | modified | 109917B -> 109917B | | `tests/copyPaste.spec.ts-snapshots/copied-widget-value-chromium-linux.png` | modified | 93456B -> 93467B | | `tests/copyPaste.spec.ts-snapshots/no-node-copied-chromium-linux.png` | modified | 93170B -> 93145B | | `tests/copyPaste.spec.ts-snapshots/paste-in-text-area-with-node-previously-copied-chromium-linux.png` | modified | 102006B -> 101981B | | `tests/execution.spec.ts-snapshots/execution-error-unconnected-slot-chromium-linux.png` | modified | 103275B -> 103258B | | `tests/interaction.spec.ts-snapshots/copied-link-chromium-linux.png` | modified | 93299B -> 93272B | | `tests/interaction.spec.ts-snapshots/legacy-click-node-select-chromium-linux.png` | modified | 94123B -> 94100B | | `tests/interaction.spec.ts-snapshots/moved-link-chromium-linux.png` | modified | 91681B -> 91655B | | `tests/interaction.spec.ts-snapshots/selected-node1-chromium-2x-linux.png` | modified | 96585B -> 95011B | | `tests/interaction.spec.ts-snapshots/selected-node1-chromium-linux.png` | modified | 94123B -> 94100B | | `tests/interaction.spec.ts-snapshots/selected-node2-chromium-2x-linux.png` | modified | 96599B -> 95024B | | `tests/interaction.spec.ts-snapshots/selected-node2-chromium-linux.png` | modified | 93990B -> 93926B | | `tests/interaction.spec.ts-snapshots/standard-click-node-select-chromium-linux.png` | modified | 94123B -> 94100B | | `tests/interaction.spec.ts-snapshots/standard-initial-chromium-linux.png` | modified | 93985B -> 93926B | | `tests/interaction.spec.ts-snapshots/standard-shift-wheel-pan-center-chromium-linux.png` | modified | 93985B -> 93926B | | `tests/interaction.spec.ts-snapshots/standard-shift-wheel-pan-left-chromium-linux.png` | modified | 93205B -> 93143B | | `tests/interaction.spec.ts-snapshots/standard-shift-wheel-pan-right-chromium-linux.png` | modified | 97818B -> 97747B | | `tests/interaction.spec.ts-snapshots/standard-space-drag-pan-chromium-linux.png` | modified | 87048B -> 86978B | | `tests/interaction.spec.ts-snapshots/text-encode-toggled-back-open-chromium-linux.png` | modified | 93170B -> 93145B | | `tests/interaction.spec.ts-snapshots/text-encode-toggled-off-chromium-linux.png` | modified | 96689B -> 96667B | | `tests/nodeSearchBox.spec.ts-snapshots/added-node-no-connection-chromium-linux.png` | modified | 100212B -> 100181B | | `tests/widget.spec.ts-snapshots/ksampler-resized-min-width-chromium-linux.png` | modified | 86064B -> 86162B | Screenshot capture is not bit-deterministic; small pixel deltas are usually text rasterization noise. Confirm each rewrite corresponds to a test expected to change.
christian-byrne
added a commit
that referenced
this pull request
Aug 26, 2026
## Why The #15924 ECS renderer change correctly stopped mutating authoritative graph membership order, but foreground and background rendering now independently rebuild the same render order with `map(getNodeLayout) -> sort -> map`. ## Proof This deterministic baseline verifies both-layer redraw cost without noisy wall-clock timing: - 245 nodes: 490 layout reads and 2 full sorts - 500 nodes: 1,000 layout reads and 2 full sorts - 1,000 nodes: 2,000 layout reads and 2 full sorts ## Follow-up The safest first optimization is frame-local sharing through `LGraphCanvas.draw()`. A persistent revision cache is intentionally out of scope because reading graph/layout revision refs may expand reactive dependencies and requires a broader compatibility proof. ## Verification Focused tests, formatting, lint, full typecheck, and commit hooks pass. Related: #15977 --------- Co-authored-by: Alexander Brown <drjkl@comfy.org>
This was referenced Aug 29, 2026
christian-byrne
added a commit
that referenced
this pull request
Sep 1, 2026
extensionConfigureView Object.assign'd the extensions-namespaced/legacy payload directly onto the caller's live serialized node/graph object and handed that same object to onConfigure — an extension mutating its argument, or simply the namespaced payload being promoted onto it, polluted the caller's workflow JSON in place. That could desync ChangeTracker's modified-state diff right after opening a workflow, and re-promote a namespaced key to a top-level legacy field on a missing- node placeholder's next serialize. Shallow-clone the canonical object before assigning onto it, so the hook gets an isolated view and the caller's object is untouched. Updates a pre-existing test that asserted onConfigure receives the exact same object reference as the caller's serialized data. Addresses part of #15973. See discussion: #15924 (comment) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xi3nY5nfCCF56rLihZVvUt
christian-byrne
added a commit
that referenced
this pull request
Sep 1, 2026
extensionConfigureView Object.assign'd the extensions-namespaced/legacy payload directly onto the caller's live serialized node/graph object and handed that same object to onConfigure — an extension mutating its argument, or simply the namespaced payload being promoted onto it, polluted the caller's workflow JSON in place. That could desync ChangeTracker's modified-state diff right after opening a workflow, and re-promote a namespaced key to a top-level legacy field on a missing- node placeholder's next serialize. Shallow-clone the canonical object before assigning onto it, so the hook gets an isolated view and the caller's object is untouched. Updates a pre-existing test that asserted onConfigure receives the exact same object reference as the caller's serialized data. Addresses part of #15973. See discussion: #15924 (comment)
pull Bot
pushed a commit
to Penguinjanator/ComfyUI_frontend
that referenced
this pull request
Sep 1, 2026
Mask-editor saves now replace the node output instead of leaving the pre-edit clipspace image. Regression coverage reproduces the paste, edit, and reopen failure. <details><summary>Full context for agent readers</summary> ## Summary After a mask-editor upload succeeds, the saved image is written through a replacing store call so the output store and the `node.images` mirror advance together. The loader prefers `node.images[0]`, so leaving that mirror untouched reopened the pre-edit clipspace image. In Vue-nodes mode nothing else re-syncs it, because the legacy path (`onDrawBackground` to `updatePreviews`) only runs on the canvas renderer. ## Changes - Add `replaceNodeOutputImages`, which sets a node's output to exactly the given images and syncs `node.images`. - Call it from the mask-editor save. `animated`, `video` and the other media keys are parallel to the images they were produced with, so an editor that rewrites the image list wholesale must not inherit them from the previous execution. - Leave `setNodeOutputImages` merge semantics untouched, so the clipspace paste path (`ComfyApp.pasteFromClipspace`), where images can legitimately be an animated webp, is unchanged. ## Verification - `nodeOutputStore.test.ts` and `useMaskEditorSaver.test.ts`: passed. The new store test fails against the pre-fix code. - `pnpm typecheck`, `pnpm knip`: passed. - CI green at `4fb6318df9`. Checklist: Comfy-Org#15973 Claim and verification: Comfy-Org#15973 (comment) Original review: Comfy-Org#15924 (comment) Fixes Comfy-Org#16009 </details>
christian-byrne
added a commit
that referenced
this pull request
Sep 2, 2026
Mask-editor saves now replace the node output instead of leaving the pre-edit clipspace image. Regression coverage reproduces the paste, edit, and reopen failure. <details><summary>Full context for agent readers</summary> ## Summary After a mask-editor upload succeeds, the saved image is written through a replacing store call so the output store and the `node.images` mirror advance together. The loader prefers `node.images[0]`, so leaving that mirror untouched reopened the pre-edit clipspace image. In Vue-nodes mode nothing else re-syncs it, because the legacy path (`onDrawBackground` to `updatePreviews`) only runs on the canvas renderer. ## Changes - Add `replaceNodeOutputImages`, which sets a node's output to exactly the given images and syncs `node.images`. - Call it from the mask-editor save. `animated`, `video` and the other media keys are parallel to the images they were produced with, so an editor that rewrites the image list wholesale must not inherit them from the previous execution. - Leave `setNodeOutputImages` merge semantics untouched, so the clipspace paste path (`ComfyApp.pasteFromClipspace`), where images can legitimately be an animated webp, is unchanged. ## Verification - `nodeOutputStore.test.ts` and `useMaskEditorSaver.test.ts`: passed. The new store test fails against the pre-fix code. - `pnpm typecheck`, `pnpm knip`: passed. - CI green at `4fb6318df9`. Checklist: #15973 Claim and verification: #15973 (comment) Original review: #15924 (comment) Fixes #16009 </details>
pull Bot
pushed a commit
to Penguinjanator/ComfyUI_frontend
that referenced
this pull request
Sep 3, 2026
…g#16464) Partial replacements now keep unresolved missing-node warnings. Regression covered; focused checks green. <details><summary>Full context for agent readers</summary> ## Summary When several missing nodes share a type, one successful replacement previously marked the entire type complete. If a later replacement failed, the missing-node warning disappeared even though an unresolved placeholder remained. ## Changes - Track replacement failures by node type. - Return a type as replaced only when no node of that type failed. - Add a regression with two same-type placeholders where the first replacement succeeds and the second fails. ## Verification - Regression failed against unmodified `main`, with missing-node state cleared instead of retained. - `pnpm test:unit src/platform/nodeReplacement/useNodeReplacement.test.ts` — 43 passed. - `pnpm typecheck` — passed. - Focused format, lint, commit hooks, and pre-push `knip` — passed. ## Review Focus Confirm that a per-type failure prevents both pending-warning and rendered-state cleanup while fully successful types retain the existing cleanup behavior. Tracked checklist item: [missing-node replacement partial failures suppress per-node warnings](Comfy-Org#15973) Original review: Comfy-Org#15924 (comment) </details> <!-- authored-by:agent -->
christian-byrne
added a commit
that referenced
this pull request
Sep 3, 2026
PrimitiveNode now keeps its serialized widget value and control mode after reload. Regression coverage reproduces the stale-target overwrite, the reroute path, and a cross-type leak. <details><summary>Full context for agent readers</summary> ## Summary Workflow loading creates a PrimitiveNode widget after node configuration, so the target widget copy overwrote the primitive's serialized value. The control widget had the same symptom from a different cause: the restore read `widgetValueStore`, which `LGraphNode.configure` clears in its own `finally` before `_createWidget` ever runs, so `control_after_generate` always fell back to `fixed`. ## Changes - Capture the serialized `widgets_values` and output type in `onConfigure`, chaining to `super` so handlers installed on `LGraphNode.prototype` still run. - Reapply index 0 after the target widget copy, including the asset-widget path, and consume the capture once the widget is built rather than on a lifecycle callback that several creation paths skip. - Bind the capture to the serialized output type, so a value cannot land on a widget of a different type and reach the backend through `applyToGraph`. - Restore the serialized control and filter values after widget creation. This covers both the `addValueControlWidgets` fallback and inputs that declare `control_after_generate`, which build their own control widget. Only values the control widget offers are written back. - Normalise `widgets_values` through `Array.from` the way base `configure` does, since custom nodes are documented to replace it with an array-like object. - Treat `recreateWidget` with no existing widgets as a first build. That is the only widget-creation path a Primitive feeding a Reroute has. - Remove `getPositionalRestoredWidgetValue`, which had no reachable caller left. ## Verification - `widgetInputs.test.ts`: 32 passed. Every new test was run against the pre-fix code first and fails there. - `pnpm typecheck`, `pnpm knip`, `pnpm lint` (0 errors): passed. - CI green at `ab37448da5`. ## Open question for review Restoration state lives on the `PrimitiveNode` instance rather than in `widgetValueStore`, which ADR 0003/0008 would prefer. The store mechanism could not work as written, because `LGraphNode.configure` clears the restoration entry before the primitive builds its widget. This needs a call: accept the instance field, or widen the restoration lifetime in the store and put it back there. Known gaps left out of scope: `widgets_values_named` is ignored when `LiteGraph.namedValuesRestore` is enabled, and a restored value is not range-checked against the rebuilt widget. Checklist item: #15973 Original review: #15924 (comment) Fixes #16007 </details>
This was referenced Sep 4, 2026
pull Bot
pushed a commit
to Penguinjanator/ComfyUI_frontend
that referenced
this pull request
Sep 8, 2026
…object (Comfy-Org#16956) Extension `configure()` hooks now receive a shallow copy of the serialized node/graph object instead of the caller's live reference, so a hook that reassigns or adds top-level fields (or the payload promotion itself) no longer pollutes the caller's workflow JSON. No serialization boundary is introduced inside `configure`: live `NodeInputSlot` instances and other callback value shapes pass through untouched. Split out of Comfy-Org#16508 at the reviewer's request. <details><summary>Full context for agent readers</summary> ## Summary `extensionConfigureView` `Object.assign`'d the namespaced/legacy extension payload directly onto the caller's live serialized object and handed that object to `onConfigure`. Any hook mutation of its argument, and the promotion of namespaced keys to top-level fields, leaked back into the caller's data. Flagged in review of Comfy-Org#15924 (Comfy-Org#15924 (comment)) and tracked in Comfy-Org#15973. ## Change `extensionConfigureView` now builds the view as `Object.assign({ ...canonical }, structuredClone(namespaced), structuredClone(legacy))` and hands that to `onConfigure`. This is a shallow copy of the canonical object: it isolates object identity and keeps promoted extension keys off the caller's object (the two consequences raised in the Comfy-Org#15924 review), without re-encoding anything. Nested values (`inputs`, `pos`, `properties`, `widgets_values`, ...) stay shared with the caller by design; in-place mutation of those still reaches the caller's data, and the migration doc says so and points extensions at `node.properties` / `graph.extra` for their own state. An earlier revision of this PR used a JSON round trip for a deep copy. That was dropped after review: `JSON.stringify` is a new failure and representation boundary in the middle of `configure` (circular references and BigInt throw; `undefined`, dates and class instances are rewritten), and `configure` previously guaranteed the callback saw the supported value shapes. The extension payloads themselves are still validated as JSON and `structuredClone`d as before; the `cloneSerialised` helper is gone. ## Tests - `extensionPersistence.test.ts` (new): `onConfigure` receives a copy, not the caller's object, and top-level adds/reassigns/deletes on the view do not reach the caller (including `size` and `extensions`); a serialized object holding live slot instances configures without throwing and the hook sees the same `inputs` array and slot instance the caller passed; serialize does not promote namespaced keys to top-level fields; a missing-node placeholder stays free of promoted keys after `onConfigure` mutates its view. - `LGraph.serialise.test.ts`: the existing "passes the original serialized object" test now asserts the hook gets a copy and that a top-level field added by the hook is absent from the saved workflow. No test asserts JSON-derived shapes. Verified green for `src/lib/litegraph/src/extensionPersistence.test.ts src/lib/litegraph/src/LGraph.serialise.test.ts src/services/litegraphService.lateRegistration.test.ts` (28 tests), plus typecheck, lint and format. ## Provenance Extracted from Comfy-Org#16508 (head f210e61) in response to the request to split the configure-isolation fix from the coverage-only work. Comfy-Org#16508 keeps the dynamic-widget fix and the `getNodeOnPos` coverage. Sibling split: the `removeNode` `keep-values` fix. Addresses Comfy-Org#15973 (isolation for extension `configure()`). </details> <!-- authored-by:agent w3-w29 --> --------- Co-authored-by: Amp <amp@ampcode.com>
This was referenced Sep 17, 2026
Closed
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Main-targeted copy of #15786, preserving the complete ECS migration stack while incorporating current
main.Changes
Review Focus
Supersedes the review target of #15786 with a PR directly against
main.Verification: 241 focused Vitest tests, ESLint, application and browser typechecks, formatting,
knip, and diff checks pass.