Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
stable: a not_promotable record list the daily check skips and clients ignore
garrytancc532828d92d
diff --git a/.github/workflows/promote-stable.yml b/.github/workflows/promote-stable.ymlindex d9c2728837..68e657d68c 100644--- a/.github/workflows/promote-stable.yml+++ b/.github/workflows/promote-stable.yml@@ -55,6 +55,21 @@ on:required: falsetype: stringdefault: ''+ not_promotable:+ description: Versions the daily check must never soak or promote, comma-separated (clients ignore this list)+ required: false+ type: string+ default: ''+ not_promotable_reason:+ description: Why those versions are bad (required with not_promotable)+ required: false+ type: string+ default: ''+ not_promotable_fixed_in:+ description: The release that fixes them (required with not_promotable)+ required: false+ type: string+ default: ''permissions:contents: write # create and push the stable-v<version> and stable tags and the stable-record branch@@ -87,6 +102,9 @@ jobs:PROMOTE_ROLLBACK: ${{ inputs.rollback }}PROMOTE_REASON: ${{ inputs.reason }}PROMOTE_WITHDRAW: ${{ inputs.withdraw }}+ PROMOTE_NOT_PROMOTABLE: ${{ inputs.not_promotable }}+ PROMOTE_NOT_PROMOTABLE_REASON: ${{ inputs.not_promotable_reason }}+ PROMOTE_NOT_PROMOTABLE_FIXED_IN: ${{ inputs.not_promotable_fixed_in }}run: |git config user.name "gbrain-release-bot"git config user.email "41898282+github-actions[bot]@users.noreply.github.com"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 753716cce1..59209e4194 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -24,6 +24,8 @@ The upgrade restarted autopilot only through an installed launchd or systemd ser**The daily stable check no longer sticks on a rolled-back release.** A release that was stable before (its `stable-v<version>` record tag exists) or that `stable.json` lists in `known_bad` is skipped and logged, so the newest release gets its soak instead of a refused promotion on every scheduled run (#8792).+**A release can be marked not promotable when it soaked clean but is known bad from outside evidence.** Dispatch `promote-stable.yml` for the current stable with `not_promotable`, `not_promotable_reason` and `not_promotable_fixed_in`. The stable record gains a `not_promotable` list, and no tag moves. The daily check never soaks or promotes a release on it, on the important path and the weekly floor alike, and a manual promotion of one is refused. Clients ignore the list, so unlike `withdraw` it moves no install to another release.+## [0.60.624.0] - 2026-11-09**`gbrain doctor` now ends on its `--budget-ms` deadline when a local probe hangs, and the cheap incident checks keep their share of the budget.** The `home_dir_in_worktree` entry, which runs before the connection checks, ran `npm root -g`, `which -a gbrain` and `crontab -l` synchronously, with 5-second limits on the first and last and none on `which`. While one of them hung, nothing else in the process could run, the deadline included. So a 2500 ms run took about 5100 ms, and every later check, `links_extraction_lag` and `persistence_capacity` included, came back unknown with `elapsed_ms: 0`. Those probes now run asynchronously and are killed with SIGKILL at the entry's deadline (5 s at most, less the 250 ms report reserve), so none of them outlives the run. The entries before the connection checks may use at most half of the time left when the check run starts, so the ops sections and the cheap incident checks keep the other half. `--only`, `--fast` and a run with no database connection still give those entries the whole budget. This was the flaky `#6803 doctor deadlines (postgres)` E2E case (#8979). It failed on every backend-matrix job that ran on the 20261026.1 runner image, where a probe ran into its 5 s limit.diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex 3679abf288..8261bebfe2 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -609,7 +609,8 @@ gh workflow run promote-stable.yml -f version=<VERSION> \- **Refs.** `refs/tags/stable` is an annotated tag on the promoted releasecommit, moved only by this workflow. Clients peel it (`refs/tags/stable^{}`)and take the `v<VERSION>` tag on that commit. The same push commits the- evidence record `stable.json` (the tag fields plus `known_bad`) to the+ evidence record `stable.json` (the tag fields plus `known_bad` and+ `not_promotable`) to the`stable-record` branch; clients read only that file and refuse a recordwithout its evidence (`stable_invalid`, `src/core/stable-channel.ts`).`refs/tags/stable-v<VERSION>` is an immutable annotated record created on a@@ -624,7 +625,24 @@ gh workflow run promote-stable.yml -f version=<VERSION> \`/attempts/<n>`), `scoreboard_url` (optional, defaults to the run URL),`rollback` (default false), `reason` (required with rollback) and`withdraw` (versions added to the carried-forward `known_bad` list;- clients on one are offered the current stable, even when older).+ clients on one are offered the current stable, even when older), and+ `not_promotable` with `not_promotable_reason` and `not_promotable_fixed_in`+ (see below).+- **Not promotable.** A release can soak clean and still be bad, when the+ evidence comes from outside the soak (a regression found on a large brain,+ say). Record it so the daily check never soaks or promotes it: dispatch this+ workflow for the current stable version and its own soak run (the re-record+ path: no tag moves), with `not_promotable` set to the bad versions,+ `not_promotable_reason` saying why and `not_promotable_fixed_in` naming the+ newer release that fixes them. The list is carried forward on every later+ record, and `promote()` refuses a release on it. Clients never read it, so+ unlike `withdraw` it offers nobody a different release. Use `withdraw`+ only for a release that was stable, so its installs move off it:++ ```bash+ gh workflow run promote-stable.yml -f version=<current stable> -f soak_run_url=<its soak run> \+ -f not_promotable=<v1>,<v2> -f not_promotable_reason='<why>' -f not_promotable_fixed_in=<fix release>+ ```- **Who.** Only an actor with the admin or maintain role; anyone else isrefused. The one exception is the scheduled daily check below.- **Soak run.** The run must belong to this repository, be completed with@@ -701,7 +719,8 @@ and keeps stable between one day and one week behind what matters:erroring, so a smaller smoke dispatch never qualifies. On the important-only path the candidate must contain the fix.A release that was stable before (its `stable-v<version>` record tag exists,so it was promoted and rolled back) or that `stable.json` lists in `known_bad`- is skipped, logged, and never promoted or soaked by the schedule; a maintainer+ or `not_promotable` is skipped, logged, and never promoted or soaked by the+ schedule, on the important path and the weekly floor alike; a maintainerre-promotes it by hand if it should return.It is promoted through the same `promote()` as a manual promotion, so everycheck above still applies and the record's `promoted_by` isdiff --git a/scripts/promote-stable.ts b/scripts/promote-stable.tsindex 89165c6b0f..08c00a593a 100644--- a/scripts/promote-stable.ts+++ b/scripts/promote-stable.ts@@ -29,7 +29,8 @@* release commit, both carrying renderTagMessage();* 7. the evidence record (renderRecord(): version, commit, tree, soak run,* and the `known_bad` list, carried forward from the previous record plus- * this run's `withdraw` versions) is committed as `stable.json` on the+ * this run's `withdraw` versions, and the `not_promotable` list stable-daily+ * skips, carried forward the same way) is committed as `stable.json` on the* `stable-record` branch, parented on the previous record commit. One* atomic push moves all three, `stable` and `stable-record` leased on* the values read, so a failed push leaves the remote unchanged and a@@ -69,8 +70,13 @@ export interface PromoteInputs {reason: string;/** Versions to add to the record's known_bad list (withdrawn releases clients move off). */withdraw?: string[];+ /** Releases to add to the record's not_promotable list: stable-daily never soaks or promotes them; clients never read it. */+ notPromotable?: NotPromotable[];}+/** A release outside evidence shows is bad although it may soak clean, with the release that fixes it. */+export interface NotPromotable { version: string; reason: string; fixed_in: string }+export interface GitResult { code: number; stdout: string; stderr: string }export interface PromoteDeps {@@ -109,7 +115,7 @@ export interface TagFields {export interface Promotion extends TagFields { recordCreated: boolean; knownBad: string[] }/** The evidence record clients read (src/core/stable-channel.ts parseStableRecord); generation 1: soak evidence. */-export function renderRecord(f: TagFields, knownBad: readonly string[]): string {+export function renderRecord(f: TagFields, knownBad: readonly string[], notPromotable: readonly NotPromotable[] = []): string {return JSON.stringify({schema: 1,channel: 'stable',@@ -124,6 +130,7 @@ export function renderRecord(f: TagFields, knownBad: readonly string[]): stringrollback: f.rollback,reason: f.reason.trim().replace(/\s+/g, ' '),known_bad: [...knownBad],+ not_promotable: notPromotable.map(e => ({ version: e.version, reason: e.reason, fixed_in: e.fixed_in })),}, null, 2) + '\n';}@@ -137,6 +144,21 @@ export function mergeKnownBad(previous: readonly string[], withdraw: readonly streturn all;}+/** The previous record's not_promotable plus this run's entries (a new entry replaces one for its version), sorted; refuses one naming the promoted version. */+export function mergeNotPromotable(previous: readonly NotPromotable[], add: readonly NotPromotable[], version: string): NotPromotable[] {+ for (const e of add) {+ if (!VERSION_RE.test(e.version)) throw new Refusal(`not_promotable entry "${e.version}" is not a release version; pass versions like 0.60.649.0, comma-separated.`);+ if (!VERSION_RE.test(e.fixed_in) || compareVersions(e.fixed_in, e.version) <= 0) throw new Refusal(`not_promotable v${e.version} needs fixed_in: the newer release that carries the fix, like 0.60.652.0 (got "${e.fixed_in}").`);+ if (!e.reason.trim()) throw new Refusal(`not_promotable v${e.version} needs a reason: say what shows the release is bad.`);+ }+ const byVersion = new Map(previous.map(e => [e.version, e]));+ for (const e of add) byVersion.set(e.version, { version: e.version, reason: e.reason.trim().replace(/\s+/g, ' '), fixed_in: e.fixed_in });+ const all = [...byVersion.values()].sort((a, b) => compareVersions(a.version, b.version));+ const own = all.find(e => e.version === version);+ if (own) throw new Refusal(`v${version} is on the stable record's not_promotable list (${own.reason}; fixed in v${own.fixed_in}); promote a different release.`);+ return all;+}+export const DAILY_WORKFLOW = '.github/workflows/stable-daily.yml';/**@@ -254,7 +276,7 @@ export function parseTagMessage(message: string): TagFields | null {};}-export function renderSummary(p: Promotion): string {+export function renderSummary(p: Promotion, notPromotable: readonly NotPromotable[] = []): string {const rows: Array<[string, string]> = [['Version', `v${p.version}`],['Commit', `\`${p.commit}\``],@@ -264,6 +286,7 @@ export function renderSummary(p: Promotion): string {['Previous stable', p.previous ? `v${p.previous}` : 'none'],['Rollback', p.rollback ? `yes: ${p.reason.trim()}` : 'no'],['Known bad', p.knownBad.length ? p.knownBad.map(v => `v${v}`).join(', ') : 'none'],+ ['Not promotable', notPromotable.length ? notPromotable.map(e => `v${e.version} (${e.reason}; fixed in v${e.fixed_in})`).join(', ') : 'none'],['Record tag', p.recordCreated ? `\`stable-v${p.version}\` created` : `\`stable-v${p.version}\` already existed (re-promotion)`],['Promoted by', `${p.promotedBy} at ${p.promotedAt}`],];@@ -292,7 +315,7 @@ export async function currentStable(deps: PromoteDeps): Promise<{ version: strinreturn { version: versions.sort(compareVersions).at(-1)!, tagObject };}-export interface PriorRecord { commit: string; version: string | null; releaseCommit: string | null; knownBad: string[] }+export interface PriorRecord { commit: string; version: string | null; releaseCommit: string | null; knownBad: string[]; notPromotable: NotPromotable[] }/** The published evidence record (the remote stable-record head), or null before the first record. */export async function readPriorRecord(deps: PromoteDeps): Promise<PriorRecord | null> {@@ -300,27 +323,36 @@ export async function readPriorRecord(deps: PromoteDeps): Promise<PriorRecord |if (!(await refExists(deps, `${RECORD_REMOTE_REF}^{commit}`))) return null;const commit = await gitOut(deps, ['rev-parse', `${RECORD_REMOTE_REF}^{commit}`], `Could not resolve ${RECORD_REMOTE_REF}; re-run this workflow.`);const shown = await deps.git(['show', `${commit}:${RECORD_FILE}`]);- let prior: { version?: unknown; commit?: unknown; known_bad?: unknown };+ let prior: { version?: unknown; commit?: unknown; known_bad?: unknown; not_promotable?: unknown };try {prior = JSON.parse(shown.stdout);} catch {throw new Refusal(`The previous stable record (${commit}:${RECORD_FILE}) is not JSON, so its known_bad list cannot be carried forward; repair the stable-record branch by hand (${DOCS}).`);}+ const notPromotable = prior.not_promotable ?? [];+ const entry = (e: unknown): e is NotPromotable => {+ const r = e as Partial<NotPromotable> | null;+ return !!r && typeof r.version === 'string' && VERSION_RE.test(r.version) && typeof r.fixed_in === 'string' && VERSION_RE.test(r.fixed_in) && typeof r.reason === 'string';+ };+ if (!Array.isArray(notPromotable) || !notPromotable.every(entry)) {+ throw new Refusal(`The previous stable record (${commit}:${RECORD_FILE}) has a not_promotable list that is not {version, reason, fixed_in} entries, so it cannot be carried forward; repair the stable-record branch by hand (${DOCS}).`);+ }return {commit,version: typeof prior.version === 'string' ? prior.version : null,releaseCommit: typeof prior.commit === 'string' ? prior.commit : null,knownBad: Array.isArray(prior.known_bad) ? prior.known_bad.filter((v): v is string => typeof v === 'string' && VERSION_RE.test(v)) : [],+ notPromotable: notPromotable.map(e => ({ version: e.version, reason: e.reason, fixed_in: e.fixed_in })),};}/** Commit stable.json for `fields` on top of the previous record commit (none before the first record). */-async function commitRecord(deps: PromoteDeps, fields: TagFields, knownBad: string[], parent: string | null): Promise<string> {- const blob = await gitOut(deps, ['hash-object', '-w', '--stdin'], 'Could not write the stable record blob; re-run this workflow.', renderRecord(fields, knownBad));+async function commitRecord(deps: PromoteDeps, fields: TagFields, knownBad: string[], notPromotable: NotPromotable[], parent: string | null): Promise<string> {+ const blob = await gitOut(deps, ['hash-object', '-w', '--stdin'], 'Could not write the stable record blob; re-run this workflow.', renderRecord(fields, knownBad, notPromotable));const recordTree = await gitOut(deps, ['mktree'], 'Could not write the stable record tree; re-run this workflow.', `100644 blob ${blob}\t${RECORD_FILE}\n`);const recordCommit = await gitOut(deps, ['commit-tree', recordTree, ...(parent ? ['-p', parent] : []), '-m', `stable record: v${fields.version}`],'Could not commit the stable record; re-run this workflow.');- deps.log(`[promote-stable] stable record ${recordCommit} (known_bad: ${knownBad.length ? knownBad.join(', ') : 'none'}).`);+ deps.log(`[promote-stable] stable record ${recordCommit} (known_bad: ${knownBad.length ? knownBad.join(', ') : 'none'}; not_promotable: ${notPromotable.length ? notPromotable.map(e => e.version).join(', ') : 'none'}).`);return recordCommit;}@@ -342,17 +374,19 @@ async function recordCurrentStable(deps: PromoteDeps, inputs: PromoteInputs, relconst prior = await readPriorRecord(deps);const knownBad = mergeKnownBad(prior?.knownBad ?? [], inputs.withdraw ?? [], version);- if (prior && prior.version === version && prior.releaseCommit === commit && knownBad.length === new Set(prior.knownBad).size) {+ const notPromotable = mergeNotPromotable(prior?.notPromotable ?? [], inputs.notPromotable ?? [], version);+ const sameNotPromotable = JSON.stringify(notPromotable) === JSON.stringify(mergeNotPromotable(prior?.notPromotable ?? [], [], version));+ if (prior && prior.version === version && prior.releaseCommit === commit && knownBad.length === new Set(prior.knownBad).size && sameNotPromotable) {throw new Refusal(`${already}, and stable.json on stable-record records it, so there is nothing to promote.`);}deps.log(`[promote-stable] ${already}; writing its stable.json from the stable tag's message (${prior ? `the record named v${prior.version ?? 'nothing'}` : 'no record was published'}).`);- const recordCommit = await commitRecord(deps, tagged, knownBad, prior?.commit ?? null);+ const recordCommit = await commitRecord(deps, tagged, knownBad, notPromotable, prior?.commit ?? null);await gitOut(deps, ['push', '--atomic', `--force-with-lease=${STABLE_REF}:${current.tagObject}`, `--force-with-lease=${RECORD_BRANCH_REF}:${prior?.commit ?? ''}`, 'origin',`${STABLE_REF}:${STABLE_REF}`, `${recordCommit}:${RECORD_BRANCH_REF}`],'Writing the stable record failed and nothing changed on the remote (stable or the record may have moved since this run read them); re-run this workflow, which re-reads both.');deps.log(`[promote-stable] stable.json now records v${version} (${commit}); no tag moved.`);const promotion: Promotion = { ...tagged, recordCreated: false, knownBad };- deps.summary(renderSummary(promotion));+ deps.summary(renderSummary(promotion, notPromotable));return promotion;}@@ -421,7 +455,8 @@ export async function promote(deps: PromoteDeps, inputs: PromoteInputs): Promiseconst prior = await readPriorRecord(deps);const priorRecordCommit = prior?.commit ?? null;const knownBad = mergeKnownBad(prior?.knownBad ?? [], inputs.withdraw ?? [], version);- const recordCommit = await commitRecord(deps, fields, knownBad, priorRecordCommit);+ const notPromotable = mergeNotPromotable(prior?.notPromotable ?? [], inputs.notPromotable ?? [], version);+ const recordCommit = await commitRecord(deps, fields, knownBad, notPromotable, priorRecordCommit);if (!recordExists) {await gitOut(deps, ['tag', '-a', '--cleanup=verbatim', '-m', message, `stable-v${version}`, commit], `Could not create the tag stable-v${version}; re-run this workflow.`);@@ -438,7 +473,7 @@ export async function promote(deps: PromoteDeps, inputs: PromoteInputs): Promisedeps.log(`[promote-stable] stable now points at v${version} (${commit}).`);const promotion: Promotion = { ...fields, recordCreated: !recordExists, knownBad };- deps.summary(renderSummary(promotion));+ deps.summary(renderSummary(promotion, notPromotable));return promotion;}@@ -471,6 +506,8 @@ if (import.meta.main) {rollback: env.PROMOTE_ROLLBACK === 'true',reason: env.PROMOTE_REASON ?? '',withdraw: (env.PROMOTE_WITHDRAW ?? '').split(',').map(v => v.trim().replace(/^v/, '')).filter(Boolean),+ notPromotable: (env.PROMOTE_NOT_PROMOTABLE ?? '').split(',').map(v => v.trim().replace(/^v/, '')).filter(Boolean)+ .map(version => ({ version, reason: env.PROMOTE_NOT_PROMOTABLE_REASON ?? '', fixed_in: (env.PROMOTE_NOT_PROMOTABLE_FIXED_IN ?? '').trim().replace(/^v/, '') })),};const deps = processDeps();try {diff --git a/scripts/stable-daily.ts b/scripts/stable-daily.tsindex 29b83c1d91..1ffd378bdf 100644--- a/scripts/stable-daily.ts+++ b/scripts/stable-daily.ts@@ -26,8 +26,9 @@* promoted through scripts/promote-stable.ts promote(), so every promotion* check (published release, exact tree, never older) still applies. A release* that was stable before (its stable-v<version> record tag exists: promoted,- * then rolled back) or that stable.json lists as known_bad is never a- * candidate or soaked (#8792).+ * then rolled back) or that stable.json lists as known_bad or not_promotable+ * (bad on outside evidence the soak cannot see) is never a candidate or soaked+ * (#8792).* 4. Nothing promotable yet: the newest release is soaked (one dispatch of the* soak on its tag) unless a soak is already running, or a soak on any newer* release did not qualify (a maintainer decides; past the weekly floor it@@ -154,6 +155,8 @@ export async function daily(deps: DailyDeps): Promise<DailyResult> {const commit = await ok(deps, ['rev-parse', `refs/tags/${tag}^{commit}`]);if (!(await onReleaseBranch(deps, commit))) { deps.log(`[stable-daily] skipping ${tag}: ${commit} is not on master.`); continue; }if (published.knownBad.includes(version)) { deps.log(`[stable-daily] skipping ${tag}: stable.json lists it as known bad (withdrawn).`); continue; }+ const blocked = published.notPromotable.find(e => e.version === version);+ if (blocked) { deps.log(`[stable-daily] skipping ${tag}: stable.json lists it as not promotable (${blocked.reason}; fixed in v${blocked.fixed_in}).`); continue; }if (await refExists(deps, `refs/tags/stable-v${version}`)) { deps.log(`[stable-daily] skipping ${tag}: stable-v${version} exists, so it was stable before and was rolled back; a maintainer re-promotes it by hand if it should return.`); continue; }releases.push({ version, commit });}diff --git a/test/scripts/promote-stable.test.ts b/test/scripts/promote-stable.test.tsindex 13ca4d586c..f058bbddf0 100644--- a/test/scripts/promote-stable.test.ts+++ b/test/scripts/promote-stable.test.ts@@ -19,9 +19,10 @@ import { tmpdir } from 'node:os';import { join } from 'node:path';import { load } from 'js-yaml';import {- checkOrder, checkSoakRun, compareVersions, mergeKnownBad, normaliseWorkflowPath, parseRunUrl, parseTagMessage, processDeps, promote, Refusal, renderRecord, renderSummary, renderTagMessage,+ checkOrder, checkSoakRun, compareVersions, mergeKnownBad, mergeNotPromotable, normaliseWorkflowPath, parseRunUrl, parseTagMessage, processDeps, promote, Refusal, renderRecord, renderSummary, renderTagMessage,type GitResult, type PromoteDeps, type PromoteInputs, type SoakRun, type TagFields,} from '../../scripts/promote-stable.ts';+import { offeredVersion } from '../../src/core/self-upgrade.ts';import { parseStableRecord } from '../../src/core/stable-channel.ts';const ROOT = join(import.meta.dir, '..', '..');@@ -168,6 +169,7 @@ function harness(setup: Setup = {}) {return { deps, calls, api, logs, summaries, repo };}+const bad = (version: string, fixed_in = '0.60.365.0') => ({ version, reason: 'preview exceeds its statement bound', fixed_in });const inputs = (over: Partial<PromoteInputs> = {}): PromoteInputs => ({ version: '0.60.361.0', soakRunUrl: RUN_URL, scoreboardUrl: '', rollback: false, reason: '', ...over });describe('soak run URL parsing', () => {@@ -409,6 +411,48 @@ describe('evidence record (GBRA-224 W1)', () => {expect(h.calls.filter(c => c.startsWith('push'))[0]).toContain('--force-with-lease=refs/heads/stable-record:rec-prior');});+ test('not_promotable carries forward through a promotion, gains this run\'s entries, and refuses promoting a listed release before anything moves', async () => {+ const h = harness();+ h.repo.records = { 'rec-prior': JSON.stringify({ schema: 1, version: '0.60.360.0', known_bad: [], not_promotable: [bad('0.60.363.0')] }) };+ h.repo.recordBranch = 'rec-prior';+ await promote(h.deps, inputs({ notPromotable: [bad('0.60.362.0')] }));+ expect(JSON.parse(h.repo.records![h.repo.recordBranch!]!)).toMatchObject({ known_bad: [], not_promotable: [bad('0.60.362.0'), bad('0.60.363.0')] });+ expect(h.summaries.at(-1)).toContain('v0.60.362.0 (preview exceeds its statement bound; fixed in v0.60.365.0)');+ const listed = harness();+ listed.repo.records = { 'rec-prior': JSON.stringify({ schema: 1, version: '0.60.360.0', known_bad: [], not_promotable: [bad('0.60.361.0')] }) };+ listed.repo.recordBranch = 'rec-prior';+ await refusedAsync(promote(listed.deps, inputs()), /v0\.60\.361\.0 is on the stable record's not_promotable list \(preview exceeds its statement bound; fixed in v0\.60\.365\.0\)/);+ expect(listed.calls.filter(c => c.startsWith('push'))).toEqual([]);+ });++ test('refuses a not_promotable entry without a release version, a newer fixed_in or a reason, and a previous list it cannot read', async () => {+ refused(() => mergeNotPromotable([], [bad('0.60.x')], '0.60.361.0'), /not_promotable entry "0\.60\.x" is not a release version/);+ refused(() => mergeNotPromotable([], [bad('0.60.362.0', '0.60.362.0')], '0.60.361.0'), /needs fixed_in: the newer release that carries the fix/);+ refused(() => mergeNotPromotable([], [bad('0.60.362.0', '')], '0.60.361.0'), /needs fixed_in/);+ refused(() => mergeNotPromotable([], [{ ...bad('0.60.362.0'), reason: ' ' }], '0.60.361.0'), /needs a reason/);+ expect(mergeNotPromotable([bad('0.60.362.0')], [{ ...bad('0.60.362.0'), reason: 'a newer\nreason' }], '0.60.361.0')).toEqual([{ ...bad('0.60.362.0'), reason: 'a newer reason' }]);+ const corrupt = harness();+ corrupt.repo.records = { 'rec-prior': JSON.stringify({ schema: 1, version: '0.60.360.0', known_bad: [], not_promotable: ['0.60.362.0'] }) };+ corrupt.repo.recordBranch = 'rec-prior';+ await refusedAsync(promote(corrupt.deps, inputs()), /has a not_promotable list that is not \{version, reason, fixed_in\} entries/);+ expect(corrupt.calls.filter(c => c.startsWith('push'))).toEqual([]);+ });++ test('a client reads a record carrying not_promotable exactly as one without it: a client on a listed release is offered nothing, never a downgrade', () => {+ const fields: TagFields = {+ version: '0.60.361.0', commit: sha('b'), tree: sha('2'), soakRun: RUN_URL, scoreboard: RUN_URL,+ promotedBy: 'alice-example', promotedAt: '2026-10-20T09:00:00Z', previous: '0.60.360.0', rollback: false, reason: '',+ };+ const without = parseStableRecord(renderRecord(fields, []));+ const listed = parseStableRecord(renderRecord(fields, [], [bad('0.60.362.0')]));+ expect(without.ok).toBe(true);+ expect(listed).toEqual(without);+ if (!listed.ok) return;+ expect(offeredVersion('0.60.362.0', listed.record.version, listed.record.known_bad)).toBeNull();+ expect(offeredVersion('0.60.360.0', listed.record.version, listed.record.known_bad)).toBe('0.60.361.0');+ expect(offeredVersion('0.60.362.0', listed.record.version, ['0.60.362.0'])).toBe('0.60.361.0');+ });+test('refuses promoting a withdrawn version, a malformed withdrawal and an unreadable previous record, before anything moves', async () => {refused(() => mergeKnownBad(['0.60.361.0'], [], '0.60.361.0'), /known_bad list \(withdrawn\)/);refused(() => mergeKnownBad([], ['0.60.x'], '0.60.361.0'), /withdraw entry "0\.60\.x" is not a release version/);@@ -542,6 +586,18 @@ describe('stable.json bridge for a stable promoted before the evidence record (Gexpect(JSON.parse(h.repo.records![h.repo.recordBranch!]!).known_bad).toEqual(['0.60.355.0']);});+ test('not_promotable is written through the current-stable re-record path, moving no tag; the same list again is a no-op', async () => {+ const h = preRecord();+ await promote(h.deps, inputs());+ await promote(h.deps, inputs({ notPromotable: [bad('0.60.363.0'), bad('0.60.362.0')] }));+ expect(h.calls.filter(c => c.startsWith('tag -a'))).toEqual([]);+ expect(h.repo.remote).toEqual({ stable: 'tagobj-stable-361', 'stable-v0.60.361.0': 'tagobj-record-361' });+ expect(JSON.parse(h.repo.records![h.repo.recordBranch!]!)).toMatchObject({ version: '0.60.361.0', known_bad: [], not_promotable: [bad('0.60.362.0'), bad('0.60.363.0')] });+ await refusedAsync(promote(h.deps, inputs({ notPromotable: [bad('0.60.362.0')] })), /already the stable release, and stable\.json on stable-record records it/);+ await promote(h.deps, inputs({ withdraw: ['0.60.355.0'] }));+ expect(JSON.parse(h.repo.records![h.repo.recordBranch!]!)).toMatchObject({ known_bad: ['0.60.355.0'], not_promotable: [bad('0.60.362.0'), bad('0.60.363.0')] });+ });+test('a record left behind by a later record-less promotion is brought up to the stable tag, keeping known_bad', async () => {const h = preRecord();h.repo.records = { 'rec-360': renderRecord({ ...prior, version: '0.60.360.0', commit: sha('a'), tree: sha('1'), previous: null }, ['0.60.300.0']) };@@ -643,8 +699,8 @@ describe('promote-stable.yml', () => {test('dispatch only, with the decided inputs, one serial group and scoped permissions', () => {expect(Object.keys(wf.on)).toEqual(['workflow_dispatch']);const i = wf.on.workflow_dispatch!.inputs;- expect(Object.keys(i)).toEqual(['version', 'soak_run_url', 'scoreboard_url', 'rollback', 'reason', 'withdraw']);- expect(i.withdraw).toMatchObject({ required: false, type: 'string', default: '' });+ expect(Object.keys(i)).toEqual(['version', 'soak_run_url', 'scoreboard_url', 'rollback', 'reason', 'withdraw', 'not_promotable', 'not_promotable_reason', 'not_promotable_fixed_in']);+ for (const k of ['withdraw', 'not_promotable', 'not_promotable_reason', 'not_promotable_fixed_in']) expect(i[k]).toMatchObject({ required: false, type: 'string', default: '' });expect([i.version!.required, i.soak_run_url!.required, i.scoreboard_url!.required]).toEqual([true, true, false]);expect(i.rollback).toMatchObject({ type: 'boolean', default: false });expect(wf.concurrency).toEqual({ group: 'promote-stable', 'cancel-in-progress': false });@@ -657,7 +713,8 @@ describe('promote-stable.yml', () => {expect(run.env).toMatchObject({GH_TOKEN: '${{ github.token }}', STABLE_SOAK_WORKFLOW: '${{ vars.STABLE_SOAK_WORKFLOW }}',PROMOTE_VERSION: '${{ inputs.version }}', PROMOTE_SOAK_RUN_URL: '${{ inputs.soak_run_url }}', PROMOTE_SCOREBOARD_URL: '${{ inputs.scoreboard_url }}',- PROMOTE_ROLLBACK: '${{ inputs.rollback }}', PROMOTE_REASON: '${{ inputs.reason }}',+ PROMOTE_ROLLBACK: '${{ inputs.rollback }}', PROMOTE_REASON: '${{ inputs.reason }}', PROMOTE_WITHDRAW: '${{ inputs.withdraw }}',+ PROMOTE_NOT_PROMOTABLE: '${{ inputs.not_promotable }}', PROMOTE_NOT_PROMOTABLE_REASON: '${{ inputs.not_promotable_reason }}', PROMOTE_NOT_PROMOTABLE_FIXED_IN: '${{ inputs.not_promotable_fixed_in }}',});for (const s of steps) expect(s.run ?? '').not.toContain('${{');const releaseYml = readFileSync(join(ROOT, '.github/workflows/release.yml'), 'utf8');diff --git a/test/scripts/stable-daily.test.ts b/test/scripts/stable-daily.test.tsindex 6c6c30ce9d..ee91e16511 100644--- a/test/scripts/stable-daily.test.ts+++ b/test/scripts/stable-daily.test.ts@@ -358,6 +358,25 @@ describe('daily: weekly floor', () => {expect(w.logs.some(l => l.includes('skipping v1.0.3: stable-v1.0.3 exists'))).toBe(true);});+ test('a soaked release stable.json lists as not_promotable is skipped on the important path: nothing is promoted and the fix release is soaked', async () => {+ const published = JSON.stringify({ schema: 1, version: '1.0.1', commit: sha(1), known_bad: [], not_promotable: [{ version: '1.0.3', reason: 'preview exceeds its statement bound', fixed_in: '1.0.4' }] });+ const w = world(base({ published, importantPrs: [{ number: 20, merge: 2 }], runs: [soak(9, 3)] }));+ const r = await daily(w.deps);+ expect(r).toMatchObject({ action: 'soak_dispatched', version: '1.0.4' });+ expect(w.posts).toEqual([{ path: `repos/${REPO}/actions/workflows/production-soak.yml/dispatches`, body: { ref: 'v1.0.4' } }]);+ expect(w.pushes).toEqual([]);+ expect(w.logs.some(l => l.includes('skipping v1.0.3: stable.json lists it as not promotable (preview exceeds its statement bound; fixed in v1.0.4)'))).toBe(true);+ });++ test('the weekly walk skips a not_promotable release too, and is never soaked', async () => {+ const published = JSON.stringify({ schema: 1, version: '1.0.1', commit: sha(1), known_bad: [], not_promotable: [{ version: '1.0.4', reason: 'regression', fixed_in: '1.0.5' }] });+ const w = world(base({ stable: old, published, runs: [soak(9, 3)] }));+ const r = await daily(w.deps);+ expect(r.action === 'promoted' && r.promotion.version).toBe('1.0.3');+ const unsoaked = world(base({ stable: old, published }));+ expect(await daily(unsoaked.deps)).toMatchObject({ action: 'soak_dispatched', version: '1.0.3' });+ });+test('a release stable.json lists as known_bad is never a candidate; an older qualifying release still promotes (#8792)', async () => {const published = JSON.stringify({ schema: 1, version: '1.0.1', commit: sha(1), known_bad: ['1.0.3'] });const w = world(base({ stable: old, published, runs: [soak(8, 2), soak(9, 3)] }));