From c6925335cae2ce785d1466ff04481f8c14b02864 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:00:09 +0000 Subject: [PATCH 01/17] fix(ci): regenerate actions.lock entries so CI starts again; guard drift The CI workflow has not started on any push or PR since 2026-10-11 (startup_failure, zero jobs). Dependabot #782 bumped ci.yml to actions/setup-node@v7.1.0 and actions/upload-artifact@v7.0.2 but left .github/workflows/actions.lock, the repo's pin authority, at v7.0.0 and v7.0.1, and GitHub refuses to start a workflow that does not match its lockfile. The last CI run that started was 4e2d263 (2026-10-08, success); 5af55f5 (#782) is the first startup_failure. panic-attack.yml (upload-artifact) and casket-pages.yml (haskell-actions/setup v2.12.1) drifted the same way, and publish-jsr.yml referenced setup-deno by SHA where the lock keys it by tag (the same commit). - actions.lock: the three bumped actions now map to their tag commits (setup-node v7.1.0 949feb24, upload-artifact v7.0.2 cf430e03, haskell-actions/setup v2.12.1 0f8e8c99, the peeled commit of an annotated tag as for v2.12.0); entries no workflow uses are dropped. - publish-jsr.yml: setup-deno@v2.0.5, the ref the lock pins. - tools/ci/check-actions-lock.sh: fails when a workflow's `uses:` set and the lock's list for it differ, either way, or a locked action has no dependency entry. Wired in as governance check 4, so a Dependabot bump without a lock regeneration is caught on its own PR. - CLAUDE.md: corrects the note that tag pins are rejected; tag pins that match the lock start fine. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- .claude/CLAUDE.md | 21 +++++--- .github/workflows/actions.lock | 26 +++++----- .github/workflows/publish-jsr.yml | 4 +- CHANGELOG.adoc | 5 ++ tools/ci/check-actions-lock.sh | 80 +++++++++++++++++++++++++++++++ tools/ci/governance-standalone.sh | 16 +++++-- 6 files changed, 127 insertions(+), 25 deletions(-) create mode 100755 tools/ci/check-actions-lock.sh diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 49cad46c..a6a3d7d2 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -272,13 +272,20 @@ resolved; kept here with current status so agents don't re-investigate: root files. A real new finding shows as a *delta in your changed files*; otherwise ignore. (The Hypatia *check run* gates separately and is green.) -**CI is now standalone and green on `main` (since #604 / `c7922cf`).** Two -`startup_failure` classes bit `ci` / `governance` / `secret-scanner` for days -(and `main` itself) — worth knowing so they aren't reintroduced: - -1. The repo's Actions "allowed actions" policy **rejects tag-pinned action - refs at run-creation** (a `startup_failure` with zero jobs). **Pin every - `uses:` to a full commit SHA** — `actions/foo@v4` will fail to start. +**CI is standalone (since #604 / `c7922cf`).** Two `startup_failure` classes +(a run that never starts, with zero jobs) have bitten `ci` / `governance` / +`secret-scanner` and `main` itself. `ci` did not run at all from +2026-10-11 until the actions.lock fix. Know them so they aren't reintroduced: + +1. **`.github/workflows/actions.lock` is the pin authority** (GitHub's actions + lockfile, `gh actions-lock`). Workflows reference actions by tag + (`actions/checkout@v7.0.1`) and the lock maps each to a commit SHA. A + workflow whose `uses:` refs do not match the lock does not start. A + Dependabot bump that does not regenerate the lock causes exactly this + (#782 stopped `ci`). **After any change to a `uses:` ref, regenerate + `actions.lock`.** `tools/ci/check-actions-lock.sh` (governance check 4) + fails on a mismatch. (An older note here said tag pins themselves were + rejected; the run history shows tag pins that match the lock start fine.) 2. A reusable-workflow *caller* that declares `concurrency:` on the same key the reusable also declares is rejected at run-creation (BP008 — see `.github/workflows/spark-theatre-gate.yml`). diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index e3212b8d..4c745e84 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -11,11 +11,11 @@ workflows: - 'actions/configure-pages@v6.0.0' - 'actions/deploy-pages@v5.0.1' - 'actions/upload-pages-artifact@v5.0.0' - - 'haskell-actions/setup@v2.12.0' + - 'haskell-actions/setup@v2.12.1' '.github/workflows/ci.yml': - 'actions/checkout@v7.0.1' - - 'actions/setup-node@v7.0.0' - - 'actions/upload-artifact@v7.0.1' + - 'actions/setup-node@v7.1.0' + - 'actions/upload-artifact@v7.0.2' '.github/workflows/codeql.yml': - 'actions/checkout@v7.0.1' - 'github/codeql-action@v4.39.3' @@ -40,7 +40,7 @@ workflows: - 'actions/upload-pages-artifact@v5.0.0' '.github/workflows/panic-attack.yml': - 'actions/checkout@v7.0.1' - - 'actions/upload-artifact@v7.0.1' + - 'actions/upload-artifact@v7.0.2' - 'dtolnay/rust-toolchain@master' '.github/workflows/publish-jsr.yml': - 'actions/checkout@v7.0.1' @@ -92,9 +92,9 @@ dependencies: commit: 'sha1-368f82528645a54fb793d4d04e342629a3f51346' owner_id: 44036562 repo_id: 438112499 - 'actions/setup-node@v7.0.0': - ref: 'v7.0.0' - commit: 'sha1-820762786026740c76f36085b0efc47a31fe5020' + 'actions/setup-node@v7.1.0': + ref: 'v7.1.0' + commit: 'sha1-949feb2413d6458794dcd2491c4babbbce0c15c1' owner_id: 44036562 repo_id: 189476904 'actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f': @@ -102,9 +102,9 @@ dependencies: commit: 'sha1-bbbca2ddaa5d8feaa63e36b76fdaad77386f024f' owner_id: 44036562 repo_id: 192625955 - 'actions/upload-artifact@v7.0.1': - ref: 'v7.0.1' - commit: 'sha1-043fb46d1a93c77aae656e7c1c64a875d1fc6a0a' + 'actions/upload-artifact@v7.0.2': + ref: 'v7.0.2' + commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9' owner_id: 44036562 repo_id: 192625955 'actions/upload-pages-artifact@v5.0.0': @@ -129,9 +129,9 @@ dependencies: commit: 'sha1-33d7b85da1a04171e211befe2c739303b9a4c066' owner_id: 9919 repo_id: 259445878 - 'haskell-actions/setup@v2.12.0': - ref: 'v2.12.0' - commit: 'sha1-6037f33647c3f17758a2356c80fc4a53d7e0685d' + 'haskell-actions/setup@v2.12.1': + ref: 'v2.12.1' + commit: 'sha1-0f8e8c99d88aeb3fbfd523f1ef2c6f762d10d64d' owner_id: 75048950 repo_id: 623796603 'hyperpolymath/smtp-notify-action@v0.5.1': diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml index 7cb5e19e..97b00bd4 100644 --- a/.github/workflows/publish-jsr.yml +++ b/.github/workflows/publish-jsr.yml @@ -43,8 +43,8 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@v7.0.1 - # v2.0.5 — immutable commit pin (tag: v2.0.5). - - uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed + # v2.0.5; its commit is pinned in actions.lock (the pin authority). + - uses: denoland/setup-deno@v2.0.5 with: deno-version: v2.x - name: Resolve package directory diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 414748a2..ce60555c 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -158,6 +158,11 @@ JSR publish (#303) ==== CI +* fix(ci): `CI` never started from 2026-10-11 (startup_failure, zero jobs) +because Dependabot #782 bumped actions in ci.yml without regenerating +`.github/workflows/actions.lock`. The lock now matches every workflow +(ci.yml, panic-attack.yml, casket-pages.yml, publish-jsr.yml), and +governance check 4 (`tools/ci/check-actions-lock.sh`) fails on any drift * ci(migration-assistant): fix smoke-parse for tree-sitter-cli 0.25 (#342) * ci: bump github/codeql-action from 4.32.6 to 4.36.0 (#323) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh new file mode 100755 index 00000000..f89406d5 --- /dev/null +++ b/tools/ci/check-actions-lock.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# +# actions.lock consistency guard. +# +# `.github/workflows/actions.lock` (GitHub's actions lockfile, generated by +# `gh actions-lock`) is this repo's pin authority: it maps every action a +# workflow uses to a commit SHA. GitHub refuses to start a workflow whose +# `uses:` refs do not match the lock, and reports only a `startup_failure` +# with zero jobs. That is how the `CI` workflow stopped running on every +# push and PR from 2026-10-11: Dependabot (#782) bumped +# `actions/setup-node` and `actions/upload-artifact` in ci.yml without +# regenerating the lock. +# +# For each workflow, this check compares the set of external actions its +# `uses:` lines reference (sub-path actions such as +# `github/codeql-action/init@v4` count as `github/codeql-action@v4`; local +# `./` actions, `docker://` images and reusable workflows are not locked) +# with the set the lock lists for it, and fails on any difference, either +# way round. It also fails if a locked action has no `dependencies:` entry. +# +# Usage: tools/ci/check-actions-lock.sh [WORKFLOW_DIR] (default .github/workflows) +set -uo pipefail + +dir="${1:-.github/workflows}" +lock="$dir/actions.lock" +fail=0 +err() { printf '::error::%s\n' "$*"; fail=1; } + +[ -f "$lock" ] || { err "actions lockfile missing: $lock"; exit 1; } + +# The actions a workflow file uses, normalised and sorted. +used() { + grep -E '^[[:space:]]*(-[[:space:]]*)?uses:' "$1" \ + | sed -E 's/^[[:space:]]*(-[[:space:]]*)?uses:[[:space:]]*//; s/[[:space:]]+#.*$//; s/^["'\'']//; s/["'\'']$//; s/[[:space:]]+$//' \ + | grep -vE '^(\./|docker://)' \ + | grep -v '/\.github/workflows/' \ + | sed -E 's#^([^/@]+/[^/@]+)/[^@]*@#\1@#' \ + | sort -u +} + +# The actions the lock lists for workflow path $1, sorted. +locked() { + awk -v wf="'$1':" ' + /^workflows:/ { inwf = 1; next } + /^dependencies:/ { inwf = 0 } + inwf && $1 == wf { on = 1; next } + inwf && on && /^ - / { v = $2; gsub(/'\''/, "", v); print v; next } + inwf && on { on = 0 } + ' "$lock" | sort -u +} + +# Dependency keys present in the lock. +deps=$(awk '/^dependencies:/ { d = 1; next } d && /^ '\''/ { k = $1; gsub(/['\'':]/, "", k); print k }' "$lock") + +checked=0 +for wf in "$dir"/*.yml "$dir"/*.yaml; do + [ -f "$wf" ] || continue + rel=".github/workflows/$(basename "$wf")" + checked=$((checked + 1)) + u=$(used "$wf") + l=$(locked "$rel") + if ! grep -qF "'$rel':" "$lock"; then + [ -z "$u" ] || err "$rel uses actions but has no actions.lock entry: $(echo $u)" + continue + fi + missing=$(comm -23 <(printf '%s\n' "$u" | sed '/^$/d') <(printf '%s\n' "$l" | sed '/^$/d')) + stale=$(comm -13 <(printf '%s\n' "$u" | sed '/^$/d') <(printf '%s\n' "$l" | sed '/^$/d')) + [ -z "$missing" ] || err "$rel uses actions the lock does not list (regenerate actions.lock): $(echo $missing)" + [ -z "$stale" ] || err "$rel: actions.lock lists actions the workflow no longer uses: $(echo $stale)" + for a in $l; do + printf '%s\n' "$deps" | grep -qxF "$a" || err "actions.lock has no dependencies entry for $a ($rel)" + done +done + +if [ "$fail" -ne 0 ]; then + echo "actions.lock check FAILED: a mismatched workflow does not start (startup_failure, zero jobs)." + exit 1 +fi +echo "actions.lock check: OK ($checked workflows match the lock)" diff --git a/tools/ci/governance-standalone.sh b/tools/ci/governance-standalone.sh index bf9241c8..ca71f05e 100755 --- a/tools/ci/governance-standalone.sh +++ b/tools/ci/governance-standalone.sh @@ -26,7 +26,7 @@ err() { printf '::error::%s\n' "$*"; fail=1; } echo "== Governance gate (standalone) ==" # --- [1] Jekyll artifacts are banned (estate SSG is hyperpolymath/casket-ssg) -echo "[1/3] Jekyll artifacts" +echo "[1/4] Jekyll artifacts" jekyll=$(find . \( -path ./.git -o -path ./_build -o -path ./node_modules \) -prune -o \ \( -name '_config.yml' -o -name 'Gemfile' -o -iname 'jekyll*.yml' \ -o -iname 'jekyll-gh-pages*.yml' \) -print 2>/dev/null || true) @@ -38,7 +38,7 @@ else note "none"; fi # --- [2] MPL-1.0 license headers are banned (must be MPL-2.0) --------------- # Match the actual SPDX identifier, not mere prose mentions of the ban (the # policy docs legitimately discuss MPL-1.0). -echo "[2/3] MPL-1.0 SPDX headers" +echo "[2/4] MPL-1.0 SPDX headers" mpl1=$(grep -rIl --exclude-dir=.git --exclude-dir=_build --exclude-dir=node_modules \ -E 'SPDX-License-Identifier:[[:space:]]*MPL-1\.0' . 2>/dev/null || true) if [ -n "$mpl1" ]; then @@ -48,7 +48,7 @@ else note "none"; fi # --- [3] DOC-FORMAT (delta): newly-added docs/ files must be .adoc ---------- # Community-health files keep their canonical .md names. -echo "[3/3] DOC-FORMAT (newly-added docs/ files must be .adoc)" +echo "[3/4] DOC-FORMAT (newly-added docs/ files must be .adoc)" base="${1:-${GOVERNANCE_BASE_REF:-${GITHUB_BASE_REF:-}}}" if [ -n "$base" ] && git rev-parse --verify --quiet "origin/$base" >/dev/null 2>&1; then added=$(git diff --name-only --diff-filter=A "origin/$base...HEAD" -- 'docs/' 2>/dev/null \ @@ -62,6 +62,16 @@ else note "no base ref available — delta check skipped" fi +# --- [4] actions.lock matches every workflow's `uses:` --------------------- +# A workflow whose actions drift from the lockfile never starts (GitHub reports +# a startup_failure with zero jobs). Dependabot bumps do exactly that unless the +# lock is regenerated: CI was silently not running from 2026-10-11 (#782). +echo "[4/4] actions.lock consistency" +if ! lock_out=$(./tools/ci/check-actions-lock.sh 2>&1); then + printf '%s\n' "$lock_out" | grep '::error::' | sed 's/^::error:: *//' | while IFS= read -r l; do err "$l"; done + err "actions.lock is out of step with the workflows (run gh actions-lock)" +else note "$lock_out"; fi + echo if [ "$fail" -ne 0 ]; then echo "Governance gate: FAIL"; exit 1; fi echo "Governance gate: PASS" From fe174afa5eb27002f019a2957acd0931f1fecbc6 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:02:31 +0000 Subject: [PATCH 02/17] style(ci): [[ ]] tests and named locals in check-actions-lock.sh (SonarCloud S7688/S7679) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index f89406d5..46b638db 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -27,11 +27,12 @@ lock="$dir/actions.lock" fail=0 err() { printf '::error::%s\n' "$*"; fail=1; } -[ -f "$lock" ] || { err "actions lockfile missing: $lock"; exit 1; } +[[ -f "$lock" ]] || { err "actions lockfile missing: $lock"; exit 1; } # The actions a workflow file uses, normalised and sorted. used() { - grep -E '^[[:space:]]*(-[[:space:]]*)?uses:' "$1" \ + local file="$1" + grep -E '^[[:space:]]*(-[[:space:]]*)?uses:' "$file" \ | sed -E 's/^[[:space:]]*(-[[:space:]]*)?uses:[[:space:]]*//; s/[[:space:]]+#.*$//; s/^["'\'']//; s/["'\'']$//; s/[[:space:]]+$//' \ | grep -vE '^(\./|docker://)' \ | grep -v '/\.github/workflows/' \ @@ -41,7 +42,8 @@ used() { # The actions the lock lists for workflow path $1, sorted. locked() { - awk -v wf="'$1':" ' + local path="$1" + awk -v wf="'$path':" ' /^workflows:/ { inwf = 1; next } /^dependencies:/ { inwf = 0 } inwf && $1 == wf { on = 1; next } @@ -55,25 +57,25 @@ deps=$(awk '/^dependencies:/ { d = 1; next } d && /^ '\''/ { k = $1; gsub(/[' checked=0 for wf in "$dir"/*.yml "$dir"/*.yaml; do - [ -f "$wf" ] || continue + [[ -f "$wf" ]] || continue rel=".github/workflows/$(basename "$wf")" checked=$((checked + 1)) u=$(used "$wf") l=$(locked "$rel") if ! grep -qF "'$rel':" "$lock"; then - [ -z "$u" ] || err "$rel uses actions but has no actions.lock entry: $(echo $u)" + [[ -z "$u" ]] || err "$rel uses actions but has no actions.lock entry: $(echo $u)" continue fi missing=$(comm -23 <(printf '%s\n' "$u" | sed '/^$/d') <(printf '%s\n' "$l" | sed '/^$/d')) stale=$(comm -13 <(printf '%s\n' "$u" | sed '/^$/d') <(printf '%s\n' "$l" | sed '/^$/d')) - [ -z "$missing" ] || err "$rel uses actions the lock does not list (regenerate actions.lock): $(echo $missing)" - [ -z "$stale" ] || err "$rel: actions.lock lists actions the workflow no longer uses: $(echo $stale)" + [[ -z "$missing" ]] || err "$rel uses actions the lock does not list (regenerate actions.lock): $(echo $missing)" + [[ -z "$stale" ]] || err "$rel: actions.lock lists actions the workflow no longer uses: $(echo $stale)" for a in $l; do printf '%s\n' "$deps" | grep -qxF "$a" || err "actions.lock has no dependencies entry for $a ($rel)" done done -if [ "$fail" -ne 0 ]; then +if [[ "$fail" -ne 0 ]]; then echo "actions.lock check FAILED: a mismatched workflow does not start (startup_failure, zero jobs)." exit 1 fi From 7fa37361ba95e97b8f79e328c6d18ff9c3f3e96e Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:10:27 +0000 Subject: [PATCH 03/17] fix(ci): actions.lock guard sees flow-style steps and transitive dependencies CodeRabbit on #803: a step written `- {uses: x}` was not read, and a dependency record's own `uses:` (upload-pages-artifact -> upload-artifact@sha) was not checked for a record of its own, so either drift passed silently. Both now fail; checked with planted cases. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 46b638db..3fde76b3 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -32,8 +32,10 @@ err() { printf '::error::%s\n' "$*"; fail=1; } # The actions a workflow file uses, normalised and sorted. used() { local file="$1" - grep -E '^[[:space:]]*(-[[:space:]]*)?uses:' "$file" \ - | sed -E 's/^[[:space:]]*(-[[:space:]]*)?uses:[[:space:]]*//; s/[[:space:]]+#.*$//; s/^["'\'']//; s/["'\'']$//; s/[[:space:]]+$//' \ + # Block style (`- uses: x`, `uses: x`) and flow style (`- {uses: x, with: …}`). + sed -E 's/[[:space:]]+#.*$//' "$file" \ + | grep -oE '(^|[{,[:space:]-])uses:[[:space:]]*[^[:space:],}]+' \ + | sed -E 's/^.*uses:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ | grep -vE '^(\./|docker://)' \ | grep -v '/\.github/workflows/' \ | sed -E 's#^([^/@]+/[^/@]+)/[^@]*@#\1@#' \ @@ -75,6 +77,14 @@ for wf in "$dir"/*.yml "$dir"/*.yaml; do done done +# Transitive references: an action the lock records may itself use other +# actions (`uses:` under its dependency record, e.g. upload-pages-artifact -> +# upload-artifact@). Each of those must have its own record too. +while IFS= read -r t; do + [[ -n "$t" ]] || continue + printf '%s\n' "$deps" | grep -qxF "$t" || err "actions.lock: a dependency uses $t, which has no dependencies entry" +done < <(awk '/^dependencies:/ { d = 1; next } d && /^ uses:/ { u = 1; next } d && u && /^ - / { v = $2; gsub(/'\''/, "", v); print v; next } { u = 0 }' "$lock" | sort -u) + if [[ "$fail" -ne 0 ]]; then echo "actions.lock check FAILED: a mismatched workflow does not start (startup_failure, zero jobs)." exit 1 From 71ac72e1d8c97faf3a73e9bbfd43cb4f968bc45f Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:12:15 +0000 Subject: [PATCH 04/17] fix(ci): actions.lock guard reads quoted uses keys, ignores run-script text CodeRabbit follow-up on #803: a quoted key ("uses": x) was not read; counting only action-shaped values (owner/repo[/path]@ref) keeps uses: text inside a run: script from being taken for a step. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 3fde76b3..30c061e4 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -32,11 +32,14 @@ err() { printf '::error::%s\n' "$*"; fail=1; } # The actions a workflow file uses, normalised and sorted. used() { local file="$1" - # Block style (`- uses: x`, `uses: x`) and flow style (`- {uses: x, with: …}`). + # Block style (`- uses: x`), flow style (`- {uses: x, with: …}`) and quoted keys (`"uses": x`). + # Only action-shaped values count (`owner/repo[/path]@ref`), so `uses:` text in + # a `run:` script (a grep pattern, say) is not mistaken for a step. sed -E 's/[[:space:]]+#.*$//' "$file" \ - | grep -oE '(^|[{,[:space:]-])uses:[[:space:]]*[^[:space:],}]+' \ - | sed -E 's/^.*uses:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ + | grep -oE '(^|[{,[:space:]-])["'\'']?uses["'\'']?:[[:space:]]*[^[:space:],}]+' \ + | sed -E 's/^.*uses["'\'']?:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ | grep -vE '^(\./|docker://)' \ + | grep -E '^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_.-]+$' \ | grep -v '/\.github/workflows/' \ | sed -E 's#^([^/@]+/[^/@]+)/[^@]*@#\1@#' \ | sort -u From 97f86230841b9a85f728cb106dc3e5a8b26f8043 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:12:16 +0000 Subject: [PATCH 05/17] style(ci): quote the joined lists in check-actions-lock.sh messages (ShellCheck SC2086) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 30c061e4..17c67773 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -68,13 +68,13 @@ for wf in "$dir"/*.yml "$dir"/*.yaml; do u=$(used "$wf") l=$(locked "$rel") if ! grep -qF "'$rel':" "$lock"; then - [[ -z "$u" ]] || err "$rel uses actions but has no actions.lock entry: $(echo $u)" + [[ -z "$u" ]] || err "$rel uses actions but has no actions.lock entry: ${u//$'\n'/ }" continue fi missing=$(comm -23 <(printf '%s\n' "$u" | sed '/^$/d') <(printf '%s\n' "$l" | sed '/^$/d')) stale=$(comm -13 <(printf '%s\n' "$u" | sed '/^$/d') <(printf '%s\n' "$l" | sed '/^$/d')) - [[ -z "$missing" ]] || err "$rel uses actions the lock does not list (regenerate actions.lock): $(echo $missing)" - [[ -z "$stale" ]] || err "$rel: actions.lock lists actions the workflow no longer uses: $(echo $stale)" + [[ -z "$missing" ]] || err "$rel uses actions the lock does not list (regenerate actions.lock): ${missing//$'\n'/ }" + [[ -z "$stale" ]] || err "$rel: actions.lock lists actions the workflow no longer uses: ${stale//$'\n'/ }" for a in $l; do printf '%s\n' "$deps" | grep -qxF "$a" || err "actions.lock has no dependencies entry for $a ($rel)" done From b18fb9ea11b16cd8744a316933112487d4984211 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:14:20 +0000 Subject: [PATCH 06/17] fix(ci): actions.lock guard allows space before the uses colon CodeRabbit on #803: `- {"uses" : x}` is valid YAML and slipped past the guard. Whitespace between the key and its colon is now accepted. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 17c67773..dc38c8d5 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -36,8 +36,8 @@ used() { # Only action-shaped values count (`owner/repo[/path]@ref`), so `uses:` text in # a `run:` script (a grep pattern, say) is not mistaken for a step. sed -E 's/[[:space:]]+#.*$//' "$file" \ - | grep -oE '(^|[{,[:space:]-])["'\'']?uses["'\'']?:[[:space:]]*[^[:space:],}]+' \ - | sed -E 's/^.*uses["'\'']?:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ + | grep -oE '(^|[{,[:space:]-])["'\'']?uses["'\'']?[[:space:]]*:[[:space:]]*[^[:space:],}]+' \ + | sed -E 's/^.*uses["'\'']?[[:space:]]*:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ | grep -vE '^(\./|docker://)' \ | grep -E '^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_.-]+$' \ | grep -v '/\.github/workflows/' \ From 57f6e2337671fe1054e49112bbee9beee16ac5cb Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:20:43 +0000 Subject: [PATCH 07/17] fix(ci): actions.lock guard keeps refs whose branch contains / CodeRabbit on #803: `uses: acme/build-action@release/v1` was dropped by the action-shape filter, so its missing lock entry passed silently. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index dc38c8d5..3fc084f8 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -33,13 +33,13 @@ err() { printf '::error::%s\n' "$*"; fail=1; } used() { local file="$1" # Block style (`- uses: x`), flow style (`- {uses: x, with: …}`) and quoted keys (`"uses": x`). - # Only action-shaped values count (`owner/repo[/path]@ref`), so `uses:` text in + # Only action-shaped values count (`owner/repo[/path]@ref`, a ref may hold `/`), so `uses:` text in # a `run:` script (a grep pattern, say) is not mistaken for a step. sed -E 's/[[:space:]]+#.*$//' "$file" \ | grep -oE '(^|[{,[:space:]-])["'\'']?uses["'\'']?[[:space:]]*:[[:space:]]*[^[:space:],}]+' \ | sed -E 's/^.*uses["'\'']?[[:space:]]*:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ | grep -vE '^(\./|docker://)' \ - | grep -E '^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_.-]+$' \ + | grep -E '^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_./-]+$' \ | grep -v '/\.github/workflows/' \ | sed -E 's#^([^/@]+/[^/@]+)/[^@]*@#\1@#' \ | sort -u From 1d2b4802566288066d0c490b47aefed2c2630d43 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:36:52 +0000 Subject: [PATCH 08/17] fix(ci): actions.lock guard fails closed on unreadable uses values CodeRabbit on #803: a folded `uses: >-` was read as `>-` and dropped, and any ref under .github/workflows/ was skipped as a reusable workflow. A uses: key at line start whose value is not a recognised form is now an error, and only refs to a .yml/.yaml file are treated as reusable workflows. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 3fc084f8..4b7bcd6a 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -40,11 +40,32 @@ used() { | sed -E 's/^.*uses["'\'']?[[:space:]]*:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ | grep -vE '^(\./|docker://)' \ | grep -E '^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_./-]+$' \ - | grep -v '/\.github/workflows/' \ + | grep -vE '/\.github/workflows/[^/@]+\.ya?ml@' \ | sed -E 's#^([^/@]+/[^/@]+)/[^@]*@#\1@#' \ | sort -u } +# Fail closed: a `uses:` key at the start of a line (block `uses:` / `- uses:`, +# or a flow mapping opened on the line, `- {uses: …}`) whose value the matcher +# above cannot read is an error, not a silent skip. That covers folded or +# literal scalars (`uses: >-` with the ref on the next line), an empty value, +# and anything else that is not a local action (`./…`), a Docker image +# (`docker://…`), a reusable workflow (`owner/repo/.github/workflows/x.yml@ref`) +# or an action (`owner/repo[/path]@ref`). Write such a step as a plain scalar. +unreadable() { + local file="$1" + sed -E 's/[[:space:]]+#.*$//' "$file" \ + | grep -nE '^[[:space:]]*(-[[:space:]]+)?\{?[[:space:]]*["'\'']?uses["'\'']?[[:space:]]*:' \ + | while IFS= read -r line; do + local n="${line%%:*}" v + v=$(printf '%s\n' "${line#*:}" \ + | sed -E 's/^[[:space:]]*(-[[:space:]]+)?\{?[[:space:]]*["'\'']?uses["'\'']?[[:space:]]*:[[:space:]]*//; s/[[:space:]]*[,}].*$//; s/^["'\'']//; s/["'\'']$//') + if ! printf '%s\n' "$v" | grep -qE '^(\./|docker://|[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_./-]+$)'; then + printf '%s: %s\n' "$n" "${v:-}" + fi + done +} + # The actions the lock lists for workflow path $1, sorted. locked() { local path="$1" @@ -65,6 +86,8 @@ for wf in "$dir"/*.yml "$dir"/*.yaml; do [[ -f "$wf" ]] || continue rel=".github/workflows/$(basename "$wf")" checked=$((checked + 1)) + bad=$(unreadable "$wf") + [[ -z "$bad" ]] || err "$rel has uses: values this guard cannot read (write them as plain scalars): ${bad//$'\n'/; }" u=$(used "$wf") l=$(locked "$rel") if ! grep -qF "'$rel':" "$lock"; then From 7fc0186be2f44dd892671a35d042a5a3e66905fa Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:39:31 +0000 Subject: [PATCH 09/17] fix(ci): tell reusable-workflow calls from steps by context, not path A step action may live in a directory named .github/workflows/x.yml; the guard skipped it. Reusable workflows are only called at job level, so the reusable exclusion now applies only outside steps: blocks (flow-style steps: [...] on the key line included). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 45 ++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 4b7bcd6a..ca3b4194 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -15,7 +15,8 @@ # For each workflow, this check compares the set of external actions its # `uses:` lines reference (sub-path actions such as # `github/codeql-action/init@v4` count as `github/codeql-action@v4`; local -# `./` actions, `docker://` images and reusable workflows are not locked) +# `./` actions, `docker://` images and reusable workflows (a job-level +# `uses:` naming a `.github/workflows/*.yml` file) are not locked) # with the set the lock lists for it, and fails on any difference, either # way round. It also fails if a locked action has no `dependencies:` entry. # @@ -29,18 +30,42 @@ err() { printf '::error::%s\n' "$*"; fail=1; } [[ -f "$lock" ]] || { err "actions lockfile missing: $lock"; exit 1; } -# The actions a workflow file uses, normalised and sorted. -used() { - local file="$1" - # Block style (`- uses: x`), flow style (`- {uses: x, with: …}`) and quoted keys (`"uses": x`). - # Only action-shaped values count (`owner/repo[/path]@ref`, a ref may hold `/`), so `uses:` text in - # a `run:` script (a grep pattern, say) is not mistaken for a step. - sed -E 's/[[:space:]]+#.*$//' "$file" \ +# Split a workflow (comments stripped) by context: lines inside a `steps:` +# block (more indented than its `steps:` key) are tagged S, all others J. +# A reusable workflow is called by a job (`jobs..uses`), never by a step, +# so the reusable-workflow exclusion below applies to J lines only: a step +# action whose directory happens to be named `.github/workflows/x.yml` is +# still checked. +tag() { + sed -E 's/[[:space:]]+#.*$//' "$1" | awk ' + { match($0, /^ */); ind = RLENGTH } + /^[[:space:]]*$/ { next } + in_steps && ind <= sind { in_steps = 0 } + /^[[:space:]]*["'\'']?steps["'\'']?[[:space:]]*:/ { + # `steps: [{uses: …}]` (flow sequence on the key line) is step context too. + print (match($0, /:[[:space:]]*[^[:space:]]/) ? "S" : "J") "\t" $0 + in_steps = 1; sind = ind; next + } + { print (in_steps ? "S" : "J") "\t" $0 } + ' +} + +# The `uses:` values on lines tagged $2 (S or J), action-shaped only. +# Block style (`- uses: x`), flow style (`- {uses: x, with: …}`) and quoted keys (`"uses": x`). +# Only action-shaped values count (`owner/repo[/path]@ref`, a ref may hold `/`), so `uses:` text in +# a `run:` script (a grep pattern, say) is not mistaken for a step. +refs() { + tag "$1" | grep -E "^$2"$'\t' | cut -f2- \ | grep -oE '(^|[{,[:space:]-])["'\'']?uses["'\'']?[[:space:]]*:[[:space:]]*[^[:space:],}]+' \ | sed -E 's/^.*uses["'\'']?[[:space:]]*:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ | grep -vE '^(\./|docker://)' \ - | grep -E '^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_./-]+$' \ - | grep -vE '/\.github/workflows/[^/@]+\.ya?ml@' \ + | grep -E '^[A-Za-z0-9_.-]+/[A-Za-z0-9_./-]+@[A-Za-z0-9_./-]+$' +} + +# The actions a workflow file uses, normalised and sorted. +used() { + local file="$1" + { refs "$file" S; refs "$file" J | grep -vE '/\.github/workflows/[^/@]+\.ya?ml@'; } \ | sed -E 's#^([^/@]+/[^/@]+)/[^@]*@#\1@#' \ | sort -u } From e3eb086c22660650b135c0ec6bb2cd9e78d597df Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:40:22 +0000 Subject: [PATCH 10/17] style(ci): name positional parameters in tag()/refs() (Sonar S7679) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index ca3b4194..5def7e9b 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -37,7 +37,8 @@ err() { printf '::error::%s\n' "$*"; fail=1; } # action whose directory happens to be named `.github/workflows/x.yml` is # still checked. tag() { - sed -E 's/[[:space:]]+#.*$//' "$1" | awk ' + local file="$1" + sed -E 's/[[:space:]]+#.*$//' "$file" | awk ' { match($0, /^ */); ind = RLENGTH } /^[[:space:]]*$/ { next } in_steps && ind <= sind { in_steps = 0 } @@ -55,7 +56,8 @@ tag() { # Only action-shaped values count (`owner/repo[/path]@ref`, a ref may hold `/`), so `uses:` text in # a `run:` script (a grep pattern, say) is not mistaken for a step. refs() { - tag "$1" | grep -E "^$2"$'\t' | cut -f2- \ + local file="$1" ctx="$2" + tag "$file" | grep -E "^$ctx"$'\t' | cut -f2- \ | grep -oE '(^|[{,[:space:]-])["'\'']?uses["'\'']?[[:space:]]*:[[:space:]]*[^[:space:],}]+' \ | sed -E 's/^.*uses["'\'']?[[:space:]]*:[[:space:]]*//; s/^["'\'']//; s/["'\'']$//' \ | grep -vE '^(\./|docker://)' \ From 5ede7ece12b6802857e78727c77133601ec03ffa Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:42:52 +0000 Subject: [PATCH 11/17] fix(ci): keep indentless step sequences in step context; add guard self-test YAML allows steps:/- uses: at the same indent; the guard ended step context there and treated the step as a job-level reusable call. Only a non-'-' line at or above the steps: key now ends it. tools/ci/test-check-actions-lock.sh pins every case raised in review (indentless and flow steps, .yml-named action dirs, quoted/spaced keys, slash refs, folded scalars, real reusable calls, local/docker refs) and runs in governance check 4. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 4 +- tools/ci/governance-standalone.sh | 4 ++ tools/ci/test-check-actions-lock.sh | 88 +++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100755 tools/ci/test-check-actions-lock.sh diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 5def7e9b..960f0e05 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -41,7 +41,9 @@ tag() { sed -E 's/[[:space:]]+#.*$//' "$file" | awk ' { match($0, /^ */); ind = RLENGTH } /^[[:space:]]*$/ { next } - in_steps && ind <= sind { in_steps = 0 } + # An indentless sequence (`steps:` then `- uses: …` at the same indent) is + # still step context: only a non-`-` line at or above the key ends it. + in_steps && (ind < sind || (ind == sind && $0 !~ /^ *-/)) { in_steps = 0 } /^[[:space:]]*["'\'']?steps["'\'']?[[:space:]]*:/ { # `steps: [{uses: …}]` (flow sequence on the key line) is step context too. print (match($0, /:[[:space:]]*[^[:space:]]/) ? "S" : "J") "\t" $0 diff --git a/tools/ci/governance-standalone.sh b/tools/ci/governance-standalone.sh index ca71f05e..0d4f3816 100755 --- a/tools/ci/governance-standalone.sh +++ b/tools/ci/governance-standalone.sh @@ -71,6 +71,10 @@ if ! lock_out=$(./tools/ci/check-actions-lock.sh 2>&1); then printf '%s\n' "$lock_out" | grep '::error::' | sed 's/^::error:: *//' | while IFS= read -r l; do err "$l"; done err "actions.lock is out of step with the workflows (run gh actions-lock)" else note "$lock_out"; fi +if ! test_out=$(./tools/ci/test-check-actions-lock.sh 2>&1); then + printf '%s\n' "$test_out" | grep '^FAIL' | while IFS= read -r l; do err "check-actions-lock self-test: $l"; done + err "the actions.lock guard failed its own regression tests (tools/ci/test-check-actions-lock.sh)" +else note "$(printf '%s\n' "$test_out" | tail -1)"; fi echo if [ "$fail" -ne 0 ]; then echo "Governance gate: FAIL"; exit 1; fi diff --git a/tools/ci/test-check-actions-lock.sh b/tools/ci/test-check-actions-lock.sh new file mode 100755 index 00000000..52b8bdb8 --- /dev/null +++ b/tools/ci/test-check-actions-lock.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# +# Regression tests for tools/ci/check-actions-lock.sh. Each case appends a +# job to a copy of the real workflows and asserts whether the guard passes. +# A reference in step context is always checked; only a job-level call of a +# workflow file (`jobs..uses: …/.github/workflows/x.yml@ref`) is skipped. +# +# Usage: tools/ci/test-check-actions-lock.sh (from the repo root) +set -uo pipefail + +guard=tools/ci/check-actions-lock.sh +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT +fails=0 + +# expect +expect() { + local want="$1" name="$2" yaml="$3" got + rm -rf "$work/wf" && mkdir "$work/wf" + cp .github/workflows/*.yml .github/workflows/actions.lock "$work/wf/" + printf '%s\n' "$yaml" >> "$work/wf/ci.yml" + if "$guard" "$work/wf" >/dev/null 2>&1; then got=pass; else got=fail; fi + if [[ "$got" == "$want" ]]; then + echo "ok $name" + else + echo "FAIL $name (expected $want, got $got)" + fails=$((fails + 1)) + fi +} + +expect pass "real workflows" "" +expect fail "unlocked step action" ' t: + runs-on: x + steps: + - uses: acme/build-action@v1' +expect fail "step action under a .github/workflows/*.yml directory" ' t: + runs-on: x + steps: + - name: odd + uses: acme/repo/.github/workflows/my-action.yml@v1' +expect fail "indentless step sequence" ' t: + runs-on: x + steps: + - name: odd + uses: acme/repo/.github/workflows/my-action.yml@v1' +expect fail "flow sequence on the steps: line" ' t: + runs-on: x + steps: [{uses: acme/repo/.github/workflows/f.yml@v2}]' +expect fail "flow mapping step" ' t: + runs-on: x + steps: + - {uses: acme/build-action@v1, with: {a: b}}' +expect fail "quoted key, spaced colon" ' t: + runs-on: x + steps: + - "uses" : acme/build-action@v1' +expect fail "ref containing a slash" ' t: + runs-on: x + steps: + - uses: acme/build-action@release/v1' +expect fail "folded scalar fails closed" ' t: + runs-on: x + steps: + - uses: >- + acme/build-action@v1' +expect fail "job-level non-workflow path is still an action" ' t: + uses: acme/repo/.github/workflows/my-action@v1' +expect pass "job-level reusable workflow call" ' t: + uses: acme/repo/.github/workflows/x.yml@0123456789abcdef0123456789abcdef01234567' +expect pass "reusable call after an indentless steps block" ' a: + runs-on: x + steps: + - run: echo + timeout-minutes: 5 + b: + uses: acme/repo/.github/workflows/x.yaml@v1' +expect pass "local action and docker image" ' t: + runs-on: x + steps: + - uses: ./tools/local-action + - uses: docker://alpine:3' + +if [[ "$fails" -ne 0 ]]; then + echo "check-actions-lock self-test: $fails case(s) FAILED" + exit 1 +fi +echo "check-actions-lock self-test: OK" From 15fe52234bc73c2b9592f7cd3f63c5e009bb8455 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:18:40 +0000 Subject: [PATCH 12/17] fix(ci): hold OCaml at 4.14 on Ubuntu 26.04 runners Ubuntu 26.04 runners ship OCaml 5.4. The old setup took any ocaml-system, so opam could not solve --with-test (bisect_ppx >= 2.8 needs OCaml < 5.0) and build, lint, bench-visibility and coverage-visibility all failed. tools/ci/setup-ocaml.sh, shared by the four jobs, uses ocaml-system only when it is 4.14.x, otherwise creates a pinned ocaml-base-compiler.4.14.2 switch, and fails closed if the switch is not 4.14. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- .github/workflows/ci.yml | 57 ++++++++++++++-------------------------- tools/ci/setup-ocaml.sh | 42 +++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 38 deletions(-) create mode 100755 tools/ci/setup-ocaml.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de35b1ae..24c020b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,15 +5,18 @@ # # Standalone CI: no dependency on third-party actions or external-repo # reusable workflows. The OCaml toolchain is self-hosted via apt + opam -# (replacing ocaml/setup-ocaml), and only first-party `actions/*` are used -# (checkout / setup-node / upload-artifact), SHA-pinned. dune-project requires -# OCaml >= 4.14, satisfied by the runner's apt OCaml (ocaml-system), with a -# base-compiler fallback. +# (replacing ocaml/setup-ocaml) in tools/ci/setup-ocaml.sh, and only +# first-party `actions/*` are used (checkout / setup-node / upload-artifact). +# OCaml is held at 4.14: dune-project needs >= 4.14 and the with-test +# dependency bisect_ppx needs < 5.0, so the runner's apt OCaml is used only +# when it is 4.14.x (Ubuntu 26.04 ships 5.4) and a pinned +# ocaml-base-compiler.4.14.2 is built otherwise. # -# NOTE on pins: first-party `actions/*` are SHA-pinned (repo SHA-pinning -# policy + Hypatia workflow_audit + the "allowed actions" policy that rejects -# tag refs at run-creation). `actions/checkout` is v7.0.0 (`9c091bb…`, bumped -# by Dependabot in #605); `setup-node` / `upload-artifact` remain v4. +# NOTE on pins: `.github/workflows/actions.lock` is the pin authority. Steps +# name actions by tag and the lock maps each to a commit SHA; a workflow +# whose refs do not match the lock never starts (startup_failure, zero +# jobs). Regenerate the lock after any `uses:` change; governance check 4 +# (tools/ci/check-actions-lock.sh) fails on drift. name: CI on: push: @@ -44,15 +47,8 @@ jobs: # clone makes property 4 fail closed ("stamp not present"). fetch-depth: 0 - name: Set up OCaml toolchain (self-hosted; replaces ocaml/setup-ocaml) - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends opam ocaml - opam init --bare --disable-sandboxing --yes - # Prefer the runner's system OCaml (>= 4.14 satisfies dune-project) - # for an instant switch; fall back to a pinned base compiler. - opam switch create . ocaml-system --no-install --yes \ - || opam switch create . ocaml-base-compiler.4.14.2 --no-install --yes - opam exec -- ocaml -version + # OCaml 4.14 (bisect_ppx needs < 5.0): runner OCaml when 4.14.x, else pinned 4.14.2. + run: ./tools/ci/setup-ocaml.sh - name: Set up Node.js uses: actions/setup-node@v7.1.0 with: @@ -187,13 +183,8 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - name: Set up OCaml toolchain (self-hosted; replaces ocaml/setup-ocaml) - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends opam ocaml - opam init --bare --disable-sandboxing --yes - opam switch create . ocaml-system --no-install --yes \ - || opam switch create . ocaml-base-compiler.4.14.2 --no-install --yes - opam exec -- ocaml -version + # OCaml 4.14 (bisect_ppx needs < 5.0): runner OCaml when 4.14.x, else pinned 4.14.2. + run: ./tools/ci/setup-ocaml.sh - name: Install dependencies # Match the build job: `dune build` compiles everything including # test/ (which depends on alcotest, with-test) and the @doc target @@ -216,13 +207,8 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - name: Set up OCaml toolchain (self-hosted; replaces ocaml/setup-ocaml) - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends opam ocaml - opam init --bare --disable-sandboxing --yes - opam switch create . ocaml-system --no-install --yes \ - || opam switch create . ocaml-base-compiler.4.14.2 --no-install --yes - opam exec -- ocaml -version + # OCaml 4.14 (bisect_ppx needs < 5.0): runner OCaml when 4.14.x, else pinned 4.14.2. + run: ./tools/ci/setup-ocaml.sh - name: Install dependencies run: opam install . --deps-only --with-test --with-doc --yes - name: Build bench targets @@ -266,13 +252,8 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - name: Set up OCaml toolchain (self-hosted; replaces ocaml/setup-ocaml) - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends opam ocaml - opam init --bare --disable-sandboxing --yes - opam switch create . ocaml-system --no-install --yes \ - || opam switch create . ocaml-base-compiler.4.14.2 --no-install --yes - opam exec -- ocaml -version + # OCaml 4.14 (bisect_ppx needs < 5.0): runner OCaml when 4.14.x, else pinned 4.14.2. + run: ./tools/ci/setup-ocaml.sh - name: Install dependencies run: opam install . --deps-only --with-test --with-doc --yes - name: Set up Node.js diff --git a/tools/ci/setup-ocaml.sh b/tools/ci/setup-ocaml.sh new file mode 100755 index 00000000..8ebceb45 --- /dev/null +++ b/tools/ci/setup-ocaml.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# +# Self-hosted OCaml toolchain for CI (replaces ocaml/setup-ocaml). +# +# Creates a local opam switch in the current directory on OCaml 4.14: +# - the runner's apt OCaml (`ocaml-system`) when it is 4.14.x, which is +# instant; +# - otherwise a pinned `ocaml-base-compiler.4.14.2`, built from source. +# +# Why not "any OCaml >= 4.14": the with-test dependency bisect_ppx (>= 2.8) +# requires OCaml < 5.0. Ubuntu 26.04 runners ship OCaml 5.4, on which +# `opam install --deps-only --with-test` cannot be solved, so every OCaml job +# failed there before this fallback. +# +# Usage: tools/ci/setup-ocaml.sh (from the repo root, on a Debian/Ubuntu runner) +set -euo pipefail + +PINNED=ocaml-base-compiler.4.14.2 + +sudo apt-get update +sudo apt-get install -y --no-install-recommends opam ocaml +opam init --bare --disable-sandboxing --yes + +system_version=$(ocamlc -version 2>/dev/null || true) +case "$system_version" in + 4.14.*) + echo "Using the runner's OCaml $system_version (ocaml-system)" + opam switch create . ocaml-system --no-install --yes + ;; + *) + echo "Runner OCaml is '${system_version:-absent}', not 4.14.x: building $PINNED" + opam switch create . "$PINNED" --no-install --yes + ;; +esac + +# Fail closed if the switch did not land on 4.14. +switch_version=$(opam exec -- ocamlc -version) +case "$switch_version" in + 4.14.*) echo "OCaml switch ready: $switch_version" ;; + *) echo "::error::OCaml switch is $switch_version, expected 4.14.x"; exit 1 ;; +esac From ebdf44c924a88b708f737cc6b78f13c8e0bd7709 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:18:49 +0000 Subject: [PATCH 13/17] docs(changelog): record the OCaml 4.14 CI toolchain fix Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- CHANGELOG.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index ce60555c..386ab46a 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -163,6 +163,11 @@ because Dependabot #782 bumped actions in ci.yml without regenerating `.github/workflows/actions.lock`. The lock now matches every workflow (ci.yml, panic-attack.yml, casket-pages.yml, publish-jsr.yml), and governance check 4 (`tools/ci/check-actions-lock.sh`) fails on any drift +* fix(ci): the OCaml jobs (build, lint, bench, coverage) failed on Ubuntu +26.04 runners, which ship OCaml 5.4, because the with-test dependency +`bisect_ppx` needs OCaml < 5.0. `tools/ci/setup-ocaml.sh` uses the runner +OCaml only when it is 4.14.x and otherwise builds a pinned +`ocaml-base-compiler.4.14.2` * ci(migration-assistant): fix smoke-parse for tree-sitter-cli 0.25 (#342) * ci: bump github/codeql-action from 4.32.6 to 4.36.0 (#323) From 8c9a09fcb2381cce46d9bf8be7a6269c967d5424 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:31:50 +0000 Subject: [PATCH 14/17] fix(tea): import node and create in the Todo example the e2e test drives affinescript-tea/e2e/todo.test.js calls node, key, text and create from the compiled todo.bun.js. Since #797 the flattener exports only the Tea names a module imports under their plain names; the rest become __priv_3Tea__, so the keyed-diffing test failed with 'm.node is not a function'. Both #778 and #797 landed while CI was not starting, so this was first seen here. Importing the two names makes the test's contract explicit and is independent of how the flattener names unimported items (#802). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- affinescript-tea/examples/todo/Todo.affine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/affinescript-tea/examples/todo/Todo.affine b/affinescript-tea/examples/todo/Todo.affine index 9afaa3cc..49d68c76 100644 --- a/affinescript-tea/examples/todo/Todo.affine +++ b/affinescript-tea/examples/todo/Todo.affine @@ -10,7 +10,7 @@ module Todo; use prelude::*; -use Tea::{Html, Attr, Cmd, Sub, Event, run, text, div, span, button, input, ul, li, h1, p, +use Tea::{Html, Attr, Cmd, Sub, Event, run, text, node, create, div, span, button, input, ul, li, h1, p, class, id, value, key, attr, lazy, on_click, on_input, on_enter, on_check, none, send, every, no_sub, tea_map, tea_filter, run_cmd, tea_defer}; From cf511fb63f4ad8d706de370151e62943b61f61b2 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:39:51 +0000 Subject: [PATCH 15/17] fix(tea): also import patch for the Todo e2e keyed-diffing test The keyed-diffing test calls m.patch as well as node/key/text/create; with all five imported, affinescript-tea/e2e passes locally (10/10 in headless Chromium). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- affinescript-tea/examples/todo/Todo.affine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/affinescript-tea/examples/todo/Todo.affine b/affinescript-tea/examples/todo/Todo.affine index 49d68c76..45c25f62 100644 --- a/affinescript-tea/examples/todo/Todo.affine +++ b/affinescript-tea/examples/todo/Todo.affine @@ -10,7 +10,7 @@ module Todo; use prelude::*; -use Tea::{Html, Attr, Cmd, Sub, Event, run, text, node, create, div, span, button, input, ul, li, h1, p, +use Tea::{Html, Attr, Cmd, Sub, Event, run, text, node, create, patch, div, span, button, input, ul, li, h1, p, class, id, value, key, attr, lazy, on_click, on_input, on_enter, on_check, none, send, every, no_sub, tea_map, tea_filter, run_cmd, tea_defer}; From d98edf64f8a8ed134e51fcc9d7a264cf664665a0 Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:41:17 +0000 Subject: [PATCH 16/17] fix(ci): trim trailing whitespace in uses: values before checking YAML excludes trailing whitespace from a plain scalar, but the guard kept it, so a locked 'uses: x@v1 ' failed as unreadable. Trailing whitespace is now stripped with comments; self-test gains a passing trailing-space case (plain and quoted) and keeps an empty value failing closed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- tools/ci/check-actions-lock.sh | 4 ++-- tools/ci/test-check-actions-lock.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/ci/check-actions-lock.sh b/tools/ci/check-actions-lock.sh index 960f0e05..3119d706 100755 --- a/tools/ci/check-actions-lock.sh +++ b/tools/ci/check-actions-lock.sh @@ -38,7 +38,7 @@ err() { printf '::error::%s\n' "$*"; fail=1; } # still checked. tag() { local file="$1" - sed -E 's/[[:space:]]+#.*$//' "$file" | awk ' + sed -E 's/[[:space:]]+#.*$//; s/[[:space:]]+$//' "$file" | awk ' { match($0, /^ */); ind = RLENGTH } /^[[:space:]]*$/ { next } # An indentless sequence (`steps:` then `- uses: …` at the same indent) is @@ -83,7 +83,7 @@ used() { # or an action (`owner/repo[/path]@ref`). Write such a step as a plain scalar. unreadable() { local file="$1" - sed -E 's/[[:space:]]+#.*$//' "$file" \ + sed -E 's/[[:space:]]+#.*$//; s/[[:space:]]+$//' "$file" \ | grep -nE '^[[:space:]]*(-[[:space:]]+)?\{?[[:space:]]*["'\'']?uses["'\'']?[[:space:]]*:' \ | while IFS= read -r line; do local n="${line%%:*}" v diff --git a/tools/ci/test-check-actions-lock.sh b/tools/ci/test-check-actions-lock.sh index 52b8bdb8..16124ca9 100755 --- a/tools/ci/test-check-actions-lock.sh +++ b/tools/ci/test-check-actions-lock.sh @@ -75,6 +75,15 @@ expect pass "reusable call after an indentless steps block" ' a: timeout-minutes: 5 b: uses: acme/repo/.github/workflows/x.yaml@v1' +expect pass "locked action with trailing spaces (plain and quoted)" ' t: + runs-on: x + steps: + - uses: actions/checkout@v7.0.1 + - uses: "actions/checkout@v7.0.1" ' +expect fail "empty uses: value still fails closed" ' t: + runs-on: x + steps: + - uses: ' expect pass "local action and docker image" ' t: runs-on: x steps: From d3bd6ebda693eddb9a86dfe7cc68cab7bdd6546b Mon Sep 17 00:00:00 2001 From: CLAUDE <355856132+HoTT-stuff@users.noreply.github.com> Date: Thu, 19 Nov 2026 20:33:53 +0000 Subject: [PATCH 17/17] fix(ci): add the gate job the main ruleset requires as CI/gate The Branch-Floor ruleset on main requires the status check CI/gate (since 2026-11-16), but no CI job was named gate, so the check never reported and no PR into main could merge. The new gate job needs every CI job and fails unless each one succeeded or was skipped. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7Zo5h4xmXVEeSeQEDvw --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ CHANGELOG.adoc | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24c020b6..e839e04a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -415,3 +415,26 @@ jobs: ( cd tools/vendor/tree-sitter-rescript \ && tree-sitter parse --quiet "${fixture_abs}" > /dev/null ) echo "smoke-parsed: ${fixtures[0]}" + + # Single required check. The `Branch-Floor` ruleset on main requires the + # status `CI/gate`; it passes only when every job above succeeded (a skipped + # job counts as passing, a failed or cancelled one does not). Add any new CI + # job to `needs:` here, or the ruleset will not wait for it. + gate: + name: gate + if: always() + needs: [build, lint, bench-visibility, coverage-visibility, vscode-smoke, migration-assistant] + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: All CI jobs passed + env: + RESULTS: ${{ join(needs.*.result, ' ') }} + run: | + echo "CI job results: $RESULTS" + for r in $RESULTS; do + case "$r" in + success|skipped) ;; + *) echo "::error::a required CI job ended as '$r'"; exit 1 ;; + esac + done diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 386ab46a..b2eaf1cf 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -168,6 +168,10 @@ governance check 4 (`tools/ci/check-actions-lock.sh`) fails on any drift `bisect_ppx` needs OCaml < 5.0. `tools/ci/setup-ocaml.sh` uses the runner OCaml only when it is 4.14.x and otherwise builds a pinned `ocaml-base-compiler.4.14.2` +* fix(ci): no PR could merge into main after the `Branch-Floor` ruleset +started requiring the status `CI/gate` (16 Nov), because no CI job was +named `gate`. A `gate` job now needs every CI job and passes only when +all of them succeed * ci(migration-assistant): fix smoke-parse for tree-sitter-cli 0.25 (#342) * ci: bump github/codeql-action from 4.32.6 to 4.36.0 (#323)