{ "intent": "Phase 2 of the cap campaign: make the 250-line cap enforceable, and stop shell changes going red on push. Both halves of the user's answer to the CI-green fork — (a) a pre-commit check that main is not already red, and (b) a pre-push mirror of the Shell tests workflow.", "scope": [ ".pre-commit-config.yaml: two new local hooks, file-length-cap and ci-baseline-green", "meta/scripts/check_ci_green.sh: new", "meta/scripts/ci_mirror.sh: mirrors the shell-tests workflow's side-effect-free half", "Bundled with the _glyph_art split because the gate cannot be wired while any file is over the cap" ], "changes": [ "file-length-cap runs check_file_length.sh --all repo-wide, not per-file: a file that grows past the cap without being staged in this commit must still be caught. Wiring it earlier in the campaign would have blocked every unrelated commit in the repo, which is why it lands last.", "ci-baseline-green (option a) checks the last COMPLETED run of 'Pre-commit checks' and 'Shell tests' on main. It fails CLOSED on a definitively red baseline and warns-and-passes on anything undeterminable — offline, no gh, unauthenticated, no runs yet — with a 5s timeout on every call. Blocking every commit on network reachability is a cost that buys nothing, because (b) is the real per-change guarantee. CI_GREEN_SKIP=1 bypasses it for a deliberate fix-forward commit, and it skips itself inside GitHub Actions.", "python-tests.yml is deliberately NOT in the required list: it is path-filtered, so a shell-only commit never triggers it and its 'latest run' can legitimately be old. Including it would produce false reds.", "ci_mirror.sh (option b) now runs every */lib/tests/run_all.sh plus the workflow's side-effect-free test list. That list is PARSED out of shell-tests.yml rather than duplicated: a hardcoded copy drifts the moment a test is added, and a mirror that silently checks less than CI is worse than none because it reports safe. It fails if the parse yields nothing.", "The Arch-container half of shell-tests is not mirrored: it needs an Arch userland running as root to touch /etc, which is what a disposable container is for and a developer machine is not." ], "verification": [ { "command": "pre-commit run file-length-cap --all-files, with a deliberate 261-line file staged", "result": "pass", "evidence": "The required Phase 2 check. The hook exits 1 and names the offender: '261 linux_configuration/scripts/toolong_probe.sh (+11)'. After removing the probe it passes. So the gate demonstrably blocks, rather than being assumed to." }, { "command": "pre-commit run ci-baseline-green --all-files", "result": "pass", "evidence": "Passes against the current green main. Its fail-closed path was also exercised for real earlier in this session: while Shell tests was red it correctly refused with 'main is RED on GitHub Actions: - Shell tests (failure)', which is what led to finding and fixing that breakage. Both skip paths (CI_GREEN_SKIP=1, GITHUB_ACTIONS=true) verified to exit 0." }, { "command": "awk parse of the test list out of shell-tests.yml", "result": "pass", "evidence": "Extracts exactly the six side-effect-free tests, and all six pass locally. The Arch job's second tests=( ) array is correctly not picked up." }, { "command": "shellcheck on both scripts", "result": "pass", "evidence": "rc=0 for check_ci_green.sh and ci_mirror.sh, no suppression added." } ], "risks": [ "ci-baseline-green blocks on a red main that someone else broke. That is the intended behaviour of option (a) — the alternative is silently building on a broken baseline — and CI_GREEN_SKIP=1 is the documented escape for a fix-forward commit.", "The extended ci_mirror makes pre-push slower. It is the price of the failure it prevents: three separate test files asserted on code a split had moved during this campaign, and every one was caught only after the push.", "ci_mirror parses YAML with awk rather than a YAML parser. It is anchored to the literal `tests=(` array shape in this one workflow and fails loudly if that shape changes, rather than silently mirroring nothing." ], "rollback": [ "git revert the commit; both hooks disappear and ci_mirror returns to covering only pre-commit and pytest.", "After rollback, confirm `pre-commit run --all-files` still passes and that check_file_length.sh --all is unaffected — it remains runnable by hand either way." ] }