Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Recover beta installers and gate release writeback on publication (#4962)
Andrew Mikofalvy90a3ee06dd27
diff --git a/.github/scripts/derive-release-stamp.mjs b/.github/scripts/derive-release-stamp.mjsindex 03866c72c..ee2a2b96c 100644--- a/.github/scripts/derive-release-stamp.mjs+++ b/.github/scripts/derive-release-stamp.mjs@@ -1,7 +1,13 @@#!/usr/bin/env node+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint outside Turbo. */import { spawnSync } from 'node:child_process';import { appendFileSync } from 'node:fs';import { pathToFileURL } from 'node:url';+import {+ previousPublishedRelease,+ realPublishedReleaseTags,+ requirePublishedRelease,+} from './published-release-tags.mjs';const STABLE_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)$/;const BETA_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)-beta\.(\d+)$/;@@ -97,27 +103,6 @@ function realResolveStableBaseRef(previousTag, tag) {return bases[0];}-function realTags() {- return runGit(['tag', '--list', 'v*'])- .split('\n')- .map((line) => line.trim())- .filter(Boolean);-}--const NO_PREVIOUS_TAG_SENTINELS = [/No names found/i, /unknown revision/i];--function realDescribePreviousTag(tag) {- const res = spawnSync('git', ['describe', '--tags', '--abbrev=0', `${tag}^`], {- encoding: 'utf8',- });- if (res.status === 0) return String(res.stdout || '').trim() || null;- const stderr = String(res.stderr || '');- if (NO_PREVIOUS_TAG_SENTINELS.some((re) => re.test(stderr))) return null;- throw new Error(- `git describe --tags --abbrev=0 ${tag}^ failed (exit ${res.status}): ${stderr.trim()}`,- );-}-export function formatOutputLines(result) {return [`channel=${result.channel}`,@@ -130,10 +115,15 @@ export function formatOutputLines(result) {function main() {let result;try {+ const tags = realPublishedReleaseTags();+ requirePublishedRelease(process.argv[2], tags);result = deriveReleaseStamp({tag: process.argv[2],- tags: realTags(),- describePreviousTag: realDescribePreviousTag,+ tags,+ describePreviousTag: (tag) => {+ const previous = previousPublishedRelease(tag, tags);+ return previous ? realResolveStableBaseRef(previous, tag) : null;+ },resolveStableBaseRef: realResolveStableBaseRef,});} catch (err) {diff --git a/.github/scripts/derive-release-stamp.test.mjs b/.github/scripts/derive-release-stamp.test.mjsindex 5d28d1382..5b474ae20 100644--- a/.github/scripts/derive-release-stamp.test.mjs+++ b/.github/scripts/derive-release-stamp.test.mjs@@ -1,5 +1,13 @@import { execFileSync, spawnSync } from 'node:child_process';-import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import {+ chmodSync,+ cpSync,+ mkdirSync,+ mkdtempSync,+ readFileSync,+ rmSync,+ writeFileSync,+} from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { fileURLToPath } from 'node:url';@@ -243,20 +251,65 @@ function makeReleaseRepo() {{ cwd: dir, encoding: 'utf8', env, stdio: ['ignore', 'pipe', 'pipe'] },).trim();git('init', '--quiet', '--initial-branch=main');+ const bin = join(dir, '.git', 'test-bin');+ mkdirSync(bin);+ writeFileSync(+ join(bin, 'gh'),+ `#!/usr/bin/env node+const {execFileSync} = require('node:child_process');+const drafts = JSON.parse(process.env.TEST_DRAFT_TAGS || '[]');+for (const tag_name of execFileSync('git', ['tag', '--list'], {encoding:'utf8'}).trim().split('\\n').filter(Boolean)) {+ console.log(JSON.stringify({tag_name, draft:drafts.includes(tag_name), published_at: drafts.includes(tag_name) ? null : '2026-09-24T22:00:00Z', assets:[{name:'OpenKnowledge-arm64.dmg'},{name:'beta-mac.yml'}]}));+}+`,+ );+ chmodSync(join(bin, 'gh'), 0o755);+ env.PATH = `${bin}:${env.PATH}`;const commit = (subject) => {git('commit', '--quiet', '--allow-empty', '-m', subject);return git('rev-parse', 'HEAD');};- const run = (tag) =>+ const run = (tag, drafts = []) =>spawnSync(process.execPath,[fileURLToPath(new URL('./derive-release-stamp.mjs', import.meta.url)), tag],- { cwd: dir, encoding: 'utf8', env: { ...env, GITHUB_OUTPUT: join(dir, 'output') } },+ {+ cwd: dir,+ encoding: 'utf8',+ env: {+ ...env,+ TEST_DRAFT_TAGS: JSON.stringify(drafts),+ GITHUB_OUTPUT: join(dir, 'output'),+ },+ },);- return { dir, git, commit, run };+ return { dir, git, commit, run, env };}describe('release scan bounds with real Git histories', () => {+ test('recovery scans every unpublished beta and refuses writeback before publication', () => {+ const { git, commit, run } = makeReleaseRepo();+ commit('published stable');+ git('tag', 'v0.77.9');+ const drafts = [];+ const fixes = [];+ for (let index = 0; index < 12; index++) {+ fixes.push(commit(`PRD-${9000 + index}: queued fix`));+ const tag = `v0.78.0-beta.${index}`;+ git('tag', tag);+ drafts.push(tag);+ }+ const target = drafts.at(-1);+ const refused = run(target, drafts);+ expect(refused.status).toBe(1);+ expect(refused.stderr).toContain('not a published desktop release');+ const recovered = run(target, drafts.slice(0, -1));+ expect(recovered.status, recovered.stderr).toBe(0);+ const { baseRef } = JSON.parse(recovered.stdout);+ expect(baseRef).toBe('v0.77.9');+ expect(git('rev-list', `${baseRef}..HEAD`).split('\n')).toEqual(fixes.reverse());+ });+test('v0.71.8 uses the common ancestor of a divergent v0.71.7 without widening the scan', () => {const { dir, git, commit, run } = makeReleaseRepo();commit('PRD-1000: already shipped');@@ -330,7 +383,7 @@ describe('release scan bounds with real Git histories', () => {test.each(['missing', 'broken'])('restores both stamping scripts and their imports over %s historical scripts',(history) => {- const { dir, git, commit } = makeReleaseRepo();+ const { dir, git, commit, env: fixtureEnv } = makeReleaseRepo();const common = commit('common');git('switch', '-c', 'previous-stable');commit('previous stable');@@ -359,7 +412,7 @@ describe('release scan bounds with real Git histories', () => {git('add', '.');const workflowSha = commit('fixed stamping scripts');const env = {- ...gitCleanEnv(),+ ...fixtureEnv,RELEASE_TAG: 'v0.71.8',GITHUB_OUTPUT: join(dir, 'output'),LINEAR_API_KEY: '',diff --git a/.github/scripts/download-candidate-dmg.mjs b/.github/scripts/download-candidate-dmg.mjsindex a295585a4..c13a9c7bc 100644--- a/.github/scripts/download-candidate-dmg.mjs+++ b/.github/scripts/download-candidate-dmg.mjs@@ -13,13 +13,15 @@ export function candidateIdentity(comparisonStatus) {}export function selectDmgAsset(assets, identity) {- const names = assets- .map((asset) => asset.name)- .filter((name) => /^OpenKnowledge(?:-Beta)?-(?:arm64|x64|universal)\.dmg$/.test(name));- if (names.length !== 1) return null;- if (identity === 'beta' && names[0].startsWith('OpenKnowledge-Beta-')) return names[0];- if (identity === 'legacy' && !names[0].startsWith('OpenKnowledge-Beta-')) return names[0];- return null;+ const pattern =+ identity === 'beta'+ ? /^OpenKnowledge-Beta-(?:arm64|x64|universal)\.dmg$/+ : identity === 'legacy'+ ? /^OpenKnowledge-(?:arm64|x64|universal)\.dmg$/+ : null;+ if (pattern === null) return null;+ const names = assets.map((asset) => asset.name).filter((name) => pattern.test(name));+ return names.length === 1 ? names[0] : null;}function ghText(args, timeout = 30_000) {diff --git a/.github/scripts/download-candidate-dmg.test.mjs b/.github/scripts/download-candidate-dmg.test.mjsindex eec45a815..254bd1af1 100644--- a/.github/scripts/download-candidate-dmg.test.mjs+++ b/.github/scripts/download-candidate-dmg.test.mjs@@ -106,7 +106,12 @@ describe('candidate DMG inventory', () => {[],[{ name: 'unrelated.dmg' }],[{ name: '../OpenKnowledge-arm64.dmg' }],- [{ name: 'OpenKnowledge-arm64.dmg' }, { name: 'OpenKnowledge-Beta-arm64.dmg' }],+ [+ { name: 'OpenKnowledge-arm64.dmg' },+ { name: 'OpenKnowledge-x64.dmg' },+ { name: 'OpenKnowledge-Beta-arm64.dmg' },+ { name: 'OpenKnowledge-Beta-x64.dmg' },+ ],].map((assets) => ({ assets })),)('refuses missing, unknown or ambiguous installers: $assets', ({ assets }) => {expect(selectDmgAsset(assets, 'legacy')).toBeNull();@@ -119,6 +124,12 @@ describe('candidate DMG inventory', () => {expect(selectDmgAsset([{ name: 'OpenKnowledge-arm64.dmg' }], 'unknown')).toBeNull();});+ test('selects the intended product from a dual-Beta release without merging their identities', () => {+ const assets = [{ name: 'OpenKnowledge-arm64.dmg' }, { name: 'OpenKnowledge-Beta-arm64.dmg' }];+ expect(selectDmgAsset(assets, 'beta')).toBe('OpenKnowledge-Beta-arm64.dmg');+ expect(selectDmgAsset(assets, 'legacy')).toBe('OpenKnowledge-arm64.dmg');+ });+test('requires proven ancestry across the product-identity split', () => {expect(candidateIdentity('behind')).toBe('legacy');expect(candidateIdentity('ahead')).toBe('beta');diff --git a/.github/scripts/linear-release-shape.test.mjs b/.github/scripts/linear-release-shape.test.mjsindex 26660595b..1845d37b8 100644--- a/.github/scripts/linear-release-shape.test.mjs+++ b/.github/scripts/linear-release-shape.test.mjs@@ -1,3 +1,4 @@+/* biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub expression and shell fixtures must remain literal. */import { readFileSync } from 'node:fs';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';@@ -45,6 +46,13 @@ const UNDELIVERABLE_POST_ONLY_WARNS =/if ! curl[\s\S]*?; then\n\s+echo "::warning::Linear stamping failure alert failed to POST\."\n\s+fi/;describe('linear release stamping workflow', () => {+ test('only completed installer publication triggers automatic stamping', () => {+ const parsed = parse(workflow);+ expect(parsed.on.repository_dispatch.types).toEqual(['desktop-release-published']);+ const derive = parsed.jobs.stamp.steps.find((step) => step.id === 'derive');+ expect(derive.env.GH_TOKEN).toBe('${{ github.token }}');+ });+test('restores workflow revision scripts after checking out historical release code', () => {const labels = stepLabels(workflow);const expected = [@@ -57,9 +65,7 @@ describe('linear release stamping workflow', () => {.flatMap((job) => job.steps).find((step) => step.name === 'Restore stamping scripts from workflow revision');expect(restore.env.WORKFLOW_SHA).toBe('${{ github.workflow_sha }}');- expect(restore.run).toBe(- 'git restore --source "$WORKFLOW_SHA" --worktree .github/scripts/',- );+ expect(restore.run).toBe('git restore --source "$WORKFLOW_SHA" --worktree .github/scripts/');expect(workflow).toContain('run: node .github/scripts/derive-release-stamp.mjs "${RELEASE_TAG}"',);diff --git a/.github/scripts/package-desktop.mjs b/.github/scripts/package-desktop.mjsnew file mode 100644index 000000000..4d5697992--- /dev/null+++ b/.github/scripts/package-desktop.mjs@@ -0,0 +1,38 @@+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions supplies the packaging context. */+import { spawnSync } from 'node:child_process';+import { existsSync } from 'node:fs';+import { join, resolve } from 'node:path';+import { pathToFileURL } from 'node:url';++export function packagingInvocation({ cwd, args, variant }) {+ const launcher = join(cwd, 'scripts', 'run-electron-builder.mjs');+ if (existsSync(launcher)) return [launcher, ...args];+ if (variant !== 'stable')+ throw new Error(+ 'This source predates product variants; only its original Stable identity can be packaged',+ );+ const legacyArgs = args.includes('--linux')+ ? [...args, '--config', 'electron-builder.linux.yml']+ : args;+ return [join(cwd, 'node_modules', 'electron-builder', 'cli.js'), ...legacyArgs];+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {+ if (!process.env.npm_config_user_agent?.startsWith('pnpm/')) {+ throw new Error(+ 'Run desktop packaging through pnpm exec node so dependency collection uses pnpm',+ );+ }+ const result = spawnSync(+ process.execPath,+ packagingInvocation({+ cwd: resolve(process.cwd()),+ args: process.argv.slice(2),+ variant: process.env.OK_DESKTOP_VARIANT,+ }),+ { stdio: 'inherit', env: process.env },+ );+ if (result.error) throw result.error;+ if (result.signal) throw new Error(`Desktop packaging terminated by ${result.signal}`);+ process.exit(result.status ?? 1);+}diff --git a/.github/scripts/package-desktop.test.mjs b/.github/scripts/package-desktop.test.mjsnew file mode 100644index 000000000..39bdc6b30--- /dev/null+++ b/.github/scripts/package-desktop.test.mjs@@ -0,0 +1,65 @@+import { execFileSync, spawnSync } from 'node:child_process';+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { expect, test } from 'vitest';+import { packagingInvocation } from './package-desktop.mjs';++const script = fileURLToPath(new URL('./package-desktop.mjs', import.meta.url));++test.each(+ [false, true].flatMap((modern) =>+ ['--mac', '--win', '--linux'].map((platform) => [modern, platform]),+ ),+)(+ 'packages source with variant launcher present=%s on %s without changing its identity',+ (modern, platform) => {+ const cwd = mkdtempSync(join(tmpdir(), 'ok-package-source-'));+ try {+ const launcher = modern+ ? join(cwd, 'scripts', 'run-electron-builder.mjs')+ : join(cwd, 'node_modules', 'electron-builder', 'cli.js');+ mkdirSync(join(launcher, '..'), { recursive: true });+ writeFileSync(join(cwd, 'package.json'), '{}');+ const output = join(cwd, 'observed.json');+ writeFileSync(+ launcher,+ `require('node:fs').writeFileSync(${JSON.stringify(output)},JSON.stringify({args:process.argv.slice(2),pm:process.env.npm_config_user_agent,variant:process.env.OK_DESKTOP_VARIANT}));`.replace(+ "require('node:fs')",+ modern ? "(await import('node:fs'))" : "require('node:fs')",+ ),+ );+ const args = [platform, '--publish', 'never', '--config.extraMetadata.version=0.77.9'];+ execFileSync(process.execPath, [script, ...args], {+ cwd,+ env: {+ ...process.env,+ npm_config_user_agent: 'pnpm/10.33.0',+ OK_DESKTOP_VARIANT: modern ? 'beta' : 'stable',+ },+ });+ expect(JSON.parse(readFileSync(output, 'utf8'))).toEqual({+ args:+ modern || platform !== '--linux'+ ? args+ : [...args, '--config', 'electron-builder.linux.yml'],+ pm: 'pnpm/10.33.0',+ variant: modern ? 'beta' : 'stable',+ });+ if (!modern)+ expect(() => packagingInvocation({ cwd, args, variant: 'beta' })).toThrow(+ 'original Stable identity',+ );+ const failed = spawnSync(process.execPath, [script, ...args], {+ cwd,+ env: { ...process.env, npm_config_user_agent: '' },+ encoding: 'utf8',+ });+ expect(failed.status).not.toBe(0);+ expect(failed.stderr).toContain('pnpm exec node');+ } finally {+ rmSync(cwd, { recursive: true, force: true });+ }+ },+);diff --git a/.github/scripts/published-release-tags.mjs b/.github/scripts/published-release-tags.mjsnew file mode 100644index 000000000..1690b8803--- /dev/null+++ b/.github/scripts/published-release-tags.mjs@@ -0,0 +1,87 @@+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint outside Turbo. */+import { execFileSync } from 'node:child_process';++const STABLE_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)$/;+const BETA_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)-beta\.(\d+)$/;++function releaseTagKey(raw) {+ const line = String(raw).trim();+ const stable = STABLE_TAG_RE.exec(line);+ if (stable) {+ return { tag: stable[0], key: [Number(stable[1]), Number(stable[2]), Number(stable[3]), 1, 0] };+ }+ const beta = BETA_TAG_RE.exec(line);+ if (beta) {+ return {+ tag: beta[0],+ key: [Number(beta[1]), Number(beta[2]), Number(beta[3]), 0, Number(beta[4])],+ };+ }+ return null;+}++function byReleaseKeyAscending(a, b) {+ for (let i = 0; i < a.key.length; i += 1) {+ if (a.key[i] !== b.key[i]) return a.key[i] - b.key[i];+ }+ return 0;+}++export function sortReleaseTagsAscending(rawTags) {+ const parsed = [];+ for (const line of rawTags) {+ const entry = releaseTagKey(line);+ if (entry) parsed.push(entry);+ }+ parsed.sort(byReleaseKeyAscending);+ return parsed.map((p) => p.tag);+}++export function publishedReleaseTags(releases) {+ return sortReleaseTagsAscending(+ releases+ .filter(+ (release) =>+ release.draft === false &&+ Number.isFinite(Date.parse(release.published_at)) &&+ release.assets?.some((asset) => asset.name.endsWith('.dmg')) &&+ release.assets?.some((asset) => asset.name.endsWith('-mac.yml')),+ )+ .map((release) => release.tag_name),+ );+}++export function requirePublishedRelease(tag, tags) {+ if (!tags.includes(tag))+ throw new Error(+ `${tag} is not a published desktop release with installers; refusing release writeback`,+ );+}++export function previousPublishedRelease(tag, tags) {+ const sorted = sortReleaseTagsAscending(tags);+ requirePublishedRelease(tag, sorted);+ return sorted[sorted.indexOf(tag) - 1] ?? null;+}++export function realPublishedReleaseTags(+ repo = process.env.GITHUB_REPOSITORY || 'inkeep/open-knowledge',+) {+ const output = execFileSync(+ 'gh',+ [+ 'api',+ `repos/${repo}/releases?per_page=100`,+ '--paginate',+ '--jq',+ '.[] | {tag_name,draft,published_at,assets:[.assets[] | {name}]}',+ ],+ { encoding: 'utf8', timeout: 120_000, maxBuffer: 32 * 1024 * 1024 },+ );+ return publishedReleaseTags(+ output+ .split('\n')+ .filter(Boolean)+ .map((line) => JSON.parse(line)),+ );+}diff --git a/.github/scripts/published-release-tags.test.mjs b/.github/scripts/published-release-tags.test.mjsnew file mode 100644index 000000000..658d9524c--- /dev/null+++ b/.github/scripts/published-release-tags.test.mjs@@ -0,0 +1,63 @@+import { expect, test } from 'vitest';+import {+ previousPublishedRelease,+ publishedReleaseTags,+ requirePublishedRelease,+} from './published-release-tags.mjs';+import { deriveVersionForFixRefs, makeReleaseWindow } from './write-back.mjs';++const release = (tag_name, over = {}) => ({+ tag_name,+ draft: false,+ published_at: '2026-09-24T22:00:00Z',+ assets: [{ name: 'OpenKnowledge-arm64.dmg' }, { name: 'beta-mac.yml' }],+ ...over,+});++test('drafts, missing publication timestamps and metadata-only records are not shipped releases', () => {+ expect(+ publishedReleaseTags([+ release('v0.77.8'),+ release('v0.77.9', { draft: true }),+ release('v0.78.0-beta.1', { published_at: null }),+ release('v0.78.0-beta.2', { assets: [] }),+ release('v0.78.0-beta.4', { assets: [{ name: 'OpenKnowledge-arm64.dmg' }] }),+ release('v0.78.0-beta.5', { assets: [{ name: 'beta-mac.yml' }] }),+ release('v0.78.0-beta.3'),+ ]),+ ).toEqual(['v0.77.8', 'v0.78.0-beta.3']);+ expect(() => requirePublishedRelease('v0.77.9', ['v0.77.8'])).toThrow(+ 'refusing release writeback',+ );+});++test('a recovered cumulative beta includes fixes first tagged across twelve unpublished drafts', () => {+ const pending = [+ ...Array.from({ length: 5 }, (_, i) => `v0.77.9-beta.${i + 1}`),+ ...Array.from({ length: 7 }, (_, i) => `v0.78.0-beta.${i}`),+ ];+ const tags = publishedReleaseTags([+ release('v0.77.8'),+ release('v0.77.9'),+ ...pending.map((tag) =>+ release(tag, {+ draft: tag !== 'v0.78.0-beta.6',+ published_at: tag === 'v0.78.0-beta.6' ? '2026-09-24T22:00:00Z' : null,+ }),+ ),+ ]);+ const privateSha = 'a'.repeat(40);+ const version = deriveVersionForFixRefs({+ fixReferences: [{ channel: 'commit', sha: privateSha }],+ stableTags: tags,+ channel: 'beta',+ findMirroredCommits: () => [{ sha: 'b'.repeat(40), message: `GitOrigin-RevId: ${privateSha}` }],+ contains: (tag) => tag === 'v0.78.0-beta.6',+ resolvePrMergeSha: () => privateSha,+ });+ expect(version).toBe('0.78.0-beta.6');+ expect(+ makeReleaseWindow({ releaseTag: 'v0.78.0-beta.6', stableTags: tags, channel: 'beta' })(version),+ ).toBe('in-window');+ expect(previousPublishedRelease('v0.78.0-beta.6', tags)).toBe('v0.77.9');+});diff --git a/.github/scripts/release-cascade-shape.test.mjs b/.github/scripts/release-cascade-shape.test.mjsindex 0a7a56655..a76c05290 100644--- a/.github/scripts/release-cascade-shape.test.mjs+++ b/.github/scripts/release-cascade-shape.test.mjs@@ -7,6 +7,7 @@ import { tmpdir } from 'node:os';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';import { afterAll, describe, expect, test } from 'vitest';+import { parse } from 'yaml';import { buildSlackPayload } from './build-smoke-alert-payload.mjs';import { selectPromotion } from './select-beta-to-promote.mjs';import { smokePackagedDmg, VERDICT } from './smoke-packaged-dmg.mjs';@@ -98,7 +99,7 @@ describe('the stable gate is upstream of everything that ships', () => {const afterGate = desktopRelease.slice(desktopRelease.indexOf('- name: Smoke the packaged DMG'),);- const shipping = afterGate.slice(0, afterGate.indexOf('- name: Alert on a blocked release'));+ const shipping = afterGate.slice(0, afterGate.indexOf(' release-consumers:'));const stepIfs = stepLevelIfConditions(shipping);expect(stepIfs.length).toBeGreaterThan(0);for (const condition of stepIfs) {@@ -115,7 +116,7 @@ describe('the stable gate is upstream of everything that ships', () => {const afterGate = desktopRelease.slice(desktopRelease.indexOf('- name: Smoke the packaged DMG'),);- const shipping = afterGate.slice(0, afterGate.indexOf('- name: Alert on a blocked release'));+ const shipping = afterGate.slice(0, afterGate.indexOf(' release-consumers:'));const conditions = stepLevelIfConditions(shipping);const shippingConditions = conditions.filter((c) => c !== "steps.channel.outputs.channel == 'latest'",@@ -270,6 +271,92 @@ describe('the publishing Windows lane attests its signed native payload', () =>});describe('the fan-in publication DAG gates every platform', () => {+ test.each([0, 1])(+ 'dispatch failure pages independently of publication (webhook exit %s)',+ (status) => {+ const job = parse(desktopRelease).jobs['release-consumers'];+ const alert = job.steps.find((step) => step.name === 'Alert on failed publication dispatch');+ expect(alert.if).toBe('failure() || cancelled()');+ const dir = mkdtempSync(join(tmpdir(), 'ok-dispatch-alert-'));+ try {+ const capture = join(dir, 'post');+ const output = execFileSync(+ 'bash',+ ['-c', `curl() { printf '%s\\n' "$*" >> "$CAPTURE"; return ${status}; }\n${alert.run}`],+ {+ encoding: 'utf8',+ env: {+ ...process.env,+ RELEASE_TAG: 'v0.78.0-beta.6',+ GITHUB_SERVER_URL: 'https://github.com',+ GITHUB_REPOSITORY: 'inkeep/open-knowledge',+ GITHUB_RUN_ID: '123',+ GITHUB_STEP_SUMMARY: join(dir, 'summary'),+ SLACK_RELEASES_WEBHOOK_URL: 'https://example.test/slack',+ CAPTURE: capture,+ },+ },+ );+ expect(readFileSync(capture, 'utf8')).toContain(+ 'Release v0.78.0-beta.6 is published, but its notification dispatch failed',+ );+ expect(readFileSync(capture, 'utf8')).toContain('desktop-release-published');+ expect(readFileSync(join(dir, 'summary'), 'utf8')).toContain(+ 'do not rebuild or republish installers',+ );+ expect(output.includes('could not be delivered')).toBe(status !== 0);+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ },+ );++ test('consumers run only after the draft flip and cannot gate installer publication', () => {+ const { jobs } = parse(desktopRelease);+ expect(jobs['release-consumers'].needs).toBe('finalize');+ expect(jobs['release-consumers'].if).toBe(+ "${{ !cancelled() && needs.finalize.outputs.published == 'true' }}",+ );+ expect(jobs.finalize.outputs.published).toBe('${{ steps.publish.outputs.published }}');+ const publish = jobs.finalize.steps.find((step) => step.id === 'publish');+ expect(publish.run.indexOf('echo "published=true"')).toBeGreaterThan(+ publish.run.lastIndexOf('gh release edit'),+ );+ expect(jobs['release-consumers'].steps[0].run).toContain('desktop-release-published');+ for (const job of [+ 'prepare',+ 'build-macos',+ 'build-windows',+ 'build-linux',+ 'publish-assets',+ 'finalize',+ ]) {+ expect(JSON.stringify(jobs[job].needs ?? [])).not.toContain('release-consumers');+ }+ for (const consumer of ['write-back.yml', 'linear-release.yml']) {+ expect(parse(read(consumer)).on.repository_dispatch.types).toEqual([+ 'desktop-release-published',+ ]);+ }+ });++ test('source builds use the immutable release tag while recovery tooling uses the workflow revision', () => {+ const { jobs } = parse(desktopRelease);+ for (const job of ['prepare', 'build-macos', 'build-windows', 'build-linux']) {+ const checkout = jobs[job].steps.find((step) => step.uses?.startsWith('actions/checkout@'));+ expect(checkout.with.ref).toBe(+ '${{ github.event.client_payload.release_tag || inputs.release_tag }}',+ );+ }+ const upgrade = jobs['build-macos'].steps.find(+ (step) => step.name === 'Verify a historical app can update in place',+ );+ expect(upgrade.run).toContain(+ 'git restore --source "$WORKFLOW_SHA" --worktree .github/scripts/smoke-historical-upgrade.mjs .github/scripts/dmg-mount.mjs',+ );+ expect(upgrade.env.WORKFLOW_SHA).toBe('${{ github.workflow_sha }}');+ });+test('publish-assets waits on all four build jobs', () => {expect(desktopRelease).toContain('needs: [prepare, build-macos, build-windows, build-linux]');});@@ -281,7 +368,7 @@ describe('the fan-in publication DAG gates every platform', () => {test('no variant builder invocation publishes; only the fan-in touches the Release', () => {expect(desktopRelease).not.toContain('--publish always');const invocations = [- ...desktopRelease.matchAll(/run-electron-builder\.mjs --(?:mac|win|linux)/g),+ ...desktopRelease.matchAll(/pnpm exec node "\$DESKTOP_PACKAGER" --(?:mac|win|linux)/g),];expect(invocations.length).toBeGreaterThanOrEqual(3);expect(desktopRelease).toContain('gh release upload "$RELEASE_TAG"');diff --git a/.github/scripts/resolve-shipped-version-cli.test.mjs b/.github/scripts/resolve-shipped-version-cli.test.mjsnew file mode 100644index 000000000..f93af850d--- /dev/null+++ b/.github/scripts/resolve-shipped-version-cli.test.mjs@@ -0,0 +1,63 @@+import { execFileSync, spawnSync } from 'node:child_process';+import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { expect, test } from 'vitest';+import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';++test('the operator CLI resolves only published desktop releases and fails closed on API errors', () => {+ const cwd = mkdtempSync(join(tmpdir(), 'ok-shipped-cli-'));+ const env = gitCleanEnv();+ const git = (...args) =>+ execFileSync('git', args, { cwd, env, encoding: 'utf8', stdio: 'pipe' }).trim();+ try {+ git('init', '--quiet');+ git(+ '-c',+ 'user.name=Test',+ '-c',+ '[email protected]',+ '-c',+ 'commit.gpgsign=false',+ 'commit',+ '--allow-empty',+ '-m',+ `fix\n\nGitOrigin-RevId: ${'a'.repeat(40)}`,+ );+ for (const tag of ['v0.77.9', 'v0.77.10']) git('-c', 'tag.gpgsign=false', 'tag', tag);+ const bin = join(cwd, 'bin');+ mkdirSync(bin);+ const releases = ['v0.77.9', 'v0.77.10'].map((tag_name, i) => ({+ tag_name,+ draft: i === 0,+ published_at: i === 0 ? null : '2026-09-24T22:00:00Z',+ assets: [{ name: 'OpenKnowledge-arm64.dmg' }, { name: 'latest-mac.yml' }],+ }));+ writeFileSync(+ join(bin, 'gh'),+ `#!/usr/bin/env node+if(process.env.TEST_API_FAILURE) process.exit(1);+console.log(${JSON.stringify(releases.map((r) => JSON.stringify(r)).join('\n'))});+`,+ );+ chmodSync(join(bin, 'gh'), 0o755);+ const script = fileURLToPath(new URL('./resolve-shipped-version.mjs', import.meta.url));+ const output = join(cwd, 'output');+ const run = (extra = {}) =>+ spawnSync(process.execPath, [script, 'a'.repeat(40)], {+ cwd,+ encoding: 'utf8',+ env: { ...env, PATH: `${bin}:${env.PATH}`, GITHUB_OUTPUT: output, ...extra },+ });+ const result = run();+ expect(result.status, result.stderr).toBe(0);+ expect(JSON.parse(result.stdout)).toMatchObject({ shipped: true, tag: 'v0.77.10' });+ expect(readFileSync(output, 'utf8')).toContain('version=0.77.10');+ const failure = run({ TEST_API_FAILURE: 'true' });+ expect(failure.status).toBe(1);+ expect(failure.stdout).toBe('');+ } finally {+ rmSync(cwd, { recursive: true, force: true });+ }+});diff --git a/.github/scripts/resolve-shipped-version.mjs b/.github/scripts/resolve-shipped-version.mjsindex 9a67605fb..51e325acd 100644--- a/.github/scripts/resolve-shipped-version.mjs+++ b/.github/scripts/resolve-shipped-version.mjs@@ -1,10 +1,11 @@#!/usr/bin/env node+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint outside Turbo. */import { execFileSync, spawnSync } from 'node:child_process';import { appendFileSync } from 'node:fs';import { pathToFileURL } from 'node:url';+import { realPublishedReleaseTags, sortReleaseTagsAscending } from './published-release-tags.mjs';const STABLE_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)$/;-const BETA_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)-beta\.(\d+)$/;const FULL_SHA_RE = /^[0-9a-f]{40}$/i;const REV_ID_RE = /^[ \t]*GitOrigin-RevId:[ \t]*([0-9a-f]{7,40})[ \t]*$/gim;const PR_URL_RE = /^https?:\/\/[^/]*github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:[/?#].*)?$/i;@@ -38,7 +39,8 @@ export function parseFixRef(raw, { defaultRepo = DEFAULT_PRIVATE_REPO } = {}) {const numMatch = PR_NUMBER_RE.exec(ref);if (numMatch) {const [owner, repo] = defaultRepo.split('/');- if (!owner || !repo) throw new Error(`invalid default repo '${defaultRepo}' (expected owner/repo)`);+ if (!owner || !repo)+ throw new Error(`invalid default repo '${defaultRepo}' (expected owner/repo)`);return { kind: 'pr', owner, repo, number: Number(numMatch[1]) };}@@ -47,39 +49,6 @@ export function parseFixRef(raw, { defaultRepo = DEFAULT_PRIVATE_REPO } = {}) {);}-function releaseTagKey(raw) {- const line = String(raw).trim();- const stable = STABLE_TAG_RE.exec(line);- if (stable) {- return { tag: stable[0], key: [Number(stable[1]), Number(stable[2]), Number(stable[3]), 1, 0] };- }- const beta = BETA_TAG_RE.exec(line);- if (beta) {- return {- tag: beta[0],- key: [Number(beta[1]), Number(beta[2]), Number(beta[3]), 0, Number(beta[4])],- };- }- return null;-}--function byReleaseKeyAscending(a, b) {- for (let i = 0; i < a.key.length; i += 1) {- if (a.key[i] !== b.key[i]) return a.key[i] - b.key[i];- }- return 0;-}--export function sortReleaseTagsAscending(rawTags) {- const parsed = [];- for (const line of rawTags) {- const entry = releaseTagKey(line);- if (entry) parsed.push(entry);- }- parsed.sort(byReleaseKeyAscending);- return parsed.map((p) => p.tag);-}-export function sortStableTagsAscending(rawTags) {const parsed = [];for (const line of rawTags) {@@ -149,7 +118,9 @@ export function resolveShippedVersion({function runGit(args) {const res = spawnSync('git', args, { encoding: 'utf8' });if (res.status !== 0) {- throw new Error(`git ${args.join(' ')} failed (exit ${res.status}): ${String(res.stderr || '').trim()}`);+ throw new Error(+ `git ${args.join(' ')} failed (exit ${res.status}): ${String(res.stderr || '').trim()}`,+ );}return String(res.stdout || '');}@@ -161,10 +132,6 @@ export function parseTagLines(raw) {.filter(Boolean);}-export function realReleaseTags() {- return parseTagLines(runGit(['tag', '--list', 'v*', '--sort=version:refname']));-}-const REC_SEP = '\x1e';const UNIT_SEP = '\x1f';@@ -201,10 +168,14 @@ export function realContains(tag, sha) {function realResolvePrMergeSha({ owner, repo, number }) {let out;try {- out = execFileSync('gh', ['api', `repos/${owner}/${repo}/pulls/${number}`, '--jq', '.merged_at,.merge_commit_sha'], {- encoding: 'utf8',- stdio: ['ignore', 'pipe', 'pipe'],- });+ out = execFileSync(+ 'gh',+ ['api', `repos/${owner}/${repo}/pulls/${number}`, '--jq', '.merged_at,.merge_commit_sha'],+ {+ encoding: 'utf8',+ stdio: ['ignore', 'pipe', 'pipe'],+ },+ );} catch (err) {throw new Error(`gh api repos/${owner}/${repo}/pulls/${number} failed: ${String(err?.stderr || err?.message || '').trim()}`,@@ -228,11 +199,13 @@ function main() {let result;let fixRef;try {- fixRef = parseFixRef(process.argv[2], { defaultRepo: process.env.PRIVATE_REPO || DEFAULT_PRIVATE_REPO });+ fixRef = parseFixRef(process.argv[2], {+ defaultRepo: process.env.PRIVATE_REPO || DEFAULT_PRIVATE_REPO,+ });const privateSha = resolvePrivateSha(fixRef, { resolvePrMergeSha: realResolvePrMergeSha });result = resolveShippedVersion({privateSha,- stableTags: realReleaseTags(),+ stableTags: realPublishedReleaseTags(),findMirroredCommits: realFindMirroredCommits,contains: realContains,});@@ -242,11 +215,15 @@ function main() {}if (result.shipped) {- log(`Shipped: ${result.privateSha.slice(0, 12)} -> mirrored ${result.mirroredSha.slice(0, 12)} -> ${result.tag}.`);+ log(+ `Shipped: ${result.privateSha.slice(0, 12)} -> mirrored ${result.mirroredSha.slice(0, 12)} -> ${result.tag}.`,+ );} else if (result.reason === 'not-mirrored') {log(`Not shipped: no mirrored commit carries GitOrigin-RevId ${result.privateSha} yet.`);} else {- log(`Not shipped: mirrored as ${result.mirroredShas.join(', ')}, but no stable tag contains it yet.`);+ log(+ `Not shipped: mirrored as ${result.mirroredShas.join(', ')}, but no stable tag contains it yet.`,+ );}console.log(JSON.stringify(result));diff --git a/.github/scripts/resolve-shipped-version.test.mjs b/.github/scripts/resolve-shipped-version.test.mjsindex a94da6468..248a56466 100644--- a/.github/scripts/resolve-shipped-version.test.mjs+++ b/.github/scripts/resolve-shipped-version.test.mjs@@ -1,4 +1,5 @@import { describe, expect, test } from 'vitest';+import { sortReleaseTagsAscending } from './published-release-tags.mjs';import {firstContainingStableTag,parseFixRef,@@ -6,7 +7,6 @@ import {parseTagLines,resolvePrivateSha,resolveShippedVersion,- sortReleaseTagsAscending,sortStableTagsAscending,} from './resolve-shipped-version.mjs';@@ -58,7 +58,9 @@ describe('parseGitOriginRevIds', () => {});test('is case-insensitive on the key and normalizes the value', () => {- expect(parseGitOriginRevIds(`gitorigin-revid: ${PRIVATE_SHA.toUpperCase()}`)).toEqual([PRIVATE_SHA]);+ expect(parseGitOriginRevIds(`gitorigin-revid: ${PRIVATE_SHA.toUpperCase()}`)).toEqual([+ PRIVATE_SHA,+ ]);});test('empty / missing message yields no trailers', () => {@@ -86,12 +88,21 @@ describe('parseFixRef', () => {});test('accepts a PR URL with trailing path or query junk', () => {- expect(parseFixRef('https://github.com/inkeep/agents-private/pull/2767/files').number).toBe(2767);- expect(parseFixRef('https://github.com/inkeep/agents-private/pull/2767#issuecomment-1').number).toBe(2767);+ expect(parseFixRef('https://github.com/inkeep/agents-private/pull/2767/files').number).toBe(+ 2767,+ );+ expect(+ parseFixRef('https://github.com/inkeep/agents-private/pull/2767#issuecomment-1').number,+ ).toBe(2767);});test('resolves a bare #N / N against the default repo', () => {- expect(parseFixRef('#2767')).toEqual({ kind: 'pr', owner: 'inkeep', repo: 'agents-private', number: 2767 });+ expect(parseFixRef('#2767')).toEqual({+ kind: 'pr',+ owner: 'inkeep',+ repo: 'agents-private',+ number: 2767,+ });expect(parseFixRef('2767', { defaultRepo: 'acme/widgets' })).toEqual({kind: 'pr',owner: 'acme',@@ -112,8 +123,23 @@ describe('parseFixRef', () => {describe('sortStableTagsAscending', () => {test('sorts numerically, not lexically, and drops non-stable refs', () => {- const raw = ['v0.9.0', 'v0.36.0', 'v0.35.10', 'v0.35.2', 'v0.35.2-beta.4', 'main', '', 'v1.0.0'];- expect(sortStableTagsAscending(raw)).toEqual(['v0.9.0', 'v0.35.2', 'v0.35.10', 'v0.36.0', 'v1.0.0']);+ const raw = [+ 'v0.9.0',+ 'v0.36.0',+ 'v0.35.10',+ 'v0.35.2',+ 'v0.35.2-beta.4',+ 'main',+ '',+ 'v1.0.0',+ ];+ expect(sortStableTagsAscending(raw)).toEqual([+ 'v0.9.0',+ 'v0.35.2',+ 'v0.35.10',+ 'v0.36.0',+ 'v1.0.0',+ ]);});test('tolerates surrounding whitespace from raw git output', () => {@@ -189,10 +215,20 @@ describe('resolveShippedVersion', () => {});test('pinned fixture: it is contained in NONE of v0.35.0 through v0.35.6', () => {- for (const tag of ['v0.35.0', 'v0.35.1', 'v0.35.2', 'v0.35.3', 'v0.35.4', 'v0.35.5', 'v0.35.6']) {+ for (const tag of [+ 'v0.35.0',+ 'v0.35.1',+ 'v0.35.2',+ 'v0.35.3',+ 'v0.35.4',+ 'v0.35.5',+ 'v0.35.6',+ ]) {expect(containsMirrored(tag, MIRRORED_SHA)).toBe(false);}- const withoutTarget = resolve({ stableTags: STABLE_TAGS_SHUFFLED.filter((t) => t !== 'v0.36.0') });+ const withoutTarget = resolve({+ stableTags: STABLE_TAGS_SHUFFLED.filter((t) => t !== 'v0.36.0'),+ });expect(withoutTarget).toMatchObject({ shipped: false, reason: 'not-in-any-stable' });});@@ -206,7 +242,10 @@ describe('resolveShippedVersion', () => {});test('discards a candidate whose message only quotes the trailer', () => {- const quoted = { sha: 'f'.repeat(40), message: `chore: cite GitOrigin-RevId: ${PRIVATE_SHA} inline` };+ const quoted = {+ sha: 'f'.repeat(40),+ message: `chore: cite GitOrigin-RevId: ${PRIVATE_SHA} inline`,+ };expect(resolve({ findMirroredCommits: finderFor([quoted]) })).toMatchObject({shipped: false,reason: 'not-mirrored',@@ -234,7 +273,12 @@ describe('resolveShippedVersion', () => {return false;},});- expect(r).toMatchObject({ shipped: true, tag: 'v0.35.7', version: '0.35.7', mirroredSha: pointReleaseSha });+ expect(r).toMatchObject({+ shipped: true,+ tag: 'v0.35.7',+ version: '0.35.7',+ mirroredSha: pointReleaseSha,+ });expect(r.mirroredShas).toEqual([MIRRORED_SHA, pointReleaseSha]);});@@ -248,7 +292,10 @@ describe('resolveShippedVersion', () => {});test('no stable tags at all (bootstrap repo) is not-in-any-stable', () => {- expect(resolve({ stableTags: [] })).toMatchObject({ shipped: false, reason: 'not-in-any-stable' });+ expect(resolve({ stableTags: [] })).toMatchObject({+ shipped: false,+ reason: 'not-in-any-stable',+ });});test('propagates an infra error from the containment boundary (fail loud)', () => {@@ -412,7 +459,6 @@ describe('resolving against a channel', () => {});});-describe('the tag boundary', () => {test('prereleases survive it, because the channel decides what counts and not this', () => {expect(parseTagLines('v0.36.0\nv0.37.0-beta.1\n\n v0.37.0 \n')).toEqual([diff --git a/.github/scripts/retry-transient.test.mjs b/.github/scripts/retry-transient.test.mjsindex babbd6a8b..085ea20f7 100644--- a/.github/scripts/retry-transient.test.mjs+++ b/.github/scripts/retry-transient.test.mjs@@ -1555,7 +1555,7 @@ describe('workflow wiring', () => {expect(new Set(blocks).size).toBe(1);expect(blocks[0]).not.toMatch(/do\s+rm -f "\$WRAPPER_TMP"/);expect(blocks[0]).toMatch(- /\[\[ -s "\$WRAPPER_TMP" \]\] &&\s+mv "\$WRAPPER_TMP" "\$WRAPPER"; then/,+ /\[\[ -s "\$PACKAGER_TMP" \]\] &&\s+mv "\$PACKAGER_TMP" "\$DESKTOP_PACKAGER" &&\s+mv "\$WRAPPER_TMP" "\$WRAPPER"; then/,);});@@ -1616,7 +1616,7 @@ describe('workflow wiring', () => {expect(packageStep).toContain('--deadline-epoch-ms "$PACKAGING_DEADLINE_EPOCH_MS"');const command = packageStep.split('\n').find((line) => /^\s*PKG_CMD:/.test(line));expect(command).toContain(- "PKG_CMD: 'rm -rf dist-desktop && node scripts/run-electron-builder.mjs",+ 'PKG_CMD: \'rm -rf dist-desktop && pnpm exec node "$DESKTOP_PACKAGER"',);expect(command).toContain('--publish never');},diff --git a/.github/scripts/select-beta-to-promote.test.mjs b/.github/scripts/select-beta-to-promote.test.mjsindex cd48d6410..e817fe18e 100644--- a/.github/scripts/select-beta-to-promote.test.mjs+++ b/.github/scripts/select-beta-to-promote.test.mjs@@ -54,6 +54,21 @@ describe('parseBetaTags', () => {});describe('selectPromotion', () => {+ test('a recovered old draft earns a full day from installer publication, not creation', () => {+ const tag = 'v0.78.0-beta.6';+ const createdAt = '2026-06-01T00:00:00Z';+ const fetchReleaseMeta = fetcher({+ [tag]: { ...meta({ publishedAt: new Date(NOW).toISOString() }), createdAt },+ });+ const options = { betaTags: [tag], fetchReleaseMeta };+ expect(select({ ...options, nowMs: NOW + SOAK * 1000 - 1 })).toEqual({ kind: 'none' });+ expect(select({ ...options, nowMs: NOW + SOAK * 1000 })).toEqual({+ kind: 'select',+ target: tag,+ tier: 'soak',+ });+ });+test('reaches back to the latest soaked beta when the head is under-soaked', () => {const r = select({betaTags: ['v0.10.0-beta.6', 'v0.10.0-beta.5'],diff --git a/.github/scripts/select-stuck-drafts.mjs b/.github/scripts/select-stuck-drafts.mjsindex b15b8fff4..88acc47b6 100644--- a/.github/scripts/select-stuck-drafts.mjs+++ b/.github/scripts/select-stuck-drafts.mjs@@ -1,3 +1,4 @@+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint outside Turbo. */import { pathToFileURL } from 'node:url';import { compareVersions, highestVersion } from './write-back-gate.mjs';@@ -19,6 +20,7 @@ export function highestPublishedStable(releases) {for (const release of releases ?? []) {if (release.isDraft || release.isPrerelease) continue;if (!isPipelineTag(release.tagName)) continue;+ if (BETA_SUFFIX.test(release.tagName)) continue;cycles.push(cycleOf(release.tagName));}return highestVersion(cycles);@@ -44,13 +46,29 @@ export function selectStuckDrafts({ releases, nowMs, maxAgeSeconds }) {keep.push({ tagName: release.tagName, cycle: null, reason: 'unrecognized tag shape' });continue;}+ if (BETA_SUFFIX.test(release.tagName)) {+ keep.push({+ tagName: release.tagName,+ cycle: cycleOf(release.tagName),+ reason: 'unpublished beta history is retained',+ });+ continue;+ }const ageSeconds = objectAgeSeconds(release, nowMs);if (ageSeconds === null) {- keep.push({ tagName: release.tagName, cycle: cycleOf(release.tagName), reason: 'no usable timestamp' });+ keep.push({+ tagName: release.tagName,+ cycle: cycleOf(release.tagName),+ reason: 'no usable timestamp',+ });continue;}if (!(ageSeconds > maxAgeSeconds)) {- keep.push({ tagName: release.tagName, cycle: cycleOf(release.tagName), reason: 'younger than the age gate' });+ keep.push({+ tagName: release.tagName,+ cycle: cycleOf(release.tagName),+ reason: 'younger than the age gate',+ });continue;}const cycle = cycleOf(release.tagName);diff --git a/.github/scripts/select-stuck-drafts.test.mjs b/.github/scripts/select-stuck-drafts.test.mjsindex db786f656..ea4e2d80a 100644--- a/.github/scripts/select-stuck-drafts.test.mjs+++ b/.github/scripts/select-stuck-drafts.test.mjs@@ -1,3 +1,4 @@+/* biome-ignore-all lint/suspicious/noTemplateCurlyInString: Shell fixtures must remain literal. */import { spawnSync } from 'node:child_process';import { readFileSync } from 'node:fs';import { dirname, join } from 'node:path';@@ -8,11 +9,20 @@ import {highestPublishedStable,isPipelineTag,objectAgeSeconds,- selectStuckDrafts,STUCK_DRAFT_MAX_AGE_SECONDS,+ selectStuckDrafts,} from './select-stuck-drafts.mjs';const NOW = Date.parse('2026-09-01T18:00:00Z');++test('a misflagged published beta cannot close a stable cycle', () => {+ expect(+ highestPublishedStable([+ { tagName: 'v0.77.8', isDraft: false, isPrerelease: false },+ { tagName: 'v0.78.0-beta.6', isDraft: false, isPrerelease: false },+ ]),+ ).toBe('0.77.8');+});const MAX_AGE = STUCK_DRAFT_MAX_AGE_SECONDS;const OLD = '2026-08-27T19:41:28Z';const FRESH = '2026-09-01T17:30:00Z';@@ -116,10 +126,10 @@ describe('selectStuckDrafts', () => {expect(swept(releases)).toEqual(['v0.65.0', 'v0.66.0']);});- test('still sweeps a stranded beta draft on a closed cycle', () => {- expect(swept([published('v0.68.3'), betaDraft('v0.64.0-beta.6')])).toEqual([- 'v0.64.0-beta.6',- ]);+ test('retains unpublished beta history even after a newer stable ships', () => {+ const releases = [published('v0.68.3'), betaDraft('v0.64.0-beta.6')];+ expect(swept(releases)).toEqual([]);+ expect(kept(releases)).toEqual(['v0.64.0-beta.6']);});test('keeps a draft whose cycle no published stable covers yet', () => {@@ -128,8 +138,8 @@ describe('selectStuckDrafts', () => {expect(kept(releases)).toEqual(['v0.69.0', 'v0.69.0-beta.1']);});- test('sweeps the draft of the newest published stable cycle itself', () => {- expect(swept([published('v0.68.3'), betaDraft('v0.68.3-beta.1')])).toEqual(['v0.68.3-beta.1']);+ test('a stable publication does not erase never-published betas of the same cycle', () => {+ expect(swept([published('v0.68.3'), betaDraft('v0.68.3-beta.1')])).toEqual([]);});test('spares a draft younger than the age gate, whatever its cycle', () => {@@ -270,7 +280,8 @@ describe('the janitor workflow drives this module', () => {test('the release list carries the object timestamp, not the commit date', () => {const start = workflow.indexOf('RELEASES_JSON=$(');const end = workflow.indexOf('sweep=$(');- if (start === -1 || end === -1) throw new Error('the janitor no longer lists releases then sweeps');+ if (start === -1 || end === -1)+ throw new Error('the janitor no longer lists releases then sweeps');const listCommand = workflow.slice(start, end);expect(listCommand).toContain('updatedAt: .updated_at');expect(listCommand).not.toContain('created_at');@@ -280,7 +291,8 @@ describe('the janitor workflow drives this module', () => {test('the release list is narrowed to what the selector actually reads', () => {const start = workflow.indexOf('RELEASES_JSON=$(');const end = workflow.indexOf('sweep=$(');- if (start === -1 || end === -1) throw new Error('the janitor no longer lists releases then sweeps');+ if (start === -1 || end === -1)+ throw new Error('the janitor no longer lists releases then sweeps');expect(workflow.slice(start, end)).toContain('select(.draft or (.prerelease | not))');});@@ -326,7 +338,8 @@ describe('the janitor workflow drives this module', () => {test('a dry run is checked before the cap, so it can preview an over-cap set', () => {const dryRunAt = workflow.indexOf('if [ "${DRY_RUN:-false}" = "true" ]');const capAt = workflow.indexOf('if [ "${count}" -gt "${MAX_SWEEP_PER_RUN}" ]');- if (dryRunAt === -1 || capAt === -1) throw new Error('the janitor no longer branches on a dry run and a cap');+ if (dryRunAt === -1 || capAt === -1)+ throw new Error('the janitor no longer branches on a dry run and a cap');expect(dryRunAt).toBeLessThan(capAt);});@@ -337,7 +350,8 @@ describe('the janitor workflow drives this module', () => {const dryRunBlock = workflow.slice(dryRunAt);const exitAt = dryRunBlock.indexOf('exit 0');const deleteAt = dryRunBlock.indexOf('gh release delete');- if (exitAt === -1 || deleteAt === -1) throw new Error('the dry-run branch no longer guards the delete');+ if (exitAt === -1 || deleteAt === -1)+ throw new Error('the dry-run branch no longer guards the delete');expect(exitAt).toBeLessThan(deleteAt);});});diff --git a/.github/scripts/stamp-by-containment.mjs b/.github/scripts/stamp-by-containment.mjsindex 679017e5e..eecca63fb 100644--- a/.github/scripts/stamp-by-containment.mjs+++ b/.github/scripts/stamp-by-containment.mjs@@ -1,10 +1,11 @@#!/usr/bin/env node+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint outside Turbo. */import { execFileSync } from 'node:child_process';import { pathToFileURL } from 'node:url';+import { realPublishedReleaseTags } from './published-release-tags.mjs';import {realContains,realFindMirroredCommits,- realReleaseTags,resolveShippedVersion,} from './resolve-shipped-version.mjs';@@ -90,15 +91,21 @@ function prMergeSha({ owner, repo, number }) {if (process.env.CROSS_REPO_TOKEN) env.GH_TOKEN = process.env.CROSS_REPO_TOKEN;let out;try {- out = execFileSync('gh', ['api', `repos/${owner}/${repo}/pulls/${number}`, '--jq', '.merged_at,.merge_commit_sha'], {- encoding: 'utf8',- env,- stdio: ['ignore', 'pipe', 'pipe'],- });+ out = execFileSync(+ 'gh',+ ['api', `repos/${owner}/${repo}/pulls/${number}`, '--jq', '.merged_at,.merge_commit_sha'],+ {+ encoding: 'utf8',+ env,+ stdio: ['ignore', 'pipe', 'pipe'],+ },+ );} catch (err) {const stderr = String(err?.stderr || '');if (/HTTP 404/i.test(stderr)) return null;- throw new Error(`gh api repos/${owner}/${repo}/pulls/${number} failed: ${stderr.trim().slice(0, 200)}`);+ throw new Error(+ `gh api repos/${owner}/${repo}/pulls/${number} failed: ${stderr.trim().slice(0, 200)}`,+ );}const [mergedAt, sha] = out.split('\n').map((s) => s.trim());if (!mergedAt || mergedAt === 'null') return null;@@ -125,9 +132,14 @@ async function fetchAttachments(issueIds) {const page = (await linear(ATTACHMENTS_QUERY, { ids, after })).issues;for (const n of page.nodes) {if (n.attachments.pageInfo.hasNextPage) {- throw new Error(`issue ${n.id} has more attachments than one page; paginate before trusting this run`);+ throw new Error(+ `issue ${n.id} has more attachments than one page; paginate before trusting this run`,+ );}- byIssue.set(n.id, n.attachments.nodes.map((a) => a.url));+ byIssue.set(+ n.id,+ n.attachments.nodes.map((a) => a.url),+ );}if (!page.pageInfo.hasNextPage) break;after = page.pageInfo.endCursor;@@ -148,7 +160,9 @@ async function fetchPipeline() {for (const r of releases) {if (r.issues.pageInfo.hasNextPage) {- throw new Error(`release ${r.name} has more issues than one page; paginate before trusting this run`);+ throw new Error(+ `release ${r.name} has more issues than one page; paginate before trusting this run`,+ );}}@@ -162,7 +176,9 @@ async function fetchPipeline() {id: i.id,identifier: i.identifier,prs: [- ...new Set((attachmentsByIssue.get(i.id) ?? []).filter((u) => PRIVATE_PR_RE.test(u ?? ''))),+ ...new Set(+ (attachmentsByIssue.get(i.id) ?? []).filter((u) => PRIVATE_PR_RE.test(u ?? '')),+ ),],attachedReleases: [],};@@ -207,7 +223,7 @@ async function main() {return;}- const releaseTags = realReleaseTags();+ const releaseTags = realPublishedReleaseTags();const sorted = releaseTags.filter((t) => /^v\d+\.\d+\.\d+$/.test(t.trim())).map((t) => t.trim());const rank = new Map(sorted.map((t, i) => [t, i]));@@ -229,7 +245,9 @@ async function main() {for (const { ticket, plan } of plans) {if (plan.action === 'noop') continue;const attached = ticket.attachedReleases.map((r) => r.name).join(', ');- log(`${live ? 'APPLY' : 'DRY '} ${ticket.identifier}: ${plan.action} (${plan.reason}) [was: ${attached}]`);+ log(+ `${live ? 'APPLY' : 'DRY '} ${ticket.identifier}: ${plan.action} (${plan.reason}) [was: ${attached}]`,+ );if (!live || (plan.add.length === 0 && plan.remove.length === 0)) continue;await linear(`mutation($id:String!,$in:IssueUpdateInput!){ issueUpdate(id:$id,input:$in){ success } }`,diff --git a/.github/scripts/write-back.mjs b/.github/scripts/write-back.mjsindex 9209bcb8b..df83beba2 100644--- a/.github/scripts/write-back.mjs+++ b/.github/scripts/write-back.mjs@@ -1,14 +1,18 @@#!/usr/bin/env node+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint outside Turbo. */import { execFileSync, spawnSync } from 'node:child_process';import { pathToFileURL } from 'node:url';+import {+ realPublishedReleaseTags,+ requirePublishedRelease,+ sortReleaseTagsAscending,+} from './published-release-tags.mjs';import {firstContainingStableTag,parseFixRef,parseGitOriginRevIds,- realReleaseTags,resolvePrivateSha,resolveShippedVersion,- sortReleaseTagsAscending,sortStableTagsAscending,} from './resolve-shipped-version.mjs';import {@@ -70,19 +74,35 @@ export function notificationMarkerUrl({ version, originUrl }) {return `${RELEASES_TAG_BASE}/v${v}${markerSuffixFor(originUrl)}`;}-export function isFixRepoInRemit({ kind, owner, repo }, { defaultRepo = DEFAULT_PRIVATE_REPO, selfRepo } = {}) {+export function isFixRepoInRemit(+ { kind, owner, repo },+ { defaultRepo = DEFAULT_PRIVATE_REPO, selfRepo } = {},+) {if (kind === 'sha') return true;const target = `${owner}/${repo}`.toLowerCase();const reachable = [defaultRepo, selfRepo]- .map((r) => String(r ?? '').trim().toLowerCase())+ .map((r) =>+ String(r ?? '')+ .trim()+ .toLowerCase(),+ ).filter(Boolean);return reachable.includes(target);}export function isSelfRepoPr({ kind, owner, repo }, selfRepo, defaultRepo = DEFAULT_PRIVATE_REPO) {if (kind !== 'pr') return false;- const self = String(selfRepo ?? '').trim().toLowerCase();- if (!self || self === String(defaultRepo ?? '').trim().toLowerCase()) return false;+ const self = String(selfRepo ?? '')+ .trim()+ .toLowerCase();+ if (+ !self ||+ self ===+ String(defaultRepo ?? '')+ .trim()+ .toLowerCase()+ )+ return false;return self === `${owner}/${repo}`.toLowerCase();}@@ -98,7 +118,9 @@ export function deriveVersionForFixRefs({channel = 'stable',log = () => {},}) {- const usable = fixReferences.filter((ref) => ref.channel !== 'commit' || FULL_SHA_RE.test(ref.sha ?? ''));+ const usable = fixReferences.filter(+ (ref) => ref.channel !== 'commit' || FULL_SHA_RE.test(ref.sha ?? ''),+ );if (usable.length === 0) return null;let highest = null;@@ -107,13 +129,15 @@ export function deriveVersionForFixRefs({if (!isFixRepoInRemit(parsed, { defaultRepo, selfRepo })) {log(`::notice::write-back: ${ref.url} lives in ${parsed.owner}/${parsed.repo}, which is outside this ` +- 'workflow\'s reach; no version can be derived for it.',+ "workflow's reach; no version can be derived for it.",);return null;}const refSha = resolvePrivateSha(parsed, { resolvePrMergeSha });if (!refSha) {- log(`::notice::write-back: ${ref.url} was closed without merging, so it carries no fix commit.`);+ log(+ `::notice::write-back: ${ref.url} was closed without merging, so it carries no fix commit.`,+ );return null;}let result;@@ -169,7 +193,6 @@ export function deriveVersionForFixRefs({return highest;}-export const DEFAULT_RELEASE_LOOKBACK = 3;export const DEFAULT_BETA_LOOKBACK = 10;@@ -190,7 +213,9 @@ export function isStableVersion(raw) {}function normalizeVersion(raw) {- const trimmed = String(raw ?? '').trim().replace(/^v/, '');+ const trimmed = String(raw ?? '')+ .trim()+ .replace(/^v/, '');return /^\d+\.\d+\.\d+(?:-beta\.\d+)?$/.test(trimmed) ? trimmed : null;}@@ -476,7 +501,11 @@ const RETRYABLE_NETWORK_CODES = new Set([]);export function isRetryableNetworkError(err) {- for (let cur = err, depth = 0; cur && typeof cur === 'object' && depth < 5; cur = cur.cause, depth += 1) {+ for (+ let cur = err, depth = 0;+ cur && typeof cur === 'object' && depth < 5;+ cur = cur.cause, depth += 1+ ) {if (cur.name === 'TimeoutError') return true;if (RETRYABLE_NETWORK_CODES.has(cur.code)) return true;if (@@ -540,9 +569,12 @@ export async function linearGraphql({signal: AbortSignal.timeout(timeoutMs),});} catch (err) {- throw new LinearRequestError(`Linear GraphQL request failed before any reply: ${err.message}`, {- retryable: isRetryableNetworkError(err),- });+ throw new LinearRequestError(+ `Linear GraphQL request failed before any reply: ${err.message}`,+ {+ retryable: isRetryableNetworkError(err),+ },+ );}if (!res.ok) {@@ -567,9 +599,12 @@ export async function linearGraphql({});}if (payload.errors?.length) {- throw new LinearRequestError(`Linear GraphQL error: ${payload.errors.map((e) => e.message).join('; ')}`, {- retryable: false,- });+ throw new LinearRequestError(+ `Linear GraphQL error: ${payload.errors.map((e) => e.message).join('; ')}`,+ {+ retryable: false,+ },+ );}return payload.data;} catch (err) {@@ -660,7 +695,9 @@ function realContains(tag, sha) {export function selectGhToken({ owner, repo, env }) {const crossRepo = String(env.CROSS_REPO_TOKEN ?? '').trim();if (!crossRepo) return null;- const self = String(env.GITHUB_REPOSITORY ?? '').trim().toLowerCase();+ const self = String(env.GITHUB_REPOSITORY ?? '')+ .trim()+ .toLowerCase();return `${owner}/${repo}`.toLowerCase() === self ? null : crossRepo;}@@ -676,10 +713,13 @@ function gh(args, target) {function realResolvePrMergeSha({ owner, repo, number }) {let out;try {- out = gh(['api', `repos/${owner}/${repo}/pulls/${number}`, '--jq', '.merged_at,.merge_commit_sha'], {- owner,- repo,- });+ out = gh(+ ['api', `repos/${owner}/${repo}/pulls/${number}`, '--jq', '.merged_at,.merge_commit_sha'],+ {+ owner,+ repo,+ },+ );} catch (err) {throw new Error(`gh api repos/${owner}/${repo}/pulls/${number} failed: ${String(err?.stderr || err?.message || '').trim()}`,@@ -706,7 +746,9 @@ export function changesetDirFor(repo) {export function findChangesetPath(filenames, { repo } = {}) {const dir = changesetDirFor(repo);const isChangeset = (name) =>- name.startsWith(dir) && /^[^/]+\.md$/.test(name.slice(dir.length)) && !name.endsWith('/README.md');+ name.startsWith(dir) &&+ /^[^/]+\.md$/.test(name.slice(dir.length)) &&+ !name.endsWith('/README.md');return filenames.map((name) => String(name).trim()).find(isChangeset) ?? null;}@@ -781,7 +823,8 @@ async function realPostReply(origin, text) {if (origin.channel === 'discord-thread') {const url = process.env.DISCORD_NOTIFY_URL;const token = process.env.DISCORD_NOTIFY_TOKEN;- if (!url || !token) throw new Error('DISCORD_NOTIFY_URL / DISCORD_NOTIFY_TOKEN are required to reply on Discord');+ if (!url || !token)+ throw new Error('DISCORD_NOTIFY_URL / DISCORD_NOTIFY_TOKEN are required to reply on Discord');const res = await fetch(url, {method: 'POST',headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` },@@ -825,7 +868,8 @@ async function main() {);}- const stableTags = realReleaseTags();+ const stableTags = realPublishedReleaseTags();+ requirePublishedRelease(releaseTag, stableTags);const versionFor = (node) =>deriveVersionForFixRefs({fixReferences: partitionAttachments(node.attachmentUrls ?? []).fixReferences,@@ -854,7 +898,8 @@ async function main() {const result = await runWriteBack({listCandidates: () => paginate({ apiKey, query: CANDIDATE_QUERY, variables: {}, log }),- listChildren: (parentId) => paginate({ apiKey, query: CHILDREN_QUERY, variables: { parentId }, log }),+ listChildren: (parentId) =>+ paginate({ apiKey, query: CHILDREN_QUERY, variables: { parentId }, log }),versionFor,classifyRelease,channel,diff --git a/.github/scripts/write-back.test.mjs b/.github/scripts/write-back.test.mjsindex 977c1f1e8..8743014a0 100644--- a/.github/scripts/write-back.test.mjs+++ b/.github/scripts/write-back.test.mjs@@ -1,5 +1,8 @@+/* biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub expression fixtures must remain literal. */+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: Tests exercise the GitHub Actions environment outside Turbo. */import { readFileSync } from 'node:fs';import { describe, expect, test } from 'vitest';+import { parse } from 'yaml';import {CANDIDATE_QUERY,changesetDirFor,@@ -10,8 +13,8 @@ import {findChangesetPath,isFixRepoInRemit,isRetryableNetworkError,- isSelfRepoPr,isRetryableStatus,+ isSelfRepoPr,isStableVersion,LINEAR_RETRY_ATTEMPTS,LINEAR_RETRY_CAP_MS,@@ -88,7 +91,9 @@ describe('candidate enumeration', () => {test('the tag list comes from the shared boundary, never a private copy of it', () => {const source = readFileSync(new URL('./write-back.mjs', import.meta.url), 'utf8');- expect(source).toMatch(/import \{[^}]*\brealReleaseTags\b[^}]*\} from '\.\/resolve-shipped-version\.mjs'/);+ expect(source).toMatch(+ /import \{[^}]*\brealPublishedReleaseTags\b[^}]*\} from '\.\/published-release-tags\.mjs'/,+ );expect(source).not.toMatch(/^function real(?:Stable|Release)Tags/m);expect(source).not.toMatch(/Tags[^\n]*\.filter\([^\n]*STABLE_TAG_RE/);});@@ -103,7 +108,9 @@ describe('candidate enumeration', () => {describe('version derivation', () => {const findMirrored = (sha) =>- sha === PRIVATE_SHA ? [{ sha: MIRRORED_SHA, message: `subject\n\nGitOrigin-RevId: ${PRIVATE_SHA}\n` }] : [];+ sha === PRIVATE_SHA+ ? [{ sha: MIRRORED_SHA, message: `subject\n\nGitOrigin-RevId: ${PRIVATE_SHA}\n` }]+ : [];const containsFrom = (map) => (tag, sha) => (map[sha] ?? []).includes(tag);const derive = (overrides = {}) =>@@ -122,7 +129,13 @@ describe('version derivation', () => {test('a commit fix reference resolves without needing a pull request', () => {expect(derive({- fixReferences: [{ channel: 'commit', url: 'https://github.com/x/y/commit/' + PRIVATE_SHA, sha: PRIVATE_SHA }],+ fixReferences: [+ {+ channel: 'commit',+ url: 'https://github.com/x/y/commit/' + PRIVATE_SHA,+ sha: PRIVATE_SHA,+ },+ ],resolvePrMergeSha: () => {throw new Error('a commit reference must not need the pull-request hop');},@@ -190,7 +203,9 @@ describe('version derivation', () => {const mirrorMain = 'd'.repeat(40);expect(deriveVersionForFixRefs({- fixReferences: [{ channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/928' }],+ fixReferences: [+ { channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/928' },+ ],stableTags: [...STABLE_TAGS, 'v0.37.0-beta.0'],selfRepo: 'inkeep/open-knowledge',resolvePrMergeSha: () => mirrorMain,@@ -207,11 +222,14 @@ describe('version derivation', () => {const cherryPick = 'e'.repeat(40);expect(deriveVersionForFixRefs({- fixReferences: [{ channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/928' }],+ fixReferences: [+ { channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/928' },+ ],stableTags: STABLE_TAGS,selfRepo: 'inkeep/open-knowledge',resolvePrMergeSha: () => mirrorMain,- readCommitMessage: (sha) => (sha === mirrorMain ? `subject\n\nGitOrigin-RevId: ${PRIVATE_SHA}\n` : null),+ readCommitMessage: (sha) =>+ sha === mirrorMain ? `subject\n\nGitOrigin-RevId: ${PRIVATE_SHA}\n` : null,findMirroredCommits: (sha) =>sha === PRIVATE_SHA? [@@ -235,9 +253,12 @@ describe('version derivation', () => {stableTags: STABLE_TAGS,selfRepo: 'inkeep/open-knowledge',resolvePrMergeSha: ({ repo }) => (repo === 'agents-private' ? PRIVATE_SHA : mirrorEcho),- readCommitMessage: (sha) => (sha === mirrorEcho ? `subject\n\nGitOrigin-RevId: ${PRIVATE_SHA}\n` : null),+ readCommitMessage: (sha) =>+ sha === mirrorEcho ? `subject\n\nGitOrigin-RevId: ${PRIVATE_SHA}\n` : null,findMirroredCommits: (sha) =>- sha === PRIVATE_SHA ? [{ sha: MIRRORED_SHA, message: `GitOrigin-RevId: ${PRIVATE_SHA}` }] : [],+ sha === PRIVATE_SHA+ ? [{ sha: MIRRORED_SHA, message: `GitOrigin-RevId: ${PRIVATE_SHA}` }]+ : [],contains: containsFrom({ [MIRRORED_SHA]: ['v0.36.0'] }),}),).toBe('0.36.0');@@ -247,7 +268,9 @@ describe('version derivation', () => {const directSha = 'a1'.repeat(20);expect(deriveVersionForFixRefs({- fixReferences: [{ channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/500' }],+ fixReferences: [+ { channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/500' },+ ],stableTags: STABLE_TAGS,selfRepo: 'inkeep/open-knowledge',resolvePrMergeSha: () => directSha,@@ -266,7 +289,9 @@ describe('version derivation', () => {const logs = [];expect(deriveVersionForFixRefs({- fixReferences: [{ channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/502' }],+ fixReferences: [+ { channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/502' },+ ],stableTags: STABLE_TAGS,selfRepo: 'inkeep/open-knowledge',resolvePrMergeSha: () => mergeSha,@@ -289,14 +314,18 @@ describe('version derivation', () => {expect(isSelfRepoPr({ kind: 'sha', sha: 'a'.repeat(40) }, 'inkeep/open-knowledge')).toBe(false);expect(isSelfRepoPr(pr('inkeep', 'open-knowledge'), undefined)).toBe(false);expect(isSelfRepoPr(pr('inkeep', 'agents-private'), 'inkeep/agents-private')).toBe(false);- expect(isSelfRepoPr(pr('inkeep', 'some-fork'), 'inkeep/some-fork', 'inkeep/some-fork')).toBe(false);+ expect(isSelfRepoPr(pr('inkeep', 'some-fork'), 'inkeep/some-fork', 'inkeep/some-fork')).toBe(+ false,+ );});test('a mirror pull request contained in no stable yet yields no version', () => {const logs = [];expect(deriveVersionForFixRefs({- fixReferences: [{ channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/501' }],+ fixReferences: [+ { channel: 'pull-request', url: 'https://github.com/inkeep/open-knowledge/pull/501' },+ ],stableTags: STABLE_TAGS,selfRepo: 'inkeep/open-knowledge',resolvePrMergeSha: () => 'b2'.repeat(20),@@ -330,14 +359,18 @@ describe('version derivation', () => {expect(parseMergeShaOutput('2026-07-23T14:19:56Z\n' + sha, at)).toBe(sha);expect(parseMergeShaOutput('2026-07-23T14:19:56Z\n' + sha.toUpperCase(), at)).toBe(sha);- expect(() => parseMergeShaOutput('2026-07-23T14:19:56Z\nnot-a-sha', at)).toThrow(/merge_commit_sha/);+ expect(() => parseMergeShaOutput('2026-07-23T14:19:56Z\nnot-a-sha', at)).toThrow(+ /merge_commit_sha/,+ );});test('a fix reference in a repo this workflow cannot reach is skipped, not attempted', () => {const logs = [];expect(derive({- fixReferences: [{ channel: 'pull-request', url: 'https://github.com/inkeep/management/pull/272' }],+ fixReferences: [+ { channel: 'pull-request', url: 'https://github.com/inkeep/management/pull/272' },+ ],selfRepo: 'inkeep/open-knowledge',resolvePrMergeSha: () => {throw new Error('must not be attempted: this repo is out of remit');@@ -372,11 +405,19 @@ describe('version derivation', () => {test('remit is decided by repo identity, and a bare commit SHA needs no repo at all', () => {const at = { defaultRepo: 'inkeep/agents-private', selfRepo: 'inkeep/open-knowledge' };- expect(isFixRepoInRemit({ kind: 'pr', owner: 'inkeep', repo: 'agents-private' }, at)).toBe(true);- expect(isFixRepoInRemit({ kind: 'pr', owner: 'InKeep', repo: 'Agents-Private' }, at)).toBe(true);- expect(isFixRepoInRemit({ kind: 'pr', owner: 'inkeep', repo: 'open-knowledge' }, at)).toBe(true);+ expect(isFixRepoInRemit({ kind: 'pr', owner: 'inkeep', repo: 'agents-private' }, at)).toBe(+ true,+ );+ expect(isFixRepoInRemit({ kind: 'pr', owner: 'InKeep', repo: 'Agents-Private' }, at)).toBe(+ true,+ );+ expect(isFixRepoInRemit({ kind: 'pr', owner: 'inkeep', repo: 'open-knowledge' }, at)).toBe(+ true,+ );expect(isFixRepoInRemit({ kind: 'pr', owner: 'inkeep', repo: 'management' }, at)).toBe(false);- expect(isFixRepoInRemit({ kind: 'pr', owner: 'inkeep', repo: 'open-knowledge-legacy' }, at)).toBe(false);+ expect(+ isFixRepoInRemit({ kind: 'pr', owner: 'inkeep', repo: 'open-knowledge-legacy' }, at),+ ).toBe(false);expect(isFixRepoInRemit({ kind: 'sha', sha: PRIVATE_SHA }, at)).toBe(true);});@@ -487,9 +528,11 @@ describe('write-back run', () => {const result = await h.run();expect(h.writes).toEqual([]);expect(result.skipped).toEqual([{ identifier: 'PRD-7539', reason: 'version-underivable' }]);- expect(h.logs.some((m) => m.startsWith('::warning::') && m.includes('no stable release could be derived'))).toBe(- true,- );+ expect(+ h.logs.some(+ (m) => m.startsWith('::warning::') && m.includes('no stable release could be derived'),+ ),+ ).toBe(true);});test('a candidate whose only origin cannot be replied to posts nothing and warns', async () => {@@ -500,11 +543,18 @@ describe('write-back run', () => {const result = await h.run();expect(h.writes).toEqual([]);expect(result.skipped).toEqual([{ identifier: 'PRD-7539', reason: 'origin-unrepliable' }]);- expect(h.logs.some((m) => m.startsWith('::warning::') && m.includes('no origin on it can be replied to'))).toBe(true);+ expect(+ h.logs.some(+ (m) => m.startsWith('::warning::') && m.includes('no origin on it can be replied to'),+ ),+ ).toBe(true);});test('a candidate with no origin at all is skipped quietly, because not every fix has a reporter', async () => {- const h = harness({ live: true, listCandidates: async () => [candidate({ attachmentUrls: [GH_PULL] })] });+ const h = harness({+ live: true,+ listCandidates: async () => [candidate({ attachmentUrls: [GH_PULL] })],+ });const result = await h.run();expect(h.writes).toEqual([]);expect(result.skipped).toEqual([{ identifier: 'PRD-7539', reason: 'no-origin' }]);@@ -515,7 +565,13 @@ describe('write-back run', () => {const h = harness({live: true,listChildren: async () => [- { id: 'a', identifier: 'PRD-7398', stateType: 'completed', labels: ['Bug'], attachmentUrls: [] },+ {+ id: 'a',+ identifier: 'PRD-7398',+ stateType: 'completed',+ labels: ['Bug'],+ attachmentUrls: [],+ },{ id: 'b', identifier: 'PRD-7401', stateType: 'unstarted', labels: [], attachmentUrls: [] },],});@@ -529,7 +585,9 @@ describe('write-back run', () => {const result = await h.run();expect(h.writes).toEqual([]);expect(result.skipped).toEqual([{ identifier: 'PRD-7539', reason: 'no-prose' }]);- expect(h.logs.some((m) => m.startsWith('::warning::') && m.includes('no changeset prose'))).toBe(true);+ expect(+ h.logs.some((m) => m.startsWith('::warning::') && m.includes('no changeset prose')),+ ).toBe(true);});test('an infra failure throws out of the run rather than being folded into silence', async () => {@@ -546,7 +604,13 @@ describe('write-back run', () => {const h = harness({live: true,listChildren: async () => [- { id: 'a', identifier: 'PRD-7398', stateType: 'completed', labels: ['Bug'], attachmentUrls: [] },+ {+ id: 'a',+ identifier: 'PRD-7398',+ stateType: 'completed',+ labels: ['Bug'],+ attachmentUrls: [],+ },{ id: 'b', identifier: 'PRD-7403', stateType: 'completed', labels: [], attachmentUrls: [] },],});@@ -558,9 +622,14 @@ describe('write-back run', () => {describe('changeset parsing', () => {test('the bump block is stripped and the release note is what remains', () => {const parsed = parseChangeset(- ['---', "'@inkeep/open-knowledge': patch", '---', '', 'Honor backslash escapes in the promoters.', ''].join(- '\n',- ),+ [+ '---',+ "'@inkeep/open-knowledge': patch",+ '---',+ '',+ 'Honor backslash escapes in the promoters.',+ '',+ ].join('\n'),);expect(parsed).toEqual({title: 'Honor backslash escapes in the promoters.',@@ -569,7 +638,9 @@ describe('changeset parsing', () => {});test('a multi-line note keeps its first line as the title and its whole text as the body', () => {- const parsed = parseChangeset(['---', "'x': patch", '---', '', 'Short subject', '', 'More detail.'].join('\n'));+ const parsed = parseChangeset(+ ['---', "'x': patch", '---', '', 'Short subject', '', 'More detail.'].join('\n'),+ );expect(parsed.title).toBe('Short subject');expect(parsed.body).toContain('More detail.');});@@ -596,7 +667,9 @@ describe('changeset parsing', () => {expect(text).not.toBeNull();expect(text).not.toContain(changeset.title);expect(text).not.toContain(changeset.body);- expect(text).toContain('[the releases page](https://github.com/inkeep/open-knowledge/releases)');+ expect(text).toContain(+ '[the releases page](https://github.com/inkeep/open-knowledge/releases)',+ );}});});@@ -614,20 +687,31 @@ describe('locating the changeset a fix shipped with', () => {});test('a pull request against the public mirror keeps it at the root, where that repo puts it', () => {- expect(findChangesetPath(['.changeset/some-fix.md'], { repo: 'open-knowledge' })).toBe('.changeset/some-fix.md');+ expect(findChangesetPath(['.changeset/some-fix.md'], { repo: 'open-knowledge' })).toBe(+ '.changeset/some-fix.md',+ );});test("another product's changeset is never picked for an Open Knowledge reporter", () => {- const foreign = ['public/agents/.changeset/some-agents-fix.md', '.changeset/a-stray-root-changeset.md'];+ const foreign = [+ 'public/agents/.changeset/some-agents-fix.md',+ '.changeset/a-stray-root-changeset.md',+ ];expect(findChangesetPath(foreign, { repo: 'agents-private' })).toBeNull();});test('the changeset README is never mistaken for a changeset', () => {- expect(findChangesetPath(['public/open-knowledge/.changeset/README.md'], { repo: 'agents-private' })).toBeNull();+ expect(+ findChangesetPath(['public/open-knowledge/.changeset/README.md'], { repo: 'agents-private' }),+ ).toBeNull();});test('a pull request that added no changeset yields nothing rather than a wrong file', () => {- expect(findChangesetPath(['public/open-knowledge/packages/app/src/x.ts'], { repo: 'agents-private' })).toBeNull();+ expect(+ findChangesetPath(['public/open-knowledge/packages/app/src/x.ts'], {+ repo: 'agents-private',+ }),+ ).toBeNull();expect(findChangesetPath([], { repo: 'agents-private' })).toBeNull();});@@ -652,7 +736,13 @@ describe('cross-repo token selection', () => {test('with no bridge token configured every call falls back to the ambient one', () => {const bare = { GITHUB_REPOSITORY: 'inkeep/open-knowledge' };expect(selectGhToken({ owner: 'inkeep', repo: 'agents-private', env: bare })).toBeNull();- expect(selectGhToken({ owner: 'inkeep', repo: 'agents-private', env: { ...bare, CROSS_REPO_TOKEN: ' ' } })).toBeNull();+ expect(+ selectGhToken({+ owner: 'inkeep',+ repo: 'agents-private',+ env: { ...bare, CROSS_REPO_TOKEN: ' ' },+ }),+ ).toBeNull();});});@@ -694,7 +784,9 @@ describe('one unreadable candidate does not silence the rest', () => {test('errors still turn the run red once the reachable reporters have been told', () => {expect(runFailureMessage({ posted: [], skipped: [], errored: [] })).toBeNull();- expect(runFailureMessage({ skipped: [{ identifier: 'PRD-1', reason: 'no-origin' }], errored: [] })).toBeNull();+ expect(+ runFailureMessage({ skipped: [{ identifier: 'PRD-1', reason: 'no-origin' }], errored: [] }),+ ).toBeNull();const message = runFailureMessage({errored: [@@ -762,7 +854,11 @@ describe('telling a failure that waits from a failure that needs a person', () =const needsHuman = runFailureMessage({errored: [{ identifier: 'PRD-0001', message: 'HTTP 503', disposition: 'retried-next-run' },- { identifier: 'PRD-0002', message: 'marker written, reply did NOT send', disposition: 'needs-human' },+ {+ identifier: 'PRD-0002',+ message: 'marker written, reply did NOT send',+ disposition: 'needs-human',+ },],});expect(needsHuman).toContain('ACTION REQUIRED');@@ -772,7 +868,12 @@ describe('telling a failure that waits from a failure that needs a person', () =});describe('a Linear call that failed for reasons unrelated to the request', () => {- const ok = (data) => ({ ok: true, status: 200, json: async () => ({ data }), headers: { get: () => null } });+ const ok = (data) => ({+ ok: true,+ status: 200,+ json: async () => ({ data }),+ headers: { get: () => null },+ });const fail = (status, body = 'upstream connect error', headers = {}) => ({ok: false,status,@@ -822,7 +923,8 @@ describe('a Linear call that failed for reasons unrelated to the request', () =>});test('every 4xx that is not 429 fails fast, and every 5xx is retried', () => {- for (const status of [400, 401, 403, 404, 409, 422]) expect(isRetryableStatus(status)).toBe(false);+ for (const status of [400, 401, 403, 404, 409, 422])+ expect(isRetryableStatus(status)).toBe(false);for (const status of [429, 500, 502, 503, 504]) expect(isRetryableStatus(status)).toBe(true);expect(isRetryableStatus(200)).toBe(false);});@@ -846,7 +948,9 @@ describe('a Linear call that failed for reasons unrelated to the request', () =>const second = retryDelayMs({ attempt: 2, random: () => 0.5 });expect(second).toBeGreaterThan(first);expect(retryDelayMs({ attempt: 20, random: () => 1 })).toBeLessThanOrEqual(LINEAR_RETRY_CAP_MS);- expect(retryDelayMs({ attempt: 1, random: () => 0 })).toBeLessThan(retryDelayMs({ attempt: 1, random: () => 1 }));+ expect(retryDelayMs({ attempt: 1, random: () => 0 })).toBeLessThan(+ retryDelayMs({ attempt: 1, random: () => 1 }),+ );expect(retryDelayMs({ attempt: 1, random: () => 0 })).toBeGreaterThan(0);});@@ -900,8 +1004,12 @@ describe('a Linear call that failed for reasons unrelated to the request', () =>});test('the network classifier reads codes anywhere in the cause chain, and refuses the rest', () => {- expect(isRetryableNetworkError(Object.assign(new Error('x'), { code: 'ECONNRESET' }))).toBe(true);- expect(isRetryableNetworkError(Object.assign(new Error('x'), { code: 'UND_ERR_SOCKET' }))).toBe(true);+ expect(isRetryableNetworkError(Object.assign(new Error('x'), { code: 'ECONNRESET' }))).toBe(+ true,+ );+ expect(isRetryableNetworkError(Object.assign(new Error('x'), { code: 'UND_ERR_SOCKET' }))).toBe(+ true,+ );expect(isRetryableNetworkError(new TypeError('fetch failed'))).toBe(true);expect(isRetryableNetworkError(new Error('socket hang up'))).toBe(true);expect(isRetryableNetworkError(new Error('Unexpected token < in JSON'))).toBe(false);@@ -985,8 +1093,8 @@ describe('workflow shape', () => {const read = (name) => readFileSync(new URL(`../workflows/${name}`, import.meta.url), 'utf8');const workflow = read('write-back.yml');- test('it triggers on the existing release dispatch rather than on release published', () => {- expect(workflow).toMatch(/repository_dispatch:\s*\n\s*types:\s*\[desktop-release\]/);+ test('it triggers only on the post-publication dispatch', () => {+ expect(workflow).toMatch(/repository_dispatch:\s*\n\s*types:\s*\[desktop-release-published\]/);expect(workflow).not.toMatch(/^\s{2}release:/m);expect(workflow).not.toContain('types: [published]');});@@ -994,9 +1102,9 @@ describe('workflow shape', () => {test('both release channels run, and a tag of neither shape runs nothing', () => {expect(workflow).toContain('^v[0-9]+\\.[0-9]+\\.[0-9]+$');expect(workflow).toContain('^v[0-9]+\\.[0-9]+\\.[0-9]+-beta\\.[0-9]+$');- expect(workflow).toContain("echo \"channel=stable\"");- expect(workflow).toContain("echo \"channel=beta\"");- expect(workflow).toContain("echo \"channel=none\"");+ expect(workflow).toContain('echo "channel=stable"');+ expect(workflow).toContain('echo "channel=beta"');+ expect(workflow).toContain('echo "channel=none"');expect(workflow).toMatch(/if:\s*steps\.tag\.outputs\.channel != 'none'/);expect(workflow).not.toMatch(/steps\.tag\.outputs\.stable/);});@@ -1011,7 +1119,8 @@ describe('workflow shape', () => {const group = /concurrency:\s*\n(?:\s*#.*\n)*\s*group:\s*(.+)/.exec(workflow)?.[1] ?? '';expect(group).toContain('reporter-write-back');for (const other of ['release.yml', 'promote-stable.yml', 'linear-release.yml']) {- const otherGroup = /concurrency:\s*\n(?:\s*#.*\n)*\s*group:\s*(.+)/.exec(read(other))?.[1] ?? '';+ const otherGroup =+ /concurrency:\s*\n(?:\s*#.*\n)*\s*group:\s*(.+)/.exec(read(other))?.[1] ?? '';expect(group.trim()).not.toBe(otherGroup.trim());}});@@ -1028,6 +1137,17 @@ describe('workflow shape', () => {});test('live posting needs an explicit mode on top of the credential', () => {+ const parsed = parse(workflow);+ expect(parsed.on.workflow_dispatch.inputs.dry_run).toMatchObject({+ type: 'boolean',+ default: true,+ });+ const notify = parsed.jobs.notify.steps.find(+ (step) => step.name === 'Notify reporters whose fix reached this release',+ );+ expect(notify.env.WRITE_BACK_MODE).toBe(+ "${{ github.event_name == 'workflow_dispatch' && inputs.dry_run && 'dry-run' || vars.WRITE_BACK_MODE }}",+ );expect(workflow).toContain('WRITE_BACK_MODE');expect(workflow).toContain('LINEAR_API_KEY');});@@ -1260,7 +1380,9 @@ describe('origin remit', () => {const h = harness({live: true,listCandidates: async () => [- candidate({ attachmentUrls: [GH_PULL, 'https://github.com/inkeep/agents/issues/412', SLACK_ARCHIVE] }),+ candidate({+ attachmentUrls: [GH_PULL, 'https://github.com/inkeep/agents/issues/412', SLACK_ARCHIVE],+ }),],});const result = await h.run();@@ -1278,7 +1400,11 @@ describe('origin remit', () => {});const result = await h.run();expect(result.skipped).toEqual([{ identifier: 'PRD-7539', reason: 'origin-unrepliable' }]);- expect(h.logs.some((m) => m.startsWith('::warning::') && m.includes('no origin on it can be replied to'))).toBe(true);+ expect(+ h.logs.some(+ (m) => m.startsWith('::warning::') && m.includes('no origin on it can be replied to'),+ ),+ ).toBe(true);});test('a Discord thread is repliable wherever it lives, because the bot is not repo-scoped', async () => {@@ -1343,7 +1469,13 @@ describe('a linked pull request, not a label, is what a reply depends on', () =>live: true,listCandidates: async () => [candidate({ attachmentUrls: [GH_ISSUE] })],listChildren: async () => [- { id: 'a', identifier: 'PRD-7398', stateType: 'completed', labels: [], attachmentUrls: [GH_PULL] },+ {+ id: 'a',+ identifier: 'PRD-7398',+ stateType: 'completed',+ labels: [],+ attachmentUrls: [GH_PULL],+ },{ id: 'b', identifier: 'PRD-7401', stateType: 'completed', labels: [], attachmentUrls: [] },],versionFor: async (node) => (node.identifier === 'PRD-7398' ? '0.36.0' : null),@@ -1359,14 +1491,22 @@ describe('a linked pull request, not a label, is what a reply depends on', () =>live: true,listCandidates: async () => [candidate({ attachmentUrls: [GH_ISSUE] })],listChildren: async () => [- { id: 'a', identifier: 'PRD-7398', stateType: 'completed', labels: [], attachmentUrls: [GH_PULL] },+ {+ id: 'a',+ identifier: 'PRD-7398',+ stateType: 'completed',+ labels: [],+ attachmentUrls: [GH_PULL],+ },{ id: 'b', identifier: 'PRD-7401', stateType: 'completed', labels: [], attachmentUrls: [] },],versionFor: async () => null,});const result = await h.run();expect(result.skipped).toEqual([{ identifier: 'PRD-7539', reason: 'version-underivable' }]);- const warning = h.logs.find((m) => m.startsWith('::warning::') && m.includes('could be derived'));+ const warning = h.logs.find(+ (m) => m.startsWith('::warning::') && m.includes('could be derived'),+ );expect(warning).toContain('PRD-7398');expect(warning).not.toContain('PRD-7401');});@@ -1476,7 +1616,9 @@ describe('the beta leg', () => {const forIssue = posts.find((p) => p.origin === GH_ISSUE);const forDiscord = posts.find((p) => p.origin === DISCORD_THREAD);expect(forIssue.text).not.toContain(CHANGESET.body);- expect(forIssue.text).toContain('[the releases page](https://github.com/inkeep/open-knowledge/releases)');+ expect(forIssue.text).toContain(+ '[the releases page](https://github.com/inkeep/open-knowledge/releases)',+ );expect(forDiscord.text).not.toContain(CHANGESET.body);expect(forDiscord.text).toContain('<https://github.com/inkeep/open-knowledge/releases>');});diff --git a/.github/workflows/desktop-release-draft-janitor.yml b/.github/workflows/desktop-release-draft-janitor.ymlindex 42b1343ab..7fc07a9fa 100644--- a/.github/workflows/desktop-release-draft-janitor.yml+++ b/.github/workflows/desktop-release-draft-janitor.yml@@ -1,39 +1,5 @@name: Draft release janitor-# Sweeps orphaned draft GitHub Releases off inkeep/open-knowledge.-#-# release.yml creates every beta as `--draft --prerelease`; promote-stable.yml-# does the same for stable. desktop-release.yml flips `draft=false` ONLY after-# the signed DMG + channel manifest (beta-mac.yml / latest-mac.yml) upload-# succeeds — the draft gate keeps a manifest-less release out of the auto-update-# .atom feed. When that build fails (both historical cases were transient:-# an Electron-runtime-download EOF and a GitHub-upload 403, neither retried-# at the time), the release is stranded as a draft. It never entered the feed,-# so auto-update never saw it, but it stays pinned to the top of the web-# releases page forever while the next cut rolls forward past it.-#-# This janitor removes such orphans on a schedule. It is deliberately-# conservative: it deletes a stuck draft beta ONLY once a published STABLE-# release covers that beta's X.Y.Z cycle. That gate is load-bearing — a beta's-# changelog delta lives ONLY in its GitHub Release body, and promote-stable.yml-# aggregates the whole cycle's beta bodies (by tag, via `gh release view`) into-# the stable release notes at promotion time (packages/*/CHANGELOG.md no longer-# accumulates per-beta under the zero-commit-bump cadence). Deleting a beta-# before its cycle is promoted would drop that increment from the stable-# changelog (it renders as "release body unavailable"). Once the cycle's stable-# exists, every in-range beta body has already been aggregated (and a later beta-# on an already-promoted base is never aggregated by any future stable), so the-# body is safe to reap. Drafts on a not-yet-promoted cycle are left for a human-# to re-run desktop-release.yml against or promote. The git TAG is always kept-# (npm-provenance source ref + version lineage); only the Release object goes.-#-# The sweep covers stable drafts on the same gate. A stable draft strands the-# same way (v0.65.0 and v0.66.0 sat draft with zero assets from 2026-08-27 to-# 2026-09-01, swept by hand) but its body feeds no later changelog, so the-# `cycle <= maxstable` gate is if anything more conservative for it than for a-# beta. The selection lives in .github/scripts/select-stuck-drafts.mjs, which is-# unit-tested; this workflow only acts on what that returns.-## The age gate reads the release OBJECT's timestamp, never `createdAt`: on a# GitHub Release `createdAt` is the TARGET COMMIT's date, so a draft created# from an older commit reads as already-aged the moment it exists and the gatediff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex 5c08011e6..c3a8c534b 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -32,7 +32,6 @@ name: Desktop release# latest-linux[-arm64].yml, or their beta-* siblings) locally regardless of# publish mode, so the fan-in uploads those alongside the installers.#-# Triggers (2):# - repository_dispatch (event_type: desktop-release) — primary cascade# from release.yml (beta) and promote-stable.yml (stable). The# upstream creates the GitHub Release as --draft (so it stays out@@ -44,14 +43,6 @@ name: Desktop release# GITHUB_TOKEN-authored release events. repository_dispatch is the# documented exemption.# See https://docs.github.com/en/actions/concepts/security/github_token.-# - workflow_dispatch — manual recovery path for re-building + re-uploading-# assets to an EXISTING Release after a transient failure (e.g., a-# CI-only fix landed after the tag was cut). Builds from the chosen ref-# and uploads to the Release matching release_tag. Unlike the-# electron-builder-publisher era this path no longer creates a missing-# Release — the Release must already exist (cut by release.yml /-# promote-stable.yml / point-release.yml).-## Required secrets:# macOS (identical shape to desktop-build.yml):# CSC_LINK / CSC_KEY_PASSWORD@@ -96,19 +87,10 @@ on:# release events; repository_dispatch is the documented exemption.repository_dispatch:types: [desktop-release]- # Manual re-publish path: lets an operator rebuild + re-upload assets for an- # existing Release when the original cascade-triggered run failed (e.g., a- # CI-only fix landed on `main` after the tag was cut). Builds from- # the chosen ref (typically `main` with the fix) and uploads to the- # Release matching release_tag. The dispatcher must ensure- # `packages/desktop/package.json#version` at the chosen ref matches- # release_tag (without the `v` prefix) — the version override below derives- # everything from the tag, so a mismatched ref ships mismatched code, not- # mismatched metadata.workflow_dispatch:inputs:release_tag:- description: "Existing release tag to upload assets to (e.g. v0.3.0)"+ description: "Existing source tag to rebuild and upload installers for (e.g. v0.3.0)"required: truetype: string@@ -172,19 +154,11 @@ jobs:{ echo "### Triggered by"; echo "- ${DISPATCHED_BY}"; } >> "$GITHUB_STEP_SUMMARY"fi- # On `repository_dispatch`, check out the ref supplied by the upstream- # workflow via `client_payload.ref` — that's the exact commit- # release.yml / promote-stable.yml resolved when cutting the tag, so- # the bundled version + any CHANGELOG artifacts match the Release.- #- # On `workflow_dispatch`, check out the workflow ref the user dispatched- # against (typically `main` with a CI fix).- ## fetch-depth: 0 — the native-config staging step's provenance check# (`git merge-base --is-ancestor`) needs full history.- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:- ref: ${{ github.event.client_payload.ref || github.ref }}+ ref: ${{ github.event.client_payload.release_tag || inputs.release_tag }}fetch-depth: 0# Detect channel from the release TAG (not package.json#version). Under@@ -533,7 +507,7 @@ jobs:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:- ref: ${{ github.event.client_payload.ref || github.ref }}+ ref: ${{ github.event.client_payload.release_tag || inputs.release_tag }}# Lockstep twin of the prepare job's step (see this job's header for why# it exists twice) — same tag → same outputs, so `steps.channel.*` here@@ -863,7 +837,7 @@ jobs:BUILD_VERSION: ${{ steps.channel.outputs.version }}BUILD_CHANNEL: ${{ steps.channel.outputs.channel }}GITHUB_WORKFLOW_SHA: ${{ github.workflow_sha }}- PKG_CMD: 'rm -rf dist-desktop && node scripts/run-electron-builder.mjs --mac --publish never --config.extraMetadata.version="${BUILD_VERSION}"'+ PKG_CMD: 'rm -rf dist-desktop && pnpm exec node "$DESKTOP_PACKAGER" --mac --publish never --config.extraMetadata.version="${BUILD_VERSION}"'working-directory: packages/desktoprun: |# extraMetadata.version override: kept as defense-in-depth so the@@ -880,17 +854,22 @@ jobs:set -euo pipefailWRAPPER="${RUNNER_TEMP}/retry-transient.mjs"WRAPPER_TMP="${WRAPPER}.tmp.$$"- trap 'rm -f "$WRAPPER_TMP"' EXIT+ export DESKTOP_PACKAGER="${RUNNER_TEMP}/package-desktop.mjs"+ PACKAGER_TMP="${DESKTOP_PACKAGER}.tmp.$$"+ trap 'rm -f "$WRAPPER_TMP" "$PACKAGER_TMP"' EXITmaterialized=falsefor materialize_attempt in 1 2 3; doif git -C "${GITHUB_WORKSPACE}" fetch --no-tags --depth=1 origin "$GITHUB_WORKFLOW_SHA" &&git -C "${GITHUB_WORKSPACE}" show "$GITHUB_WORKFLOW_SHA:.github/scripts/retry-transient.mjs" > "$WRAPPER_TMP" &&[[ -s "$WRAPPER_TMP" ]] &&+ git -C "${GITHUB_WORKSPACE}" show "$GITHUB_WORKFLOW_SHA:.github/scripts/package-desktop.mjs" > "$PACKAGER_TMP" &&+ [[ -s "$PACKAGER_TMP" ]] &&+ mv "$PACKAGER_TMP" "$DESKTOP_PACKAGER" &&mv "$WRAPPER_TMP" "$WRAPPER"; thenmaterialized=truebreakfi- rm -f "$WRAPPER_TMP"+ rm -f "$WRAPPER_TMP" "$PACKAGER_TMP"if [[ "$materialize_attempt" -lt 3 ]]; thenmaterialize_delay=$((materialize_attempt * 5))echo "::warning::Retry wrapper materialization attempt ${materialize_attempt}/3 failed; retrying in ${materialize_delay}s."@@ -956,12 +935,15 @@ jobs:- name: Verify a historical app can update in placeif: matrix.variant != 'beta'env:+ WORKFLOW_SHA: ${{ github.workflow_sha }}GH_TOKEN: ${{ github.token }}SOURCE_TAG: ${{ matrix.variant == 'legacy-beta' && 'v0.77.9-beta.0' || 'v0.77.8' }}UPDATER_CHANNEL: ${{ matrix.variant == 'legacy-beta' && 'beta' || 'latest' }}run: |set -euo pipefailmkdir -p "$RUNNER_TEMP/historical-upgrade"+ git fetch --no-tags --depth=1 origin "$WORKFLOW_SHA"+ git restore --source "$WORKFLOW_SHA" --worktree .github/scripts/smoke-historical-upgrade.mjs .github/scripts/dmg-mount.mjsgh release download "$SOURCE_TAG" --pattern 'OpenKnowledge-arm64.dmg' --dir "$RUNNER_TEMP/historical-upgrade"node .github/scripts/smoke-historical-upgrade.mjs "$RUNNER_TEMP/historical-upgrade/OpenKnowledge-arm64.dmg" "$UPDATER_CHANNEL"@@ -972,13 +954,6 @@ jobs:# never post. (That's strictly stronger than the pre-fan-in behavior,# where the mac assets were already uploaded before the smoke ran.)#- # The gate is skipped when the checked-out ref predates it. On the- # cascade path this job checks out `client_payload.ref` — a tag pointing- # at the promoted beta's commit, which for the first releases after this- # lands will not contain the smoke harness. Blocking a release because- # the gate did not exist yet would be wrong; the gate applies from the- # first tag that carries it.- ## Stable only. Every beta cut flows through this same job on# channel=beta, and FR5b is scoped to the stable artifact — the beta# equivalent is the selection-time gate in select-beta-to-promote.yml,@@ -1081,7 +1056,7 @@ jobs:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:- ref: ${{ github.event.client_payload.ref || github.ref }}+ ref: ${{ github.event.client_payload.release_tag || inputs.release_tag }}- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0with:@@ -1182,7 +1157,7 @@ jobs:BUILD_VERSION: ${{ needs.prepare.outputs.version }}BUILD_CHANNEL: ${{ env.UPDATER_CHANNEL }}GITHUB_WORKFLOW_SHA: ${{ github.workflow_sha }}- PKG_CMD: 'rm -rf dist-desktop && node scripts/run-electron-builder.mjs --win --publish never --config.extraMetadata.version="${BUILD_VERSION}" --config.win.azureSignOptions.endpoint="${AZURE_SIGNING_ENDPOINT}" --config.win.azureSignOptions.codeSigningAccountName="${AZURE_SIGNING_ACCOUNT}" --config.win.azureSignOptions.certificateProfileName="${AZURE_SIGNING_PROFILE}" --config.win.azureSignOptions.publisherName="${AZURE_SIGNING_PUBLISHER}"'+ PKG_CMD: 'rm -rf dist-desktop && pnpm exec node "$DESKTOP_PACKAGER" --win --publish never --config.extraMetadata.version="${BUILD_VERSION}" --config.win.azureSignOptions.endpoint="${AZURE_SIGNING_ENDPOINT}" --config.win.azureSignOptions.codeSigningAccountName="${AZURE_SIGNING_ACCOUNT}" --config.win.azureSignOptions.certificateProfileName="${AZURE_SIGNING_PROFILE}" --config.win.azureSignOptions.publisherName="${AZURE_SIGNING_PUBLISHER}"'run: |set -euo pipefailmissing=()@@ -1200,17 +1175,22 @@ jobs:echo "::notice::Azure Trusted Signing credentials present — building SIGNED installers."WRAPPER="${RUNNER_TEMP}/retry-transient.mjs"WRAPPER_TMP="${WRAPPER}.tmp.$$"- trap 'rm -f "$WRAPPER_TMP"' EXIT+ export DESKTOP_PACKAGER="${RUNNER_TEMP}/package-desktop.mjs"+ PACKAGER_TMP="${DESKTOP_PACKAGER}.tmp.$$"+ trap 'rm -f "$WRAPPER_TMP" "$PACKAGER_TMP"' EXITmaterialized=falsefor materialize_attempt in 1 2 3; doif git -C "${GITHUB_WORKSPACE}" fetch --no-tags --depth=1 origin "$GITHUB_WORKFLOW_SHA" &&git -C "${GITHUB_WORKSPACE}" show "$GITHUB_WORKFLOW_SHA:.github/scripts/retry-transient.mjs" > "$WRAPPER_TMP" &&[[ -s "$WRAPPER_TMP" ]] &&+ git -C "${GITHUB_WORKSPACE}" show "$GITHUB_WORKFLOW_SHA:.github/scripts/package-desktop.mjs" > "$PACKAGER_TMP" &&+ [[ -s "$PACKAGER_TMP" ]] &&+ mv "$PACKAGER_TMP" "$DESKTOP_PACKAGER" &&mv "$WRAPPER_TMP" "$WRAPPER"; thenmaterialized=truebreakfi- rm -f "$WRAPPER_TMP"+ rm -f "$WRAPPER_TMP" "$PACKAGER_TMP"if [[ "$materialize_attempt" -lt 3 ]]; thenmaterialize_delay=$((materialize_attempt * 5))echo "::warning::Retry wrapper materialization attempt ${materialize_attempt}/3 failed; retrying in ${materialize_delay}s."@@ -1417,7 +1397,7 @@ jobs:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:- ref: ${{ github.event.client_payload.ref || github.ref }}+ ref: ${{ github.event.client_payload.release_tag || inputs.release_tag }}- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0with:@@ -1503,22 +1483,27 @@ jobs:LINUX_TARGETS: ${{ matrix.targets }}VERSION: ${{ needs.prepare.outputs.version }}GITHUB_WORKFLOW_SHA: ${{ github.workflow_sha }}- PKG_CMD: 'rm -rf dist-desktop && node scripts/run-electron-builder.mjs --linux ${LINUX_TARGETS} --publish never --config.extraMetadata.version="${VERSION}"'+ PKG_CMD: 'rm -rf dist-desktop && pnpm exec node "$DESKTOP_PACKAGER" --linux ${LINUX_TARGETS} --publish never --config.extraMetadata.version="${VERSION}"'run: |set -euo pipefailWRAPPER="${RUNNER_TEMP}/retry-transient.mjs"WRAPPER_TMP="${WRAPPER}.tmp.$$"- trap 'rm -f "$WRAPPER_TMP"' EXIT+ export DESKTOP_PACKAGER="${RUNNER_TEMP}/package-desktop.mjs"+ PACKAGER_TMP="${DESKTOP_PACKAGER}.tmp.$$"+ trap 'rm -f "$WRAPPER_TMP" "$PACKAGER_TMP"' EXITmaterialized=falsefor materialize_attempt in 1 2 3; doif git -C "${GITHUB_WORKSPACE}" fetch --no-tags --depth=1 origin "$GITHUB_WORKFLOW_SHA" &&git -C "${GITHUB_WORKSPACE}" show "$GITHUB_WORKFLOW_SHA:.github/scripts/retry-transient.mjs" > "$WRAPPER_TMP" &&[[ -s "$WRAPPER_TMP" ]] &&+ git -C "${GITHUB_WORKSPACE}" show "$GITHUB_WORKFLOW_SHA:.github/scripts/package-desktop.mjs" > "$PACKAGER_TMP" &&+ [[ -s "$PACKAGER_TMP" ]] &&+ mv "$PACKAGER_TMP" "$DESKTOP_PACKAGER" &&mv "$WRAPPER_TMP" "$WRAPPER"; thenmaterialized=truebreakfi- rm -f "$WRAPPER_TMP"+ rm -f "$WRAPPER_TMP" "$PACKAGER_TMP"if [[ "$materialize_attempt" -lt 3 ]]; thenmaterialize_delay=$((materialize_attempt * 5))echo "::warning::Retry wrapper materialization attempt ${materialize_attempt}/3 failed; retrying in ${materialize_delay}s."@@ -1794,6 +1779,8 @@ jobs:# that).finalize:needs: [prepare, build-macos, publish-assets]+ outputs:+ published: ${{ steps.publish.outputs.published }}# `!cancelled()` for the same reason as publish-assets: under a degraded# required-set, a non-required platform's failure elsewhere in the run# must not skip finalization. The explicit success checks keep the real@@ -1863,6 +1850,7 @@ jobs:# full inventory. Channel-mirror invariant: see# packages/desktop/src/main/auto-updater.ts:336-356.- name: Promote draft release to published+ id: publishenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |@@ -1895,6 +1883,8 @@ jobs:echo "Promoted ${RELEASE_TAG} to published (draft=false, latest=false; channel=${CHANNEL})."fi+ echo "published=true" >> "$GITHUB_OUTPUT"+# FR5b — the npm stable publish sits downstream of the DMG smoke gate# (build-macos fails on a bad verdict, which skips this whole job) AND# the full-inventory verification, so npm `latest` can only move for a@@ -2072,11 +2062,45 @@ jobs:echo "::warning::Discord announcement failed for ${RELEASE_TAG} (release is published; notification is best-effort)."fi- # Fires precisely when the rest of the pipeline did not finish. FR5c — page- # the release channel when a stable release is blocked; the STUCK-DRAFT- # marker keeps failed betas findable via log search. Lives in its own job- # (not a `failure()` step inside finalize) because a packaging job failing- # SKIPS finalize entirely — skipped steps can't alert.+ release-consumers:+ needs: finalize+ if: ${{ !cancelled() && needs.finalize.outputs.published == 'true' }}+ runs-on: ubuntu-latest+ timeout-minutes: 5+ permissions:+ contents: write+ steps:+ - name: Dispatch publication to release consumers+ env:+ GH_TOKEN: ${{ github.token }}+ RELEASE_TAG: ${{ github.event.client_payload.release_tag || inputs.release_tag }}+ run: |+ set -euo pipefail+ jq -nc --arg tag "$RELEASE_TAG" '{event_type:"desktop-release-published",client_payload:{release_tag:$tag,ref:$tag}}' |+ gh api -X POST "repos/${GITHUB_REPOSITORY}/dispatches" --input -++ - name: Alert on failed publication dispatch+ if: failure() || cancelled()+ env:+ RELEASE_TAG: ${{ github.event.client_payload.release_tag || inputs.release_tag }}+ SLACK_RELEASES_WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK_URL }}+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}+ run: |+ set -euo pipefail+ RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"+ TEXT="Release ${RELEASE_TAG} is published, but its notification dispatch failed or was cancelled. Reporter writeback and Linear stamping may not have run. Inspect the consumer runs before replaying desktop-release-published for this tag; do not rebuild or republish installers. ${RUN_URL}"+ echo "::error::$TEXT"+ echo "$TEXT" >> "$GITHUB_STEP_SUMMARY"+ WEBHOOK_URL="${SLACK_RELEASES_WEBHOOK_URL:-${SLACK_WEBHOOK_URL:-}}"+ if [[ -z "$WEBHOOK_URL" ]]; then+ echo "::warning::No Slack webhook configured; publication dispatch failure remains visible in Actions."+ exit 0+ fi+ payload="$(jq -nc --arg text "$TEXT" '{text:$text}')"+ if ! curl --fail --silent --show-error --connect-timeout 10 --max-time 30 -X POST -H 'Content-Type: application/json' --data "$payload" "$WEBHOOK_URL"; then+ echo "::warning::Publication dispatch failure alert could not be delivered."+ fi+alert:needs: [prepare, build-macos, build-windows, build-linux, publish-assets, finalize]# "The release did not publish" — not "some job failed": under a degradeddiff --git a/.github/workflows/linear-release.yml b/.github/workflows/linear-release.ymlindex a2ca000f3..5698b18fd 100644--- a/.github/workflows/linear-release.yml+++ b/.github/workflows/linear-release.yml@@ -12,16 +12,6 @@ name: Linear Release# the beta and the stable it shipped in, in its Linear sidebar. Uses Linear's# first-party CLI via linear/linear-release-action.#-# HOW IT'S TRIGGERED (no edits to the delicate publish path)-# release.yml (beta) and promote-stable.yml (stable) BOTH already fire a-# repository_dispatch event_type=desktop-release with-# client_payload.{release_tag, ref} right after cutting the tag + draft-# Release. We piggyback on that same event rather than adding a new dispatch,-# so release.yml / promote-stable.yml stay byte-untouched. We cannot use-# `release: published`: GitHub suppresses cascades from GITHUB_TOKEN-authored-# release events, and repository_dispatch is the documented exemption (which-# is exactly why the desktop-release cascade uses it).-## Channel is derived from the tag shape: a `-beta.N` suffix => beta (started# stage `Beta`); a bare vX.Y.Z => stable, which COMPLETES the release so it# lands in the pipeline's built-in completed stage `Released`. Two channels,@@ -75,9 +65,7 @@ name: Linear Releaseon:repository_dispatch:- # Fired by release.yml (beta) and promote-stable.yml (stable) after each- # tag + draft Release. Carries client_payload.{release_tag, ref}.- types: [desktop-release]+ types: [desktop-release-published]# Manual re-stamp / backfill for a specific tag.workflow_dispatch:inputs:@@ -116,7 +104,7 @@ jobs:if: env.HAS_KEY == 'true'uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:- ref: ${{ github.event.client_payload.ref || inputs.release_tag }}+ ref: ${{ github.event.client_payload.release_tag || inputs.release_tag }}# Full history + tags so the commit scan and previous-tag lookup work.fetch-depth: 0fetch-tags: true@@ -138,6 +126,8 @@ jobs:- name: Derive channel, version, and scan rangeif: env.HAS_KEY == 'true'id: derive+ env:+ GH_TOKEN: ${{ github.token }}run: node .github/scripts/derive-release-stamp.mjs "${RELEASE_TAG}"# Create/find the release keyed by this cut's own tag and attach the@@ -219,6 +209,7 @@ jobs:- name: Correct the stable stamp by containmentif: steps.derive.outputs.channel == 'stable'env:+ GH_TOKEN: ${{ github.token }}LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}CROSS_REPO_TOKEN: ${{ steps.bridge-token.outputs.token }}# Absent by default, so wiring credentials cannot by itself startdiff --git a/.github/workflows/write-back.yml b/.github/workflows/write-back.ymlindex f693a17d1..9dd1f422c 100644--- a/.github/workflows/write-back.yml+++ b/.github/workflows/write-back.yml@@ -6,15 +6,6 @@ name: Reporter Write-Back# narrows on the Bug label, because whether someone hears back should not depend# on how triage classified what they raised.#-# HOW IT'S TRIGGERED (no edits to the delicate publish path)-# release.yml (beta) and promote-stable.yml (stable) both already fire a-# repository_dispatch event_type=desktop-release carrying-# client_payload.{release_tag, ref}. This piggybacks on that same event, the-# way linear-release.yml already does, so the publish workflows stay-# byte-untouched. `release: published` is not an option: GitHub suppresses-# cascades from GITHUB_TOKEN-authored release events, and repository_dispatch-# is the documented exemption.-## BOTH channels run, and they say different things. A `-beta.N` cut tells the# reporter their fix is available now in a beta and that a second message is# coming; the stable promotion sends that second message. The two are kept@@ -51,7 +42,7 @@ name: Reporter Write-Backon:repository_dispatch:- types: [desktop-release]+ types: [desktop-release-published]# Manual backfill / dry-run rehearsal against a specific tag.workflow_dispatch:inputs:@@ -59,6 +50,11 @@ on:description: "Release tag to notify reporters about (e.g. v0.36.0 or v0.36.0-beta.3)"required: truetype: string+ dry_run:+ description: "Preview replies without writing notification markers or posting"+ required: false+ type: boolean+ default: truepermissions:contents: read@@ -155,7 +151,7 @@ jobs:LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}# Absent by default. Set to `live` on the repo (a variable, not a# secret, so it is visible in the settings UI) to arm real posts.- WRITE_BACK_MODE: ${{ vars.WRITE_BACK_MODE }}+ WRITE_BACK_MODE: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run && 'dry-run' || vars.WRITE_BACK_MODE }}DISCORD_NOTIFY_URL: ${{ secrets.DISCORD_NOTIFY_URL }}DISCORD_NOTIFY_TOKEN: ${{ secrets.DISCORD_NOTIFY_TOKEN }}run: node .github/scripts/write-back.mjs