Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Revert "test: add failing tests for the round-7 saved workflow regressions"

JPPhoto6fb8ca01da32
diff --git a/invokeai/frontend/web/src/features/nodes/store/util/reactFlowUtil.test.ts b/invokeai/frontend/web/src/features/nodes/store/util/reactFlowUtil.test.ts
index 29d0453d39..b70eda4bda 100644
--- a/invokeai/frontend/web/src/features/nodes/store/util/reactFlowUtil.test.ts
+++ b/invokeai/frontend/web/src/features/nodes/store/util/reactFlowUtil.test.ts
@@ -20,20 +20,4 @@ describe('connectionToEdge', () => {
id: 'reactflow__edge-source-nodevalue-target-nodea',
});
});
-
- // `connectionToEdge` is the only edge constructor this editor has, and it is
- // used by reconnect and by fresh connection drags. Now that loop_linkage edges
- // load here, dragging one back onto the same handle must not silently turn it
- // into a data edge: webv2 infers the type from the handle names, and the
- // backend rejects a loop_linkage field wired by a default edge.
- it('creates a loop_linkage edge when both endpoints are loop linkage handles', () => {
- expect(
- connectionToEdge({
- source: 'for-node',
- sourceHandle: 'loop_linkage',
- target: 'for-return-node',
- targetHandle: 'loop_linkage',
- })
- ).toMatchObject({ type: 'loop_linkage' });
- });
});
diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.test.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.test.ts
index e62df37a30..ea772a16bf 100644
--- a/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.test.ts
+++ b/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.test.ts
@@ -376,32 +376,4 @@ describe('buildNodesGraph', () => {
const graphNode = graph.nodes['img_resize-1'] as Record<string, unknown> | undefined;
expect(graphNode?.metadata).toBeUndefined();
});
-
- // Loading a webv2 for-loop workflow now works, but the run graph drops the
- // linkage: `buildNodesGraph` keeps only `type === 'default'` edges, and the
- // backend then refuses the run with "must have exactly one loop linkage".
- // The filter is edge-type based, so any two executable nodes demonstrate it.
- it('keeps loop_linkage edges in the run graph', () => {
- const source = buildNode(addTemplate);
- const target = buildNode(addTemplate);
- const linkage = { ...buildEdge(source.id, 'loop_linkage', target.id, 'loop_linkage'), type: 'loop_linkage' };
- const nextState = deepClone(nodesSliceConfig.getInitialState());
-
- nextState.nodes = [source, target];
- nextState.edges = [linkage as (typeof nextState.edges)[number]];
-
- const rootState = {
- gallery: { autoAddBoardId: 'none' },
- nodes: { future: [], past: [], present: nextState },
- } as never;
-
- const graph = buildNodesGraph(rootState, templates);
-
- expect(graph.edges).toContainEqual(
- expect.objectContaining({
- destination: { field: 'loop_linkage', node_id: target.id },
- source: { field: 'loop_linkage', node_id: source.id },
- })
- );
- });
});
diff --git a/invokeai/frontend/web/src/features/nodes/util/workflow/graphToWorkflow.test.ts b/invokeai/frontend/web/src/features/nodes/util/workflow/graphToWorkflow.test.ts
index 6bccc3023b..e692f7d071 100644
--- a/invokeai/frontend/web/src/features/nodes/util/workflow/graphToWorkflow.test.ts
+++ b/invokeai/frontend/web/src/features/nodes/util/workflow/graphToWorkflow.test.ts
@@ -207,28 +207,6 @@ describe('issue #9151: graphToWorkflow + zod validation roundtrip', () => {
expect(migrated.edges[0]?.type).toBe('loop_linkage');
});
-
- // The graph carries the edge type (`Literal["default", "loop_linkage"]`), and
- // this is the path used to load a workflow from an image that embedded only a
- // graph. Downgrading the linkage to a data edge produces a workflow that looks
- // intact but no longer loops, and that the backend rejects on the next run.
- it('preserves a loop_linkage edge taken from the graph', () => {
- const workflow = graphToWorkflow(
- {
- ...userFirstGraph,
- edges: [
- {
- destination: { field: 'loop_linkage', node_id: 'lora_selector:lXZkTpWiQQ' },
- source: { field: 'loop_linkage', node_id: 'core_metadata:sbmUlPbCpY' },
- type: 'loop_linkage',
- },
- ],
- } as NonNullableGraph,
- false
- );
-
- expect(workflow.edges[0]?.type).toBe('loop_linkage');
- });
});
const imageCollectionTemplate = {
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.browser.test.tsx
index 1db4290e47..7aff7d08a6 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.browser.test.tsx
@@ -86,22 +86,6 @@ const settle = async (ms: number) => {
});
};
-/** Waits until the request count stops changing, so an early window cannot read as a pass. */
-const settleUntilRequestsStop = async (getCount: () => number, sample = 25, maxSamples = 80) => {
- let previous = -1;
-
- for (let index = 0; index < maxSamples; index += 1) {
- const current = getCount();
-
- if (current === previous) {
- return;
- }
-
- previous = current;
- await settle(sample);
- }
-};
-
/**
* A child workflow that cannot be fetched has to settle: every node naming it
* ends at `error`, so the Invoke button can say why, and the requests stop.
@@ -437,61 +421,4 @@ describe('CallSavedWorkflowSyncRuntime with an unreachable child workflow', () =
expect(attempts.filter((id) => id === MISSING_WORKFLOW_ID)).toHaveLength(2);
expect(readStatuses(readGraph())).toEqual(['ready']);
});
-
- /**
- * One invalidation refreshes one shared cache entry, so it costs one request
- * however many nodes name that workflow. Selecting the workflow through the
- * picker arms a per-node retry, and a node that then skips its fetch (the
- * entry is already warm) keeps that authorization. An invalidation whose
- * refetch then fails lets every such node spend its stale authorization, one
- * doomed request each.
- */
- it('refetches an invalidated workflow once for nodes that selected it through the picker', async () => {
- const SHARED_WORKFLOW_ID = 'shared-workflow';
- let isAvailable = true;
-
- getLibraryWorkflowRecordMock.mockImplementation(
- () =>
- new Promise((resolve, reject) => {
- setTimeout(() => {
- if (isAvailable) {
- resolve({ name: 'Child', workflow: { edges: [], nodes: [] }, workflow_id: SHARED_WORKFLOW_ID });
- return;
- }
-
- reject(new Error('not found'));
- }, 10);
- })
- );
-
- const { readGraph, updateGraph } = await mountWith([
- buildCallNode('call-1', ''),
- buildCallNode('call-2', ''),
- buildCallNode('call-3', ''),
- ]);
-
- await settle(60);
-
- for (const nodeId of ['call-1', 'call-2', 'call-3']) {
- updateGraph(
- projectGraphReducer(readGraph(), {
- fieldName: 'workflow_id',
- nodeId,
- type: 'setFieldValue',
- value: SHARED_WORKFLOW_ID,
- })
- );
- await settle(60);
- }
-
- const callsBeforeInvalidation = getLibraryWorkflowRecordMock.mock.calls.length;
-
- isAvailable = false;
- invalidateWorkflowLibraryCache(SHARED_WORKFLOW_ID);
- // Poll to quiescence rather than trusting a fixed window: the failure here
- // is extra requests, so a window that expired early would read as a pass.
- await settleUntilRequestsStop(() => getLibraryWorkflowRecordMock.mock.calls.length);
-
- expect(getLibraryWorkflowRecordMock.mock.calls.length - callsBeforeInvalidation).toBe(1);
- });
});
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
index 77217618d6..67a3859501 100644
--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
@@ -3497,9 +3497,7 @@ describe('workbenchReducer Phase 5 generation flow', () => {
// wrong reason.
expect(submission).toMatchObject({ kind: 'workflow' });
expect(submission).not.toHaveProperty('workflow');
- expect(
- nextState.notifications.find((notification) => notification.title === 'Workflow metadata omitted')
- ).toMatchObject({
+ expect(nextState.notifications[0]).toMatchObject({
kind: 'info',
message: 'Workflow metadata was omitted because the workflow contains multiple workflow_return nodes.',
messageKey: 'workflowLibrary.workflowMetadataOmittedBody',
@@ -3507,12 +3505,6 @@ describe('workbenchReducer Phase 5 generation flow', () => {
titleKey: 'workflowLibrary.workflowMetadataOmitted',
});
- // The omitted-metadata notice is additional information about the run, not
- // a replacement for it: the run was queued, so the queued notification has
- // to be recorded too. `category: 'enqueue'` is also what lets the toast
- // policy honour the user's "notify when queued" preference.
- expect(nextState.notifications.filter((notification) => notification.category === 'enqueue')).toHaveLength(1);
-
const repeatedState = submitWorkflow(nextState);
expect(