mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 19:14:02 +01:00
Two single-use scripts with no deployed copy, so the entry+lib shape is safe. Each keeps the ordering, the safety checks and the user-facing output; the configuration writers move to a library beside it. Both scripts write `set -e # Exit on any error`, so extract_shell_functions.py now matches the directive rather than the whole line. Regression-checked by re-deriving the committed fresh-install/main.sh split byte-for-byte. Verified: all 6 and all 9 top-level functions verbatim via the shfmt harness; both libraries source with no side effects and define every function moved into them; bash -n passes on all four. Neither script was run. nvidia_troubleshoot.sh writes /etc/X11 config and installs pyroveil; setup_passwordless_system.sh writes sudoers and lightdm autologin, which is what this machine's login depends on. Over-cap files 31 -> 29. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
55 lines
3.5 KiB
JSON
55 lines
3.5 KiB
JSON
{
|
|
"intent": "Split nvidia_troubleshoot.sh (336) and setup_passwordless_system.sh (374) into entry scripts plus sourced configuration libraries, all four files under the 250-line cap.",
|
|
"scope": [
|
|
"nvidia_troubleshoot.sh 336 -> 169, new fixes/lib/nvidia_config.sh 181",
|
|
"setup_passwordless_system.sh 374 -> 195, new utils/lib/passwordless_config.sh 193",
|
|
"meta/scripts/extract_shell_functions.py: match the set -e directive rather than the whole line",
|
|
"Non-goal: any behaviour change; neither script was executed"
|
|
],
|
|
"changes": [
|
|
"Moved the four configuration writers out of each script, leaving the entry script owning the ordering, the safety checks and the user-facing output.",
|
|
"Both scripts write `set -e # Exit on any error`, so the extractor's anchor was loosened to match the directive rather than an exact line. The change was regression-checked by re-deriving the already-verified fresh-install/main.sh split and diffing byte-for-byte.",
|
|
"nvidia_troubleshoot.sh keeps suggest_kernel_params and suggest_desktop_settings, which only print advice; setup_passwordless_system.sh keeps check_sudo, backup_file, test_configurations and the two output functions."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "bash meta/scripts/verify_shell_split.sh HEAD <entry> <lib> <entry>, for each",
|
|
"result": "pass",
|
|
"evidence": "nvidia_troubleshoot: IDENTICAL, all 6 top-level functions verbatim. setup_passwordless_system: IDENTICAL, all 9 verbatim."
|
|
},
|
|
{
|
|
"command": "bash -c '. <lib>; declare -F <each moved function>'",
|
|
"result": "pass",
|
|
"evidence": "Both libraries source with no side effects and define every function moved into them. This is the check that caught the discarded first attempt at the main.sh split, where interleaved top-level commands ended up in the library."
|
|
},
|
|
{
|
|
"command": "bash -n on all four files",
|
|
"result": "pass",
|
|
"evidence": "All parse. Neither script was executed: nvidia_troubleshoot.sh writes /etc/X11 configuration and installs pyroveil, and setup_passwordless_system.sh writes sudoers and lightdm autologin - the two things this machine's login depends on."
|
|
},
|
|
{
|
|
"command": "Regression check of the extractor after loosening the set -e match",
|
|
"result": "pass",
|
|
"evidence": "Re-derived the committed fresh-install/main.sh split in a throwaway worktree at HEAD~2; both files came out byte-for-byte identical, so the anchor change did not alter existing behaviour."
|
|
},
|
|
{
|
|
"command": "pre-commit run --files <all four>",
|
|
"result": "pass",
|
|
"evidence": "All hooks pass, including shfmt and shellcheck."
|
|
},
|
|
{
|
|
"command": "bash ~/utils/scripts/check_file_length.sh --all",
|
|
"result": "pass",
|
|
"evidence": "29 files over cap, down from 31."
|
|
}
|
|
],
|
|
"risks": [
|
|
"Neither script has a test or CI coverage - both are hand-run single-use fixes. The verbatim proof, the source-time check and bash -n are the whole of the evidence.",
|
|
"nvidia_troubleshoot.sh's known trace blocker is unaddressed: its trace dies at step 3 because backup_file writes into an unbound /etc, so most of the file never executes under the harness. That blocks a runtime trace, not this split, which is verified statically instead."
|
|
],
|
|
"rollback": [
|
|
"git revert the commit; both entry scripts return to their original size and the two libraries disappear.",
|
|
"After rollback, confirm bash -n passes on both and that each file again contains all of its function definitions."
|
|
]
|
|
}
|