ci: stop CI being red for a reason nobody acts on, and gate the manifest key set

notify-ci-failure.yml called a reusable that declares DISCORD_CI_WEBHOOK as
`required: true`, which GitHub validates before any of the reusable's own logic
runs. With the secret unset — docs/00 §10.6 lists it as still open — that
workflow failed on *every* CI completion, success included, from the first push
after it landed. The file's own header comment admitted it. This is precisely
the failure mode commit 5f4c6e7 fixed for releases: a run that is red for a
reason nobody acts on teaches everyone to stop reading the colour, and the next
genuine failure goes unnoticed.

release.yml's `gh release create` had no existence check, so any failure after
it — realistically the CWS publish step, once autopublish is on — stranded the
tag: a re-run could not get past that line, and recovery meant deleting the
Release and the tag by hand. v1.0.1 is the first tag to exercise that path at
all, since both the continue-on-error announce fix and tag_override landed
after the v1.0.0 tag object.

check-manifest.mjs now asserts the exact top-level key SET, not just the absence
of ten enumerated reach-widening keys. The forbidden list can only catch what
someone thought to name; this catches a build tool that starts emitting a key
nobody asked for. That matters immediately: WXT is a 0.x dependency, so a
routine minor bump is exactly when it happens, and tests/unit/manifest.test.ts
is structurally blind to it — it reads wxt.config.ts, which a WXT upgrade cannot
change. Verified by injecting a `commands` key into a built manifest and
watching the gate fail.

docs/12's sample YAML updated in the same commit, so the drift this phase just
finished correcting does not immediately start again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5 committed 2026-08-03 19:16:12 +07:00
1 parent 8882be03cb
commit b1698aca0b
4 files changed
+79 -9

No files matched your search

+12 -4
View File
@@ -1,10 +1,16 @@
# Caller stub — docs/12 §2.4.
#
# The reusable already filters to `conclusion == 'failure'` on the default
# branch, so this caller needs no `if:`.
# The reusable filters to `conclusion == 'failure'` on the default branch
# internally, so the `if:` below is redundant for behaviour — but not for this:
# the reusable declares `DISCORD_CI_WEBHOOK` as `required: true`, and GitHub
# validates that BEFORE any of the reusable's own logic runs. With the secret
# unset (docs/00 §10.6) this workflow therefore failed on *every* CI completion,
# success included, from the first push after it landed.
#
# ⚠️ It declares `DISCORD_CI_WEBHOOK` as `required: true`, so this workflow
# fails until that repo secret exists (docs/12 §5).
# `continue-on-error` on top of that, for the same reason `release.yml`'s
# announce job has it: a notification must never be able to change the colour of
# the thing it is reporting on. A run that is red for a reason nobody acts on
# teaches everyone to stop reading the colour.
name: Notify CI failure
on:
@@ -18,6 +24,8 @@ permissions:
jobs:
notify:
if: github.event.workflow_run.conclusion == 'failure'
continue-on-error: true
uses: poli0981/.github/.github/workflows/notify-ci-failure.yml@main
permissions:
contents: read
+14 -2
View File
@@ -53,12 +53,24 @@ jobs:
working-directory: .output
run: sha256sum *-chrome.zip > SHA256SUMS.txt
# Idempotent on purpose. `gh release create` fails outright if a Release
# for the tag already exists, so any failure AFTER this step — realistically
# the CWS publish below, once CWS_AUTOPUBLISH is on — used to strand the
# tag: re-running the workflow could not get past this line, and the only
# recovery was deleting the Release and the tag by hand (docs/13 §7).
- name: GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --generate-notes
set -euo pipefail
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
echo "Release $GITHUB_REF_NAME exists — re-uploading assets."
gh release upload "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --clobber
else
gh release create "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --generate-notes
fi
# v1.0.x is published by hand (docs/12 §3) — first store reviews often
# ask questions and want a human in the loop. Flipping the repo variable
+16 -3
View File
@@ -196,12 +196,18 @@ jobs:
working-directory: .output
run: sha256sum *-chrome.zip > SHA256SUMS.txt
- name: GitHub Release
- name: GitHub Release # idempotent — see below
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --generate-notes
set -euo pipefail
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --clobber
else
gh release create "$GITHUB_REF_NAME" \
.output/*-chrome.zip .output/SHA256SUMS.txt --generate-notes
fi
- name: Publish to Chrome Web Store
if: vars.CWS_AUTOPUBLISH == 'true'
@@ -223,6 +229,13 @@ jobs:
secrets: inherit
```
**The Release step is idempotent deliberately.** `gh release create` fails
outright when a Release for the tag already exists, so any failure *after* it —
realistically the CWS publish step, once `CWS_AUTOPUBLISH` is on — stranded the
tag: a re-run could not get past that line, and recovery meant deleting the
Release and the tag by hand. `docs/13 §7` documents the manual escape; this
removes the need for it in the common case.
`continue-on-error` because the reusable exits 1 on "No webhooks configured"
when both Discord secrets are unset — which §5 lists as optional. On the real
v1.0.0 run the Release, the zip and `SHA256SUMS.txt` all published correctly
+37
View File
@@ -20,6 +20,32 @@ const MANIFEST = join(process.cwd(), '.output', 'chrome-mv3', 'manifest.json');
/** Exactly this, in any order. Adding one is a minor-version event (docs/09 §4). */
const ALLOWED_PERMISSIONS = ['bookmarks', 'storage'];
/**
* The exact top-level key set the build is expected to emit.
*
* The forbidden list below can only catch reach-widening keys someone thought
* to enumerate. This catches the other direction — a build tool that starts
* emitting a key nobody asked for, or stops emitting one the store requires.
* WXT is a 0.x dependency, so a routine minor bump is exactly when that
* happens, and the unit test over `wxt.config.ts` is structurally blind to it:
* a WXT upgrade cannot change that file.
*
* Adding a key here is a deliberate act. Check docs/08 §1 first.
*/
const EXPECTED_KEYS = [
'action',
'default_locale',
'description',
'homepage_url',
'icons',
'manifest_version',
'minimum_chrome_version',
'name',
'options_ui',
'permissions',
'version',
];
/** Keys that would widen the extension's reach. None may be present. */
const FORBIDDEN_KEYS = [
'host_permissions',
@@ -60,6 +86,17 @@ for (const key of FORBIDDEN_KEYS) {
if (key in manifest) problems.push(`declares "${key}": ${JSON.stringify(manifest[key])}`);
}
const actualKeys = Object.keys(manifest).sort();
const expectedKeys = [...EXPECTED_KEYS].sort();
const unexpected = actualKeys.filter((key) => !expectedKeys.includes(key));
const missing = expectedKeys.filter((key) => !actualKeys.includes(key));
if (unexpected.length > 0) {
problems.push(`unexpected top-level key(s): ${unexpected.join(', ')} — see docs/08 §1`);
}
if (missing.length > 0) {
problems.push(`missing expected top-level key(s): ${missing.join(', ')}`);
}
if (problems.length > 0) {
for (const problem of problems) {
console.error(`::error::check-manifest: ${problem}`);