testsAndMisc/docs/superpowers/evidence/linux-config-batch6-2026-08-16.json
Krzysztof kuhy Rudnicki 2527fb37e6 Split three large linux_configuration scripts, defer a fourth
organize_downloads.sh 513 -> 72, setup_kcd2_dice_solver.sh 497 -> 112,
fix_ubuntu_performance.sh 494 -> 150. First 490+ line scripts done; all
three needed two or three seams.

Repeated splitting chained the libs - each sourced the next, because the
tool inserts its source line relative to the file it just wrote.
Flattened so the entry sources all three and no lib sources a sibling.

diagnose_pacman_hook_stall.sh is reverted and stays at 493. Its
transaction runner assigns LAST_ELAPSED that the caller reads and reads
PACMAN_BIN that the caller defines, so linted alone it is SC2034 plus
SC2153. The pre-commit hook lints each lib in isolation and fails, while
shellcheck -x on the entry passes - suppressing that would be papering
over a seam that does not exist.

organize_downloads.sh is the ExecStart of media-organizer.service; the
unit still resolves and the script still parses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-16 19:06:16 +02:00

52 lines
3.9 KiB
JSON

{
"intent": "Split three of the largest remaining linux_configuration scripts, and defer a fourth whose seam cannot be made lint-clean without a suppression.",
"scope": [
"single_use/utils/organize_downloads.sh (513 -> 72) + lib/download_classify.sh, download_sizes.sh, download_media.sh",
"single_use/features/setup_kcd2_dice_solver.sh (497 -> 112) + lib/kcd2_serve.sh, kcd2_expose.sh, kcd2_autorebuild.sh",
"single_use/fixes/fix_ubuntu_performance.sh (494 -> 150) + lib/ubuntu_perf_fixes.sh, ubuntu_perf_more.sh",
"Deferred and fully restored: single_use/fixes/diagnose_pacman_hook_stall.sh (493)",
"Non-goal: no script executed"
],
"changes": [
"Three cuts each for organize_downloads.sh and setup_kcd2_dice_solver.sh, two for fix_ubuntu_performance.sh. These are the first 490+ line scripts done, and every one needed more than one seam.",
"Repeated splitting chained the libs - each new lib sourced the next, because the tool inserts its source line relative to the file it just wrote. Flattened so organize_downloads.sh sources all three directly and no lib sources a sibling, and removed a leftover SCRIPT_DIR the chain had left in a lib.",
"diagnose_pacman_hook_stall.sh was reverted to HEAD. Its transaction runner assigns LAST_ELAPSED which the caller reads, and reads PACMAN_BIN which the caller defines; linted as a fragment that is SC2034 plus SC2153, and the pre-commit hook lints each lib in isolation. Neither is a real bug, which is exactly why suppressing them would be wrong - the honest answer is that this seam does not exist."
],
"verification": [
{
"command": "meta/scripts/verify_shell_split.sh per script",
"result": "fail then pass",
"evidence": "organize_downloads.sh first reported SC1091 for a lib sourcing a sibling; after flattening, all three report 'libs sourced, functions defined'."
},
{
"command": "pre-commit run shellcheck --files <all touched>",
"result": "fail then pass",
"evidence": "Failed on the pacman lib's SC2034/SC2153. This is the check that matters here and is stricter than shellcheck -x on the entry script, which passed on the same code - the hook lints each lib alone, with no view of the caller's globals. Passes now that the split is reverted."
},
{
"command": "systemctl cat media-organizer.service, test -f its ExecStart, bash -n that file",
"result": "pass",
"evidence": "Resolves to organize_downloads.sh and parses. This is one of only two units pointing into the repo, and it is the script that shrank most in this batch (513 -> 72)."
},
{
"command": "git checkout HEAD -- diagnose_pacman_hook_stall.sh, then shellcheck -x",
"result": "pass",
"evidence": "Restored to 493 lines and clean. Note the first `git checkout` without HEAD restored the staged split rather than the original - checked with wc -l, not assumed."
},
{
"command": "bash ~/utils/scripts/check_file_length.sh --all",
"result": "pass",
"evidence": "None of the three entry scripts or seven libs is listed."
}
],
"risks": [
"None of the three was run. organize_downloads.sh moves files in ~/Downloads and runs from a live systemd timer; verifying it by running would be exactly the mutation decision 6 forbids. The unit-path check and bash -n are the strongest available evidence.",
"The lib-chaining bug now has two instances (20-dump-stock.sh, organize_downloads.sh). Any script split more than twice needs its source lines grepped afterwards; the tool does not do this itself.",
"diagnose_pacman_hook_stall.sh remains at 493 lines, the largest deferred file. Splitting it needs the LAST_ELAPSED/PACMAN_BIN state passed explicitly rather than shared."
],
"rollback": [
"git revert the commit; the three scripts return to their previous sizes and the seven libs disappear.",
"After rollback, re-run bash -n and shellcheck on the restored scripts."
]
}