From f8fc962c2449f198330b6e44485d0cd7b875442f Mon Sep 17 00:00:00 2001 From: Vinh Trinh Date: Sat, 24 Oct 2026 03:34:30 -0400 Subject: [PATCH 1/3] fix(workspace): a compatibility answer only counts for the check that asked for it (BE-19373) --- .../useDeploymentCompatibility.test.ts | 70 +++++++++++++++++++ .../composables/useDeploymentCompatibility.ts | 8 ++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/platform/workspace/composables/useDeploymentCompatibility.test.ts b/src/platform/workspace/composables/useDeploymentCompatibility.test.ts index c4a1d26dc2a..397cfb87235 100644 --- a/src/platform/workspace/composables/useDeploymentCompatibility.test.ts +++ b/src/platform/workspace/composables/useDeploymentCompatibility.test.ts @@ -563,6 +563,76 @@ describe('useDeploymentCompatibility', () => { expect(markFor('dep-plain')).toEqual({ kind: 'runs' }) }) + it('keeps the newest answer when an older check of the same workflow answers last', async () => { + const answers: ((value: DeploymentCompatibility) => void)[] = [] + const checks: Promise[] = [] + vi.mocked(workspaceApi.checkDeploymentCompatibility).mockImplementation( + () => { + const check = new Promise((resolve) => { + answers.push(resolve) + }) + checks.push(check) + return check + } + ) + const { markFor } = setup() + + hoisted.rootGraph = graph({ type: 'KSampler' }) + useWorkflowStore().activeWorkflow = fromPartial({ + path: 'workflows/core-only.json' + }) + await nextTick() + hoisted.rootGraph = rgthreeWorkflow() + useWorkflowStore().activeWorkflow = fromPartial({ + path: 'workflows/rgthree.json' + }) + await nextTick() + expect(workspaceApi.checkDeploymentCompatibility).toHaveBeenCalledTimes(3) + + answers[2](answer) + await checks[2] + expect(markFor('dep-rgthree')).toEqual({ kind: 'runs' }) + + answers[0]({ + deployments: [ + { deployment_id: 'dep-rgthree', missing_node_types: [], unknown: true } + ], + cloud: { missing_node_types: [] } + }) + await checks[0] + + expect(markFor('dep-rgthree')).toEqual({ kind: 'runs' }) + }) + + it('shows no old marks when a workflow comes back and its new check fails', async () => { + const { markFor } = setup() + await vi.waitFor(() => + expect(markFor('dep-rgthree')).toEqual({ kind: 'runs' }) + ) + + hoisted.rootGraph = graph() + useWorkflowStore().activeWorkflow = fromPartial({ + path: 'workflows/empty.json' + }) + await nextTick() + expect(markFor('dep-rgthree')).toBeNull() + + const failure = Promise.reject(new Error('503')) + vi.mocked(workspaceApi.checkDeploymentCompatibility).mockReturnValueOnce( + failure + ) + hoisted.rootGraph = rgthreeWorkflow() + useWorkflowStore().activeWorkflow = fromPartial({ + path: 'workflows/rgthree.json' + }) + await nextTick() + expect(workspaceApi.checkDeploymentCompatibility).toHaveBeenCalledTimes(2) + await failure.catch(() => {}) + + expect(markFor('dep-rgthree')).toBeNull() + expect(markFor(null)).toBeNull() + }) + it('starts the deployment listing when nothing has loaded it yet', async () => { useDeploymentPickStore().state = { phase: 'idle' } vi.mocked(workspaceApi.listDeployments).mockResolvedValue({ diff --git a/src/platform/workspace/composables/useDeploymentCompatibility.ts b/src/platform/workspace/composables/useDeploymentCompatibility.ts index 372cf968087..30df8573df1 100644 --- a/src/platform/workspace/composables/useDeploymentCompatibility.ts +++ b/src/platform/workspace/composables/useDeploymentCompatibility.ts @@ -136,10 +136,16 @@ export const useDeploymentCompatibility = createSharedComposable(() => { compatibility: DeploymentCompatibility } | null>(null) let checkFailureReported = false + // A workflow that is opened again brings back the same key, so the key + // cannot tell this check's answer from an earlier one; each check is + // numbered and only the newest one's answer counts. + let latestCheck = 0 watch( requestKey, async (key) => { + const check = ++latestCheck + answer.value = null const current = request.value if (key === null || current === null) return try { @@ -147,7 +153,7 @@ export const useDeploymentCompatibility = createSharedComposable(() => { current.workspaceId, current.nodeTypes ) - if (requestKey.value === key) answer.value = { key, compatibility } + if (check === latestCheck) answer.value = { key, compatibility } } catch (error) { if (checkFailureReported) return checkFailureReported = true From b66b77209a559d008483c387eef9072ac5a01392 Mon Sep 17 00:00:00 2001 From: Vinh Trinh Date: Sat, 24 Oct 2026 03:54:40 -0400 Subject: [PATCH 2/3] test(workspace): no old mark shows while a returning workflow's check is pending (BE-19373) --- .../composables/useDeploymentCompatibility.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/platform/workspace/composables/useDeploymentCompatibility.test.ts b/src/platform/workspace/composables/useDeploymentCompatibility.test.ts index 397cfb87235..646e9dfef8b 100644 --- a/src/platform/workspace/composables/useDeploymentCompatibility.test.ts +++ b/src/platform/workspace/composables/useDeploymentCompatibility.test.ts @@ -617,7 +617,10 @@ describe('useDeploymentCompatibility', () => { await nextTick() expect(markFor('dep-rgthree')).toBeNull() - const failure = Promise.reject(new Error('503')) + let fail: (error: Error) => void = () => {} + const failure = new Promise((_, reject) => { + fail = reject + }) vi.mocked(workspaceApi.checkDeploymentCompatibility).mockReturnValueOnce( failure ) @@ -627,6 +630,10 @@ describe('useDeploymentCompatibility', () => { }) await nextTick() expect(workspaceApi.checkDeploymentCompatibility).toHaveBeenCalledTimes(2) + expect(markFor('dep-rgthree')).toBeNull() + expect(markFor(null)).toBeNull() + + fail(new Error('503')) await failure.catch(() => {}) expect(markFor('dep-rgthree')).toBeNull() From 03068f964cc34581d5f4c8d8f1ba0a7bd447e440 Mon Sep 17 00:00:00 2001 From: Vinh Trinh Date: Sat, 24 Oct 2026 03:58:54 -0400 Subject: [PATCH 3/3] chore(workspace): drop the added comment on the check counter (BE-19373) --- .../workspace/composables/useDeploymentCompatibility.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/platform/workspace/composables/useDeploymentCompatibility.ts b/src/platform/workspace/composables/useDeploymentCompatibility.ts index 30df8573df1..e2985d6762c 100644 --- a/src/platform/workspace/composables/useDeploymentCompatibility.ts +++ b/src/platform/workspace/composables/useDeploymentCompatibility.ts @@ -136,9 +136,6 @@ export const useDeploymentCompatibility = createSharedComposable(() => { compatibility: DeploymentCompatibility } | null>(null) let checkFailureReported = false - // A workflow that is opened again brings back the same key, so the key - // cannot tell this check's answer from an earlier one; each check is - // numbered and only the newest one's answer counts. let latestCheck = 0 watch(