Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Serialize stable desktop publication across tags (#6163)
Nick Gomez5b832fd70cb9
diff --git a/.github/scripts/build-smoke-alert-payload.mjs b/.github/scripts/build-smoke-alert-payload.mjsindex 6f9103736..29908481e 100644--- a/.github/scripts/build-smoke-alert-payload.mjs+++ b/.github/scripts/build-smoke-alert-payload.mjs@@ -61,12 +61,13 @@ export function recoveryCommand(tag, repo = DEFAULT_REPO) {function summaryLine(tag, verdict, blockedBy) {const { subject } = describeBlock({ verdict, blockedBy });- return `π¨ ${ALERT_HEADLINE}: ${tag} ${subject} β nothing shipped`;+ return `π¨ ${ALERT_HEADLINE}: ${tag} ${subject}`;}function recoveryGuidance(tag) {return [- "*Recovery guidance:* Inspect the failed packaging job's final `outcome=`.",+ '*Recovery guidance:* If the Release is published, inspect the failed downstream npm or release-consumer operation before choosing recovery.',+ "If it is unpublished, follow RELEASES.md, Resuming a blocked cut, using a guarded workflow revision. Inspect the failed packaging job's final `outcome=` when packaging failed.",'With no newer stable release, `transient-exhausted`, `deadline`, or `signal` can re-fire the same tag; investigate a recurring deadline.','`unknown-exhausted` requires manual log review. `terminal` requires fixing the cause in `reason=`.','`reason=rule:download-integrity` is the terminal exception: re-fire once on a fresh runner, then stop and investigate upstream if the same artifact fails again.',@@ -88,9 +89,9 @@ function bodyLines({ tag, verdict, reason, runUrl, repo, blockedBy }) {? `*Why:* ${other} failed. The DMG smoke itself passed (${reason}).`: `*Why:* ${other} failed (${reason}).`: `*Why:* ${reason}`,- '*State:* the GitHub Release is still a DRAFT and npm `latest` has NOT moved.',+ '*State:* Publication may have completed. Inspect the GitHub Release, npm and run before recovery.',recoveryGuidance(tag),- `*Recovery command:*\n\`${recoveryCommand(tag, repo)}\``,+ `*Recovery command (only after confirming an eligible unpublished tag):*\n\`${recoveryCommand(tag, repo)}\``,`*Run:* ${runUrl}`,];}diff --git a/.github/scripts/build-smoke-alert-payload.test.mjs b/.github/scripts/build-smoke-alert-payload.test.mjsindex a41aca690..e00581204 100644--- a/.github/scripts/build-smoke-alert-payload.test.mjs+++ b/.github/scripts/build-smoke-alert-payload.test.mjs@@ -41,11 +41,13 @@ describe('alert content', () => {}});- test('states that nothing shipped', () => {+ test('does not infer publication state from a smoke failure', () => {const slack = JSON.stringify(buildSlackPayload(base));- expect(slack).toContain('nothing shipped');- expect(slack).toContain('DRAFT');- expect(slack).toContain('npm `latest` has NOT moved');+ expect(slack).toContain('Publication may have completed');+ expect(slack).toContain('Inspect the GitHub Release, npm and run before recovery');+ expect(slack).not.toContain('nothing shipped');+ expect(slack).not.toContain('DRAFT');+ expect(slack).not.toContain('npm `latest` has NOT moved');});test('a genuine failure and an infrastructure error read differently', () => {@@ -107,7 +109,7 @@ describe('a passing smoke is never rendered as a smoke failure', () => {expect(text).not.toContain('DMG smoke ERRORED');expect(text).not.toContain('DMG smoke FAILED');expect(text).toContain('RELEASE BLOCKED');- expect(text).toContain('nothing shipped');+ expect(text).not.toContain('nothing shipped');});test('the body does not pair an error verdict with a passing reason', () => {@@ -131,7 +133,7 @@ describe('a passing smoke is never rendered as a smoke failure', () => {test('a pass with no known blocking stage still reads as blocked, not as a pass', () => {const vague = buildSlackPayload({ ...base, verdict: 'pass', blockedBy: '' });expect(vague.text).toContain('RELEASE BLOCKED');- expect(vague.text).toContain('nothing shipped');+ expect(vague.text).not.toContain('nothing shipped');expect(JSON.stringify(vague)).toContain('NOT an app regression');});diff --git a/.github/scripts/release-alert-publication-state.test.mjs b/.github/scripts/release-alert-publication-state.test.mjsnew file mode 100644index 000000000..fc2b9a981--- /dev/null+++ b/.github/scripts/release-alert-publication-state.test.mjs@@ -0,0 +1,170 @@+import { spawnSync } from 'node:child_process';+import { mkdtempSync, readFileSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { afterAll, expect, test } from 'vitest';+import { parse } from 'yaml';++const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');+const scratch = [];+afterAll(() => {+ for (const dir of scratch) rmSync(dir, { recursive: true, force: true });+});++function step(file, job, name) {+ const workflow = parse(readFileSync(join(ROOT, '.github/workflows', file), 'utf8'));+ const found = workflow.jobs[job].steps.find((entry) => entry.name === name);+ expect(found).toBeDefined();+ return found.run;+}++function fixture() {+ const dir = mkdtempSync(join(tmpdir(), 'ok-release-alert-state-'));+ scratch.push(dir);+ return {+ dir,+ env: {+ PATH: process.env.PATH,+ CAPTURE: join(dir, 'curl-args'),+ CALLS: join(dir, 'gh-calls'),+ GITHUB_OUTPUT: join(dir, 'outputs'),+ GITHUB_STEP_SUMMARY: join(dir, 'summary'),+ GITHUB_SERVER_URL: 'https://github.com',+ GITHUB_REPOSITORY: 'test/release',+ GITHUB_RUN_ID: '123',+ GITHUB_EVENT_NAME: 'repository_dispatch',+ RELEASE_TAG: 'v1.2.3',+ VERSION: '1.2.3',+ CHANNEL: 'latest',+ SMOKE_VERDICT: 'pass',+ SMOKE_REASON: 'all smoke tests passed',+ REQUIRED_PLATFORMS: 'mac,windows,linux',+ RESULT_PREPARE: 'success',+ RESULT_MACOS: 'success',+ RESULT_WINDOWS: 'success',+ RESULT_LINUX: 'success',+ RESULT_PUBLISH: 'success',+ RESULT_FINALIZE: 'failure',+ SLACK_RELEASES_WEBHOOK_URL: 'https://example.test/slack',+ },+ };+}++function run(script, env, cwd = ROOT) {+ return spawnSync('bash', ['--noprofile', '--norc', '-eo', 'pipefail', '-c', script], {+ cwd,+ env,+ encoding: 'utf8',+ timeout: 10_000,+ });+}++function alert(context, { fallback = false, curlStatus = 0, env = {} } = {}) {+ const result = run(+ `curl() { printf '%s\\0' "$@" > "$CAPTURE"; return ${curlStatus}; }\n${step('desktop-release.yml', 'alert', 'Alert on a blocked release (FR5c)')}`,+ { ...context.env, ...env },+ fallback ? context.dir : ROOT,+ );+ expect(result.status, result.stderr).toBe(0);+ const args = readFileSync(context.env.CAPTURE, 'utf8').split('\0');+ const payload = JSON.parse(args[args.indexOf('--data') + 1]);+ return { result, args, payload };+}++function expectUnknownPublication({ result, payload }) {+ const message = JSON.stringify(payload);+ expect(message).toContain('https://github.com/test/release/actions/runs/123');+ expect(message).toMatch(/publication may have completed/i);+ expect(message).not.toMatch(/nothing shipped|still a DRAFT|has NOT moved/);+ expect(result.stdout).not.toMatch(/stays a draft|npm latest is untouched|nothing shipped/);+}++test.each([false, true])(+ 'a failed npm dispatch after the publication PATCH reports uncertainty with fallback %s',+ (fallback) => {+ const context = fixture();+ const gh = `gh() {+ printf '%s\\n' "$*" >> "$CALLS"+ if [[ "$1 $2" == 'release edit' ]]; then return 0; fi+ if [[ "$1 $2 $3" == 'api -X POST' ]]; then return 1; fi+ return 99+}`;+ const published = run(+ `${gh}\n${step('desktop-release.yml', 'finalize', 'Promote draft release to published')}`,+ context.env,+ );+ expect(published.status, published.stderr).toBe(0);+ expect(readFileSync(context.env.CALLS, 'utf8')).toContain(+ 'release edit v1.2.3 --draft=false --latest',+ );+ expect(readFileSync(context.env.GITHUB_OUTPUT, 'utf8')).toBe('published=true\n');+ const dispatched = run(+ `${gh}\n${step('desktop-release.yml', 'finalize', 'Trigger release.yml to publish stable to npm')}`,+ context.env,+ );+ expect(dispatched.status).toBe(1);+ expect(readFileSync(context.env.CALLS, 'utf8')).toContain('api -X POST repos/test/release/dispatches');+ const observed = alert(context, { fallback });+ expect(observed.payload.text).toContain('finalize');+ if (fallback) expect(observed.result.stdout).toContain('payload builder unavailable');+ expectUnknownPublication(observed);+ },+);++test.each([0, 28])('an upstream packaging failure remains the diagnosis with webhook exit %s', (curlStatus) => {+ const observed = alert(fixture(), {+ curlStatus,+ env: { RESULT_LINUX: 'failure', RESULT_PUBLISH: 'skipped', RESULT_FINALIZE: 'skipped' },+ });+ expect(observed.payload.text).toContain('Linux packaging');+ expect(observed.payload.text).not.toContain('finalize');+ expect(JSON.stringify(observed.payload)).toContain('smoke itself passed');+ expectUnknownPublication(observed);+ expect(observed.args[observed.args.indexOf('--connect-timeout') + 1]).toBe('10');+ expect(observed.args[observed.args.indexOf('--max-time') + 1]).toBe('30');+ if (curlStatus === 28) expect(observed.result.stdout).toContain('delivery is unconfirmed');+});++test('a follower failure reports the failed retry without inferring publication state', () => {+ const context = fixture();+ const result = run(+ `curl() { printf '%s\\0' "$@" > "$CAPTURE"; return 0; }\n${step('desktop-release-auto-retry.yml', 'rerun', 'Alert when the automatic re-run could not start')}`,+ { ...context.env, RUN_URL: 'https://github.com/test/release/actions/runs/123', RUN_ID: '123' },+ );+ expect(result.status, result.stderr).toBe(0);+ const args = readFileSync(context.env.CAPTURE, 'utf8').split('\0');+ const payload = JSON.parse(args[args.indexOf('--data') + 1]);+ expect(payload.text).toContain('automatic re-run');+ expect(payload.text).toContain('could not start');+ expectUnknownPublication({ result, payload });+});++test.each([0, 28])('Discord reports only the request outcome with curl exit %s', (curlStatus) => {+ const context = fixture();+ const webhook = 'https://example.test/discord?thread_id=123&wait=false';+ const result = run(+ `gh() { printf 'release notes'; }+timeout() { shift 2; "$@"; }+curl() {+ printf 'attempt\\n' >> "$CALLS"+ printf '%s\\0' "$@" > "$CAPTURE"+ return ${curlStatus}+}+${step('desktop-release.yml', 'finalize', 'Announce stable release to Discord')}`,+ { ...context.env, DISCORD_WEBHOOK_URL: webhook },+ );+ expect(result.status, result.stderr).toBe(0);+ expect(readFileSync(context.env.CALLS, 'utf8')).toBe('attempt\n');+ const args = readFileSync(context.env.CAPTURE, 'utf8').split('\0');+ expect(args).toContain(webhook);+ expect(JSON.parse(args[args.indexOf('--data') + 1]).content).toContain('1.2.3');+ if (curlStatus === 0) {+ expect(result.stdout).toContain('Discord announcement request completed for v1.2.3');+ expect(result.stdout).toContain('saved-message confirmation not checked');+ } else {+ expect(result.stdout).toContain('::warning::Discord announcement failed');+ expect(result.stdout).not.toContain('Discord announcement request completed');+ }+ expect(result.stdout).not.toContain('Posted stable-release announcement');+});diff --git a/.github/scripts/release-cascade-shape.test.mjs b/.github/scripts/release-cascade-shape.test.mjsindex 09a7e0431..28f8b617b 100644--- a/.github/scripts/release-cascade-shape.test.mjs+++ b/.github/scripts/release-cascade-shape.test.mjs@@ -706,7 +706,7 @@ describe('the stable gate does not touch the beta cadence', () => {test('the beta path keeps its existing stuck-draft warning', () => {const warn = scoped('- name: Warn on stuck draft');- expect(warn).toContain('RECOVERY="gh release edit');+ expect(warn).toContain('Recovering unpublished beta installers');expect(warn).not.toContain("if: needs.prepare.outputs.channel == 'latest'");});});diff --git a/.github/scripts/shipped-fix-containment-shape.test.mjs b/.github/scripts/shipped-fix-containment-shape.test.mjsindex 485cba234..591a823d8 100644--- a/.github/scripts/shipped-fix-containment-shape.test.mjs+++ b/.github/scripts/shipped-fix-containment-shape.test.mjs@@ -35,6 +35,16 @@ describe('promotion: promote-stable refuses before it tags', () => {const steps = stepsOf('promote-stable.yml', 'promote');const [guard] = guardSteps(steps);+ test('an existing stable Release stays unpublished until desktop finalization', () => {+ const create = steps.find((step) => step.name === 'Create stable GitHub Release');+ expect(create).toBeDefined();+ const edits = create.run.split('\n').filter((line) => line.trim().startsWith('gh release edit '));+ expect(edits.map((line) => line.trim())).toEqual([+ 'gh release edit "$STABLE_TAG" --notes-file "$BODY_FILE"',+ ]);+ expect(create.run).toMatch(/gh release create "\$STABLE_TAG" \\\n\s+--draft/);+ });+test('the promote job runs the guard on the beta it computed the version for', () => {expect(guardSteps(steps)).toHaveLength(1);expect(guard.run).toContain('--candidate "$BETA_SHA"');@@ -183,6 +193,22 @@ describe('direct recovery and re-runs: desktop-release checks again right beforeconst steps = stepsOf('desktop-release.yml', 'finalize');const [guard] = guardSteps(steps);+ test('RELEASES.md stable publication holds one lock across the final check and draft flip', () => {+ expect(release.jobs.finalize.concurrency).toEqual({+ group:+ "${{ needs.prepare.outputs.channel == 'latest' && 'ok-stable-publication' || format('desktop-finalize-{0}', github.run_id) }}",+ 'cancel-in-progress': false,+ });+ expect(release.concurrency).toEqual({+ group: 'desktop-release-${{ github.event.client_payload.release_tag || inputs.release_tag }}',+ 'cancel-in-progress': false,+ });+ for (const [name, job] of Object.entries(release.jobs)) {+ if (name === 'finalize') continue;+ expect(job.concurrency, name).toBeUndefined();+ }+ });+test('finalize runs the guard on the stable channel, from a checkout of the workflow revision with every tag', () => {expect(guardSteps(steps)).toHaveLength(1);expect(guard.if).toBe("success() && needs.prepare.outputs.channel == 'latest'");@@ -319,3 +345,139 @@ describe('the bug lane does not hand over a batch a point release would refuse',expect(handoff.if).toContain("steps.evaluate.outputs.fix_refs != ''");});});+++describe('stable publication recovery reporting', () => {+ test('beta recovery keeps the installer and inventory gates before publication', () => {+ const step = stepsOf('desktop-release.yml', 'alert').find(+ (candidate) => candidate.name === 'Warn on stuck draft',+ );+ expect(step).toBeDefined();+ const res = spawnSync('bash', ['-c', step.run], {+ encoding: 'utf8',+ env: { PATH: process.env.PATH, RELEASE_TAG: 'v1.2.3-beta.1', CHANNEL: 'beta' },+ });+ expect(res.status, res.stderr).toBe(0);+ expect(res.stdout).toContain('STUCK-DRAFT');+ expect(res.stdout).toContain('Recovering unpublished beta installers');+ expect(res.stdout).toContain('build and inventory gates');+ expect(res.stdout).not.toContain('gh release edit');+ });++ test('the stuck-draft warning routes stable recovery through the publication lock', () => {+ const step = stepsOf('desktop-release.yml', 'alert').find(+ (candidate) => candidate.name === 'Warn on stuck draft',+ );+ expect(step).toBeDefined();+ const res = spawnSync('bash', ['-c', step.run], {+ encoding: 'utf8',+ env: { PATH: process.env.PATH, RELEASE_TAG: 'v1.2.3', CHANNEL: 'latest' },+ });+ expect(res.status, res.stderr).toBe(0);+ expect(res.stdout).toContain('STUCK-DRAFT');+ expect(res.stdout).toContain('lock-bearing finalize');+ expect(res.stdout).toContain('RELEASES.md');+ expect(res.stdout).not.toContain('gh release edit');+ });++ test.each([+ ['success', 0, 'finalize was cancelled'],+ ['success', 28, 'finalize was cancelled'],+ ['failure', 0, 'Linux packaging'],+ ])('cancelled finalize reports the blocker with Linux %s and webhook exit %s', (linux, curlStatus, expected) => {+ const step = stepsOf('desktop-release.yml', 'alert').find(+ (candidate) => candidate.name === 'Alert on a blocked release (FR5c)',+ );+ expect(step).toBeDefined();+ const dir = realpathSync(mkdtempSync(join(tmpdir(), 'ok-finalize-cancel-')));+ scratch.push(dir);+ const capture = join(dir, 'curl-args');+ const res = spawnSync(+ 'bash',+ ['-c', `curl() { printf '%s\\0' "$@" > "$CAPTURE"; return ${curlStatus}; }\n${step.run}`],+ {+ cwd: OK_ROOT,+ encoding: 'utf8',+ env: {+ PATH: process.env.PATH,+ CAPTURE: capture,+ RELEASE_TAG: 'v1.2.3',+ SMOKE_VERDICT: 'pass',+ RESULT_PREPARE: 'success',+ RESULT_MACOS: 'success',+ RESULT_WINDOWS: 'success',+ RESULT_LINUX: linux,+ RESULT_PUBLISH: 'success',+ RESULT_FINALIZE: 'cancelled',+ GITHUB_SERVER_URL: 'https://github.com',+ GITHUB_REPOSITORY: 'test/release',+ GITHUB_RUN_ID: '123',+ SLACK_RELEASES_WEBHOOK_URL: 'https://example.test/slack',+ },+ },+ );+ expect(res.status, res.stderr).toBe(0);+ const args = readFileSync(capture, 'utf8').split('\0');+ const payload = JSON.parse(args[args.indexOf('--data') + 1]);+ const message = payload.text;+ expect(message).toContain(expected);+ expect(message).toContain('v1.2.3');+ if (linux === 'success') expect(message).toContain('publication may have completed');+ expect(JSON.stringify(payload)).toContain('https://github.com/test/release/actions/runs/123');+ if (linux === 'success') {+ expect(res.stdout).not.toContain('The Release stays a draft');+ expect(message).not.toContain('nothing shipped');+ }+ if (curlStatus === 28) expect(res.stdout).toContain('cancelled-finalize alert failed to POST');+ });+});+++describe('stable announcements cannot consume the finalizer job budget', () => {+ test.each(['Slack', 'Discord'])('%s bounds requests and preserves best-effort failure', (service) => {+ const step = stepsOf('desktop-release.yml', 'finalize').find(+ (candidate) => candidate.name === `Announce stable release to ${service}`,+ );+ expect(step).toBeDefined();+ const dir = realpathSync(mkdtempSync(join(tmpdir(), 'ok-finalize-post-')));+ scratch.push(dir);+ const capture = join(dir, 'curl-args');+ const fetchCapture = join(dir, 'fetch-args');+ writeFileSync(fetchCapture, '');+ const res = spawnSync(+ 'bash',+ [+ '-c',+ `gh() { printf 'gh %s\\n' "$*" >> "$FETCH_CAPTURE"; }+timeout() { printf 'timeout %s\\n' "$*" >> "$FETCH_CAPTURE"; printf partial-fetch; return 124; }+curl() { printf '%s\\0' "$@" > "$CAPTURE"; return 28; }+${step.run}`,+ ],+ {+ cwd: OK_ROOT,+ encoding: 'utf8',+ env: {+ PATH: process.env.PATH,+ CAPTURE: capture,+ FETCH_CAPTURE: fetchCapture,+ RELEASE_TAG: 'v1.2.3',+ VERSION: '1.2.3',+ GITHUB_REPOSITORY: 'test/release',+ SLACK_RELEASES_WEBHOOK_URL: 'https://example.test/slack',+ DISCORD_WEBHOOK_URL: 'https://example.test/discord',+ },+ },+ );+ expect(res.status, res.stderr).toBe(0);+ expect(res.stdout).toContain(`::warning::${service} announcement failed`);+ const args = readFileSync(capture, 'utf8').split('\0');+ expect(args[args.indexOf('--max-time') + 1]).toBe('30');+ expect(args[args.indexOf('--connect-timeout') + 1]).toBe('10');+ expect(readFileSync(fetchCapture, 'utf8')).toContain(+ 'timeout --kill-after=5s 30s gh release view v1.2.3',+ );+ const payload = JSON.parse(args[args.indexOf('--data') + 1]);+ expect(payload.text ?? payload.content).toContain('1.2.3');+ expect(JSON.stringify(payload)).not.toContain('partial-fetch');+ });+});diff --git a/.github/workflows/desktop-release-auto-retry.yml b/.github/workflows/desktop-release-auto-retry.ymlindex 3a7747fa3..5d8dac539 100644--- a/.github/workflows/desktop-release-auto-retry.yml+++ b/.github/workflows/desktop-release-auto-retry.yml@@ -46,7 +46,7 @@ jobs:RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}run: |set -uo pipefail- TEXT="π¨ RELEASE BLOCKED: the automatic re-run of ${RUN_URL} could not start β nothing shipped. Re-run its failed jobs by hand: gh run rerun ${RUN_ID} --failed -R ${GITHUB_REPOSITORY}"+ TEXT="π¨ RELEASE BLOCKED: the automatic re-run of ${RUN_URL} could not start or its request was not confirmed. Publication may have completed. Inspect the Release, npm and current run attempt before recovery; follow RELEASES.md, Resuming a blocked cut."echo "::error::${TEXT}"webhook="${SLACK_RELEASES_WEBHOOK_URL:-${SLACK_WEBHOOK_URL:-}}"if [[ -z "$webhook" ]]; then@@ -55,5 +55,5 @@ jobs:fiif ! curl -sS --fail --max-time 30 -X POST -H 'Content-type: application/json' \--data "$(jq -nc --arg t "$TEXT" '{text: $t}')" "$webhook"; then- echo "::warning::The auto-retry alert failed to POST; the release is still blocked."+ echo "::warning::The auto-retry alert failed to POST; delivery is unconfirmed; inspect the source run and Release."fidiff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex 4621649e1..5b06bf65f 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -1835,6 +1835,9 @@ jobs:# that).finalize:needs: [prepare, build-macos, publish-assets]+ concurrency:+ group: ${{ needs.prepare.outputs.channel == 'latest' && 'ok-stable-publication' || format('desktop-finalize-{0}', github.run_id) }}+ cancel-in-progress: falseoutputs:published: ${{ steps.publish.outputs.published }}# `!cancelled()` for the same reason as publish-assets: under a degraded@@ -2067,7 +2070,7 @@ jobs:# through. A failed fetch is not fatal: the builder degrades to the# header + link message on empty input. The builder strips the# Downloads block + consumed-set marker on its side.- NOTES="$(gh release view "$RELEASE_TAG" --json body --jq '.body' 2>/dev/null || true)"+ NOTES="$(timeout --kill-after=5s 30s gh release view "$RELEASE_TAG" --json body --jq '.body' 2>/dev/null)" || NOTES=""# The builder emits the whole Block Kit payload as JSON (so $VERSION /# $RELEASE_URL are JSON-escaped β a stray quote in a tag would# otherwise corrupt the body), converts the notes from GitHub markdown@@ -2102,7 +2105,7 @@ jobs:# The failing curl sits in an `if` condition, which `set -e` does# not treat as fatal β a Slack outage routes to the else/warning# and the step still exits 0.- if curl -sS --fail -X POST -H 'Content-type: application/json' --data "$payload" "$WEBHOOK_URL"; then+ if curl -sS --fail --connect-timeout 10 --max-time 30 -X POST -H 'Content-type: application/json' --data "$payload" "$WEBHOOK_URL"; thenecho "Posted stable-release announcement for ${RELEASE_TAG} to Slack."elseecho "::warning::Slack announcement failed for ${RELEASE_TAG} (release is published; notification is best-effort)."@@ -2121,7 +2124,7 @@ jobs:exit 0fiRELEASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/tag/${RELEASE_TAG}"- NOTES="$(gh release view "$RELEASE_TAG" --json body --jq '.body' 2>/dev/null || true)"+ NOTES="$(timeout --kill-after=5s 30s gh release view "$RELEASE_TAG" --json body --jq '.body' 2>/dev/null)" || NOTES=""# Discord renders no markdown tables; strip the marker-delimited# Downloads block (the release page keeps it β the embed links# there).@@ -2148,8 +2151,8 @@ jobs:) }]}')"- if curl -sS --fail -X POST -H 'Content-Type: application/json' --data "$payload" "$DISCORD_WEBHOOK_URL"; then- echo "Posted stable-release announcement for ${RELEASE_TAG} to Discord."+ if curl -sS --fail --connect-timeout 10 --max-time 30 -X POST -H 'Content-Type: application/json' --data "$payload" "$DISCORD_WEBHOOK_URL"; then+ echo "Discord announcement request completed for ${RELEASE_TAG} (best-effort; saved-message confirmation not checked)."elseecho "::warning::Discord announcement failed for ${RELEASE_TAG} (release is published; notification is best-effort)."fi@@ -2196,9 +2199,6 @@ jobs:alert:needs: [prepare, build-macos, build-windows, build-linux, publish-assets, finalize]- # "The release did not publish" β not "some job failed": under a degraded- # required-set a non-required platform can fail while the release still- # publishes, and paging on that would train readers to ignore the alert.# finalize != success covers every blocked shape transitively (prepare,# a required build, publish-assets, or finalize itself). prepare failing# before channel detection leaves the channel output empty; the steps@@ -2253,12 +2253,6 @@ jobs:# keeps the STUCK-DRAFT warning below; paging the release channel for# every beta hiccup would train readers to ignore the alert.#- # Same destination as the release announcement: this alert is the- # negative of that message (the release that did NOT ship), so it belongs- # with the notes rather than in the product channel. SLACK_WEBHOOK_URL- # remains the fallback, with the same unset -> ::notice:: -> skip- # tolerance.- ## Slack only, deliberately β rationale lives in the module docstring of# .github/scripts/build-smoke-alert-payload.mjs. Ratcheted by# build-smoke-alert-payload.test.mjs so this cannot drift back.@@ -2322,13 +2316,26 @@ jobs:[[ "${RESULT_PUBLISH}" == "failure" ]] && blocked+=("asset publication")# finalize is the alert's own trigger, so it is only worth naming when# nothing blocking upstream failed β otherwise every page would list it.- if [[ ${#blocked[@]} -eq 0 && "${RESULT_FINALIZE}" == "failure" ]]; then+ if [[ ${#blocked[@]} -eq 0 && ( "${RESULT_FINALIZE}" == "failure" || "${RESULT_FINALIZE}" == "cancelled" ) ]]; thenblocked+=("finalize")fiBLOCKED_BY=""for b in ${blocked[@]+"${blocked[@]}"}; doBLOCKED_BY="${BLOCKED_BY:+${BLOCKED_BY}, }${b}"done+ if [[ "$RESULT_FINALIZE" == "cancelled" && "$BLOCKED_BY" == "finalize" ]]; then+ RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"+ TEXT="RELEASE FINALIZATION CANCELLED: ${RELEASE_TAG}: finalize was cancelled. Inspect the Release and run before recovery; publication may have completed. ${RUN_URL}"+ echo "::warning::${TEXT}"+ webhook="${SLACK_RELEASES_WEBHOOK_URL:-${SLACK_WEBHOOK_URL:-}}"+ if [[ -n "$webhook" ]]; then+ payload="$(jq -nc --arg text "$TEXT" '{text: $text}')"+ if ! curl -sS --fail --connect-timeout 10 --max-time 30 -X POST -H 'Content-Type: application/json' --data "$payload" "$webhook"; then+ echo "::warning::The cancelled-finalize alert failed to POST; inspect the run and Release."+ fi+ fi+ exit 0+ fiREASON="${SMOKE_REASON:-the release pipeline failed before completing β see the run}"if [[ "${RETRY_OUTCOME:-}" == "failure" ]]; thenREASON="${REASON}. Not re-run automatically: the re-run decision failed, see the run"@@ -2356,37 +2363,27 @@ jobs:# Never go silent. Losing the formatting is a degradation; losing# the page is the outage this step exists to prevent.echo "::warning::Smoke-alert payload builder unavailable for ${RELEASE_TAG}; sending the plain-text alert."- payload="$(jq -nc --arg t "π¨ RELEASE BLOCKED: ${RELEASE_TAG} β ${BLOCKED_BY:-pipeline ${VERDICT}} β nothing shipped. ${REASON} ${RUN_URL}" '{text: $t}')"+ payload="$(jq -nc --arg t "π¨ RELEASE BLOCKED: ${RELEASE_TAG} β ${BLOCKED_BY:-pipeline ${VERDICT}} β publication may have completed. Inspect the Release, npm and run before recovery. ${REASON} ${RUN_URL}" '{text: $t}')"fi# The failing curl sits in an `if` condition, so a webhook outage# routes to the warning instead of masking the failure.- if curl -sS --fail -X POST -H 'Content-type: application/json' --data "$payload" "$webhook"; then+ if curl -sS --fail --connect-timeout 10 --max-time 30 -X POST -H 'Content-type: application/json' --data "$payload" "$webhook"; thenecho "Posted the ${label} smoke alert for ${RELEASE_TAG}."else- echo "::warning::${label} smoke alert failed to POST for ${RELEASE_TAG} β the release is still blocked; only the notification was lost."+ echo "::warning::${label} smoke alert failed to POST for ${RELEASE_TAG} β delivery is unconfirmed; inspect the Release, npm and run before recovery."fi}post "${SLACK_RELEASES_WEBHOOK_URL:-${SLACK_WEBHOOK_URL:-}}" Slack# The annotation is emitted IN ADDITION to the page, so the run page# tells the same story as the channel.- echo "::error::RELEASE BLOCKED: ${RELEASE_TAG} β ${BLOCKED_BY:-pipeline ${VERDICT}} β ${REASON}. The Release stays a draft and npm latest is untouched."-- # Lightweight discoverability for stuck-draft state. NOT a substitute- # for full paging observability β this is a zero-cost log marker that- # makes stuck drafts findable via GitHub Actions log search using the- # STUCK-DRAFT tag. Operators bisecting a missing release can grep- # workflow logs for the tag, then run the recovery command in the- # message. (Recovery re-publishes nothing by itself β re-run the failed- # jobs first so publish-assets has verified the inventory.)+ echo "::error::RELEASE BLOCKED: ${RELEASE_TAG} β ${BLOCKED_BY:-pipeline ${VERDICT}} β ${REASON}. Publication may have completed. Inspect the Release, npm and run before recovery."+- name: Warn on stuck draftrun: |- # Recovery command mirrors the Promote step's combined PATCH shape- # (--draft=false [--latest]) β empirically atomic per GitHub's- # post-state evaluation of make_latest.- if [[ "$CHANNEL" == "latest" ]]; then- RECOVERY="gh release edit ${RELEASE_TAG} --draft=false --latest (never for a tag the shipped-fix check refused)"+ if [[ "$CHANNEL" == "beta" ]]; then+ RECOVERY="Follow RELEASES.md, Recovering unpublished beta installers; re-dispatch desktop-release.yml for this tag so the build and inventory gates pass before publication."else- RECOVERY="gh release edit ${RELEASE_TAG} --draft=false"+ RECOVERY="Follow RELEASES.md, Recovery workflow revision and Resuming a blocked cut; stable recovery must publish through a lock-bearing finalize. Never recover a tag the shipped-fix check refused."fi- echo "::warning::STUCK-DRAFT: Release ${RELEASE_TAG} may be stuck as draft (channel=${CHANNEL:-unknown}). Recovery after the failed jobs are re-run green: ${RECOVERY}"+ echo "::warning::STUCK-DRAFT: Release ${RELEASE_TAG} may be stuck as draft (channel=${CHANNEL:-unknown}). ${RECOVERY}"diff --git a/.github/workflows/promote-stable.yml b/.github/workflows/promote-stable.ymlindex ea5312800..1beac7690 100644--- a/.github/workflows/promote-stable.yml+++ b/.github/workflows/promote-stable.yml@@ -482,15 +482,8 @@ jobs:# Idempotency: a re-run after a transient failure should not# explode if the Release already exists.if gh release view "$STABLE_TAG" >/dev/null 2>&1; then- # Idempotent re-run after a transient failure (e.g., the draft- # was created but desktop-release.yml never promoted it). The- # combined PATCH (--draft=false + --prerelease=false + --latest)- # is empirically atomic: GitHub evaluates the make_latest- # constraint against the post-request state, so the draftβ- # published flip and Latest stamp succeed in a single call.- # No-op on an already-published release.- echo "Release ${STABLE_TAG} already exists; updating notes + ensuring published + --latest."- gh release edit "$STABLE_TAG" --notes-file "$BODY_FILE" --draft=false --prerelease=false --latest+ echo "Release ${STABLE_TAG} already exists; updating notes and preserving publication state."+ gh release edit "$STABLE_TAG" --notes-file "$BODY_FILE"else# Create as draft so the release is invisible in the .atom feed# until desktop-release.yml uploads latest-mac.yml AND promotes