testsAndMisc/docs/superpowers/contracts/bt-adapter-coverage-2026-08-22.json
Krzysztof kuhy Rudnicki 434cb7587e Test bt_adapter.sh to 98.55%; line 97 is unreachable by construction
Third of the 16 untested fixes/lib libs, and the first that does NOT come
off the allowlist. 68/69 = 98.55%, up from 45/69. The remaining line is
not a missing test:

  PS4='+TRACE:${BASH_SOURCE##*/}:${LINENO} ' bash -x

shows bash attributing the whole multi-line dbus-send assignment in
_services_resolved to line 100, and never emitting line 97 at all. Line 97
is the OPENING line of a backslash-continued statement; kcov instruments
it, bash never attributes a statement to it. That is defect (a) in
docs/kcov-under-report.md -- a wrong denominator -- and no test can move it.

continuation_lines() in shell_coverage_lines.py already excludes such lines,
but only detects them by tracking QUOTE state, so a line ending in an
unquoted backslash slips through. Fixing that is deliberately left out of
this commit: it changes the denominator for every measured lib, and if it
regresses one of the libs now gated with no exemption, reverting a mixed
commit would throw away these tests too.

Scope of the problem, measured rather than guessed -- backslash
continuations are confined to the bluetooth family: bt_audio.sh 10,
bt_adapter.sh 7, bt_pairing.sh 3, pacman_hook_stall_summary.sh 2, and ZERO
in the other 12 remaining libs. So this caps bt_audio.sh next and then stops
mattering.

Also replaces the harness's _t_only_path with _t_hide. _t_only_path dropped
PATH to $FAKE_BIN alone, which hid grep, head and sort as well as the tool
under test -- so the "usbreset is not installed" case died in a cascade of
"command not found" and passed for the wrong reason instead of exercising
the fallback. _t_hide rebuilds PATH from symlinks to every real executable
except the named ones; verified directly that command -v usbreset is then
empty while grep and head still resolve.

bt_report.sh (37/37) and bt_pairing.sh (65/65) re-measured at --min 100,
both exit 0, so neither cleared lib regressed.

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

18 lines
2.1 KiB
JSON

{
"title": "Test bt_adapter.sh, and record why its last line is unreachable",
"objective": "Cover the third of the sixteen untested fixes/lib libs. Unlike the first two this one does NOT come off the allowlist: it tops out at 98.55% because line 97 is the opening line of a backslash-continued statement, which kcov instruments but bash never attributes a statement to. The deliverable is therefore the tests plus a proven diagnosis, not a cleared entry.",
"acceptance_criteria": [
"bt_adapter.sh measures 98.55% (68/69) through lib/tests/run_all.sh, with line 97 the only uncovered line.",
"The claim that line 97 is unreachable is proven by a PS4 trace showing bash attributing the statement to line 100, not asserted.",
"bt_report.sh and bt_pairing.sh still measure 100.00% at --min 100 with exit 0, since both are now gated with no exemption.",
"The whole suite passes bare: run_all.sh reports all test files passing.",
"Every test file stays under the repo's 250-line cap, and pre-commit passes with no suppression added."
],
"out_of_scope": [
"Removing bt_adapter.sh from meta/shell-coverage-allowlist.txt. It is not at 100%, so it does not meet the bar.",
"Changing continuation_lines() in meta/scripts/lib/shell_coverage_lines.py to recognise backslash continuations. That alters the denominator for every measured lib and must land on its own, so a regression can be reverted without losing these tests.",
"Reformatting bt_adapter.sh to collapse the multi-line dbus-send call. Production source is not rewritten to please the coverage tool."
],
"verifier": "bash linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh (expects all files passing, 14 + 27 for the two bt_adapter files), plus bash meta/scripts/shell_coverage_jail.sh --subject linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh --measure bt_adapter.sh --min 1 --fail-on-case-error -- \"\" (expects 68/69 = 98.55%, uncovered: 97), plus the same command with --measure bt_report.sh and --measure bt_pairing.sh at --min 100 (expects 37/37 and 65/65, exit 0)."
}