@futurelastic/colab-handbook 1.12.0-rc.35 → 1.12.0-rc.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -27,5 +27,5 @@
27
27
  "engines": {
28
28
  "node": ">=18"
29
29
  },
30
- "version": "1.12.0-rc.35"
30
+ "version": "1.12.0-rc.36"
31
31
  }
@@ -102,6 +102,13 @@
102
102
  # failed) is the ordinary output of most runs; it is printed to the run summary as a
103
103
  # warning and the job stays green, so a refusal never paints main red for `colab ship`.
104
104
  # Only a run that produced no verdict at all (a crash, gh unusable, bad flags) fails.
105
+ # A STANDING refusal is still not a failure, but it is not a warning either (#467): one no
106
+ # later run clears by itself — no first final tag, a malformed colab:switch marker, a
107
+ # manifest that disagrees — is an `::error title=Release stalled::` annotation plus a
108
+ # summary banner, and `colab release-status` flags the repo. Still exit 0: a red run here
109
+ # would make main's head not-green and refuse the very ship that clears the stall.
110
+ # Every finalize run that makes no final says why, and lists each open candidate's reason
111
+ # and when its own test period ends (#468).
105
112
  #
106
113
  # THE CLI IGNORES THIS WORKFLOW'S OWN RUNS when it reads CI at a commit (GITHUB_WORKFLOW,
107
114
  # #425) — otherwise its own in-progress run would read as "CI not finished" forever. So
@@ -344,7 +351,21 @@ jobs:
344
351
  elif [ "$(jq -r '.ok' "$OUT")" = "true" ]; then
345
352
  echo "Verdict ok but nothing created." | tee -a "$GITHUB_STEP_SUMMARY"
346
353
  else
347
- echo "::warning::colab release cut refused: $(jq -r '[.checks[]? | select(.ok | not) | .condition] | join(", ")' "$OUT")"
354
+ # #467: a refusal no later run clears by itself (no first final, a malformed marker, a
355
+ # wrong manifest) is a STALL — an error annotation and a summary banner, still exit 0: a red
356
+ # release run at main's head would make trunk not-green and refuse the very ship that fixes it.
357
+ STANDING="$(jq -r '(.standing // []) | join(", ")' "$OUT")"
358
+ if [ -n "$STANDING" ]; then
359
+ echo "::error title=Release stalled::colab release cut refused on a condition that does not clear by itself: $(jq -r '. as $v | [$v.checks[]? | select(.ok | not) | select(.condition as $c | any(($v.standing // [])[]; . == $c)) | "\(.condition) — \(.detail)"] | join("; ")' "$OUT")"
360
+ {
361
+ echo "#### ⚠ Release stalled"
362
+ echo
363
+ echo "\`colab release cut --auto\` refused on **$STANDING** — the next run refuses the same way until a human acts (the ✗ rows above say what). The run stays green on purpose, so it never blocks the ship that fixes it."
364
+ echo
365
+ } >> "$GITHUB_STEP_SUMMARY"
366
+ else
367
+ echo "::warning::colab release cut refused: $(jq -r '[.checks[]? | select(.ok | not) | .condition] | join(", ")' "$OUT")"
368
+ fi
348
369
  fi
349
370
 
350
371
  - name: Finalize the newest clean candidate (colab release finalize --auto)
@@ -363,11 +384,21 @@ jobs:
363
384
  exit 1
364
385
  fi
365
386
  STATE="$(jq -r '.state' "$OUT")"
387
+ # #468: why no final, and every other open candidate with its own reason — the checklist
388
+ # above it is only the picked candidate's, which alone reads as "only the newest counts".
389
+ WHY="$(jq -r '.why.line // empty' "$OUT")"
366
390
  {
367
391
  echo "### colab release finalize --auto — $STATE"
368
392
  echo
369
393
  jq -r '.checks[]? | "- \(if .ok then "✓" else "✗" end) **\(.condition)** — \(.detail)"' "$OUT"
370
394
  echo
395
+ if [ -n "$WHY" ]; then echo "**Why no final:** $WHY"; echo; fi
396
+ if [ "$(jq -r '(.skipped // []) | length' "$OUT")" != "0" ]; then
397
+ echo "Other open candidates:"
398
+ jq -r '(.skipped // [])[:10][] | "- \(.tag): \(.state)\(if .detail then " — \(.detail)" else "" end)"' "$OUT"
399
+ jq -r '(.skipped // []) | if length > 10 then "- … \(length - 10) more" else empty end' "$OUT"
400
+ echo
401
+ fi
371
402
  } >> "$GITHUB_STEP_SUMMARY"
372
403
  if [ "$(jq -r '.tagged' "$OUT")" = "true" ]; then
373
404
  TAG="$(jq -r '.finalTag' "$OUT")"
@@ -375,8 +406,8 @@ jobs:
375
406
  echo "Finalized $TAG" | tee -a "$GITHUB_STEP_SUMMARY"
376
407
  else
377
408
  case "$STATE" in
378
- refused|needs-new-candidate|held) echo "::warning::colab release finalize: $STATE" ;;
379
- *) echo "Finalize: $STATE" ;;
409
+ refused|needs-new-candidate|held) echo "::warning::colab release finalize: $STATE${WHY:+ — $WHY}" ;;
410
+ *) echo "Finalize: $STATE${WHY:+ — $WHY}" ;;
380
411
  esac
381
412
  fi
382
413
 
