From 2ceb571d2507c2497e03a7e97a623c6bd64e7e90 Mon Sep 17 00:00:00 2001 From: Fledge Platform Dev-4 Date: Tue, 24 Nov 2026 10:43:02 +0000 Subject: [PATCH] fix(release): read the release-plan artifact the daily-release job publishes (#1279) The job uploads `{ mainSha, plan, drive }`, but the watchdog required a top-level `shouldRelease`, so a real declined night was called unreadable and reported as a missed release with a card (#1279 is that card). Read the plan from `plan` and keep accepting a bare plan; two tests use the artifact's real shape, one asserting the slot state (`declined`, no card) instead of the card text. Docs-not-needed: docs/deploy.md already states a declined night opens no card. Signed-off-by: Fledge Platform Dev-4 --- changelog.d/1279.fixed.md | 1 + scripts/lib/release-slot-watchdog.mjs | 8 ++++-- test/releaseSlotWatchdog.test.ts | 38 +++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 changelog.d/1279.fixed.md diff --git a/changelog.d/1279.fixed.md b/changelog.d/1279.fixed.md new file mode 100644 index 00000000..fa93fb44 --- /dev/null +++ b/changelog.d/1279.fixed.md @@ -0,0 +1 @@ +The release-slot watchdog reads the `release-plan` artifact in the shape the daily-release job actually publishes, so a night the planner declined no longer opens a "slot shipped no release" card. Before this, every green run that declined a release was reported as `plan-unavailable` and then as a miss, which put a false alarm in front of the owner on most nights. diff --git a/scripts/lib/release-slot-watchdog.mjs b/scripts/lib/release-slot-watchdog.mjs index 0c5269c1..d576329d 100644 --- a/scripts/lib/release-slot-watchdog.mjs +++ b/scripts/lib/release-slot-watchdog.mjs @@ -144,6 +144,11 @@ function planOf(plan) { * smallest reader that gets the JSON out of one. Anything unreadable answers * null, which the decision treats as "the plan is not known" — a miss, never a * silent decline. + * + * The job publishes `{ mainSha, plan, drive }`, not the plan object on its own, + * so the plan is read from `plan`; a bare plan keeps working (#1220). Reading + * only the top level called every real declined night unreadable and opened a + * "missed release" card for it. */ export function planFromArtifactZip(bytes) { const buffer = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes ?? []) @@ -156,8 +161,7 @@ export function planFromArtifactZip(bytes) { return null } if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) return null - if (typeof parsed.shouldRelease !== 'boolean') return null - return planOf(parsed) + return planOf(parsed) ?? planOf(parsed.plan) } function zipEntry(buffer, wanted) { diff --git a/test/releaseSlotWatchdog.test.ts b/test/releaseSlotWatchdog.test.ts index 27264544..71227bd6 100644 --- a/test/releaseSlotWatchdog.test.ts +++ b/test/releaseSlotWatchdog.test.ts @@ -444,6 +444,44 @@ test('the plan is read out of the artifact zip the daily-release run uploads', a assert.deepEqual(planFromArtifactZip(zip), DECLINED_FEATURES) }) +// #1220: the shape the daily-release job actually uploads, read back from the +// `release-plan` artifact of run 45311131982 (`2026-11-24T02:16:15Z`). The plan +// and the drive record are wrapped, so a reader that only looks at the top level +// calls a real declined night unreadable and opens a "missed release" card. +const PUBLISHED_DECLINED = { + mainSha: 'effecdea59ee7f4b11aed9f5f4ce2feaacc8e271', + plan: { shouldRelease: false, reason: 'not-enough-features', total: 11, features: 1, fragments: 12, nextVersion: '0.5.1', bump: 'patch' }, + drive: { action: 'none', reason: 'the rule is not met: not-enough-features', ciOkReads: 1, ciOkWaitedMs: 0 }, +} + +test('a plan artifact in the published shape is read, not called unreadable', async () => { + const { planFromArtifactZip } = await import('../scripts/lib/release-slot-watchdog.mjs') + const zip = zipOf({ 'release-plan.json': `${JSON.stringify(PUBLISHED_DECLINED)}\n` }) + assert.deepEqual(planFromArtifactZip(zip), { + shouldRelease: false, + reason: 'not-enough-features', + total: 11, + features: 1, + fragments: 12, + }) +}) + +test('a declined night read from the published artifact releases the slot instead of opening a card', async () => { + const { planFromArtifactZip, decideSlotWatchdog } = await import('../scripts/lib/release-slot-watchdog.mjs') + const zip = zipOf({ 'release-plan.json': `${JSON.stringify(PUBLISHED_DECLINED)}\n` }) + const decision = decideSlotWatchdog({ + now: '2026-11-24T03:42:41.000Z', + releases: [], + runs: [run(45311131982, 'push', '2026-11-24T02:16:15Z')], + issues: [], + plan: planFromArtifactZip(zip), + }) + assert.equal(decision.action, 'declined') + assert.equal(decision.alarm, undefined) + assert.equal(decision.issue, undefined) + assert.equal(decision.planReason, 'not-enough-features') +}) + test('an artifact zip without a plan file answers null instead of guessing', async () => { const { planFromArtifactZip } = await import('../scripts/lib/release-slot-watchdog.mjs') const zip = zipOf({ 'other.json': '{"shouldRelease":false}' })