testsAndMisc/docs/superpowers/contracts/bt-pairing-coverage-2026-08-22.json
Krzysztof kuhy Rudnicki 0e9cc0ce95
Some checks are pending
Pre-commit checks / pre-commit (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Test bt_pairing.sh to 100%: allowlist 97 -> 96
Second of the 16 untested fixes/lib libs. 65/65 = 100.00% through
run_all.sh, twice, the second at --min 100 (exit 0), then cleared from the
allowlist and confirmed by the real gate with no exemption.

Two findings worth keeping:

- udevadm was NOT in the harness's stub list, so `udevadm control
  --reload-rules` was reaching the REAL binary during the suite. A
  prepended stub dir cannot hide a tool the host actually has. Caught by
  asserting on the recorded call rather than by reading the code, which is
  the argument for asserting on calls at all.

- _disable_usb_autosuspend writes /etc/udev/rules.d/50-bluetooth-no-
  autosuspend.rules. Binding /etc in the jail would have covered it, and
  was rejected: run_all.sh runs UN-jailed in ci_mirror.sh and in the
  shell-tests workflow, as its own header says, so a bind mount protects
  the coverage run and leaves every bare run writing to a real root-owned
  file. Instead the lib gained a UDEV_RULES_DIR override, defaulting to the
  real path -- the same env-override seam pacman_hook_stall_harness.sh uses
  for PACMAN_LOG/CACHE_DIR/PACMAN_LOCK.

Proof the suite is safe where it runs un-jailed: after a bare run_all.sh,
the real rule file still has its 2026-02-21 mtime (it is a genuine artifact
of a production run six months ago) and the probed power/control values are
unchanged. The jail cannot give that check.

fix_usb_autosuspend globs the real /sys/bus/usb/devices/*/ with no override,
so its branches are driven through stubbed lsusb output: ffff:ffff matches
nothing on any machine and reaches the not-found arm, while 046d:c077
(control=on) and 046d:0825 (control=auto) are read-only probes, each guarded
so the case self-skips with a note if the host state changes rather than
silently asserting nothing.

Split across two test files to stay under the 250-line cap; run_all.sh globs
test_*.sh, so splitting costs nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 16:47:40 +02:00

18 lines
2.1 KiB
JSON

{
"title": "Test bt_pairing.sh to 100% and clear it from the shell-coverage allowlist",
"objective": "Cover the second of the sixteen untested linux_configuration/scripts/single_use/fixes/lib libs. bt_pairing.sh is the first in the family whose code writes outside its own process -- a sysfs power/control file and a udev rule under /etc -- so the contract is to reach 100% without ever letting the suite touch either, given that lib/tests/run_all.sh runs UN-jailed in ci_mirror.sh and in CI.",
"acceptance_criteria": [
"bt_pairing.sh measures 100.00% through lib/tests/run_all.sh, twice, the second run at --min 100 with exit 0.",
"check_shell_coverage.sh exits 0 for bt_pairing.sh with its allowlist line removed, i.e. with no exemption.",
"A bare (un-jailed) run of run_all.sh leaves /etc/udev/rules.d/50-bluetooth-no-autosuspend.rules with its original 2026-02-21 mtime, and leaves the power/control values of the probed USB devices unchanged.",
"Every test file stays under the repo's 250-line cap.",
"pre-commit passes on all changed files with no suppression added -- no # shellcheck disable, no noqa."
],
"out_of_scope": [
"Bind-mounting /etc in the jail to make the udev write safe. Rejected: run_all.sh runs un-jailed in ci_mirror.sh and CI, so a bind mount would protect only the coverage run.",
"Refactoring pacman_hook_stall_harness.sh onto the new lib_test_core.sh. Its six libs are already gated at 100% with no exemption.",
"The remaining fourteen untested fixes/lib libs, which land in later commits."
],
"verifier": "bash linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh (expects all files passing, 11 + 20 for the two bt_pairing files), plus bash meta/scripts/shell_coverage_jail.sh --subject linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh --measure bt_pairing.sh --min 100 --fail-on-case-error -- \"\" (expects 65/65 = 100.00% and exit 0), plus bash meta/scripts/check_shell_coverage.sh linux_configuration/scripts/single_use/fixes/lib/bt_pairing.sh (expects exit 0), plus stat -c '%y' /etc/udev/rules.d/50-bluetooth-no-autosuspend.rules (expects 2026-02-21)."
}