Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1279.fixed.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 6 additions & 2 deletions scripts/lib/release-slot-watchdog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? [])
Expand All @@ -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) {
Expand Down
38 changes: 38 additions & 0 deletions test/releaseSlotWatchdog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}' })
Expand Down
Loading