mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 18:54:03 +01:00
test_pacman_wrapper_security.sh (287) and test_i3blocks_efficiency.sh (345). Both keep their filenames -- shell-tests.yml runs them by name -- and both were verified by diffing a full run against the pre-split code: byte-identical output, exit 0 either side. The i3blocks setup half stays in the entry on purpose. Its five fake $BIN_DIR binaries are written with heredocs, and a seam inside a heredoc yields a lib that will not parse -- the worst failure this effort has produced so far. Only the two heredoc-free regions moved. Both i3blocks lib functions end in an explicit `return 0`. Their last statement is a `|| fail ...`, which as a function tail under set -e becomes the return value and would abort a run in which every check passed. `fail` exits on its own, so reaching the end means success. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
60 lines
3.8 KiB
JSON
60 lines
3.8 KiB
JSON
{
|
|
"intent": "Bring the two remaining over-cap shell test suites in linux_configuration/tests under the 250-line cap without changing a single assertion or its result.",
|
|
"scope": [
|
|
"linux_configuration/tests/test_pacman_wrapper_security.sh (287 -> 128 lines)",
|
|
"linux_configuration/tests/lib/pacman_wrapper_syntax.sh (new)",
|
|
"linux_configuration/tests/lib/pacman_wrapper_makepkg.sh (new)",
|
|
"linux_configuration/tests/test_i3blocks_efficiency.sh (345 -> 214 lines)",
|
|
"linux_configuration/tests/lib/i3blocks_config_checks.sh (new)",
|
|
"linux_configuration/tests/lib/i3blocks_claude_usage.sh (new)",
|
|
"Non-goal: changing, weakening, skipping or deleting any check",
|
|
"Non-goal: reformatting test_i3blocks_efficiency.sh, which was already shfmt-dirty (2-space indent) before this change"
|
|
],
|
|
"changes": [
|
|
"test_pacman_wrapper_security.sh: tests 1-12 and 13-19 moved into two sourced libs, each wrapped in a function and called in the original order. The trailing checks keep their heredocs and their trap ... EXIT in the entry script, so trap scope is unchanged.",
|
|
"test_i3blocks_efficiency.sh: the config/guard checks and the claude_usage checks moved into two sourced libs. The setup half stays in the entry deliberately: the five fake $BIN_DIR binaries are written with heredocs, and a seam inside a heredoc yields a lib that will not parse.",
|
|
"Both i3blocks lib functions end in an explicit `return 0`. Their last statement is a `|| fail ...` conditional, which as a function tail under `set -e` would become the return value and abort a fully passing run; `fail` itself exits, so reaching the end means every check passed.",
|
|
"Both entry scripts keep their filenames, because .github/workflows/shell-tests.yml runs these suites by filename."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "bash -n on both entries and all four new libs",
|
|
"result": "pass",
|
|
"evidence": "OK for all six files."
|
|
},
|
|
{
|
|
"command": "shellcheck on each new lib ALONE (no -x), plus shellcheck -x on both entries",
|
|
"result": "pass",
|
|
"evidence": "LIBS CLEAN and ENTRY CLEAN for both suites. No suppression added."
|
|
},
|
|
{
|
|
"command": "bash test_pacman_wrapper_security.sh, diffed against the same suite run from a detached worktree at HEAD",
|
|
"result": "pass",
|
|
"evidence": "OUTPUT BYTE-IDENTICAL PRE/POST SPLIT; both runs exit 0."
|
|
},
|
|
{
|
|
"command": "bash test_i3blocks_efficiency.sh, diffed against the pre-split run captured before editing",
|
|
"result": "pass",
|
|
"evidence": "OUTPUT BYTE-IDENTICAL PRE/POST SPLIT; both runs exit 0, ending in 'All i3blocks efficiency regression tests passed.'"
|
|
},
|
|
{
|
|
"command": "shfmt -d on the pacman entry and its two libs",
|
|
"result": "pass",
|
|
"evidence": "SHFMT CLEAN. The i3blocks files are shfmt-dirty both before and after: the original uses 2-space indent, and the new libs inherit the style of the code they hold rather than being reformatted."
|
|
},
|
|
{
|
|
"command": "bash ~/utils/scripts/check_file_length.sh --all | grep -c 'over by'",
|
|
"result": "pass",
|
|
"evidence": "63 -> 61 violations; neither suite appears any more."
|
|
}
|
|
],
|
|
"risks": [
|
|
"The libs are only valid when sourced from their entry script, which owns the helpers, paths and fake $BIN_DIR binaries. Running one directly is not supported and never was a use case.",
|
|
"A future check appended to an i3blocks lib must keep the `return 0` last, or a passing run can abort on the set -e function-tail trap."
|
|
],
|
|
"rollback": [
|
|
"git revert the commit; both entry scripts return to single files and the four libs disappear.",
|
|
"After rollback, run both suites and confirm test_pacman_wrapper_security.sh ends in 'All Tests Passed!' and test_i3blocks_efficiency.sh in 'All i3blocks efficiency regression tests passed.', each exiting 0."
|
|
]
|
|
}
|