testsAndMisc/docs/superpowers/evidence/mtk-root-run-tests-split-2026-08-16.json
Krzysztof kuhy Rudnicki 4ff7a0bf15 Split mtk_root run_tests.sh: assertions and the dump-test group
421 -> 218 + 157 + 75. The assertion helpers (pass, fail, assert_*,
strip_noncode, run_recon) go to lib/assertions.sh; the six
20-dump-stock.sh tests go to lib/dump_tests.sh. run_tests.sh keeps the
counters, the trap, the eight recon tests and main().

Verified by running the suite, not by inspecting it: 58 passed / 0 failed
before and after, and a diff of the complete 89-line output reports no
differences. The suite is hermetic -- every test drives a fixture via
MTK_ROOT_FIXTURE -- so this is a real execution of 58 assertions rather
than a stubbed trace.

All three files are shfmt-dirty, but run_tests.sh already was at HEAD
(2-space indent against shfmt's tabs) and the libs inherit that style, so
no clean file was made dirty.

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

50 lines
2.7 KiB
JSON

{
"intent": "Bring linux_configuration/scripts/mtk_root/tests/run_tests.sh (421 lines) under the 250-line cap by extracting the assertion helpers and the 20-dump-stock.sh test group into sourced libs.",
"scope": [
"linux_configuration/scripts/mtk_root/tests/run_tests.sh",
"linux_configuration/scripts/mtk_root/tests/lib/assertions.sh (new)",
"linux_configuration/scripts/mtk_root/tests/lib/dump_tests.sh (new)",
"Non-goal: no assertion changed, no test removed, renamed or skipped"
],
"changes": [
"Move pass/fail/assert_contains/assert_not_contains/assert_eq/strip_noncode/run_recon into lib/assertions.sh.",
"Move the six 20-dump-stock.sh tests (refusals, happy path, truncation, ordering, facts file) into lib/dump_tests.sh.",
"run_tests.sh keeps SCRIPT_DIR, the counters, cleanup/trap, the eight recon tests and main(), and sources both libs."
],
"verification": [
{
"command": "bash run_tests.sh (before the split, from the tests directory)",
"result": "pass",
"evidence": "=== 58 passed, 0 failed ===, exit 0. Suite is hermetic: every test drives a fixture directory via MTK_ROOT_FIXTURE, so no phone is involved."
},
{
"command": "bash run_tests.sh (after the split), full stdout diffed against the baseline capture",
"result": "pass",
"evidence": "=== 58 passed, 0 failed ===, exit 0, and `diff` of the complete 89-line output reported no differences -- OUTPUT IDENTICAL. This is a real-execution check with 58 assertions, not a stubbed trace."
},
{
"command": "bash -n on all three files; shellcheck -x on the entry; shellcheck on both libs",
"result": "pass",
"evidence": "All exit 0 with no output."
},
{
"command": "pre-commit run --files <the three files>",
"result": "pass",
"evidence": "No hook reported a failure."
},
{
"command": "bash ~/utils/scripts/check_file_length.sh on all three",
"result": "pass",
"evidence": "421 -> 218 (entry) + 157 (dump_tests) + 75 (assertions), all under 250."
}
],
"risks": [
"The libs depend on caller state: pass/fail increment PASS and FAIL, run_recon reads WORKROOT, FIXTURES and RECON. All are defined in run_tests.sh before the source lines, and the header comments say so.",
"All three files are shfmt-dirty, but run_tests.sh was already shfmt-dirty at HEAD (2-space indent vs shfmt's tabs) and the new libs inherit that existing style. No clean file was made dirty; shfmt is not a pre-commit hook in this repo."
],
"rollback": [
"git revert the commit; both libs disappear and run_tests.sh returns to 421 lines.",
"Re-run `bash run_tests.sh` from the tests directory and confirm '58 passed, 0 failed'."
]
}