From 8e8dd7167308f208b2bf51dc74818f09be724ccb Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 21:39:30 -0700 Subject: [PATCH 1/5] test(autogrow): grown slots and their links survive a round-trip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ECS 1.53 Area 4 asks that an autogrow node keep its grown inputs and their wires across a reload. Commit 9594ad18b2 fixed autogrow links dropping on load; nothing asserted it. Uses the ByteDance reference-image fixture and objectInfo injection that subgraphConvertAutogrowInputs.spec.ts already uses — it is the only autogrow node available to the e2e backend. The test connects a third image first, growing the group past what the fixture stores on disk. Without that step a round-trip that simply re-read the original file would match. Link origins are compared alongside slot names because a group rebuilt with its slots but without its wires renders almost identically. --- .../tests/autogrowInputPersistence.spec.ts | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 browser_tests/tests/autogrowInputPersistence.spec.ts diff --git a/browser_tests/tests/autogrowInputPersistence.spec.ts b/browser_tests/tests/autogrowInputPersistence.spec.ts new file mode 100644 index 00000000000..58c934caa11 --- /dev/null +++ b/browser_tests/tests/autogrowInputPersistence.spec.ts @@ -0,0 +1,82 @@ +import { + comfyExpect as expect, + comfyPageFixture as baseTest +} from '@e2e/fixtures/ComfyPage' +import { + BYTEDANCE_REFERENCE_NODE_TYPE, + REFERENCE_IMAGES_PREFIX, + byteDanceReferenceNodeDef +} from '@e2e/fixtures/data/byteDanceReferenceNodeDef' +import { + getConnectedInputs, + getInputNames +} from '@e2e/fixtures/utils/nodeInputLinks' +import { routeObjectInfoFromSetupApi } from '@e2e/fixtures/utils/objectInfo' + +const REFERENCE_NODE_ID = '26' +const IMAGE_1 = `${REFERENCE_IMAGES_PREFIX}image_1` +const IMAGE_2 = `${REFERENCE_IMAGES_PREFIX}image_2` +const IMAGE_3 = `${REFERENCE_IMAGES_PREFIX}image_3` +const IMAGE_4 = `${REFERENCE_IMAGES_PREFIX}image_4` + +const test = baseTest.extend({ + page: async ({ page }, use) => { + const unrouteObjectInfo = await routeObjectInfoFromSetupApi( + page, + (objectInfo) => { + objectInfo[BYTEDANCE_REFERENCE_NODE_TYPE] = byteDanceReferenceNodeDef + } + ) + try { + await use(page) + } finally { + await unrouteObjectInfo() + } + } +}) + +/** + * An autogrow input group appends an empty slot as soon as its last one is + * connected, so the slot count on disk is always one behind what the user sees. + * Reloading has to rebuild the grown slots and reattach their links; a reload + * that keeps the slots but drops the wires renders almost identically. + */ +test.describe('Autogrow input persistence', { tag: '@node' }, () => { + test.beforeEach(async ({ comfyPage }) => { + await comfyPage.workflow.loadWorkflow('subgraphs/autogrow-reference-images') + }) + + test('grown slots and their links survive a serialize round-trip', async ({ + comfyPage + }) => { + const connected = () => + getConnectedInputs(comfyPage, REFERENCE_NODE_ID, REFERENCE_IMAGES_PREFIX) + const slotNames = () => + getInputNames(comfyPage, REFERENCE_NODE_ID, REFERENCE_IMAGES_PREFIX) + + await expect.poll(connected).toEqual([ + { name: IMAGE_1, originNodeId: '18' }, + { name: IMAGE_2, originNodeId: '19' } + ]) + await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3]) + + // Grow the group past what the fixture stores on disk. Without this the + // round-trip could simply be re-reading the original file and still match. + const loadImage = await comfyPage.nodeOps.getNodeRefById('18') + const referenceNode = + await comfyPage.nodeOps.getNodeRefById(REFERENCE_NODE_ID) + await loadImage.connectOutput(0, referenceNode, 2) + await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) + + const connectedBefore = await connected() + expect(connectedBefore).toHaveLength(3) + + const serialized = await comfyPage.workflow.getExportedWorkflow() + await comfyPage.workflow.loadGraphData(serialized) + + // Slot names alone cannot tell a rebuilt-but-unwired group from a restored + // one, so the link origins are compared as well. + await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) + await expect.poll(connected).toEqual(connectedBefore) + }) +}) From eda23dcbbfc9d33a7f0ff95726cc6e8e6e7d635b Mon Sep 17 00:00:00 2001 From: Amp Date: Sat, 12 Sep 2026 06:15:01 +0000 Subject: [PATCH 2/5] test: strengthen autogrow persistence assertions Amp-Thread-ID: https://ampcode.com/threads/T-01a09436-7f44-75c8-8b68-ba9288bbd2de --- .../tests/autogrowInputPersistence.spec.ts | 82 ------------------ .../links/autogrowInputPersistence.spec.ts | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 82 deletions(-) delete mode 100644 browser_tests/tests/autogrowInputPersistence.spec.ts create mode 100644 browser_tests/tests/links/autogrowInputPersistence.spec.ts diff --git a/browser_tests/tests/autogrowInputPersistence.spec.ts b/browser_tests/tests/autogrowInputPersistence.spec.ts deleted file mode 100644 index 58c934caa11..00000000000 --- a/browser_tests/tests/autogrowInputPersistence.spec.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - comfyExpect as expect, - comfyPageFixture as baseTest -} from '@e2e/fixtures/ComfyPage' -import { - BYTEDANCE_REFERENCE_NODE_TYPE, - REFERENCE_IMAGES_PREFIX, - byteDanceReferenceNodeDef -} from '@e2e/fixtures/data/byteDanceReferenceNodeDef' -import { - getConnectedInputs, - getInputNames -} from '@e2e/fixtures/utils/nodeInputLinks' -import { routeObjectInfoFromSetupApi } from '@e2e/fixtures/utils/objectInfo' - -const REFERENCE_NODE_ID = '26' -const IMAGE_1 = `${REFERENCE_IMAGES_PREFIX}image_1` -const IMAGE_2 = `${REFERENCE_IMAGES_PREFIX}image_2` -const IMAGE_3 = `${REFERENCE_IMAGES_PREFIX}image_3` -const IMAGE_4 = `${REFERENCE_IMAGES_PREFIX}image_4` - -const test = baseTest.extend({ - page: async ({ page }, use) => { - const unrouteObjectInfo = await routeObjectInfoFromSetupApi( - page, - (objectInfo) => { - objectInfo[BYTEDANCE_REFERENCE_NODE_TYPE] = byteDanceReferenceNodeDef - } - ) - try { - await use(page) - } finally { - await unrouteObjectInfo() - } - } -}) - -/** - * An autogrow input group appends an empty slot as soon as its last one is - * connected, so the slot count on disk is always one behind what the user sees. - * Reloading has to rebuild the grown slots and reattach their links; a reload - * that keeps the slots but drops the wires renders almost identically. - */ -test.describe('Autogrow input persistence', { tag: '@node' }, () => { - test.beforeEach(async ({ comfyPage }) => { - await comfyPage.workflow.loadWorkflow('subgraphs/autogrow-reference-images') - }) - - test('grown slots and their links survive a serialize round-trip', async ({ - comfyPage - }) => { - const connected = () => - getConnectedInputs(comfyPage, REFERENCE_NODE_ID, REFERENCE_IMAGES_PREFIX) - const slotNames = () => - getInputNames(comfyPage, REFERENCE_NODE_ID, REFERENCE_IMAGES_PREFIX) - - await expect.poll(connected).toEqual([ - { name: IMAGE_1, originNodeId: '18' }, - { name: IMAGE_2, originNodeId: '19' } - ]) - await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3]) - - // Grow the group past what the fixture stores on disk. Without this the - // round-trip could simply be re-reading the original file and still match. - const loadImage = await comfyPage.nodeOps.getNodeRefById('18') - const referenceNode = - await comfyPage.nodeOps.getNodeRefById(REFERENCE_NODE_ID) - await loadImage.connectOutput(0, referenceNode, 2) - await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) - - const connectedBefore = await connected() - expect(connectedBefore).toHaveLength(3) - - const serialized = await comfyPage.workflow.getExportedWorkflow() - await comfyPage.workflow.loadGraphData(serialized) - - // Slot names alone cannot tell a rebuilt-but-unwired group from a restored - // one, so the link origins are compared as well. - await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) - await expect.poll(connected).toEqual(connectedBefore) - }) -}) diff --git a/browser_tests/tests/links/autogrowInputPersistence.spec.ts b/browser_tests/tests/links/autogrowInputPersistence.spec.ts new file mode 100644 index 00000000000..797472f8896 --- /dev/null +++ b/browser_tests/tests/links/autogrowInputPersistence.spec.ts @@ -0,0 +1,86 @@ +import { + comfyExpect as expect, + comfyPageFixture as baseTest +} from '@e2e/fixtures/ComfyPage' +import { + BYTEDANCE_REFERENCE_NODE_TYPE, + REFERENCE_IMAGES_PREFIX, + byteDanceReferenceNodeDef +} from '@e2e/fixtures/data/byteDanceReferenceNodeDef' +import { + getConnectedInputs, + getInputNames +} from '@e2e/fixtures/utils/nodeInputLinks' +import { routeObjectInfoFromSetupApi } from '@e2e/fixtures/utils/objectInfo' + +const REFERENCE_NODE_ID = '26' +const IMAGE_1 = `${REFERENCE_IMAGES_PREFIX}image_1` +const IMAGE_2 = `${REFERENCE_IMAGES_PREFIX}image_2` +const IMAGE_3 = `${REFERENCE_IMAGES_PREFIX}image_3` +const IMAGE_4 = `${REFERENCE_IMAGES_PREFIX}image_4` + +const test = baseTest.extend({ + page: async ({ page }, use) => { + const unrouteObjectInfo = await routeObjectInfoFromSetupApi( + page, + (objectInfo) => { + objectInfo[BYTEDANCE_REFERENCE_NODE_TYPE] = byteDanceReferenceNodeDef + } + ) + try { + await use(page) + } finally { + await unrouteObjectInfo() + } + } +}) + +test.describe( + 'Autogrow input persistence', + { tag: ['@canvas', '@node'] }, + () => { + test.beforeEach(async ({ comfyPage }) => { + await comfyPage.workflow.loadWorkflow( + 'subgraphs/autogrow-reference-images' + ) + }) + + test('grown slots and their links survive a serialize round-trip', async ({ + comfyPage + }) => { + const connected = () => + getConnectedInputs( + comfyPage, + REFERENCE_NODE_ID, + REFERENCE_IMAGES_PREFIX + ) + const slotNames = () => + getInputNames(comfyPage, REFERENCE_NODE_ID, REFERENCE_IMAGES_PREFIX) + + const initialConnections = [ + { name: IMAGE_1, originNodeId: '18' }, + { name: IMAGE_2, originNodeId: '19' } + ] + const grownConnections = [ + ...initialConnections, + { name: IMAGE_3, originNodeId: '18' } + ] + + await expect.poll(connected).toEqual(initialConnections) + await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3]) + + const loadImage = await comfyPage.nodeOps.getNodeRefById('18') + const referenceNode = + await comfyPage.nodeOps.getNodeRefById(REFERENCE_NODE_ID) + await loadImage.connectOutput(0, referenceNode, 2) + await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) + await expect.poll(connected).toEqual(grownConnections) + + const serialized = await comfyPage.workflow.getExportedWorkflow() + await comfyPage.workflow.loadGraphData(serialized) + + await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) + await expect.poll(connected).toEqual(grownConnections) + }) + } +) From c7a9dd866401b0cb4ad86cfbb3db3642424f3b18 Mon Sep 17 00:00:00 2001 From: christian-byrne Date: Sun, 20 Sep 2026 21:28:19 -0700 Subject: [PATCH 3/5] test: read the autogrow starting state from the fixture, not from memory This spec asserted the reference node starts with two links. It does not any more: `autogrow-reference-images.json` is shared, and #16897 added a third when it started covering link preservation on subgraph unpack. The pull request was approved and green, and would have turned `main` red. Its checks ran against a `main` whose fixture had two links, 370 commits ago, and have not run since. A green board records that it passed then. Rebased onto current `main` and adapted: three links present four slots, because autogrow keeps exactly one empty trailing slot; filling that slot grows the group to five. The property under test is unchanged - grown slots and their links survive a serialize round trip - only the arithmetic moved. Verified against the real fixture rather than by reasoning about it. Before this commit the case fails on the current fixture with `+ "originNodeId": "20"`, the link the spec did not know about; after it, it passes in 10.6s. --- .../links/autogrowInputPersistence.spec.ts | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/browser_tests/tests/links/autogrowInputPersistence.spec.ts b/browser_tests/tests/links/autogrowInputPersistence.spec.ts index 797472f8896..4ddf7b1cf39 100644 --- a/browser_tests/tests/links/autogrowInputPersistence.spec.ts +++ b/browser_tests/tests/links/autogrowInputPersistence.spec.ts @@ -18,6 +18,7 @@ const IMAGE_1 = `${REFERENCE_IMAGES_PREFIX}image_1` const IMAGE_2 = `${REFERENCE_IMAGES_PREFIX}image_2` const IMAGE_3 = `${REFERENCE_IMAGES_PREFIX}image_3` const IMAGE_4 = `${REFERENCE_IMAGES_PREFIX}image_4` +const IMAGE_5 = `${REFERENCE_IMAGES_PREFIX}image_5` const test = baseTest.extend({ page: async ({ page }, use) => { @@ -57,29 +58,42 @@ test.describe( const slotNames = () => getInputNames(comfyPage, REFERENCE_NODE_ID, REFERENCE_IMAGES_PREFIX) + // The three links are the fixture's, not this spec's. #16897 added the + // third when it started covering link preservation on subgraph unpack, + // and the fixture is shared. Read the starting state from it rather than + // restating it: an earlier revision of this spec hard-coded two links and + // went red the moment the fixture grew a third. const initialConnections = [ { name: IMAGE_1, originNodeId: '18' }, - { name: IMAGE_2, originNodeId: '19' } + { name: IMAGE_2, originNodeId: '19' }, + { name: IMAGE_3, originNodeId: '20' } ] const grownConnections = [ ...initialConnections, - { name: IMAGE_3, originNodeId: '18' } + { name: IMAGE_4, originNodeId: '18' } ] + // Autogrow keeps exactly one empty trailing slot, so three links present + // four slots. await expect.poll(connected).toEqual(initialConnections) - await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3]) + await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) const loadImage = await comfyPage.nodeOps.getNodeRefById('18') const referenceNode = await comfyPage.nodeOps.getNodeRefById(REFERENCE_NODE_ID) - await loadImage.connectOutput(0, referenceNode, 2) - await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) + // Fill the empty trailing slot; the group must grow one more. + await loadImage.connectOutput(0, referenceNode, 3) + await expect + .poll(slotNames) + .toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4, IMAGE_5]) await expect.poll(connected).toEqual(grownConnections) const serialized = await comfyPage.workflow.getExportedWorkflow() await comfyPage.workflow.loadGraphData(serialized) - await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) + await expect + .poll(slotNames) + .toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4, IMAGE_5]) await expect.poll(connected).toEqual(grownConnections) }) } From a260fdc42dafe096ff616d447f1cfc7c774b8b05 Mon Sep 17 00:00:00 2001 From: christian-byrne Date: Sun, 20 Sep 2026 21:49:30 -0700 Subject: [PATCH 4/5] test: derive the autogrow baseline instead of restating the fixture Addresses both CodeRabbit findings, and the second one is the better version of the fix I pushed before it. My previous commit updated the hard-coded expectations from two links to three. That fixed the symptom. The spec still restated the shared workflow's contents, so it would break again the next time that workflow gains a link - which is exactly how it broke the first time, and the failure reads as a product regression rather than a stale expectation. It now reads the starting state and asserts the delta: the group ends in exactly one empty slot, filling that slot grows it by one, and the grown slot and its link survive a serialize round trip. Nothing in the spec names how many links the fixture happens to carry. Demonstrated rather than argued. With the fixture's third link removed - the state it had before #16897 - the spec passes unchanged, 1 passed in 5.7s; with the link restored it passes unchanged, 1 passed in 10.7s. The version this replaces fails on one of those two. Free-standing constants and helpers moved out of the spec per browser_tests/README.md: `readAutogrowInputGroup` joins its two readers in `nodeInputLinks.ts`, and the workflow name and node id join the node definition they belong to. The spec is now imports, the Playwright fixture, and one test. The `baseTest.extend` wrapper stays. It is Playwright's own API and the established shape for routing `object_info` in this suite, including in `subgraphConvertAutogrowInputs.spec.ts` against the same workflow. --- .../data/byteDanceReferenceNodeDef.ts | 6 + .../fixtures/utils/nodeInputLinks.ts | 39 +++++++ .../links/autogrowInputPersistence.spec.ts | 109 ++++++++++-------- 3 files changed, 103 insertions(+), 51 deletions(-) diff --git a/browser_tests/fixtures/data/byteDanceReferenceNodeDef.ts b/browser_tests/fixtures/data/byteDanceReferenceNodeDef.ts index b625a88dd95..15b4d0b80b4 100644 --- a/browser_tests/fixtures/data/byteDanceReferenceNodeDef.ts +++ b/browser_tests/fixtures/data/byteDanceReferenceNodeDef.ts @@ -4,6 +4,12 @@ export const BYTEDANCE_REFERENCE_NODE_TYPE = 'ByteDance2ReferenceNode' export const REFERENCE_IMAGES_PREFIX = 'model.reference_images.' +/** The workflow fixture that exercises this node's autogrow input group. */ +export const AUTOGROW_REFERENCE_WORKFLOW = 'subgraphs/autogrow-reference-images' + +/** Id of the reference node inside `AUTOGROW_REFERENCE_WORKFLOW`. */ +export const AUTOGROW_REFERENCE_NODE_ID = '26' + function ordinalNames(prefix: string, count: number): string[] { return Array.from({ length: count }, (_, index) => `${prefix}_${index + 1}`) } diff --git a/browser_tests/fixtures/utils/nodeInputLinks.ts b/browser_tests/fixtures/utils/nodeInputLinks.ts index 90f37bbf759..54d3ce6add9 100644 --- a/browser_tests/fixtures/utils/nodeInputLinks.ts +++ b/browser_tests/fixtures/utils/nodeInputLinks.ts @@ -55,3 +55,42 @@ export async function getConnectedInputs( { nodeId: toNodeId(nodeId), namePrefix } ) } + +export interface AutogrowInputGroup { + /** Slot names in the group, in order, including the empty trailing slot. */ + slotNames: string[] + /** Connected slots, in order, with the node each link originates from. */ + connections: ConnectedInput[] + /** + * Index of the empty trailing slot autogrow maintains, which is also the + * count of connected slots. + */ + trailingSlotIndex: number +} + +/** + * The current state of an autogrow input group, read from the graph. + * + * Exists so a test can describe what it is exercising - "fill the trailing + * slot, expect one more" - instead of hard-coding the workflow fixture's + * contents. A spec that restates those contents breaks the next time the + * fixture gains a link, and the failure looks like a product regression rather + * than a stale expectation. That is not hypothetical: it is how + * `autogrowInputPersistence.spec.ts` came to assert two links against a fixture + * that had grown to three. + */ +export async function readAutogrowInputGroup( + comfyPage: ComfyPage, + nodeId: string, + namePrefix: string +): Promise { + const [slotNames, connections] = await Promise.all([ + getInputNames(comfyPage, nodeId, namePrefix), + getConnectedInputs(comfyPage, nodeId, namePrefix) + ]) + return { + slotNames, + connections, + trailingSlotIndex: connections.length + } +} diff --git a/browser_tests/tests/links/autogrowInputPersistence.spec.ts b/browser_tests/tests/links/autogrowInputPersistence.spec.ts index 4ddf7b1cf39..96332d89a23 100644 --- a/browser_tests/tests/links/autogrowInputPersistence.spec.ts +++ b/browser_tests/tests/links/autogrowInputPersistence.spec.ts @@ -3,23 +3,15 @@ import { comfyPageFixture as baseTest } from '@e2e/fixtures/ComfyPage' import { + AUTOGROW_REFERENCE_NODE_ID, + AUTOGROW_REFERENCE_WORKFLOW, BYTEDANCE_REFERENCE_NODE_TYPE, REFERENCE_IMAGES_PREFIX, byteDanceReferenceNodeDef } from '@e2e/fixtures/data/byteDanceReferenceNodeDef' -import { - getConnectedInputs, - getInputNames -} from '@e2e/fixtures/utils/nodeInputLinks' +import { readAutogrowInputGroup } from '@e2e/fixtures/utils/nodeInputLinks' import { routeObjectInfoFromSetupApi } from '@e2e/fixtures/utils/objectInfo' -const REFERENCE_NODE_ID = '26' -const IMAGE_1 = `${REFERENCE_IMAGES_PREFIX}image_1` -const IMAGE_2 = `${REFERENCE_IMAGES_PREFIX}image_2` -const IMAGE_3 = `${REFERENCE_IMAGES_PREFIX}image_3` -const IMAGE_4 = `${REFERENCE_IMAGES_PREFIX}image_4` -const IMAGE_5 = `${REFERENCE_IMAGES_PREFIX}image_5` - const test = baseTest.extend({ page: async ({ page }, use) => { const unrouteObjectInfo = await routeObjectInfoFromSetupApi( @@ -41,60 +33,75 @@ test.describe( { tag: ['@canvas', '@node'] }, () => { test.beforeEach(async ({ comfyPage }) => { - await comfyPage.workflow.loadWorkflow( - 'subgraphs/autogrow-reference-images' - ) + await comfyPage.workflow.loadWorkflow(AUTOGROW_REFERENCE_WORKFLOW) }) test('grown slots and their links survive a serialize round-trip', async ({ comfyPage }) => { - const connected = () => - getConnectedInputs( - comfyPage, - REFERENCE_NODE_ID, - REFERENCE_IMAGES_PREFIX - ) - const slotNames = () => - getInputNames(comfyPage, REFERENCE_NODE_ID, REFERENCE_IMAGES_PREFIX) + // Read the starting state instead of restating it. The workflow is shared + // with the subgraph-unpack tests and has already gained a link once; a + // spec that hard-codes its contents fails the next time that happens, and + // the failure reads as a product regression rather than a stale + // expectation. + const before = await readAutogrowInputGroup( + comfyPage, + AUTOGROW_REFERENCE_NODE_ID, + REFERENCE_IMAGES_PREFIX + ) + + // The invariant under test, stated as one: autogrow keeps exactly one + // empty slot after the connected ones. + expect(before.connections.length).toBeGreaterThan(0) + expect(before.slotNames).toHaveLength(before.connections.length + 1) + + const loadImage = await comfyPage.nodeOps.getNodeRefById('18') + const referenceNode = await comfyPage.nodeOps.getNodeRefById( + AUTOGROW_REFERENCE_NODE_ID + ) + await loadImage.connectOutput(0, referenceNode, before.trailingSlotIndex) - // The three links are the fixture's, not this spec's. #16897 added the - // third when it started covering link preservation on subgraph unpack, - // and the fixture is shared. Read the starting state from it rather than - // restating it: an earlier revision of this spec hard-coded two links and - // went red the moment the fixture grew a third. - const initialConnections = [ - { name: IMAGE_1, originNodeId: '18' }, - { name: IMAGE_2, originNodeId: '19' }, - { name: IMAGE_3, originNodeId: '20' } - ] const grownConnections = [ - ...initialConnections, - { name: IMAGE_4, originNodeId: '18' } + ...before.connections, + { + name: before.slotNames[before.trailingSlotIndex], + originNodeId: '18' + } ] + const grownSlotCount = before.slotNames.length + 1 - // Autogrow keeps exactly one empty trailing slot, so three links present - // four slots. - await expect.poll(connected).toEqual(initialConnections) - await expect.poll(slotNames).toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4]) - - const loadImage = await comfyPage.nodeOps.getNodeRefById('18') - const referenceNode = - await comfyPage.nodeOps.getNodeRefById(REFERENCE_NODE_ID) - // Fill the empty trailing slot; the group must grow one more. - await loadImage.connectOutput(0, referenceNode, 3) await expect - .poll(slotNames) - .toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4, IMAGE_5]) - await expect.poll(connected).toEqual(grownConnections) + .poll(async () => { + const grown = await readAutogrowInputGroup( + comfyPage, + AUTOGROW_REFERENCE_NODE_ID, + REFERENCE_IMAGES_PREFIX + ) + return { + connections: grown.connections, + slotCount: grown.slotNames.length + } + }) + .toEqual({ + connections: grownConnections, + slotCount: grownSlotCount + }) const serialized = await comfyPage.workflow.getExportedWorkflow() await comfyPage.workflow.loadGraphData(serialized) - await expect - .poll(slotNames) - .toEqual([IMAGE_1, IMAGE_2, IMAGE_3, IMAGE_4, IMAGE_5]) - await expect.poll(connected).toEqual(grownConnections) + // The point of the test: the grown slot and its link are still there + // after a round trip, and the group still ends in exactly one empty slot. + const after = await readAutogrowInputGroup( + comfyPage, + AUTOGROW_REFERENCE_NODE_ID, + REFERENCE_IMAGES_PREFIX + ) + expect(after.connections).toEqual(grownConnections) + expect(after.slotNames).toHaveLength(grownSlotCount) + expect(after.slotNames.slice(0, before.slotNames.length)).toEqual( + before.slotNames + ) }) } ) From 0862ce5d3b0917f119aaece10a25612ab8151fb8 Mon Sep 17 00:00:00 2001 From: christian-byrne Date: Sun, 20 Sep 2026 22:21:39 -0700 Subject: [PATCH 5/5] test: export ConnectedInput, which AutogrowInputGroup already exposes The interface was module-private while an exported type returned it, so a caller could hold the value but not name it. Exporting it costs nothing and is what the exported shape already implies. --- browser_tests/fixtures/utils/nodeInputLinks.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser_tests/fixtures/utils/nodeInputLinks.ts b/browser_tests/fixtures/utils/nodeInputLinks.ts index 54d3ce6add9..5cea902d475 100644 --- a/browser_tests/fixtures/utils/nodeInputLinks.ts +++ b/browser_tests/fixtures/utils/nodeInputLinks.ts @@ -2,7 +2,8 @@ import { toNodeId } from '@/types/nodeId' import type { ComfyPage } from '@e2e/fixtures/ComfyPage' -interface ConnectedInput { +/** A connected input slot, paired with the node its link originates from. */ +export interface ConnectedInput { name: string originNodeId: string }