mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-14 20:40:48 +01:00
918 -> 138 lines, across five libs plus two data-file payloads. The two generated scripts became data files rather than heredocs. ENTER_EOF alone was 279 lines, so any lib containing it would have been over the cap however the rest was arranged. Both heredocs were quoted, so their bodies were already literal text with no build-time interpolation, and copying them verbatim is exactly equivalent. The payloads are named *.sh.in on purpose. The pre-commit hook globs staged files by '\.(sh|bash|zsh)$', runs shfmt -w on them and re-stages the result -- and shfmt does reformat these bodies. That would have changed their bytes and destroyed the property this split is verified by. The .in extension keeps them out of every .sh-globbing hook without a suppression or an exclude regex. cat + chmod 0755 became a single `install -m 0755`, closing the window the original left between creating the file and making it executable. The load-bearing check: running install_enter_script and install_unlock_script against a scratch directory produces mode-0755 files whose sha256 sums are identical to the copies already deployed in /usr/local/bin on this machine. The split provably emits the exact bytes that are running today, and it touched no system file -- sha256sum -c on both deployed artifacts passes unchanged. help, status and an unknown command are byte-identical to their pre-split baselines. A line-multiset check leaves exactly six lines unaccounted for: the two cat/heredoc openers, the two terminators and the two chmod calls that install -m now performs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
21 lines
2.3 KiB
JSON
21 lines
2.3 KiB
JSON
{
|
|
"title": "Split setup_night_lockdown.sh under the 250-line cap",
|
|
"objective": "Bring linux_configuration/scripts/periodic_background/digital_wellbeing/setup_night_lockdown.sh (918 lines) under the repo-wide 250-line cap by moving config, systemd-unit generation and the subcommands into five sourced libs, and externalizing the two large generated scripts as data-file payloads -- while emitting byte-identical artifacts to the ones already deployed in /usr/local/bin on this machine.",
|
|
"acceptance_criteria": [
|
|
"The entry script and all five lib/nl_*.sh files are each at most 250 lines.",
|
|
"`help`, `status` and an unknown-command run are byte-identical to the pre-split baselines, with exit codes 0, 0 and 1.",
|
|
"The artifacts emitted by install_enter_script and install_unlock_script are mode 0755 and sha256-identical to the live /usr/local/bin/night-lockdown-{enter,unlock}.sh.",
|
|
"A line-multiset check accounts for every functional line of the 918-line original, with the only differences being the six lines the heredoc-to-data-file conversion replaces.",
|
|
"The payload files are not reformatted by the pre-commit shfmt pass, since any byte change there breaks the hash equality above.",
|
|
"shellcheck passes without -x on the entry script and libs, and shfmt -w is a no-op on all of them, with no suppression added.",
|
|
"The live deployed artifacts are unchanged by the work: sha256sum -c passes at the end."
|
|
],
|
|
"out_of_scope": [
|
|
"Running `setup` or `unlock`: they write /etc/systemd/system, enable timers and reconfigure the machine's night lockdown.",
|
|
"Re-deploying to /usr/local/bin -- unnecessary, since the split emits the bytes already there.",
|
|
"Shell test coverage for the new libs; no suite exists for this script.",
|
|
"Any change to the lockdown schedule, the monitored units, or the RGB/i2c behaviour."
|
|
],
|
|
"verifier": "bash meta/scripts/check_file_length.sh --all for the cap; diff of help/status/unknown against captured baselines; a scratch-directory run of install_enter_script and install_unlock_script with sha256 comparison against the live deployed copies; a python3 line-multiset diff including the payload files; shellcheck, shfmt idempotence and bash -n; sha256sum -c on the deployed artifacts as the final step; pre-commit run --files on the staged set."
|
|
}
|