package/tools/colab CHANGED
@@ -1324,7 +1324,7 @@ function measureCandidateConditions(repoAbs, { sha, lastFinal, at, readRuns, iss
1324
1324
  const why = ghUnusableWhy(repoAbs);
1325
1325
  ci = { ok: false, detail: `gh not usable (${why}) — cannot confirm CI at ${at}` };
1326
1326
  suite = { ok: false, detail: `gh not usable (${why}) — cannot confirm the suite ran at ${at}` };
1327
- switches = { ok: false, detail: `gh not usable (${why}) — the colab:switch markers cannot be read` };
1327
+ switches = { ok: false, unread: true, detail: `gh not usable (${why}) — the colab:switch markers cannot be read` };
1328
1328
  } else {
1329
1329
  const rows = readRuns();
1330
1330
  const run = git.summarizeRunsForCommit(rows, sha);
@@ -1340,7 +1340,7 @@ function measureCandidateConditions(repoAbs, { sha, lastFinal, at, readRuns, iss
1340
1340
  const declared = migrationPaths.unionPaths(projectDoc(repoAbs), projectDocAt(repoAbs, sha));
1341
1341
  const changes = releaseCutChanges(repoAbs, lastFinal, sha, declared);
1342
1342
  const schema = changes === null
1343
- ? { ok: false, detail: 'git diff failed — schema changes cannot be read' }
1343
+ ? { ok: false, unread: true, detail: 'git diff failed — schema changes cannot be read' }
1344
1344
  : releaseCut.schemaVerdict(changes, lastFinal || 'the first commit', declared);
1345
1345
  // #441: every migration file since the last final, destructive or not — an operator-granted
1346
1346
  // automatic final refuses an ungranted one (release-finalize.js migrationGrantVerdict).
@@ -1474,7 +1474,7 @@ function measureFastRoute(repoAbs, { policy, remote, issues, lastFinal, tags, au
1474
1474
  const trust = trustAt(repoAbs, `${remote}/main`);
1475
1475
  const finalGrant = isGhUsable(repoAbs)
1476
1476
  ? releasePolicy.finalGrantVerdict(git.ghIssueView(repoAbs, grantDecl.issue, ['state', 'labels', 'comments']), { issue: grantDecl.issue, trust })
1477
- : { ok: false, ruledBy: null, detail: `release.final-grant #${grantDecl.issue} could not be read: gh not usable (${ghUnusableWhy(repoAbs)})` };
1477
+ : { ok: false, unread: true, ruledBy: null, detail: `release.final-grant #${grantDecl.issue} could not be read: gh not usable (${ghUnusableWhy(repoAbs)})` };
1478
1478
  const holds = releaseCut.holdsVerdict(issues);
1479
1479
  let tracking = null;
1480
1480
  let grant = null;
@@ -1647,7 +1647,7 @@ function cmdReleaseCut(argv) {
1647
1647
  if (opts.json) {
1648
1648
  print(JSON.stringify({
1649
1649
  repo: shortRepo(repoAbs), sha, ...(offTrunk ? { trunk } : {}), lastFinal, suggestion, dry: !!opts.dry, auto: !!opts.auto,
1650
- ok: verdict.ok, noop: !!verdict.noop, tag: verdict.tag, created, published, channel, version: verdict.version, bump: verdict.bump,
1650
+ ok: verdict.ok, noop: !!verdict.noop, standing: verdict.standing || [], tag: verdict.tag, created, published, channel, version: verdict.version, bump: verdict.bump,
1651
1651
  overridden: verdict.overridden, signals: verdict.signals ? verdict.signals.lines : null, checks: verdict.checks,
1652
1652
  // #446: present on every route, so the workflow reads one shape — final only on deploy-tag-fast.
1653
1653
  final: !!verdict.final,
@@ -1673,6 +1673,8 @@ function cmdReleaseCut(argv) {
1673
1673
  }
1674
1674
  if (!verdict.ok) {
1675
1675
  print(`✗ refused — ${verdict.refusals.length} condition(s) failed; nothing cut.`);
1676
+ // #467: a refusal no further run clears by itself is a stall — say so, so nobody waits on it.
1677
+ if (verdict.standing && verdict.standing.length) print(` release stalled — ${verdict.standing.join(', ')} will not clear by itself; a human act is owed (the next run refuses the same way).`);
1676
1678
  if (handoff) print(`\nA migration rides this release. The one command, for a human to run:\n ${handoff}`);
1677
1679
  return 1;
1678
1680
  }
@@ -1968,7 +1970,7 @@ function cmdReleaseFinalize(argv) {
1968
1970
  manifests, ancestry, tags: tagNames, finalGrant, migrations,
1969
1971
  human: { bar: humanBar, answeredBy: opts.answeredBy || null },
1970
1972
  });
1971
- return { candidate: cand, verdict, period, tracking };
1973
+ return { candidate: cand, verdict, period, tracking, trunk };
1972
1974
  };
1973
1975
 
1974
1976
  let cand = null; let verdict; let period = null; let tracking = version0 ? trackings.get(version0) : null;
@@ -1976,14 +1978,23 @@ function cmdReleaseFinalize(argv) {
1976
1978
  if (walk) {
1977
1979
  const MAX_JUDGED = 10;
1978
1980
  const evals = [];
1981
+ // #468: every red trunk run a judged candidate's window held. One red run puts every candidate cut
1982
+ // in the test period before it into needs-new-candidate; on a repo cutting several a day, judging
1983
+ // each one in full spent MAX_JUDGED on them and the walk stopped before the older clean one.
1984
+ const knownRed = [];
1979
1985
  for (const c of releaseFinalize.openCandidates(tags, remote)) {
1980
- if (c.refused) { skipped.push({ tag: c.tag, state: 'refused', detail: c.refused }); continue; }
1986
+ if (c.refused) { skipped.push({ tag: c.tag, state: 'refused', detail: c.refused, endsAt: null }); continue; }
1981
1987
  const tr = trackings.has(c.version) ? trackings.get(c.version) : trackingFor(c.version, { isCandidate: true });
1982
1988
  const p = releaseFinalize.periodVerdict({ cutAt: c.cutAt, trackingCreatedAt: tr && tr.createdAt, testPeriodDays: policy.effective.testPeriodDays, now });
1983
1989
  // Cheap skip: a younger candidate whose own period has not elapsed cannot finalize — only the newest is judged regardless, so the report has a state.
1984
- if (!p.elapsed && evals.length) { skipped.push({ tag: c.tag, state: 'testing', detail: p.detail }); continue; }
1990
+ if (!p.elapsed && evals.length) { skipped.push({ tag: c.tag, state: 'testing', detail: `test-period: ${p.detail}`, endsAt: p.endsAt }); continue; }
1991
+ // #468: cheap skip, the second kind — a red run already seen inside this candidate's own window.
1992
+ // Not counted toward MAX_JUDGED. May be wrong only in the safe direction (windowHasRed).
1993
+ const seenRed = evals.length ? releaseFinalize.windowHasRed(p, knownRed) : null;
1994
+ if (seenRed) { skipped.push({ tag: c.tag, state: 'needs-new-candidate', detail: `trunk-green: trunk went red at ${seenRed}, inside its own test period (seen judging a newer candidate)`, endsAt: p.endsAt }); continue; }
1985
1995
  const e = judge(c, { kind: 'candidate', candidate: c, superseded: [], detail: `${c.tag} at ${shortSha(c.sha)}, cut ${c.cutAt} (--auto: judged on its own clock)` });
1986
1996
  evals.push(e);
1997
+ if (e.trunk && Array.isArray(e.trunk.redAt)) knownRed.push(...e.trunk.redAt);
1987
1998
  if (e.verdict.state === 'finalized' || e.verdict.state === 'held' || evals.length >= MAX_JUDGED) break;
1988
1999
  }
1989
2000
  const pick = releaseFinalize.pickNewestClean(evals);
@@ -2080,13 +2091,16 @@ function cmdReleaseFinalize(argv) {
2080
2091
  const trackingOut = tracking && !tracking.error
2081
2092
  ? { number: tracking.number || null, url: tracking.url || null, created: trackingCreated && (!cand || cand.version === version0), held: !!tracking.held, supersededHeld }
2082
2093
  : null;
2094
+ // #468: why this run made no final, and which candidate finals first — the line the release
2095
+ // workflow prints, so "no final" never has to be reconstructed from a checklist.
2096
+ const why = releaseFinalize.whyNoFinal({ state: verdict.state, candidate: cand, checks: verdict.checks, period, skipped: walk ? skipped : [], now });
2083
2097
  if (opts.json) {
2084
2098
  print(JSON.stringify({
2085
2099
  repo: shortRepo(repoAbs), row: policy.derived.row, route: policy.effective.route, final: policy.effective.final, testPeriodDays: policy.effective.testPeriodDays,
2086
2100
  lastFinal, dry: !!opts.dry, auto: !!opts.auto, candidate: cand, tracking: trackingOut,
2087
2101
  periodStart: period ? period.start : null, periodEndsAt: period ? period.endsAt : null,
2088
2102
  state: verdict.state, tagged, finalTag: verdict.finalTag, checks: verdict.checks, handoff: verdict.handoff,
2089
- skipped: walk ? skipped : undefined, announced, grant: verdict.grant || null, channel,
2103
+ skipped: walk ? skipped : undefined, why, next: why ? why.next : null, announced, grant: verdict.grant || null, channel,
2090
2104
  }, null, 2));
2091
2105
  } else {
2092
2106
  print(`colab release finalize${opts.auto ? ' --auto' : ''} — ${shortRepo(repoAbs)} (last final: ${lastFinal || 'none'}${cand ? `, candidate: ${cand.tag}` : ''})`);
@@ -2098,6 +2112,7 @@ function cmdReleaseFinalize(argv) {
2098
2112
  }
2099
2113
  print('');
2100
2114
  print(`state: ${verdict.state}${opts.dry ? ' [--dry: nothing written]' : ''}${tagged ? ` — tagged ${verdict.finalTag} and pushed it to ${remote}` : ''}`);
2115
+ if (why) print(`why no final: ${why.line}`);
2101
2116
  if (announced && announced.issues.length) print(`released in ${verdict.finalTag || version0}: told ${announced.posted.length ? announced.posted.map((n) => `#${n}`).join(', ') : 'nobody new'} (carried: ${announced.issues.map((n) => `#${n}`).join(', ')}${announced.skipped.length ? `; unreadable: ${announced.skipped.map((n) => `#${n}`).join(', ')}` : ''})`);
2102
2117
  if (channel && channel.ok) print(`✓ ${channel.detail}`);
2103
2118
  else if (channel) warn(`${channel.detail} — the final tag stands`);
@@ -6929,7 +6944,9 @@ Per tag-gated repo:
6929
6944
  headCandidate #443, where candidates are automatic: { state, flag, detail } — whether the newest
6930
6945
  candidate names main's head. Flags (state untagged, "head not a candidate") when
6931
6946
  head has been green for longer than one CI cycle — the longest suite run at that
6932
- sha — and carries no tag. Other states: named · nothing-owed · not-green ·
6947
+ sha — and carries no tag. Also flags (state no-final, #467) when there is no final tag
6948
+ at all: \`release cut --auto\` refuses every run until a human tags the first version,
6949
+ a stall that otherwise reads green. Other states: named · nothing-owed · not-green ·
6933
6950
  pending (inside one cycle) · not-promotion (trunk: dev, a hotfix head) · unread · off.
6934
6951
  semverSuggestion from Conventional-Commit types since the last tag: a breaking change (! or a
6935
6952
  BREAKING CHANGE: footer) -> major, else feat -> minor, else fix -> patch,
@@ -6941,7 +6958,7 @@ fetch failure does not abort the row — it degrades to whatever is on disk and
6941
6958
  rather than reporting nothing.
6942
6959
 
6943
6960
  Exit code: 0 when nothing is flagged, 1 when at least one repo is (an unpromoted or unreleased
6944
- fix/breaking commit, or a green head that is not a candidate) — same posture as \`colab update\`'s "behind" tally.
6961
+ fix/breaking commit, a green head that is not a candidate, or no final tag at all) — same posture as \`colab update\`'s "behind" tally.
6945
6962
  `;
6946
6963
 
6947
6964
  function cmdReleaseStatus(argv) {
@@ -6990,7 +7007,7 @@ function cmdReleaseStatus(argv) {
6990
7007
  const tableRows = printable.map((r) => {
6991
7008
  const up = r.unpromoted ? `${r.unpromoted.commits}${r.unpromoted.fixFlag ? ' ⚠' : ''}` : '—';
6992
7009
  const un = r.unreleased.tag ? `${r.unreleased.commits}${r.unreleased.fixFlag ? ' ⚠' : ''} (${r.unreleased.days}d since ${r.unreleased.tag})` : 'no tags yet';
6993
- const hc = r.headCandidate ? (r.headCandidate.flag ? '⚠ not a candidate' : r.headCandidate.state) : '—';
7010
+ const hc = r.headCandidate ? (r.headCandidate.flag ? (r.headCandidate.state === 'no-final' ? '⚠ no final' : '⚠ not a candidate') : r.headCandidate.state) : '—';
6994
7011
  return [r.repo, up, un, hc, r.semverSuggestion.bump || '—', r.flag ? '⚠ FLAGGED' : ''];
6995
7012
  });
6996
7013
  print(table(tableRows, ['REPO', 'UNPROMOTED', 'UNRELEASED', 'HEAD', 'SUGGEST', '']));
@@ -7007,7 +7024,7 @@ function cmdReleaseStatus(argv) {
7007
7024
  }
7008
7025
  print('');
7009
7026
  if (flagged.length) {
7010
- print(`${flagged.length} repo(s) FLAGGED — a fix or breaking commit is sitting unreleased/unpromoted, or a green head is not a candidate:`);
7027
+ print(`${flagged.length} repo(s) FLAGGED — a fix or breaking commit is sitting unreleased/unpromoted, a green head is not a candidate, or there is no final for candidates to follow:`);
7011
7028
  for (const r of flagged) print(` ${r.repo}${r.headCandidate && r.headCandidate.flag ? ` — ${r.headCandidate.detail}` : ''}`);
7012
7029
  print('Who cuts the tag follows the release rung of CONVENTIONS §6 — this only measures the gap.');
7013
7030
  } else {
@@ -85,6 +85,20 @@ const CONDITIONS = Object.freeze([
85
85
  'final-grant', 'release-hold', 'migration-grant',
86
86
  ]);
87
87
 
88
+ /**
89
+ * #467: the refusals that do NOT clear by themselves. A run refused on one of these refuses again on
90
+ * the next run and the one after — nothing but a human act (a first final tag, a fixed marker, a
91
+ * fixed manifest, a recorded grant) moves it — so the release workflow reports it as a STALL, an
92
+ * error annotation, never as the routine warning a CI-still-running refusal gets. The rest are
93
+ * transient: `ci-green` / `full-suite` (a run in flight, a red run the next merge fixes), an UNREAD
94
+ * anything (a read that failed — the next run reads again), and `release-hold` (a deliberate human
95
+ * veto is not a stall; it is the system working). Classified in decide() as `standing`.
96
+ */
97
+ const STANDING_CONDITIONS = Object.freeze([
98
+ 'release-policy', 'prerelease-trigger', 'version', 'schema-additive', 'switch-dependencies',
99
+ ...releaseTag.PRE_TAG_CONDITIONS, 'final-grant', 'migration-grant',
100
+ ]);
101
+
88
102
  /** #446: the conditions only route deploy-tag-fast reports. */
89
103
  const FAST_CONDITIONS = Object.freeze(['spacing', 'already-final', 'final-grant', 'release-hold', 'migration-grant']);
90
104
 
@@ -371,7 +385,7 @@ function parseMigrationSection(text, version) {
371
385
  function decideAutoVersion({ lastFinal, signals, migration, tags }) {
372
386
  const refuse = (detail, extra = {}) => ({ ok: false, detail, ...extra });
373
387
  const s = signals || { total: 0, breaking: [], minor: [], patch: [], unread: [] };
374
- if (s.unread && s.unread.length) return refuse(`a bump signal could not be read — fail closed: ${s.unread.join('; ')}`);
388
+ if (s.unread && s.unread.length) return refuse(`a bump signal could not be read — fail closed: ${s.unread.join('; ')}`, { unread: true });
375
389
  if (!lastFinal) return refuse('no final release tag (vX.Y.Z) on main yet — the first version is a human decision, not a computed bump');
376
390
  const last = parseVersion(lastFinal);
377
391
  if (!last) return refuse(`the last release tag ${lastFinal} is not vX.Y.Z — cannot compute a bump from it`);
@@ -443,7 +457,7 @@ function spacingVerdict({ finals, spacingHours, now }) {
443
457
  * to put the label on, so a human may put it on any issue, and only a human removes it.
444
458
  */
445
459
  function holdsVerdict(issues) {
446
- if (issues === null || issues === undefined) return { ok: false, detail: `the open issues could not be read — an unread ${HOLD_LABEL} is not an absent one` };
460
+ if (issues === null || issues === undefined) return { ok: false, unread: true, detail: `the open issues could not be read — an unread ${HOLD_LABEL} is not an absent one` };
447
461
  const held = issues.filter((i) => i && (!i.state || String(i.state).toUpperCase() === 'OPEN')
448
462
  && (i.labels || []).some((l) => (l && typeof l === 'object' ? l.name : l) === HOLD_LABEL)).map((i) => i.number);
449
463
  return held.length
@@ -480,16 +494,22 @@ const DOWNSTREAM_EVENTS = Object.freeze(['workflow_run', 'schedule', 'workflow_d
480
494
  * whole suite-duration after it went green is one the release run did not tag.
481
495
  *
482
496
  * Returns { state, flag, detail, greenAt, cycleMs } — state is one of: off · named · nothing-owed ·
483
- * not-promotion · unread · not-green · pending · untagged. Only `untagged` flags.
497
+ * no-final · not-promotion · unread · not-green · pending · untagged. `untagged` and `no-final` flag.
498
+ *
499
+ * `no-final` (#467): candidates are automatic but there is no final tag to compute a bump from, so
500
+ * `release cut --auto` refuses on every run, forever, until a human tags the first version. That is a
501
+ * stall, not "nothing owed" — reading it as nothing-owed is how a repo sat green for days with no tag.
484
502
  */
485
503
  function headCandidateVerdict({ candidatesAuto, sha, tagsAtSha, owed, runs, promotion, now }) {
486
504
  const at = `main@${String(sha || '').slice(0, 7)}`;
487
- const out = (state, detail, extra = {}) => ({ state, flag: state === 'untagged', detail, greenAt: null, cycleMs: null, ...extra });
505
+ const out = (state, detail, extra = {}) => ({ state, flag: state === 'untagged' || state === 'no-final', detail, greenAt: null, cycleMs: null, ...extra });
488
506
  if (!candidatesAuto) return out('off', 'candidates are not automatic here — nothing names the head by itself');
489
507
  const named = (tagsAtSha || []).filter((t) => /^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[1-9][0-9]*)?$/.test(t));
490
508
  if (named.length) return out('named', `${at} is ${named.join(', ')}`);
491
509
  if (owed === 0) return out('nothing-owed', `nothing merged on main since the last final — no candidate is owed`);
492
- if (owed === null || owed === undefined) return out('nothing-owed', 'no final tag yet — the first version is a human decision, so no candidate is owed');
510
+ if (owed === null || owed === undefined) {
511
+ return out('no-final', 'no final tag yet — `release cut --auto` refuses every run until a human tags the first version (CONVENTIONS.md §6, Versioning); release stalled');
512
+ }
493
513
  if (promotion && !promotion.ok) return out('not-promotion', `${at} is not a promotion of trunk — --auto never cuts it (${promotion.detail})`);
494
514
  if (!Array.isArray(runs)) return out('unread', `gh run list failed — cannot tell whether ${at} is green`);
495
515
  const suite = runs.filter((r) => r && !DOWNSTREAM_EVENTS.includes(r.event));
@@ -725,7 +745,7 @@ function closedDone(issue) {
725
745
  * here: this is the release-time consequence, not the edge audit.
726
746
  */
727
747
  function switchVerdict(issues) {
728
- if (issues === null || issues === undefined) return { ok: false, detail: 'the issue list could not be read — switch dependencies cannot be cleared' };
748
+ if (issues === null || issues === undefined) return { ok: false, unread: true, detail: 'the issue list could not be read — switch dependencies cannot be cleared' };
729
749
  const problems = [];
730
750
  const needsOf = new Map(); // name -> { needs: [..], from: #N }
731
751
  const declared = new Set();
@@ -799,11 +819,18 @@ function promotionVerdict({ trunk, sha, parents, headOnTrunk, mergedFromTrunk, e
799
819
  function decide(facts) {
800
820
  const f = facts || {};
801
821
  const checks = [];
802
- const add = (condition, ok, detail) => checks.push({ condition, ok: !!ok, detail });
822
+ // #467: `unread` marks a failure that is a failed READ, not a measured fact — the next run reads
823
+ // again, so it is never a standing refusal. Kept out of the check rows (their shape is frozen).
824
+ const unreadSet = new Set();
825
+ const add = (condition, ok, detail, unread) => {
826
+ checks.push({ condition, ok: !!ok, detail });
827
+ if (!ok && unread) unreadSet.add(condition);
828
+ };
829
+ const isUnread = (verdict) => !!(verdict && verdict.unread);
803
830
 
804
831
  const p = f.policy;
805
832
  const fast = isFastRoute(p) && !(p.findings && p.findings.length);
806
- if (!p) add('release-policy', false, 'no release policy was evaluated');
833
+ if (!p) add('release-policy', false, 'no release policy was evaluated', true);
807
834
  else if (p.findings && p.findings.length) add('release-policy', false, `the release: block is invalid — ${p.findings.map((x) => x.text).join('; ')}`);
808
835
  else if (fast && !f.auto) {
809
836
  add('release-policy', false, 'route deploy-tag-fast tags its finals only from the release workflow (`colab release cut --auto`), where the deploy runs in the same run — a final cut by hand would reach production with no deploy job behind it');
@@ -822,7 +849,7 @@ function decide(facts) {
822
849
  let noop = false;
823
850
  if (f.auto) {
824
851
  const cad = f.auto.cadence || { ok: false, detail: 'cadence not measured' };
825
- add('cadence', cad.ok, cad.detail);
852
+ add('cadence', cad.ok, cad.detail, !f.auto.cadence);
826
853
  if (!cad.ok) noop = !!f.auto.cadence;
827
854
  if (fast) {
828
855
  const sp = f.auto.spacing || { ok: false, detail: 'final spacing not measured' };
@@ -832,7 +859,7 @@ function decide(facts) {
832
859
  // #429: on `trunk:` other than main, only a promotion head is a candidate; anything else no-ops.
833
860
  const pr = f.auto.promotion;
834
861
  if (pr) {
835
- add('promotion', pr.ok, pr.detail);
862
+ add('promotion', pr.ok, pr.detail, isUnread(pr));
836
863
  if (!pr.ok && !pr.unread) noop = true;
837
864
  }
838
865
  }
@@ -844,7 +871,7 @@ function decide(facts) {
844
871
  const v = f.auto
845
872
  ? decideAutoVersion({ lastFinal: f.lastFinal, signals: f.auto.signals, migration: f.auto.migration, tags: f.tags })
846
873
  : decideVersion({ lastFinal: f.lastFinal, suggestion: f.suggestion, override: f.override, tags: f.tags });
847
- add('version', v.ok, v.detail);
874
+ add('version', v.ok, v.detail, isUnread(v));
848
875
  // "Nothing merged since the last final" is a no-op for the release workflow, not a failure.
849
876
  if (f.auto && v.nothing) noop = true;
850
877
 
@@ -875,7 +902,10 @@ function decide(facts) {
875
902
  // #424: the three pre-tag checks, on the tag this run would create.
876
903
  if (tag) {
877
904
  for (const c of releaseTag.preTagChecks({ tag, manifests: f.manifests, ancestry: f.ancestry, tags: f.tags, trunk: RELEASE_BRANCH, versionSource: versionSourceOf(p) })) {
878
- add(c.condition, c.ok, c.detail);
905
+ // An unread manifest list or an unmeasured ancestry is a failed read, not a wrong manifest.
906
+ const unreadPre = (c.condition === 'manifest-version' && (f.manifests === null || f.manifests === undefined))
907
+ || (c.condition === 'on-trunk' && !f.ancestry);
908
+ add(c.condition, c.ok, c.detail, unreadPre);
879
909
  if (c.derivable && c.derivable.length) derivable = c.derivable;
880
910
  }
881
911
  } else if (f.ancestry && f.ancestry.shallow) {
@@ -884,8 +914,8 @@ function decide(facts) {
884
914
  }
885
915
 
886
916
  for (const [condition, verdict] of [['ci-green', f.ci], ['full-suite', f.suite], ['schema-additive', f.schema], ['switch-dependencies', f.switches]]) {
887
- if (!verdict) add(condition, false, 'not measured');
888
- else add(condition, verdict.ok, verdict.detail);
917
+ if (!verdict) add(condition, false, 'not measured', true);
918
+ else add(condition, verdict.ok, verdict.detail, isUnread(verdict));
889
919
  }
890
920
 
891
921
  // #446: what the fast route keeps in place of the test period it does not have.
@@ -893,19 +923,24 @@ function decide(facts) {
893
923
  let grant = null;
894
924
  if (fast) {
895
925
  const g = f.finalGrant || { ok: false, detail: `release.final-grant #${p.effective.finalGrant.issue} was not resolved — an unresolved grant is not a grant` };
896
- add('final-grant', g.ok, g.detail);
926
+ add('final-grant', g.ok, g.detail, !f.finalGrant || isUnread(g));
897
927
  if (g.ok) grant = { issue: p.effective.finalGrant.issue, ruledBy: g.ruledBy || null };
898
928
  const h = f.holds || { ok: false, detail: `${HOLD_LABEL} was not measured` };
899
- add('release-hold', h.ok, h.detail);
929
+ add('release-hold', h.ok, h.detail, !f.holds || isUnread(h));
900
930
  const mig = f.migrations || { ok: false, detail: 'migrations since the last final were not measured' };
901
- add('migration-grant', mig.ok, mig.detail);
931
+ add('migration-grant', mig.ok, mig.detail, !f.migrations || isUnread(mig));
902
932
  if (!mig.ok && v.ok && mig.paths && mig.paths.length) handoff = migrationHandoff(f.trackingIssue, v.version);
903
933
  }
904
934
 
905
935
  const refusals = checks.filter((c) => !c.ok);
906
936
  const ok = refusals.length === 0 && !!tag;
937
+ // #467: the refusals that will not clear by themselves — empty on ok and on a no-op, whose
938
+ // "failures" (cadence, nothing merged, head already a candidate) are the route holding.
939
+ const standing = ok || noop ? [] : refusals
940
+ .filter((c) => STANDING_CONDITIONS.includes(c.condition) && !unreadSet.has(c.condition))
941
+ .map((c) => c.condition);
907
942
  return {
908
- ok, noop: !ok && noop, checks, refusals, version: v.ok ? v.version : null, tag: ok ? tag : null,
943
+ ok, noop: !ok && noop, standing, checks, refusals, version: v.ok ? v.version : null, tag: ok ? tag : null,
909
944
  bump: v.ok ? v.bump : (v.bump || null), overridden: v.ok ? v.overridden : null,
910
945
  signals: f.auto ? f.auto.signals || null : null, migration: v.migration || null,
911
946
  derivable,
@@ -945,7 +980,7 @@ function tagMessage(verdict, { sha, lastFinal }) {
945
980
  }
946
981
 
947
982
  module.exports = {
948
- CONDITIONS, FAST_CONDITIONS, BUMPS, MIGRATION_FILE, RELEASE_BRANCH, HOLD_LABEL,
983
+ CONDITIONS, FAST_CONDITIONS, STANDING_CONDITIONS, BUMPS, MIGRATION_FILE, RELEASE_BRANCH, HOLD_LABEL,
949
984
  isFastRoute, spacingVerdict, holdsVerdict, migrationHandoff,
950
985
  parseVersion, formatVersion, candidateNumbers, nextCandidateNumber, decideVersion,
951
986
  parseGuardOutput, exportsDiff, switchRemovalsSince, autoSignals, parseMigrationSection, decideAutoVersion, cadenceVerdict,
@@ -202,18 +202,102 @@ function openCandidates(tags, remote = 'origin') {
202
202
  }
203
203
 
204
204
  /**
205
- * --auto (#423): `evaluations` is [{ candidate, verdict }] NEWEST FIRST, one decide() per candidate
206
- * judged. Returns { candidate, verdict, skipped: [{ tag, state }] }:
205
+ * #468: the one check that explains a verdict's state, as `<condition>: <detail>` — or null when the
206
+ * state needs no explaining (finalized, already-final). What a reader of a run needs is WHY this
207
+ * candidate did not finalize, not the whole checklist again.
208
+ */
209
+ function stateDetail(verdict) {
210
+ const v = verdict || {};
211
+ const checks = v.checks || [];
212
+ const failing = (name) => checks.find((c) => c.condition === name && !c.ok);
213
+ const fmt = (c) => (c ? `${c.condition}: ${c.detail}` : null);
214
+ switch (v.state) {
215
+ case 'finalized': case 'already-final': return null;
216
+ case 'held': return fmt(failing('release-hold'));
217
+ case 'needs-new-candidate': return fmt(failing('regressions') || failing('trunk-green'));
218
+ case 'testing': return fmt(failing('test-period') || failing('trunk-green'));
219
+ case 'candidate-ready': return fmt(failing('human'));
220
+ default: return fmt(checks.find((c) => c.required !== false && !c.ok) || checks.find((c) => !c.ok));
221
+ }
222
+ }
223
+
224
+ /**
225
+ * --auto (#423): `evaluations` is [{ candidate, verdict, period? }] NEWEST FIRST, one decide() per
226
+ * candidate judged. Returns { candidate, verdict, skipped: [{ tag, state, detail, endsAt }] }:
207
227
  * - any `held` verdict wins outright — a human veto is never walked around;
208
228
  * - else the first `finalized` (the newest candidate clean on its own clock);
209
229
  * - else the newest candidate's verdict (testing, refused …), with the older ones listed as skipped.
230
+ * #468: each skipped entry says why (stateDetail) and when its own period ends, so a run that
231
+ * finalizes nothing can say which candidate finals first — the fallback to the newest candidate
232
+ * otherwise reads exactly like "only the newest candidate is considered".
210
233
  */
211
234
  function pickNewestClean(evaluations) {
212
235
  const ev = evaluations || [];
213
236
  if (!ev.length) return { candidate: null, verdict: null, skipped: [] };
214
237
  const held = ev.find((e) => e.verdict.state === 'held');
215
238
  const pick = held || ev.find((e) => e.verdict.state === 'finalized') || ev[0];
216
- return { candidate: pick.candidate, verdict: pick.verdict, skipped: ev.filter((e) => e !== pick).map((e) => ({ tag: e.candidate.tag, state: e.verdict.state })) };
239
+ return {
240
+ candidate: pick.candidate,
241
+ verdict: pick.verdict,
242
+ skipped: ev.filter((e) => e !== pick).map((e) => ({
243
+ tag: e.candidate.tag, state: e.verdict.state, detail: stateDetail(e.verdict), endsAt: e.period ? e.period.endsAt : null,
244
+ })),
245
+ };
246
+ }
247
+
248
+ /**
249
+ * #468: is any red trunk run (`redAts`, ISO createdAt times from trunkGreenVerdict's `redAt`) inside
250
+ * this candidate's own window [start, endsAt)? The window is half-open exactly as trunkGreenVerdict
251
+ * reads it. True means the candidate would read `needs-new-candidate` — IF the red run's workflow is
252
+ * among the ones that vetted it; that is only known after a full judge, so a true here may be wrong
253
+ * in the safe direction only: a final delayed, never one made.
254
+ */
255
+ function windowHasRed(period, redAts) {
256
+ if (!period) return null;
257
+ const startMs = Date.parse(period.start);
258
+ const endMs = Date.parse(period.endsAt);
259
+ return (redAts || []).find((t) => { const ms = Date.parse(t); return ms >= startMs && ms < endMs; }) || null;
260
+ }
261
+
262
+ /**
263
+ * #468: why a run produced no final, in one line, plus the candidate that finals first.
264
+ * state, candidate, checks the picked verdict (and its candidate) — the run's reported state
265
+ * period the picked candidate's own period, or null
266
+ * skipped pickNewestClean's skipped list, the cheap-skipped testing ones included
267
+ * now ISO timestamp (the module stays clock-free)
268
+ * Returns null when a final was made (or the version is already final); else { line, next } where
269
+ * `next` = { tag, endsAt, hoursLeft } for the TESTING candidate whose own period ends soonest, or null.
270
+ */
271
+ function whyNoFinal({ state, candidate, checks, period, skipped, now } = {}) {
272
+ if (state === 'finalized' || state === 'already-final') return null;
273
+ const nowMs = Date.parse(now);
274
+ const testing = [
275
+ ...(state === 'testing' && candidate && period ? [{ tag: candidate.tag, endsAt: period.endsAt }] : []),
276
+ ...(skipped || []).filter((x) => x.state === 'testing' && x.endsAt),
277
+ ].filter((x) => !Number.isNaN(Date.parse(x.endsAt)));
278
+ testing.sort((a, b) => Date.parse(a.endsAt) - Date.parse(b.endsAt) || String(a.tag).localeCompare(String(b.tag)));
279
+ const first = testing[0] || null;
280
+ const next = first
281
+ ? { tag: first.tag, endsAt: first.endsAt, hoursLeft: Number.isNaN(nowMs) ? null : Math.max(0, Math.ceil((Date.parse(first.endsAt) - nowMs) / 3600000)) }
282
+ : null;
283
+ const nextText = next ? `${next.tag} is first, its own test period ends ${next.endsAt}${next.hoursLeft !== null ? ` (${next.hoursLeft}h left)` : ''}` : null;
284
+ const why = stateDetail({ state, checks });
285
+ const tag = candidate ? candidate.tag : 'no candidate';
286
+ let line;
287
+ if (state === 'no-candidate') line = `no open candidate to finalize${why ? ` — ${why}` : ''}`;
288
+ else if (state === 'testing') {
289
+ const allTesting = (skipped || []).every((x) => x.state === 'testing');
290
+ line = allTesting && nextText
291
+ ? `no candidate's own test period has elapsed clean — ${nextText}`
292
+ : `${tag} is still testing (${why || 'test period'})${nextText ? `; ${nextText}` : ''}`;
293
+ } else line = `${tag}: ${state}${why ? ` — ${why}` : ''}${nextText ? `; ${nextText}` : ''}`;
294
+ const older = (skipped || []).filter((x) => x.state !== 'testing');
295
+ if (older.length && state === 'testing') {
296
+ const counts = {};
297
+ for (const x of older) counts[x.state] = (counts[x.state] || 0) + 1;
298
+ line += `; older candidates: ${Object.entries(counts).map(([k, n]) => `${n} ${k}`).join(', ')}`;
299
+ }
300
+ return { line, next };
217
301
  }
218
302
 
219
303
  // ---- the test period ----------------------------------------------------------------------------
@@ -263,7 +347,9 @@ function trunkGreenVerdict(runs, { periodStart, periodEnd = null, suiteWorkflows
263
347
  const inWindow = runs.filter((r) => r && Date.parse(r.createdAt) >= startMs && Date.parse(r.createdAt) < endMs && suite.has(r.workflowName || '(unnamed workflow)') && r.event !== 'pull_request');
264
348
  const red = inWindow.filter((r) => r.status === 'completed' && !NOT_RED.has(r.conclusion) && r.conclusion !== 'cancelled');
265
349
  if (red.length) {
266
- return { ok: false, permanent: true, pending: false, detail: `trunk went red during the test period: ${red.map((r) => `${r.workflowName} ${r.conclusion}${r.branch ? ` on ${r.branch}` : ''} at ${String(r.headSha).slice(0, 7)} (${r.createdAt})`).join('; ')}` };
350
+ // #468: redAt — when each red run started — lets an --auto walk skip older candidates whose
351
+ // window holds the same red run without paying a full judge for each (windowHasRed).
352
+ return { ok: false, permanent: true, pending: false, redAt: red.map((r) => r.createdAt), detail: `trunk went red during the test period: ${red.map((r) => `${r.workflowName} ${r.conclusion}${r.branch ? ` on ${r.branch}` : ''} at ${String(r.headSha).slice(0, 7)} (${r.createdAt})`).join('; ')}` };
267
353
  }
268
354
  const unsettled = [];
269
355
  let pending = inWindow.some((r) => r.status !== 'completed');
@@ -342,7 +428,7 @@ function regressionVerdict(edges, { periodStart }) {
342
428
  * evaluate. Returns { ok, detail }.
343
429
  */
344
430
  function migrationGrantVerdict({ paths, grant, since }) {
345
- if (paths === null || paths === undefined) return { ok: false, detail: 'the migration files since the last final could not be read — an unread migration is not an absent one' };
431
+ if (paths === null || paths === undefined) return { ok: false, unread: true, detail: 'the migration files since the last final could not be read — an unread migration is not an absent one' };
346
432
  if (!paths.length) return { ok: true, detail: `no migration file changed since ${since || 'the first commit'}` };
347
433
  const list = paths.join(', ');
348
434
  if (grant && grant.ok) return { ok: true, detail: `${paths.length} migration file(s) since ${since || 'the first commit'} (${list}), granted on the tracking issue #${grant.issue}` };
@@ -522,7 +608,7 @@ module.exports = {
522
608
  STATES, CONDITIONS, HOLD_LABEL, CUT_SUBJECT_SUFFIX,
523
609
  parseVersion, compareVersions, parseCandidate,
524
610
  parseReleaseMarker, releaseMarker, eventMarker, hasEvent, trackingTitle, trackingBody,
525
- selectCandidate, openCandidates, pickNewestClean, periodVerdict, trunkGreenVerdict, windowBranches, mergeWindowRuns, regressionVerdict,
611
+ selectCandidate, openCandidates, pickNewestClean, stateDetail, windowHasRed, whyNoFinal, periodVerdict, trunkGreenVerdict, windowBranches, mergeWindowRuns, regressionVerdict,
526
612
  handoffCommand, decide, tagMessage, migrationGrantVerdict,
527
613
  carriedIssues, previousFinal, releasedEvent, releasedComment,
528
614
  };
@@ -421,7 +421,7 @@ function parseGrantIssue(v) {
421
421
  function finalGrantVerdict(record, { issue, trust } = {}) {
422
422
  const decisionRecord = require('./decision-record.js');
423
423
  const ref = `release.final-grant #${issue}`;
424
- if (!record) return { ok: false, ruledBy: null, detail: `${ref} could not be read from the tracker — an unread grant is not a grant` };
424
+ if (!record) return { ok: false, unread: true, ruledBy: null, detail: `${ref} could not be read from the tracker — an unread grant is not a grant` };
425
425
  const labels = (record.labels || []).map((l) => (l && typeof l === 'object' ? l.name : l));
426
426
  const all = decisionRecord.liveDecisions(record.comments);
427
427
  const live = decisionRecord.trustedDecisions(record.comments, trust);