{ "intent": "Fix two defects in the shell-coverage ratchet found in review, before the gate is wired into pre-commit: a path classifier that treated test helpers as production libraries, and a shrink-only rule that was documented but not enforced.", "scope": [ "meta/scripts/check_shell_coverage.sh — is_shell_lib classifier, seed_allowlist guard", "meta/shell-coverage-allowlist.txt — reseeded 125 -> 115 as a legitimate shrink", "NON-GOAL: wiring the pre-commit hook. That edit is still denied as a sensitive file; the YAML block to add is recorded in NEXT_SESSION_PROMPT.md." ], "changes": [ "is_shell_lib now excludes */tests/lib/* as well as */lib/tests/*. Both nestings are test code; only the first was excluded, so helpers under tests/lib/ were classified as production libraries and the gate demanded 'tests/lib/tests/run_all.sh' — an incoherent path. Confirmed by probe before fixing: un-exempting linux_configuration/tests/lib/ made the gate emit exactly that demand for 7 files.", "The bug's timing was the reason to fix it now, not its size: Phase 3's follow-up work is writing test suites, which means editing test helpers — precisely the files that would have been blocked.", "--seed now diffs the proposed set against the existing allowlist and exits 1 if it would ADD any entry, rather than relying on a header comment saying not to. Per workflow-rules.md, a remedy that only works if a human remembers something is hygiene, not a fix.", "Reseeded the allowlist from 125 to 115; the 10 removed entries are the misclassified test helpers under linux_configuration/tests/lib, scripts/mtk_root/tests/lib and scripts/boot_recovery/tests/lib." ], "verification": [ { "command": "bash meta/scripts/check_shell_coverage.sh --seed", "result": "pass", "evidence": "'seeded allowlist with 115 uncovered librar(ies)', down from 125. `grep -c '/tests/lib/'` on the allowlist is now 0." }, { "command": "bash meta/scripts/check_shell_coverage.sh linux_configuration/tests/lib/i3blocks_claude_usage.sh", "result": "pass", "evidence": "exit=0. Before the fix the same file was reported as needing linux_configuration/tests/lib/tests/run_all.sh." }, { "command": "git add -N ; bash meta/scripts/check_shell_coverage.sh --seed", "result": "pass", "evidence": "exit=1, 'refusing to seed — that would ADD 1 entr(ies)', and `diff -q` confirms the allowlist file was left byte-identical. Note the guard only sees tracked files: an unstaged probe was invisible to `git ls-files` and seeded normally, so the first run of this probe was a false negative until the file was staged." }, { "command": "full case matrix: covered lib / unrelated entry script / exempt lib / test helper / new untested lib", "result": "pass", "evidence": "exits 0,0,0,0,1 — all five as intended. The unrelated-entry-script case (exit 0) is the one that distinguishes a ratchet from a repo-wide gate." }, { "command": "shellcheck meta/scripts/check_shell_coverage.sh; shfmt -d meta/scripts/check_shell_coverage.sh", "result": "pass", "evidence": "shellcheck clean, shfmt reports no diff. No suppressions added." } ], "risks": [ "The gate still proves a suite EXISTS beside a library, not that it exercises that specific file. A directory that already has a run_all.sh can gain an untested library silently — the shrink-only guard does not close this, because such a file is never a candidate for the allowlist in the first place.", "The --seed guard reads tracked files only. A library that exists on disk but has never been git-added is invisible to both the guard and the gate until staged; pre-commit stages before running hooks, so this is not a hole in the hook path.", "Counts in this session drifted twice and are worth stating precisely once: an earlier per-directory map was inflated because the git pathspec '*' crosses '/', and the 208 figure in the parent commit's evidence predates this fix, since it still counted the 10 test helpers as libraries. Verified independently after the fix: 198 in-scope libraries = 115 exempt + 83 covered." ], "rollback": [ "git revert this commit. That restores the 125-entry allowlist and the classifier that misreads tests/lib, so it should be paired with reverting the parent commit 3278bebd rather than done alone.", "After rollback confirm `bash meta/scripts/check_shell_coverage.sh --all` still runs and that no pre-commit hook references the script, since the hook entry was never landed." ] }