Repository navigation
fix(gates): composite shell -e silently killed two gates - #32
Merged
Merged
Conversation
GitHub runs a composite `shell: bash` step as
`bash --noprofile --norc -e -o pipefail {0}`. The `-e` comes from the
harness, and a script's own `set -uo pipefail` does not clear it. Any
`x=$(grep ... )` is therefore a silent kill site whenever grep
legitimately matches nothing.
Two gates were dying on it, both in the case they exist to handle:
required-files-check
A comment-only CODEOWNERS made `grep -v ... | wc -l` exit 1, killing
the step ONE LINE ABOVE the message declaring that exact file valid
("valid for solo-maintained repos per Rule 1"). The gate killed
precisely the repos it was written to accept. Measured on
pons-asinorum run 35782895038: the log stops after the last
successful echo, with no `::error::` anywhere, and the check-run
annotation carries only "Process completed with exit code 1".
Because this is step 3 of the estate audit, its red SKIPS 25
downstream gates — one unguarded pipeline blanked the whole audit
for every solo-maintained repo in the estate.
spdx-license-check
`git grep -i "SPDX-License-Identifier" | wc -l` exits 1 on a repo
with zero SPDX lines, so the step hard-failed and the `::warning::`
branch beneath it was UNREACHABLE — inverting the intent stated in
the comment beside it ("disabled strictly to prevent total CI
blockage until adoption").
Fixes:
- required-files-check restores its own contract with `set +e`. The
script accumulates `fail=1` to report EVERY defect and exit once at
the end; `-e` means "die on the first", which is the opposite. Both
count sites are additionally guarded with `|| true` so the intent
survives someone re-adding `-e`.
- spdx-license-check guards its `git grep` so the zero-SPDX branch can
be reached at all.
- formatting-check and metrics-check already used `|| true`/`|| echo 0`
at every such site and are untouched; the sweep found no others.
tests/composite-shell-contract.sh runs both gates under the exact CI
shell against a fixture repo that is valid under every rule they state,
and KILLS A MUTANT: it reinstates the unguarded pipeline, asserts both
mutations actually applied, asserts the mutant parses, and requires it
to die SILENTLY with no `::error::` — the CI signature. Without that
last check the red could come from fixture drift and prove nothing
about `-e`. Wired into code-hygiene-self-test.yml. PASS=7 FAIL=0.
Refs: #787
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WRvDivYwLSeVCJUrfjic3f
Contributor
|
Warning Review limit reachedNext included review available in 27 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The `test` job invokes composite actions, which drag transitive `uses:` edges into actions.lock. One of those pins is currently stale — the lock records `hyperpolymath/cicd-suite@main` at 9adb390 while main is at 6ff6057, and `$/actions/manifest-check` resolves to the head SHA, which has no lock entry at all — so the job dies in `prepare` with "lockfile missing pin for hyperpolymath/deed-ecosystem@f9d999b6", before a single step runs. That is pre-existing (this change adds no `uses:`), and it is the same shape as the defect this suite exists to cover: a failure that happens before the thing being measured is ever reached. A suite that can be masked that way is not a measurement. So the contract suite gets its own job, touching nothing but checkout. Its square now always reflects the suite. The lock staleness is left for its own change rather than hand-edited here — the file is machine generated, and `gh actions-lock` rewrite mode has a recorded history of de-pinning SHAs and inventing invalid local refs. Refs: #787 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WRvDivYwLSeVCJUrfjic3f
|
hyperpolymath
added a commit
that referenced
this pull request
Sep 22, 2026
…nsumer (#35) ## The cure was green here and inert everywhere else `fa71ac2` (#32) cured the composite `-e` kill. `0c1bc9f` (#34) restored the lockfile pins #28 dropped. Both merged green. **Neither reached a single consumer**, and nothing was red to say so. pons-asinorum was repointed at `0c1bc9f` (pons#26) and its estate audit *still* died at `Required Files Gate` — 82 ms, silent, exit 1, 25 downstream gates skipped. Identical to before the cure. ### Why The reusable invokes its gates by **branch** ref: ```yaml uses: hyperpolymath/cicd-suite/actions/required-files-check@main ``` A branch ref is *trusted from the lockfile*, and the runner executes **the commit the lockfile names** — not the branch tip. This lock pinned `cicd-suite@main` at `9adb3908`, four commits back: | commit | PR | carried | |---|---|---| | `0c1bc9f` | #34 | lock pins restored | | `fa71ac2` | #32 | the `-e` cure (3 + 1 guards) | | `6ff6057` | #31 | linguist-check | | `3b4afaf` | #28 | (the regression) | `9adb3908` has **0** of those guards. So no SHA a consumer picks for the *reusable* can reach a cured *composite*. The lock's `@main` entry is the real gate, and re-pinning it is the actual delivery step — the one #31, #32 and #34 all skipped. ## What this does 1. Bumps `dependencies['hyperpolymath/cicd-suite@main'].commit` to `0c1bc9f`. Ancestor-clean fast-forward (`9adb3908` is an ancestor of `0c1bc9f`); the transitive `uses:` list is unchanged, so `dependencies:` needs no other churn. 2. **Makes it impossible to forget again.** `tests/lock-transitive-closure.sh` gains a third assertion: for any self-referencing branch pin, the `actions/` tree at the locked commit must equal `HEAD`'s. On drift it names the files. 3. `shell-contract` gains `fetch-depth: 0` so the locked commit is present to compare against. The house pattern for this is a follow-up *"pin cicd-suite lock at `<sha>`"* commit — `f8c8f4a`, `4f9a7a4`, `373714a` all do exactly this. It has been carried by memory, and memory dropped it three times running. Now it is a test. ## Non-vacuity — twice **The assertion was written before the bump and caught the live defect**, naming all three drifted composites: ``` FAIL hyperpolymath/cicd-suite@main pins 9adb390..., whose actions/ tree differs from HEAD actions/linguist-check/action.yml actions/required-files-check/action.yml actions/spdx-license-check/action.yml ``` And its first draft printed its header while checking *nothing* — an ERE `sed` has no lazy quantifiers, so `.git` stayed on the repo name and no dependency key ever matched. A header is not a check, so the block now carries its own non-vacuity counter, separate from block 1's. ## Local ``` tests/lock-transitive-closure.sh PASS=9 FAIL=0 tests/composite-shell-contract.sh PASS=7 FAIL=0 (mutant dies silently) ``` ## Acceptance `Composite shell contract` green with the new assertion passing — and then pons#26's audit re-measured. Per the standing owner ruling, the gates that have been *skipped rather than passing* may now surface new findings; those become issues with acceptance criteria, not blockers on this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WRvDivYwLSeVCJUrfjic3f Co-authored-by: Claude Opus 5 <[email protected]>
4 tasks
This was referenced Oct 14, 2026
hyperpolymath
added a commit
to hyperpolymath/marches
that referenced
this pull request
Oct 14, 2026
## One root cause behind both red checks `.github/workflows/actions.lock` drifted. It does this in two ways: | Check | Why it fails | Evidence | |---|---|---| | `CI` → `startup_failure` (no check run at all) | Dependabot (#34) bumped `ci.yml` to `leanprover/[email protected]` and `codeql.yml` to `github/[email protected]`, but the lock still names `v1.6.0` / `v4.38.0`. | Every `CI` run since #34 (runs 78–81) | | `estate-audit` → silent exit 1 | The lock pins `hyperpolymath/cicd-suite@main` to `5a10b72`. That is before hyperpolymath/proven-cicd-and-workflows#32 (`fa71ac2`, 22 Sept) fixed the Required Files Gate's `grep -v … \| wc -l` under `-e -o pipefail` on a comment-only CODEOWNERS. | Reproduced locally at `5a10b72`. Upstream `main` now uses `grep -cvE … \|\| true`. | So the upstream gate bug is **already fixed**, and nothing needs filing on cicd-suite. marches just needs its lock advanced. **Why Dependabot keeps causing this.** dependabot-core can rewrite `actions.lock`, but only behind a server-side experiment (`Experiments.enabled?(:github_actions_lockfile)` in `github_actions/file_fetcher.rb`). That isn't something `dependabot.yml` can enable, so every Actions bump will drift the lock again until GitHub rolls it out. ## The fix: relock remotely, automatically New `.github/workflows/actions-lock.yml` runs the official extension, `github/gh-actions-lock` (pinned **v0.2.0**, the latest release, 12 Oct), on GitHub's runners: - **When:** - On every push to `main` that changes a workflow, so a merged Dependabot bump is relocked within minutes. - Weekly on Monday, after Dependabot, so branch pins like `cicd-suite@main` track latest. - On demand. - **What:** `gh actions-lock --relock --no-narrow --no-migrate-local-actions`, scoped to two groups: - the workflows the lock already tracks; - every workflow with no `uses:`, which is recorded as `[]` with nothing to rewrite. A workflow that has refs but isn't tracked yet, i.e. the estate's canonical `secret-scanner.yml` caller, is never onboarded automatically, because v0.2.0 may turn its SHA ref into a tag. - **Guard:** a run that would change anything but `actions.lock` is refused, the same assert as #25. Otherwise it opens or updates a lockfile-only PR from `ci/relock-actions`. - **No `uses:`**, so it runs precisely when the lock is stale. This follows `labels.yml`. - **Token:** it falls back to `GITHUB_TOKEN`. Two repo settings matter: 1. **Settings → Actions → General → "Allow GitHub Actions to create and approve pull requests"** must be on, or `gh pr create` fails. 2. A PR opened with `GITHUB_TOKEN` does not trigger CI. Adding one secret, **`AUTOMATION_TOKEN`** (a fine-grained token on this repo with Contents, Issues, Pull requests and Workflows set to read/write), makes CI run on the bots' PRs. It also covers the case where GitHub refuses a `GITHUB_TOKEN` write under `.github/workflows/`. The track-latest workflows in #42 share it. **Merging this starts the first relock automatically**, because it's a push to `main` that touches a workflow. I'll watch that run and the PR it opens. ## Checks ``` $ actionlint -shellcheck=$(which shellcheck) .github/workflows/actions-lock.yml # v1.7.7 (clean) ``` The run itself can only be exercised on GitHub. This sandbox can't reach the GitHub API, which is why the relock has to run remotely in the first place. The scope computation was dry-run locally and picks `actions-lock.yml`, `ci.yml`, `codeql.yml`, `label-triage.yml`, `labels.yml`, `main-estate-audit.yml` and `pages.yml`. This PR's own `CI` and `estate-audit` will still be red, for the reasons above. The relock PR fixes both. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VTeVWDEJgdYKsUNr4uhnXX --------- Co-authored-by: Claude <[email protected]>
hyperpolymath
added a commit
that referenced
this pull request
Oct 14, 2026
…-tracking bot (#50) ## Why Consumers kept reporting `Central Estate CI/CD Audit / estate-audit: failing after 8s`. There were three causes, and none of them was the gate code on main. 1. **Copies freeze.** Each estate repository held a full copy of the 26-step workflow, pinned through its `actions.lock`. hyperpolymath/marches, for example, held `cicd-suite@main` at `5a10b72`, the commit before #32 fixed required-files. With the gates at `5a10b72`, 25 of 26 pass on marches and required-files fails, which matches its CI. At `4f54042` (current main), all 26 pass. Fixes made here never reached a consumer. 2. **One job masks the rest.** All 26 gates ran in one job, so the first failure hid every later gate. 3. **Stubs were run.** `prat` and `semantic-audit` printed success without checking anything (README defect 5). ## What changes - **`.github/workflows/main-estate-audit.yml`** stays a reusable workflow. It has had `workflow_call` since #7, but it now runs five jobs, one check run each: - `governance`: required-files · spdx-license · affirmation · referencing - `hygiene`: code-hygiene · formatting · linguist · secrets · vaulted-tokens - `manifests`: manifest · recipes-set - `languages`: idris2-abi · zig-unified-api-adapter · proof-runner · boj-cartridge - `advisory`: the nine advisory gates; this check cannot fail, by design Every gate step has `if: !cancelled() && steps.checkout.outcome == 'success'`, so a failing gate does not stop the later gates in its job. The workflow has `permissions: contents: read`, and checkout plus all 24 gates are pinned by full SHA (`1aa6bfb`, unchanged). - **The stubs are no longer run.** Their directories under `actions/` are kept rather than moved to `draft/`. Unmigrated copies of the old workflow still reference them by path, and `tests/lock-transitive-closure.sh` requires the pinned SHA to serve HEAD's whole `actions/` tree. So this PR does not touch `actions/**`. - **`templates/estate-audit-caller.yml`** is the ten-line caller each repository holds. It pins a full SHA, because `sha_pinning_required` rejects `@main` and tags. - **`templates/track-estate-audit.yml`** is a weekly bot with no `uses:`. It opens a PR that moves the caller's pin to cicd-suite HEAD, and that PR's own audit run is the check. If its branch holds a commit the bot did not make, it leaves the branch alone instead of force-pushing over it. It needs an `AUTOMATION_TOKEN` secret, because `GITHUB_TOKEN` may not write under `.github/workflows/`. - **`scripts/deonboard-estate-audit.sh`** removes the caller from a repository's `actions.lock` and prunes the dependencies only it reached. An onboarded cross-repo reusable-workflow call startup-fails with zero jobs. The script needs mikefarah `yq` v4 and is idempotent. On marches' lock it removed exactly the audit entry plus `cicd-suite@main`, `deed-ecosystem@f9d999b` and `k9-ecosystem@2155aa2`, all as pure removals with the 4-space layout kept. - **`rollout_estate.sh`** installs the caller, the bot and the de-onboarding in each repository, instead of copying the workflow. It refuses to write anything unless the pinned commit's audit declares `workflow_call`. It writes files and does not commit them. - **README and ARCHITECTURE** describe the new consumption model. Defect 5 is closed by removal from the workflow. ## Verification - `tests/lock-transitive-closure.sh`: PASS=8 FAIL=0. - `tests/composite-shell-contract.sh`: PASS=28 FAIL=0. - actionlint 1.7.7 is clean on `main-estate-audit.yml` and both templates. The errors it reports in `code-hygiene-self-test.yml` are already on main; that file is unchanged here. shellcheck is clean on `rollout_estate.sh` and `scripts/*.sh`. - 24 gate steps: the old 26 minus the two stubs. - Rollout guard: - Negative control: with `origin/main` at `0405f13`, the commit before #7, it exits 1 and writes nothing. - Positive control: with `origin/main` at this branch, it installs both files, and they pass actionlint. - **End to end:** hyperpolymath/marches#44 calls this workflow at this branch's head. All five `estate / *` checks are green there. After this merges, I'll re-pin it to the merge commit. ## Not in this PR - Moving `prat`/`semantic-audit` to `draft/`. That waits until the estate runs the caller. - Defect 6 (bare `git grep` in six gates). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VTeVWDEJgdYKsUNr4uhnXX --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The defect
GitHub runs every composite
shell: bashstep as:That
-ecomes from the harness, not from the script, and a script's ownset -uo pipefaildoes not clear it — it never mentionse. So anyx=$(grep ... )is a silent kill site whenever grep legitimately matches nothing.Two gates were dying on it, each in the exact case it exists to handle.
1.
required-files-check— killed the repos it was written to acceptA comment-only CODEOWNERS makes
grep -vexit 1 →pipefail→-ekills thestep one line above the message declaring that file valid.
Measured on
pons-asinorumrun35782895038. The failure is invisible twiceover: no
::error::is ever reached, so the log simply stops after the lastsuccessful
echo, and the check-run annotation carries onlyProcess completed with exit code 1.Because this is step 3 of the estate audit, its red skips 25 downstream
gates. One unguarded pipeline has been blanking the entire audit for every
solo-maintained repo in the estate.
2.
spdx-license-check— its own warning branch was unreachablegit grepexits 1 on zero matches, so a repo with no SPDX headers — the onlycase this check exists to detect — hard-failed the step, doing the exact
opposite of what the comment beside it says.
The fix
required-files-check:set +e, restoring the script's own contract. Itaccumulates
fail=1so it can report every defect and exit once at the end;-emeans "die on the first", which is the opposite contract. Both count sitesare additionally guarded with
|| true, so the intent survives someonere-adding
-elater.spdx-license-check: guard thegit grepso the zero-SPDX branch isreachable at all.
formatting-checkandmetrics-checkalready used|| true/|| echo 0at every such site — theauthors knew about this hazard and missed these two files. No other instances.
Non-vacuity
tests/composite-shell-contract.shruns both gates under the exact CI shellagainst a fixture repo that is valid under every rule those gates state
(comment-only CODEOWNERS, zero SPDX headers), and kills a mutant:
set +e;$RFis yq-extracted, so itsindentation is not the
.yml's, and a no-opsedhere produces a fake green(this happened while writing the file);
bash -nproduces a fake red;::error::— the CI signature.Without that last check the red could come from fixture drift and would prove
nothing about
-e(this also happened while writing the file: a 4-lineMAINTAINERSstub made the mutant "die" for the wrong reason).Wired into
code-hygiene-self-test.ymlwith the matchingpaths:filters.Verification
Reproduced locally against
pons-asinorumat the same composite version CI ran(
@main=6ff6057):bash reqfiles.shbash -e -o pipefail reqfiles.sh-e -o pipefailRefs: #787
🤖 Generated with Claude Code
https://claude.ai/code/session_01WRvDivYwLSeVCJUrfjic3f