testsAndMisc/docs/superpowers/evidence/gate-reads-jail-args-2026-08-22.json
Krzysztof kuhy Rudnicki 0091608b08 Make the gate read jail_args and refuse a suite that dies partway
Two defects found in review, both of which made checks PASS more easily, so
neither ever went red.

GATE: is_covered() hardcoded its jail flags and never read the jail_args
marker that ci_mirror.sh and shell-tests.yml both consume. The features/lib
suite needs /usr/local/share and /etc/pki and aborts under set -e without
them -- but the coverage number still printed, because kcov had already
recorded whatever the dead run reached. The gate would have graded 44 libs on
a suite that never finished. It now reads the marker, keeps the historical
defaults for suites without one, fails closed on an empty marker, and passes
--fail-on-case-error.

Negative control: stripping the binds makes the gate exit 1 and restoring
them returns exit 0. Before this commit both cases exited 0 -- the gate could
not fail on an aborting suite.

HASH CACHE: the _t_unstub helper written earlier today for the transcribe
harness was needed in features_harness.sh too. Two assertions were vacuous --
test_dwm_config's "verify still reports when dwm is absent", and
test_rpi_nc_ca's uname removal, where a cached uname left every later branch
running under a faked Darwin. All four `rm -f "$TEST_TMPDIR/bin/` sites in
the repo were audited; the other two are sound (one probes with [[ -f ]], the
other runs in a subshell).

No measured figure moved: dot_resolver_install.sh still 39/39 = 100.00% with
real absence enforced, so its off-allowlist clearance holds.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016sxxsDHWgdRhmdmzNMA6XM
2026-08-22 13:36:54 +02:00

51 lines
4.4 KiB
JSON

{
"intent": "Close two defects found in review that would each have made the campaign's guarantees hollow: is_covered() ignored the jail_args marker (so 44 features/lib libs could never reach 100% through the gate), and two suites unstubbed a tool with a bare `rm`, which bash's command hash cache makes a no-op.",
"scope": [
"meta/scripts/lib/shell_coverage_bar.sh: is_covered() reads jail_args and passes --fail-on-case-error",
"linux_configuration/scripts/single_use/features/lib/tests/features_harness.sh: new _t_unstub helper",
".../tests/test_dwm_config.sh and test_rpi_nc_ca.sh: switched to _t_unstub",
"Non-goal: test_cco_state.sh's `rm` of beeper.orig -- get_real_binary probes with `[[ -f ]]`, which the hash cache does not affect, so that test is sound"
],
"changes": [
"GATE DEFECT: is_covered() hardcoded `--bind /etc --bind /usr/local/bin --bind /var/lib` and never read the jail_args file that ci_mirror.sh and shell-tests.yml both consume. The features/lib suite needs /usr/local/share and /etc/pki and ABORTS under set -e without them -- yet the coverage number still printed, because kcov had already recorded whatever the dead run reached. The gate would have graded a lib on a suite that never finished.",
"is_covered() now reads the marker, falls back to the historical defaults when a suite has none, fails closed on a present-but-empty marker, and passes --fail-on-case-error so a suite that dies partway fails the gate instead of being scored on its stump.",
"HASH-CACHE DEFECT: the _t_unstub helper written for the transcribe harness was needed in features_harness.sh too. Two assertions were vacuous -- test_dwm_config.sh's 'verify still reports when dwm is absent' and test_rpi_nc_ca.sh's uname removal after the macOS branch, where a cached uname would have left every later branch running under a faked Darwin.",
"This was found by review rather than by a failing test, which is the point: both defects made checks PASS more easily, so nothing went red."
],
"verification": [
{
"command": "bash meta/scripts/check_shell_coverage.sh .../dot_resolver_install.sh",
"result": "pass",
"evidence": "exit 0 -- the lib that is already OFF the allowlist still clears the real gate now that the gate reads the marker and enforces case failure."
},
{
"command": "NEGATIVE CONTROL: replace jail_args with `--bind /etc` alone, re-run the gate, restore",
"result": "pass",
"evidence": "gate exit=1 with the binds stripped, exit=0 after restoring. Before this commit BOTH cases exited 0 -- the gate could not fail on an aborting suite. git diff --stat on jail_args is empty afterwards."
},
{
"command": "re-measure all four features libs after the _t_unstub fix",
"result": "pass",
"evidence": "dot_resolver_install.sh 39/39 = 100.00% (unchanged -- its off-allowlist clearance is sound with real absence enforced), dwm_config.sh 47.95%, rpi_nc_ca.sh 98.63%, aw_autostart.sh 82.93%. No figure moved."
},
{
"command": "the features/lib runner under --fail-on-case-error after the change",
"result": "pass",
"evidence": "0 case failures -- every assertion still passes with the tools genuinely absent rather than cached."
},
{
"command": "grep -rn 'rm -f \"$TEST_TMPDIR/bin/' --include='test_*.sh' linux_configuration/",
"result": "pass",
"evidence": "Four hits audited. Two fixed; test_aw_autostart.sh's runs in a subshell via $status_script so the parent's cache is irrelevant; test_cco_state.sh probes with [[ -f ]], not command -v."
}
],
"risks": [
"is_covered() now runs the full jailed suite per lib with --fail-on-case-error, so a directory whose suite is slow makes the gate slower per file. Hook mode was measured at 0.42s/file before; a jailed suite is seconds, which is why an --all sweep belongs in CI rather than a commit hook.",
"A suite that legitimately has no jail_args gets the historical default binds. If such a suite later needs a mount it will abort and now correctly fail the gate -- loudly, which is the intended direction, but it is a new way for the gate to go red."
],
"rollback": [
"git revert the commit; is_covered() returns to hardcoded binds with no case-failure check, and the two suites return to vacuous absence assertions.",
"After rollback, re-run the negative control: it should exit 0 with the binds stripped, confirming the fail-open behaviour is back."
]
}