From f9750a57452fb7b560a90123a7f1edc33fe95676 Mon Sep 17 00:00:00 2001 From: Danyang Chen Date: Tue, 27 Oct 2026 13:58:40 +0800 Subject: [PATCH] test(workflow-run): split the 5b case into acceptance 5 and the foreign-card rule (#1339) One case carried two rules, so the `cardsOfJob` knife reddened a composite and its title promised two things. Split it: 5b pins that two ready nodes open together (knife: cap `planJob`'s `open` at one node), 5c pins that a card parented to another job closes nothing here, in the plan or in `completions` (knife: drop the `parentId` test in `cardsOfJob`). Each knife now reds only its own case. Test-only: `cardsOfJob`, `planJob` and `completions` are unchanged. --- core/test/workflow-run.test.js | 14 ++++++++++---- patches/ds-bot/files/test/workflow-run.test.js | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/core/test/workflow-run.test.js b/core/test/workflow-run.test.js index 2121e824d..7b1bc610e 100644 --- a/core/test/workflow-run.test.js +++ b/core/test/workflow-run.test.js @@ -103,17 +103,23 @@ test('node two opens only when node one\'s output is present and current', () => }) // 5b. Two nodes ready at once are both opened — the definition said so, and WIP = 1 per Bot is the -// queue's rule (#1247), not a second limit here. A node card parented to another job is not this job's -// record, so it cannot close this job's node (#1316 pin 4: the identity is `(jobId, nodeId)`). -// Knife: drop the `parentId` test in `cardsOfJob` → the foreign card closes `triage` and this goes red. -test('two ready nodes open together, and another job\'s card is not this job\'s record', () => { +// queue's rule (#1247), not a second limit here. +// Knife: make `planJob` hand back only the first ready node (an invented one-per-pass cap) → only +// this case reds; the identity rule below keeps its own knife. +test('two ready nodes open together, with no second limit in the plan', () => { const both = planJob({ definition: flow, job: { id: 'j', workflow: 'run-flow' }, facts: facts({ present: { 'issue.ready': ready() }, current: { 'issue.ready': 'aaaa1111' } }), }) assert.deepEqual(both.open.map((entry) => entry.node), ['triage', 'build']) +}) +// 5c. A node card parented to another job is not this job's record, so it cannot close this job's +// node (#1316 pin 4: the identity is `(jobId, nodeId)`). +// Knife: drop the `parentId` test in `cardsOfJob` → the foreign card closes `triage` and only this +// case reds; acceptance 5 above stays green. +test('another job\'s card is not this job\'s record, in the plan or in completions', () => { const foreign = planJob({ definition: flow, job: { id: 'j', workflow: 'run-flow' }, cards: [{ node: 'triage', column: 'done', parentId: 'another-job' }], facts: facts() }) assert.deepEqual(foreign.open.map((entry) => entry.node), ['triage']) const own = planJob({ definition: flow, job: { id: 'j', workflow: 'run-flow' }, cards: [{ node: 'triage', column: 'done', parentId: 'j' }], facts: facts() }) diff --git a/patches/ds-bot/files/test/workflow-run.test.js b/patches/ds-bot/files/test/workflow-run.test.js index 2121e824d..7b1bc610e 100644 --- a/patches/ds-bot/files/test/workflow-run.test.js +++ b/patches/ds-bot/files/test/workflow-run.test.js @@ -103,17 +103,23 @@ test('node two opens only when node one\'s output is present and current', () => }) // 5b. Two nodes ready at once are both opened — the definition said so, and WIP = 1 per Bot is the -// queue's rule (#1247), not a second limit here. A node card parented to another job is not this job's -// record, so it cannot close this job's node (#1316 pin 4: the identity is `(jobId, nodeId)`). -// Knife: drop the `parentId` test in `cardsOfJob` → the foreign card closes `triage` and this goes red. -test('two ready nodes open together, and another job\'s card is not this job\'s record', () => { +// queue's rule (#1247), not a second limit here. +// Knife: make `planJob` hand back only the first ready node (an invented one-per-pass cap) → only +// this case reds; the identity rule below keeps its own knife. +test('two ready nodes open together, with no second limit in the plan', () => { const both = planJob({ definition: flow, job: { id: 'j', workflow: 'run-flow' }, facts: facts({ present: { 'issue.ready': ready() }, current: { 'issue.ready': 'aaaa1111' } }), }) assert.deepEqual(both.open.map((entry) => entry.node), ['triage', 'build']) +}) +// 5c. A node card parented to another job is not this job's record, so it cannot close this job's +// node (#1316 pin 4: the identity is `(jobId, nodeId)`). +// Knife: drop the `parentId` test in `cardsOfJob` → the foreign card closes `triage` and only this +// case reds; acceptance 5 above stays green. +test('another job\'s card is not this job\'s record, in the plan or in completions', () => { const foreign = planJob({ definition: flow, job: { id: 'j', workflow: 'run-flow' }, cards: [{ node: 'triage', column: 'done', parentId: 'another-job' }], facts: facts() }) assert.deepEqual(foreign.open.map((entry) => entry.node), ['triage']) const own = planJob({ definition: flow, job: { id: 'j', workflow: 'run-flow' }, cards: [{ node: 'triage', column: 'done', parentId: 'j' }], facts: facts() })