testsAndMisc/docs/superpowers/evidence/arch-perf-fixes-coverage-2026-08-22.json
Krzysztof kuhy Rudnicki 0c92a00f0f Test arch_perf_fixes.sh to 93.48% and fix the journal regex a third time
Eighth of the 16 untested fixes/lib libs. 22 assertions; 43/46 = 93.48%. The
lib STAYS on the allowlist -- see the artifact below.

Third instance of the same dead branch. Line 16 matched on
`([0-9]+\.?[0-9]*)\ G`, a required space before the unit, while journalctl
prints "4.2G" with no separator, so the vacuum could never run. Fixed to an
optional space, as in arch_perf_report.sh.

This one differs from that earlier fix and the difference was confirmed with
the user before landing: arch_perf_report.sh's vacuum sits behind
--apply-safe-fixes, but THIS one runs whenever fix_arch_performance.sh runs.
So the fix makes an unflagged destructive action live -- the script will now
really vacuum the journal to 300M once it passes a gigabyte. That is the
function's evident intent, since its next act is to write a permanent 300M
cap, and the user approved it explicitly.

Three absolute paths moved behind overrides defaulting to the real ones:
JOURNALD_CONF_DIR, SYSTEMD_UNIT_DIR (fix_media_organizer writes
/etc/systemd/system/media-organizer.service) and ORGANIZE_SCRIPT_CANDIDATES.
Verified afterwards that the real unit file still carries its 2026-07-25
mtime and the journald drop-in its 2026-03-02 one, i.e. a bare un-jailed
run_all.sh touched neither.

The three uncovered lines (68-70) are the element lines of a multi-line array
literal. `PS4` + `set -x` on a minimal case shows bash reporting the whole
assignment at its OPENING line and never emitting the elements or the closing
paren, so they are data, not statements -- a fourth flavour of defect (a),
after multi-line quotes, `} |` and the backslash-continued assignment. The
array is provably used: the loop on the next line iterates it and the
media-organizer assertions pass.

Worth fixing, unlike the bt_adapter one-liner: the form appears in three of
the remaining untested libs (thorium_repairs.sh has four) and in nine
allowlisted libs repo-wide. That lands as its own commit next.

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

51 lines
4.8 KiB
JSON

{
"intent": "Test linux_configuration/scripts/single_use/fixes/lib/arch_perf_fixes.sh, eighth of the 16 untested fixes/lib libs, and fix a third instance of the dead journal-size regex. The lib reaches 93.48% and STAYS on the allowlist: the three remaining lines are the element lines of a multi-line array literal, which bash attributes to the array's opening line.",
"scope": [
"linux_configuration/scripts/single_use/fixes/lib/arch_perf_fixes.sh (journal regex, plus three env overrides for absolute paths)",
"linux_configuration/scripts/single_use/fixes/lib/tests/test_arch_perf_fixes.sh (new, 22 assertions)",
"linux_configuration/scripts/single_use/fixes/lib/tests/arch_perf_harness.sh (three new overrides and their per-test reset)",
"meta/shell-coverage-allowlist.txt is deliberately UNCHANGED: arch_perf_fixes.sh does not meet the 100% bar",
"Non-goal: extending continuation_lines() for multi-line array literals, which lands separately"
],
"changes": [
"Fixed the journal size regex at arch_perf_fixes.sh:16, the THIRD instance of the same bug: it required a space before the unit (([0-9]+\\.?[0-9]*)\\ G) but journalctl prints '4.2G' with no separator, so the vacuum branch was dead. The space is now optional, matching the fix already made in arch_perf_report.sh.",
"Added JOURNALD_CONF_DIR, SYSTEMD_UNIT_DIR and ORGANIZE_SCRIPT_CANDIDATES overrides, all defaulting to the real paths. fix_journal writes a journald drop-in, fix_media_organizer writes /etc/systemd/system/media-organizer.service, and the organizer script is probed at two absolute home paths. run_all.sh runs UN-jailed in ci_mirror.sh and in CI, so a bind mount would protect only the coverage run.",
"Added test_arch_perf_fixes.sh covering fix_journal (multi-gigabyte journal vacuumed and capped, a small journal capped but not vacuumed, and an already-configured cap left alone), fix_nm_wait_online (enabled and already-disabled), and fix_media_organizer (script missing, unit written with the right user and ExecStart, an already-correct unit skipped, and a unit naming the wrong user rewritten)."
],
"verification": [
{
"command": "bash linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh",
"result": "pass",
"evidence": "arch_perf_fixes: 22 passed, 0 failed. All fixes lib test files passed, so the six cleared libs and the eight pacman_hook_stall suites stay green."
},
{
"command": "bash meta/scripts/shell_coverage_jail.sh --subject linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh --measure arch_perf_fixes.sh --min 1 --fail-on-case-error -- \"\"",
"result": "pass",
"evidence": "arch_perf_fixes.sh: 43/46 lines = 93.48%, uncovered 68, 69, 70."
},
{
"command": "PS4='+L${LINENO} ' bash -x on a minimal multi-line array literal",
"result": "pass",
"evidence": "bash reports the whole assignment at the OPENING line ('+L3 items=(\\'one\\' \\'two\\')') and never emits the element lines or the closing paren. So lines 68-70 of arch_perf_fixes.sh are data inside a multi-line array, not statements; the array is provably used, since the loop on line 71 iterates it and the media-organizer assertions pass."
},
{
"command": "ls -la /etc/systemd/system/media-organizer.service after a bare (un-jailed) run of run_all.sh",
"result": "pass",
"evidence": "Still dated 2026-07-25, a genuine artifact of a past production run, untouched by the suite. The journald drop-in likewise keeps its 2026-03-02 mtime."
},
{
"command": "Scope the artifact: grep for multi-line array literals across fixes/lib and the allowlist",
"result": "pass",
"evidence": "Three of the remaining untested libs use the form (arch_perf_fixes.sh 1, thorium_repairs.sh 4, ubuntu_perf_fixes.sh 1), and nine allowlisted libs repo-wide contain a '=(' line ending. Large enough to be worth extending continuation_lines(), which follows as its own commit."
}
],
"risks": [
"The journal regex fix makes a previously-dead vacuum live: fix_journal will now really run 'journalctl --vacuum-size=300M' when the journal exceeds a gigabyte. Unlike arch_perf_report.sh's version this one is NOT behind an --apply-safe-fixes flag; it runs whenever fix_arch_performance.sh runs. That is the function's evident intent -- it is named fix_journal and its next act is to write a permanent 300M cap -- but the behaviour change is real and worth stating.",
"arch_perf_fixes.sh stays on the allowlist at 93.48% pending the array-literal detector change."
],
"rollback": [
"git revert the commit; it adds one test file, three harness overrides, and changes one regex plus three path defaults in the lib. No allowlist entry is touched.",
"After rollback, run bash linux_configuration/scripts/single_use/fixes/lib/tests/run_all.sh and confirm the remaining suites pass."
]
}