Skip to content

fix(release): wait for ci-ok before refusing a release, and never read a failure twice - #905

Merged
HugoXK merged 1 commit into
mainfrom
dev3/864-release-ci-ok-retry-r2
Nov 16, 2026
Merged

HugoXK merged 1 commit into
mainfrom
dev3/864-release-ci-ok-retry-r2

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Written-by: Fledge Platform Dev-3
Bot: Fledge Platform Dev-3

Fixes #864

The daily release read ci-ok exactly once. A run that started while CI was still in flight saw a check run with no conclusion, scripts/lib/release-state.mjs reported missing, and scripts/lib/release-drive.mjs folded that into none — the 0.3.7 slot was refused with a green tip still running.

The two facts stay apart now. missing (also unknown/pending) is a wait-ci decision: the Decide step re-reads ci-ok at the same tip the plan was computed from, up to three reads five minutes apart (CI_OK_READS, CI_OK_INTERVAL_MS in the module), and decides again — so missing → success releases. A concluded non-success still returns none on the first read and is never re-read. The reason and the step summary name the ci-ok run id, its status and how many reads were made, so "not yet" is distinguishable from "red"; a tip that never concludes ends the slot with none and the run id in the reason. A dry run neither waits nor re-reads: it reports what a real run would have done.

release-state.mjs gained latestRun — the newest run by id, with its status and conclusion — and buildState carries it as ciOkRun; latestConclusion delegates to it, so the older readers keep their behaviour. The Decide step writes the verdict it established back to state.json before the step summary and the #80 comment read .ciOk, so a released night cannot be commented as missing. The Decide step states timeout-minutes: 15 and the release job 30, which covers the ten minutes of waiting plus the push, opener, auto-merge and comment that follow.

Docs: docs/deploy.md gains a short The ci-ok read waits for the verdict (#864) subsection under the daily release section. Changelog fragment: changelog.d/864-release-waits-for-ci-ok.fixed.md.

Ran:

  • npm run check — pass, 2412/2412 tests (lint, typecheck, tests, build), read on the tree as cut from 3672754c
  • npx tsx --test test/releaseCiOk.test.ts — pass, 6/6; the same file fails on the base tree because scripts/lib/release-drive.mjs exports no decideWithCiRetry
  • npx tsx --test test/dailyRelease.test.ts test/mechanicalRelease.test.ts test/releaseState.test.ts — pass
  • the Decide snippet extracted from the workflow, run against fixtures — a failure fixture decides none with the run id on one read; a dry-run missing fixture reports wouldHave: wait-ci and does not sleep
  • node scripts/risk-gate.mjs --base 3672754c751d5e2367f9cb741ceb29b9d7881faf — risk-tier: T3; basis: .github/workflows/daily-release.yml

Not run: a live workflow run. The bounded re-read is asserted with an injected reader and an injected wait; the step's gh api call and its ten-minute sleep cannot be exercised from here, and the first scheduled run after merge is the first live proof.

Rebase note: the commit was re-based onto 78ea77a3 (current main) after the cut, with the same nine files byte for byte; the tree sha therefore differs from the one the counts above were measured on, and the reviewer's own run is the reading at this tip.

Red first: test/releaseCiOk.test.ts and the two new test/dailyRelease.test.ts assertions fail at the base tree and pass with the change; both readings were kept.

Risk: this touches the nightly release path (scripts/lib/, .github/workflows/) — T3, PASS at the tip required. The wait can only delay a release inside one slot. It cannot release a red tip: failure is decided before any re-read.

@HugoXK
HugoXK force-pushed the dev3/864-release-ci-ok-retry-r2 branch from 401d4e8 to 8cdec9e Compare November 16, 2026 06:42

@HugoXK-bot HugoXK-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS at 8cdec9e
Written-by: HugoXK-bot
Author: Fledge Platform Verdict

wait-ci is only for a run that has not concluded — missing, unknown, pending or an empty conclusion at scripts/lib/release-drive.mjs:46-48 — and every other non-success still returns none on the first read (:188-194), so a red tip is never waited on.
The re-read is bounded at three reads five minutes apart (:237-238), leaves the loop on any decision that is not wait-ci (:311-317), and asks commits/${MAIN_SHA} from steps.state.outputs.main_sha (.github/workflows/daily-release.yml:210, :235), so a later main cannot be judged; a tip that never concludes ends none naming the run id and the read count (:318-330).
A dry run turns wait-ci into none plus wouldHave: wait-ci before the loop (:209-216), and the suite proves it never touches the reader or the waiter (test/releaseCiOk.test.ts:100-107).
Step and job budgets cover the sleep (daily-release.yml:93, :207), and the rewritten state.json keeps the summary and the #80 comment from reporting missing beside a released branch (:269).
Non-blocking: the push still cuts release/v* from the workflow-start checkout (:380), so the wait widens the window where that branch is based on a main that has since moved (:116).

Ran: at 8cdec9e, clean tree, node v22.23.2

  • npm run check → 2431 tests, 2431 pass, 0 fail, exit 0
  • node --test test/releaseCiOk.test.ts test/dailyRelease.test.ts → 36 pass, 0 fail
  • node scripts/pr-lint.mjs --pr 905 → pr-lint: ok (#905, T3, 9 files)
  • mutation in release-drive.mjs: fold missing back into none → 4 of 6 tests fail; re-read a concluded failure → its test fails; drop the dry-run branch → its test fails

Not run: the scheduled workflow itself (no runner here); docker, codeql-required and coverage are CI's own. The red review-gate on this sha is the push-triggered run that predates any verdict.

@HugoXK
HugoXK merged commit d00ead4 into main Nov 16, 2026
35 of 36 checks passed
@HugoXK
HugoXK deleted the dev3/864-release-ci-ok-retry-r2 branch November 16, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: the daily release reads ci-ok once, so a green tip that is still running is read as missing

2 participants