From 1502d3dfba104656f5cde605ff156fff33679864 Mon Sep 17 00:00:00 2001 From: Glary-Bot Date: Mon, 27 Apr 2026 21:52:27 +0000 Subject: [PATCH 1/2] test(subgraph): pin #10849 promoted-widget-value corruption with it.fails The Z-Image-Turbo regression introduced by #10849 corrupts promoted widget values on load when widgets_values comes from a pre-#10849 template (where that array was leftover noise rather than promoted-widget state). The fix on the unmerged inline-proxyWidgets-state branch distinguishes legacy 2-tuple proxyWidgets entries from new-format entries that carry inline state, and falls back to the source widget's value for the legacy shape. Two new vitest cases assert the user-visible symptom directly: 1. After configure() with a legacy 2-tuple proxyWidgets entry and a misaligned widgets_values, widget.value reflects the source default (42), not the legacy noise (999). 2. After configure() with a misaligned widgets_values whose length doesn't match the promoted-view count, the bound widget still reflects the source default, not the leaked legacy entry. Both use it.fails so CI stays green while the bug is present and flips to failing the moment the inline-proxyWidgets-state fix lands. When that happens, drop the .fails marker. Verified locally that removing .fails makes both tests fail with the expected positional-corruption errors (received 999 / 111, expected 42). Care taken not to assert serialize-side contracts that conflict with the existing 'preserves per-instance widget values after configure' / 'round- trips per-instance widget values' coverage in the same file. --- .../SubgraphNode.multiInstance.test.ts | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts b/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts index 66f2817cc36..df61078d208 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts @@ -258,4 +258,80 @@ describe('SubgraphNode multi-instance widget isolation', () => { const serialized = instance.serialize() expect(serialized.widgets_values).toBeUndefined() }) + + // Pins the open #10849 regression: the post-#10849 SubgraphNode.configure + // applies `widgets_values` positionally to promoted widgets, which corrupts + // pre-#10849 templates (e.g. Z-Image-Turbo) where `widgets_values` was + // leftover from older serialization and never represented promoted-widget + // values. The fix on the unmerged inline-proxyWidgets-state branch + // distinguishes legacy entries (plain 2-tuples) from new-format entries + // (entries carrying inline state), and falls back to the source widget's + // value for the legacy shape. + // + // Uses it.fails so the suite stays green while the bug is present and + // flips to failing when the fix lands. Drop the `.fails` marker then. + it.fails('falls back to source widget value when proxyWidgets is in legacy 2-tuple shape (regression for #10849)', () => { + const subgraph = createTestSubgraph({ + inputs: [{ name: 'value', type: 'number' }] + }) + + const SOURCE_DEFAULT = 42 + const LEGACY_NOISE = 999 + + const { node } = createNodeWithWidget('TestNode', SOURCE_DEFAULT) + subgraph.add(node) + subgraph.inputNode.slots[0].connect(node.inputs[0], node) + + const instance = createTestSubgraphNode(subgraph, { id: 801 }) + instance.configure({ + id: 801, + type: subgraph.id, + pos: [100, 100], + size: [200, 100], + inputs: [], + outputs: [], + mode: 0, + order: 0, + flags: {}, + properties: { proxyWidgets: [['-1', 'widget']] }, + widgets_values: [LEGACY_NOISE] + }) + + const widget = instance.widgets?.[0] + expect(widget?.value).toBe(SOURCE_DEFAULT) + expect(widget?.serializeValue?.(instance, 0)).toBe(SOURCE_DEFAULT) + }) + + it.fails('does not corrupt unbound promoted widgets when widgets_values length mismatches view count (regression for #10849)', () => { + const subgraph = createTestSubgraph({ + inputs: [{ name: 'value', type: 'number' }] + }) + + const SOURCE_DEFAULT = 42 + const LEGACY_NOISE_A = 111 + const LEGACY_NOISE_B = 222 + + const { node } = createNodeWithWidget('TestNode', SOURCE_DEFAULT) + subgraph.add(node) + subgraph.inputNode.slots[0].connect(node.inputs[0], node) + + const instance = createTestSubgraphNode(subgraph, { id: 802 }) + instance.configure({ + id: 802, + type: subgraph.id, + pos: [100, 100], + size: [200, 100], + inputs: [], + outputs: [], + mode: 0, + order: 0, + flags: {}, + properties: { proxyWidgets: [['-1', 'widget']] }, + widgets_values: [LEGACY_NOISE_A, LEGACY_NOISE_B] + }) + + const widget = instance.widgets?.[0] + expect(widget?.value).toBe(SOURCE_DEFAULT) + expect(widget?.value).not.toBe(LEGACY_NOISE_A) + }) }) From 76c6e6e57fb8f006c90454cce92994e77f4d6c11 Mon Sep 17 00:00:00 2001 From: Glary-Bot Date: Mon, 27 Apr 2026 22:06:33 +0000 Subject: [PATCH 2/2] test(subgraph): trim regression comment per CodeRabbit nitpick --- .../src/subgraph/SubgraphNode.multiInstance.test.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts b/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts index df61078d208..40480e588f5 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphNode.multiInstance.test.ts @@ -259,17 +259,8 @@ describe('SubgraphNode multi-instance widget isolation', () => { expect(serialized.widgets_values).toBeUndefined() }) - // Pins the open #10849 regression: the post-#10849 SubgraphNode.configure - // applies `widgets_values` positionally to promoted widgets, which corrupts - // pre-#10849 templates (e.g. Z-Image-Turbo) where `widgets_values` was - // leftover from older serialization and never represented promoted-widget - // values. The fix on the unmerged inline-proxyWidgets-state branch - // distinguishes legacy entries (plain 2-tuples) from new-format entries - // (entries carrying inline state), and falls back to the source widget's - // value for the legacy shape. - // - // Uses it.fails so the suite stays green while the bug is present and - // flips to failing when the fix lands. Drop the `.fails` marker then. + // it.fails pins the open #10849 SubgraphNode.configure regression on Main; + // drop the marker once the inline-proxyWidgets-state fix lands. it.fails('falls back to source widget value when proxyWidgets is in legacy 2-tuple shape (regression for #10849)', () => { const subgraph = createTestSubgraph({ inputs: [{ name: 'value', type: 'number' }]