From b699970d98ce6239df3858c536f1141c9873d924 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 17 Oct 2026 05:36:51 -0700 Subject: [PATCH 1/4] fix(agent-crdt): connect a dangling link when its endpoint arrives A link can reach the follower before the node it names. The follower declines to connect it, which is correct -- `connectLink` answers `unresolved` rather than inventing an endpoint. The defect is that nothing ever retries: `applyFrame` sweeps the document's links incident to a node it just materialized only when `upsertNode` answers `recreated`, so a node arriving for the FIRST time leaves its incident links permanently unconnected. The document says the two nodes are wired, the canvas shows no wire, and no later frame revisits it. That is canvas divergence that outlives the frame. Run the incident-link sweep for `created` as well as `recreated`. The frame-level isolation this PR originally set out to fix now holds on main on its own -- a frame carrying one unresolvable link already applies its good nodes. The new browser case asserts both halves, and only the second half is red without this change. Proofs: - liveGraphApplier.test.ts: "connects a dangling link when its endpoint arrives in a later frame" -- red on main, green here. - browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts: the black-box half per docs/harness-first-qa.md. Drives two frames through the real follower transport and asserts the wire on the rendered Vue node's own input slot and in the live graph's link table. Red on main (the slot stays unconnected for 30s after the endpoint lands), green here. Rebuilt onto main at 5bbc122a. The branch's nine commits -- including two merges of main -- collapsed to this one net change; the conflict was pure context drift against main's failure-counting in `applyFrame`, resolved by taking main's shape and applying only the condition change. The squash also retires the `cla-assistant` failure: the branch's first commit was authored as christian-byrne , an address linked to no GitHub account, so the CLA action could not resolve it to the signed id 72887196 and reported it as "not a GitHub user". --- .../agentFollowerLateEndpointLink.spec.ts | 302 ++++++++++++++++++ .../agent/crdt/liveGraphApplier.test.ts | 22 ++ .../extensions/agent/crdt/liveGraphApplier.ts | 2 +- 3 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts diff --git a/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts new file mode 100644 index 00000000000..1f4a5a00767 --- /dev/null +++ b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts @@ -0,0 +1,302 @@ +import { expect, mergeTests } from '@playwright/test' + +import type { WidgetCatalog, WorkflowJSON } from '@comfyorg/comfy-multi-player' +import type { ComfyNodeDef } from '@/schemas/nodeDefSchema' + +import { + BLANK_WORKFLOW, + agentTest, + bootAgentApp, + loadIntoBootWorkflow, + mockAgentTurnApi, + mockWorkflowPersistence +} from '@e2e/fixtures/agentPanelFixture' +import type { RecordedGraphOperation } from '@e2e/fixtures/data/agent/agentConversation' +import { HostDoc } from '@e2e/fixtures/agentConversationHostDoc' +import { AgentPanel } from '@e2e/fixtures/components/AgentPanel' +import { VueNodeHelpers } from '@e2e/fixtures/VueNodeHelpers' +import { webSocketFixture } from '@e2e/fixtures/ws' + +const test = mergeTests(agentTest, webSocketFixture) + +/** + * A link can reach the follower before the node it names. The follower + * correctly declines to connect it -- `connectLink` answers `unresolved` + * rather than inventing an endpoint -- and, as the first step below pins, + * declining one link does not cost the rest of the frame. + * + * The question this spec asks is what happens on the NEXT frame, when the + * missing endpoint finally arrives: the follower sweeps the document's links + * incident to a node it has just materialized, and if that sweep only runs for + * a node it is RE-creating, a first-time arrival leaves the link permanently + * unconnected. The document says the two nodes are wired; the canvas shows no + * wire; nothing ever retries. That is canvas divergence that outlives the + * frame, not a cosmetic miss. + * + * The unit suite (`liveGraphApplier.test.ts`, "connects a dangling link when + * its endpoint arrives in a later frame") pins the applier's own answer. This + * spec is the black-box half required by `docs/harness-first-qa.md`: it drives + * the two frames through the real follower transport onto the real canvas and + * asserts the wire the user is supposed to see, on the rendered Vue node's own + * input slot as well as in the live graph's link table. + * + * Invariants this exercises, all of which hold in both the red and green runs: + * the follower never writes the shared document (KEEP-ALIVE #6) -- every + * mutation here originates at the host; and an unresolvable link is answered + * by declining that one link, never by wiping or re-seeding the follower + * document (KEEP-ALIVE #13 / FORECLOSE #11) -- the good nodes sharing the + * frame with it land anyway, which is what the first assertion step pins. + * + * Carrier: https://github.com/Comfy-Org/ComfyUI_frontend/pull/16554 + */ + +const WORKFLOW_ID = 'c1d4e7fa-0000-4000-8000-000000000020' +const MESSAGE_ID = 'c1d4e7fa-0000-4000-8000-000000000021' +const THREAD_ID = 'c1d4e7fa-0000-4000-8000-000000000022' + +const SOURCE_TYPE = 'AgentLateEndpointSource' +const SINK_TYPE = 'AgentLateEndpointSink' + +// The link's target: present from the first frame. +const SINK_NODE_ID = 2 +// Rides the same frame as the dangling link and has nothing to do with it. +// Its arrival is what proves the frame was not dropped wholesale. +const BYSTANDER_NODE_ID = 4 +// Named by the link in frame A and only materialized by frame B. +const LATE_SOURCE_NODE_ID = 3 +const LINK_ID = 7 + +const nodeDefs: Record = { + [SOURCE_TYPE]: { + name: SOURCE_TYPE, + display_name: 'Agent Late Endpoint Source', + description: '', + category: 'test', + python_module: 'test', + output_node: false, + output: ['IMAGE'], + output_is_list: [false], + output_name: ['IMAGE'], + input: {}, + input_order: {} + }, + [SINK_TYPE]: { + name: SINK_TYPE, + display_name: 'Agent Late Endpoint Sink', + description: '', + category: 'test', + python_module: 'test', + output_node: true, + output: [], + output_is_list: [], + output_name: [], + input: { required: { image: ['IMAGE', {}] } }, + input_order: { required: ['image'] } + } +} + +const catalog: WidgetCatalog = { + types: { + [SOURCE_TYPE]: { widget_order: [] }, + [SINK_TYPE]: { widget_order: [] } + } +} + +function sinkNode(id: number, y: number) { + return { + id, + type: SINK_TYPE, + pos: [520, y] as [number, number], + size: [240, 60] as [number, number], + flags: {}, + order: 0, + mode: 0, + inputs: [{ name: 'image', type: 'IMAGE', link: null }], + outputs: [], + properties: {}, + widgets_values: [] + } +} + +const seed: WorkflowJSON = { + nodes: [sinkNode(SINK_NODE_ID, 120), sinkNode(BYSTANDER_NODE_ID, 320)], + links: [], + groups: [], + config: {}, + extra: {}, + version: 0.4 +} + +/** The endpoint frame A's link named, arriving for the FIRST time. */ +function lateSourceAdd(): RecordedGraphOperation { + return { + op: 'add_node', + node_id: LATE_SOURCE_NODE_ID, + class_type: SOURCE_TYPE, + pos: [120, 120], + node: { + id: LATE_SOURCE_NODE_ID, + type: SOURCE_TYPE, + pos: [120, 120], + size: [240, 60], + mode: 0, + flags: {}, + order: 1, + inputs: [], + outputs: [{ name: 'IMAGE', type: 'IMAGE', links: [LINK_ID] }], + properties: {}, + widgets_values: [] + } + } +} + +test.describe( + 'Agent follower on a link whose endpoint arrives in a later frame', + { tag: ['@cloud', '@agent', '@canvas', '@node'] }, + () => { + test.use({ connectWebSocketToServer: false }) + + test('connects the wire once the missing endpoint node materializes', async ({ + page, + getWebSocket + }) => { + test.setTimeout(90_000) + await page.setViewportSize({ width: 1920, height: 1280 }) + + await bootAgentApp(page, true, { + settings: { + 'Comfy.VueNodes.Enabled': true, + 'Comfy.Graph.CanvasInfo': false + }, + objectInfo: nodeDefs, + beforeNavigate: async (page) => { + await mockAgentTurnApi(page, { + message_id: MESSAGE_ID, + thread_id: THREAD_ID, + workflow_id: WORKFLOW_ID + }) + await mockWorkflowPersistence(page, WORKFLOW_ID) + } + }) + await loadIntoBootWorkflow(page, BLANK_WORKFLOW) + + const socket = await getWebSocket() + const outboundFrames: string[] = [] + socket.onMessage((message) => outboundFrames.push(String(message))) + + const vueNodes = new VueNodeHelpers(page) + const agentPanel = new AgentPanel(page) + + await test.step('bind the workflow so the follower subscribes', async () => { + await agentPanel.open() + await agentPanel.selectWorkflow() + await agentPanel.sendMessage('wire the source into the sink') + await expect + .poll(() => outboundFrames, { timeout: 15_000 }) + .toContainEqual(expect.stringContaining('doc_subscribe')) + }) + + const host = new HostDoc(WORKFLOW_ID, seed, catalog) + // Written into the host document BEFORE the first frame is cut and the + // returned frame deliberately discarded, so the dangling link rides the + // very same delta as the two good nodes instead of arriving alone. That + // is the frame shape the fix is about: one bad link in company. + host.replaceLink([ + LINK_ID, + LATE_SOURCE_NODE_ID, + 0, + SINK_NODE_ID, + 0, + 'IMAGE' + ]) + + const sink = vueNodes.getNodeLocator(String(SINK_NODE_ID)) + + await test.step('frame A carries one unresolvable link alongside good nodes: the good nodes still arrive', async () => { + for (const frame of host.initialSync()) + socket.send(JSON.stringify(frame)) + + await expect(sink).toBeVisible({ timeout: 30_000 }) + await expect( + vueNodes.getNodeLocator(String(BYSTANDER_NODE_ID)) + ).toBeVisible({ timeout: 30_000 }) + + // The link naming an absent node is declined on its own terms. Not a + // wipe, not a re-seed, not an invented endpoint -- just that one link + // missing, which is the defined partial-apply state. + await expect + .poll(() => + page.evaluate(() => window.app!.graph.nodes.length) + ) + .toBe(2) + expect( + await page.evaluate(() => window.app!.graph.links.size) + ).toBe(0) + }) + + await test.step('frame B materializes the missing endpoint for the first time', async () => { + socket.send(JSON.stringify(host.apply([lateSourceAdd()]))) + await expect( + vueNodes.getNodeLocator(String(LATE_SOURCE_NODE_ID)) + ).toBeVisible({ timeout: 30_000 }) + }) + + await test.step("the host's document says the two nodes are wired", () => { + // Read off `linksMap` rather than `project()`: the projection walks + // every map in the document and is not what is in question here. + expect(host.link(LINK_ID)).toEqual([ + LINK_ID, + LATE_SOURCE_NODE_ID, + 0, + SINK_NODE_ID, + 0, + 'IMAGE' + ]) + }) + + await test.step('and so does the canvas: the wire the user is supposed to see is there', async () => { + // The rendered Vue node's own input slot, read through the shared + // helper the link specs use. + await expect + .poll( + () => + vueNodes.isSlotConnected( + vueNodes.getInputSlotRow(String(SINK_NODE_ID), 0) + ), + { timeout: 30_000 } + ) + .toBe(true) + + // ...and the live graph's own link table agrees on both endpoints, + // so this is a real connection rather than a stale slot flag. + await expect + .poll(() => + page.evaluate(() => + [...window.app!.graph.links.values()].map((link) => ({ + origin: String(link.origin_id), + originSlot: link.origin_slot, + target: String(link.target_id), + targetSlot: link.target_slot, + type: link.type + })) + ) + ) + .toEqual([ + { + origin: String(LATE_SOURCE_NODE_ID), + originSlot: 0, + target: String(SINK_NODE_ID), + targetSlot: 0, + type: 'IMAGE' + } + ]) + }) + + await test.step('the follower never wrote the shared document (KEEP-ALIVE #6)', () => { + expect( + outboundFrames.filter((frame) => frame.includes('doc_ops')) + ).toEqual([]) + }) + }) + } +) diff --git a/src/workbench/extensions/agent/crdt/liveGraphApplier.test.ts b/src/workbench/extensions/agent/crdt/liveGraphApplier.test.ts index ec8de68d02d..4a451c64fc7 100644 --- a/src/workbench/extensions/agent/crdt/liveGraphApplier.test.ts +++ b/src/workbench/extensions/agent/crdt/liveGraphApplier.test.ts @@ -1768,6 +1768,28 @@ describe('LiveGraphApplier', () => { expect(reportError).not.toHaveBeenCalled() }) + it('connects a dangling link when its endpoint arrives in a later frame', () => { + const { graph, doc, applyCollected, applyEdit } = setup({ + nodes: [sourceNode(1), sinkNode(2)], + links: [] + }) + applyCollected() + + applyEdit(() => { + linksMap(doc).set('7', [7, 3, 0, 2, 0, 'IMAGE']) + }) + expect(graph.links.has(toLinkId(7))).toBe(false) + + applyEdit(() => { + nodesMap(doc).set('3', new Y.Map(Object.entries(sourceNode(3)))) + }) + + expect(graph.links.get(toLinkId(7))).toMatchObject({ + origin_id: toNodeId(3), + target_id: toNodeId(2) + }) + }) + it('removes a live link whose document entry now names a slot the node lacks', () => { const { graph, doc, applyCollected, applyEdit } = setup({ nodes: [sourceNode(1), sinkNode(2)], diff --git a/src/workbench/extensions/agent/crdt/liveGraphApplier.ts b/src/workbench/extensions/agent/crdt/liveGraphApplier.ts index daebfe4b2ce..89f0cd084e0 100644 --- a/src/workbench/extensions/agent/crdt/liveGraphApplier.ts +++ b/src/workbench/extensions/agent/crdt/liveGraphApplier.ts @@ -582,7 +582,7 @@ export class LiveGraphApplier { this.try(context, () => { const result = this.upsertNode(graph, doc, id, mode) if (result === 'created') created.push(toNodeId(id)) - if (result === 'recreated') { + if (result === 'created' || result === 'recreated') { for (const link of docLinksIncident(doc, id)) { this.connectLink(graph, doc, link) } From 22c94d5ee5d60d4e344d0acec304544720e40040 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 17 Oct 2026 12:40:31 +0000 Subject: [PATCH 2/4] [automated] Apply ESLint and Oxfmt fixes --- .../tests/agent/agentFollowerLateEndpointLink.spec.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts index 1f4a5a00767..5b339e7b947 100644 --- a/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts +++ b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts @@ -225,13 +225,9 @@ test.describe( // wipe, not a re-seed, not an invented endpoint -- just that one link // missing, which is the defined partial-apply state. await expect - .poll(() => - page.evaluate(() => window.app!.graph.nodes.length) - ) + .poll(() => page.evaluate(() => window.app!.graph.nodes.length)) .toBe(2) - expect( - await page.evaluate(() => window.app!.graph.links.size) - ).toBe(0) + expect(await page.evaluate(() => window.app!.graph.links.size)).toBe(0) }) await test.step('frame B materializes the missing endpoint for the first time', async () => { From d9a2f1960dd608ac325c22d658da63b4f4bab71b Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 17 Oct 2026 07:06:40 -0700 Subject: [PATCH 3/4] test(agent-crdt): drop the spec's comments per the repo guideline CodeRabbit flagged the explanatory JSDoc and inline comments on agentFollowerLateEndpointLink.spec.ts, citing AGENTS.md rule 6 and docs/guidance/engineering.md, which calls an added comment a blocking finding and asks for a rename, an extraction or a test instead. It is right, so the rationale moves to the PR description and the comments come out. Where a comment was carrying meaning, the remedy the guideline names is used rather than deletion alone: - the pre-first-frame link write is extracted as `putUnresolvableLinkIntoTheUpcomingFirstFrame(host)`, so the fact that it rides the upcoming delta is in the name; - `lateSourceAdd` becomes `firstArrivalOfTheLinksMissingEndpoint`; - the invariants stay readable because they were already in the `test.step` names, not in comments. No assertion changed. Re-verified at this tree: green with the fix, and red without it (sink input slot still unconnected after 30s). --- .../agentFollowerLateEndpointLink.spec.ts | 68 +++---------------- 1 file changed, 9 insertions(+), 59 deletions(-) diff --git a/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts index 5b339e7b947..ebf619f979a 100644 --- a/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts +++ b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts @@ -19,37 +19,6 @@ import { webSocketFixture } from '@e2e/fixtures/ws' const test = mergeTests(agentTest, webSocketFixture) -/** - * A link can reach the follower before the node it names. The follower - * correctly declines to connect it -- `connectLink` answers `unresolved` - * rather than inventing an endpoint -- and, as the first step below pins, - * declining one link does not cost the rest of the frame. - * - * The question this spec asks is what happens on the NEXT frame, when the - * missing endpoint finally arrives: the follower sweeps the document's links - * incident to a node it has just materialized, and if that sweep only runs for - * a node it is RE-creating, a first-time arrival leaves the link permanently - * unconnected. The document says the two nodes are wired; the canvas shows no - * wire; nothing ever retries. That is canvas divergence that outlives the - * frame, not a cosmetic miss. - * - * The unit suite (`liveGraphApplier.test.ts`, "connects a dangling link when - * its endpoint arrives in a later frame") pins the applier's own answer. This - * spec is the black-box half required by `docs/harness-first-qa.md`: it drives - * the two frames through the real follower transport onto the real canvas and - * asserts the wire the user is supposed to see, on the rendered Vue node's own - * input slot as well as in the live graph's link table. - * - * Invariants this exercises, all of which hold in both the red and green runs: - * the follower never writes the shared document (KEEP-ALIVE #6) -- every - * mutation here originates at the host; and an unresolvable link is answered - * by declining that one link, never by wiping or re-seeding the follower - * document (KEEP-ALIVE #13 / FORECLOSE #11) -- the good nodes sharing the - * frame with it land anyway, which is what the first assertion step pins. - * - * Carrier: https://github.com/Comfy-Org/ComfyUI_frontend/pull/16554 - */ - const WORKFLOW_ID = 'c1d4e7fa-0000-4000-8000-000000000020' const MESSAGE_ID = 'c1d4e7fa-0000-4000-8000-000000000021' const THREAD_ID = 'c1d4e7fa-0000-4000-8000-000000000022' @@ -57,12 +26,8 @@ const THREAD_ID = 'c1d4e7fa-0000-4000-8000-000000000022' const SOURCE_TYPE = 'AgentLateEndpointSource' const SINK_TYPE = 'AgentLateEndpointSink' -// The link's target: present from the first frame. const SINK_NODE_ID = 2 -// Rides the same frame as the dangling link and has nothing to do with it. -// Its arrival is what proves the frame was not dropped wholesale. const BYSTANDER_NODE_ID = 4 -// Named by the link in frame A and only materialized by frame B. const LATE_SOURCE_NODE_ID = 3 const LINK_ID = 7 @@ -127,8 +92,11 @@ const seed: WorkflowJSON = { version: 0.4 } -/** The endpoint frame A's link named, arriving for the FIRST time. */ -function lateSourceAdd(): RecordedGraphOperation { +function putUnresolvableLinkIntoTheUpcomingFirstFrame(host: HostDoc): void { + host.replaceLink([LINK_ID, LATE_SOURCE_NODE_ID, 0, SINK_NODE_ID, 0, 'IMAGE']) +} + +function firstArrivalOfTheLinksMissingEndpoint(): RecordedGraphOperation { return { op: 'add_node', node_id: LATE_SOURCE_NODE_ID, @@ -197,18 +165,7 @@ test.describe( }) const host = new HostDoc(WORKFLOW_ID, seed, catalog) - // Written into the host document BEFORE the first frame is cut and the - // returned frame deliberately discarded, so the dangling link rides the - // very same delta as the two good nodes instead of arriving alone. That - // is the frame shape the fix is about: one bad link in company. - host.replaceLink([ - LINK_ID, - LATE_SOURCE_NODE_ID, - 0, - SINK_NODE_ID, - 0, - 'IMAGE' - ]) + putUnresolvableLinkIntoTheUpcomingFirstFrame(host) const sink = vueNodes.getNodeLocator(String(SINK_NODE_ID)) @@ -221,9 +178,6 @@ test.describe( vueNodes.getNodeLocator(String(BYSTANDER_NODE_ID)) ).toBeVisible({ timeout: 30_000 }) - // The link naming an absent node is declined on its own terms. Not a - // wipe, not a re-seed, not an invented endpoint -- just that one link - // missing, which is the defined partial-apply state. await expect .poll(() => page.evaluate(() => window.app!.graph.nodes.length)) .toBe(2) @@ -231,15 +185,15 @@ test.describe( }) await test.step('frame B materializes the missing endpoint for the first time', async () => { - socket.send(JSON.stringify(host.apply([lateSourceAdd()]))) + socket.send( + JSON.stringify(host.apply([firstArrivalOfTheLinksMissingEndpoint()])) + ) await expect( vueNodes.getNodeLocator(String(LATE_SOURCE_NODE_ID)) ).toBeVisible({ timeout: 30_000 }) }) await test.step("the host's document says the two nodes are wired", () => { - // Read off `linksMap` rather than `project()`: the projection walks - // every map in the document and is not what is in question here. expect(host.link(LINK_ID)).toEqual([ LINK_ID, LATE_SOURCE_NODE_ID, @@ -251,8 +205,6 @@ test.describe( }) await test.step('and so does the canvas: the wire the user is supposed to see is there', async () => { - // The rendered Vue node's own input slot, read through the shared - // helper the link specs use. await expect .poll( () => @@ -263,8 +215,6 @@ test.describe( ) .toBe(true) - // ...and the live graph's own link table agrees on both endpoints, - // so this is a real connection rather than a stale slot flag. await expect .poll(() => page.evaluate(() => From 9710caa3d506bc5945d77c7f0c42e91631fee405 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 17 Oct 2026 07:31:22 -0700 Subject: [PATCH 4/4] test(agent-crdt): inline the spec's single-use setup CodeRabbit's path instruction for browser_tests says a spec holds tests and Playwright hooks, not free-standing setup helpers. The two helpers it names were introduced by the previous commit to satisfy the no-comments rule, so the two guidelines pulled against each other; CodeRabbit named the resolution itself, which is that single-use setup belongs beside the test. Both uses are now inline. Nothing is lost: the link write sits inside the step named for what that frame carries, and the add_node op sits inside the step named for the endpoint's first arrival, so the step names carry what the helper names did. Re-verified: green with the fix, red without it. --- .../agentFollowerLateEndpointLink.spec.ts | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts index ebf619f979a..87df96fe6c9 100644 --- a/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts +++ b/browser_tests/tests/agent/agentFollowerLateEndpointLink.spec.ts @@ -11,7 +11,6 @@ import { mockAgentTurnApi, mockWorkflowPersistence } from '@e2e/fixtures/agentPanelFixture' -import type { RecordedGraphOperation } from '@e2e/fixtures/data/agent/agentConversation' import { HostDoc } from '@e2e/fixtures/agentConversationHostDoc' import { AgentPanel } from '@e2e/fixtures/components/AgentPanel' import { VueNodeHelpers } from '@e2e/fixtures/VueNodeHelpers' @@ -92,32 +91,6 @@ const seed: WorkflowJSON = { version: 0.4 } -function putUnresolvableLinkIntoTheUpcomingFirstFrame(host: HostDoc): void { - host.replaceLink([LINK_ID, LATE_SOURCE_NODE_ID, 0, SINK_NODE_ID, 0, 'IMAGE']) -} - -function firstArrivalOfTheLinksMissingEndpoint(): RecordedGraphOperation { - return { - op: 'add_node', - node_id: LATE_SOURCE_NODE_ID, - class_type: SOURCE_TYPE, - pos: [120, 120], - node: { - id: LATE_SOURCE_NODE_ID, - type: SOURCE_TYPE, - pos: [120, 120], - size: [240, 60], - mode: 0, - flags: {}, - order: 1, - inputs: [], - outputs: [{ name: 'IMAGE', type: 'IMAGE', links: [LINK_ID] }], - properties: {}, - widgets_values: [] - } - } -} - test.describe( 'Agent follower on a link whose endpoint arrives in a later frame', { tag: ['@cloud', '@agent', '@canvas', '@node'] }, @@ -165,11 +138,17 @@ test.describe( }) const host = new HostDoc(WORKFLOW_ID, seed, catalog) - putUnresolvableLinkIntoTheUpcomingFirstFrame(host) - const sink = vueNodes.getNodeLocator(String(SINK_NODE_ID)) await test.step('frame A carries one unresolvable link alongside good nodes: the good nodes still arrive', async () => { + host.replaceLink([ + LINK_ID, + LATE_SOURCE_NODE_ID, + 0, + SINK_NODE_ID, + 0, + 'IMAGE' + ]) for (const frame of host.initialSync()) socket.send(JSON.stringify(frame)) @@ -186,7 +165,29 @@ test.describe( await test.step('frame B materializes the missing endpoint for the first time', async () => { socket.send( - JSON.stringify(host.apply([firstArrivalOfTheLinksMissingEndpoint()])) + JSON.stringify( + host.apply([ + { + op: 'add_node', + node_id: LATE_SOURCE_NODE_ID, + class_type: SOURCE_TYPE, + pos: [120, 120], + node: { + id: LATE_SOURCE_NODE_ID, + type: SOURCE_TYPE, + pos: [120, 120], + size: [240, 60], + mode: 0, + flags: {}, + order: 1, + inputs: [], + outputs: [{ name: 'IMAGE', type: 'IMAGE', links: [LINK_ID] }], + properties: {}, + widgets_values: [] + } + } + ]) + ) ) await expect( vueNodes.getNodeLocator(String(LATE_SOURCE_NODE_ID))