mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 20:14:02 +01:00
The five Python splits this session were made safe by a throwaway ast identity check. There is no ast for bash, so meta/scripts/verify_shell_split.sh does the same job with shfmt -mn (minify: strips comments and indentation, keeps logic), hashing each top-level function and naming the one that differs. shfmt is already a REQUIRED_TOOLS binary, so this adds no dependency. Validated in all three directions before trusting it: an unchanged copy is IDENTICAL, a copy with blank lines inserted is IDENTICAL, and a one-character logic change ($1 -> $2) is caught and named. The first mutation attempt used sed 's/exit 1/exit 2/' on a file with no 'exit 1' and reported IDENTICAL - the harness was fine, the test was vacuous. That trap is now documented, because a normalizer that silently passes everything is worse than none. Also triaged all 29 over-cap shell scripts for deployed copies, which the trace harness cannot see. The finding that changes the plan: deploy.sh copies a hardcoded per-file list into /data/local/tmp/focus_mode and never deploys lib/, so an entry+lib seam would break focus mode on the phone at its first source - for 8 of the 29, not the 2 the brief named. Those scripts source only config.sh, which is on the copy list, so a sibling-file seam works provided deploy.sh's list grows in the same commit. 16 scripts have no deployed copy and are safe to split conventionally. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
54 lines
3.9 KiB
JSON
54 lines
3.9 KiB
JSON
{
|
|
"intent": "Build and validate the shell equivalent of the Python ast identity check, and record the deployment triage of all 29 over-cap shell scripts, so the splits that follow can be verified rather than assumed.",
|
|
"scope": [
|
|
"New: meta/scripts/verify_shell_split.sh",
|
|
"docs/shell-split-verification.md - the harness usage, its self-test contract, and the triage table",
|
|
"Non-goal: any split; this commit only builds the tooling"
|
|
],
|
|
"changes": [
|
|
"verify_shell_split.sh extracts each top-level function from a git rev and from the post-split files, normalises through shfmt -mn, and compares a hash per function. shfmt is already a REQUIRED_TOOLS binary here, so this adds no dependency.",
|
|
"It names the function that changed rather than reporting a whole-file diff, so a failure points at the seam.",
|
|
"Documented the triage: deploy.sh copies a hardcoded per-file list into /data/local/tmp/focus_mode and never deploys lib/, which decides the seam shape for 8 of the 29 scripts."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "verify_shell_split.sh HEAD <file> <unchanged copy of it>",
|
|
"result": "pass",
|
|
"evidence": "IDENTICAL: all 5 top-level functions moved verbatim."
|
|
},
|
|
{
|
|
"command": "verify_shell_split.sh against a copy with blank lines inserted every 7th line",
|
|
"result": "pass",
|
|
"evidence": "IDENTICAL - formatting changes do not register, which is what makes the check usable after shfmt and pre-commit autofixes."
|
|
},
|
|
{
|
|
"command": "verify_shell_split.sh against a copy with one character of logic changed (file_path=\"$1\" -> \"$2\")",
|
|
"result": "pass",
|
|
"evidence": "DIFFERENCE FOUND, naming process_packages and printing both hashes, exit 1. The first attempt at this test used sed 's/exit 1/exit 2/' on a file containing no 'exit 1' and reported IDENTICAL; diffing the mutation showed it had never applied. The harness was fine, the test was vacuous - which is exactly the failure mode a normalizer self-test exists to catch, and it is now written down."
|
|
},
|
|
{
|
|
"command": "shellcheck meta/scripts/verify_shell_split.sh",
|
|
"result": "pass",
|
|
"evidence": "Clean. An SC2329 on the cleanup function was fixed by inlining it into the trap rather than suppressing the warning."
|
|
},
|
|
{
|
|
"command": "grep triage over all 29 over-cap shell scripts for cp/install/ln into deployed locations",
|
|
"result": "pass",
|
|
"evidence": "13 scripts have a deployed copy: the 8 phone_focus_mode scripts (individually listed in deploy.sh), install_leechblock.sh and block_compulsive_opening.sh (preferred from /usr/local by pacman_wrapper.sh on every pacman call), and three that install helpers to /usr/local. The other 16 are safe to give an entry+lib shape. Confirmed the phone scripts source only config.sh, which is on deploy.sh's copy list - so a sibling-file seam works there but an entry+lib seam would not."
|
|
},
|
|
{
|
|
"command": "npx prettier --write docs/shell-split-verification.md and wc -l",
|
|
"result": "pass",
|
|
"evidence": "136 lines, under the 250-line cap. prettier runs on pre-push, so markdown is formatted before it can fail there."
|
|
}
|
|
],
|
|
"risks": [
|
|
"The function extractor is a brace-counting awk pass, so a function whose body contains an unbalanced brace inside a string or heredoc could be mis-delimited. Mitigated by the control test on a real repo script and by the harness reporting the function count, which would drop visibly if extraction went wrong.",
|
|
"The check covers top-level functions only. Code outside any function - the argument parsing and main flow most of these scripts end with - is not compared, so a split must still be verified by running the script."
|
|
],
|
|
"rollback": [
|
|
"git revert the commit; the harness and the documentation section disappear together.",
|
|
"Nothing depends on them yet, so no follow-up validation is needed after rollback."
|
|
]
|
|
}
|