mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 19:34:03 +01:00
Three review findings, all before the hook is wired:
is_shell_lib excluded */lib/tests/* but not */tests/lib/*. Both are test
code; the second nesting made the gate demand tests/lib/tests/run_all.sh
for 10 helper files. It would have fired precisely while editing test
helpers to write the suites this ratchet asks for. Reseeded 125 -> 115.
--seed now refuses (exit 1) when a reseed would ADD an entry, instead of
a header comment asking nicely. It reads tracked files only, so an
unstaged probe seeds normally -- staging it produces the refusal with
the allowlist left byte-identical.
The parent commit's docs claimed an exempt file loses its exemption when
next modified. It does not: check_files exempts allowlisted paths
unconditionally, verified by staging an edit and getting exit 0. Fixed
the text, not the code -- making an edit trip the gate would block
routine work across 115 of 198 libraries, which is the repo-wide gate
this ratchet exists to avoid.
Also corrects the "a percentage is unreachable" rationale: commit
53e80462 reached 100% on an entry script with no suppressions. Presence
is still the right bar, because that took per-file mount analysis.
58 lines
6.2 KiB
JSON
58 lines
6.2 KiB
JSON
{
|
|
"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.",
|
|
"Corrected a docs-vs-code mismatch: the parent commit's script header, commit message and handoff all said an exempt file loses its exemption 'when next modified', but check_files never consults modification — it exempts allowlisted paths unconditionally. Verified by staging an edit to phone_focus_mode/lib/adb_common.sh and running the gate: exit 0. Fixed the TEXT rather than the code, because making an edit trip the gate would block routine work across 115 of the repo's 198 shell libraries, which is the repo-wide gate this ratchet exists to avoid.",
|
|
"Corrected the parent commit's rationale, which claimed a coverage percentage was unreachable without forbidden suppressions. It is reachable: an earlier session the same day hit 100% (38/38) on setup_night_lockdown.sh via a user-namespace jail with no source changes and no suppressions. Presence remains the right bar because the generic runner scored 75% (57/76) on the next subject, so a percentage needs bespoke per-file mount analysis — a cost, not an impossibility.",
|
|
"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 <a new untested lib>; 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": "git add <edit to phone_focus_mode/lib/adb_common.sh>; bash meta/scripts/check_shell_coverage.sh phone_focus_mode/lib/adb_common.sh",
|
|
"result": "pass",
|
|
"evidence": "exit=0 — a modified allowlisted library is NOT blocked, disproving the 'until modified' wording in the parent commit. File restored from backup and `git status` confirmed clean afterwards. A first attempt used the path phone_focus_mode/lib/adb.sh, which does not exist; that created a stray 22-byte untracked file whose exit=1 was a false positive. It was deleted and the test rerun against the real allowlisted path."
|
|
},
|
|
{
|
|
"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."
|
|
]
|
|
}
|