mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 13:47:47 +01:00
A stub that prints nothing makes `size=$(du -sk x)` empty, so every `((size > 0))` is false and the trace walks past every guarded branch. Two such traces compare identical while exercising none of the changed code -- a green check that proves nothing, which is the exact failure mode this harness exists to prevent. --stub now takes `name=output`. Measured on a fixture whose `sudo rm -rf` is guarded by a size test: the silent stub gives `size=[]` / "branch skipped" and never records the rm; `--stub 'du=4096\t/some/dir'` gives `size=[4096]` / "BRANCH TAKEN" and captures it. This weakens the earlier disk_cleanup_check.sh trace, which used a silent du stub: that trace only proved the empty-size path identical. The real run from /tmp is what covered the populated path. Noted in the evidence. Docs also record two limits found while surveying: file-placement installers are not yet traceable (stub cp/chmod/ln and the trace is empty; don't and it rewrites the live system), and baselines for scripts reading relative paths must run from the script's own directory. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
44 lines
2.6 KiB
JSON
44 lines
2.6 KiB
JSON
{
|
|
"intent": "Let a stub emit a value so traces exercise guarded branches, closing a hole where two traces compare identical while skipping every branch the split touched.",
|
|
"scope": [
|
|
"meta/scripts/trace_shell_split.sh",
|
|
"docs/shell-split-verification.md",
|
|
"Non-goal: does not make file-placement installers traceable; that needs a prefix redirect"
|
|
],
|
|
"changes": [
|
|
"--stub now accepts `name=output`; the generated stub prints that value after recording the call.",
|
|
"Generate stubs from a quoted heredoc with the name and value passed via printf %q, so $* and $TRACE_FILE stay literal. Fixes SC2016 by restructuring rather than suppressing.",
|
|
"Document the silent-stub trap, the file-placement scripts that remain out of scope, and the need to run baselines from the script's own directory when it reads relative paths."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "trace_shell_split.sh on a fixture whose `sudo rm -rf` is guarded by `((size > 0))`, with --stub du (silent)",
|
|
"result": "pass (hole demonstrated)",
|
|
"evidence": "stdout 'size=[]' then 'branch skipped'; the guarded `sudo rm -rf` never appears in the trace. Two such traces would match perfectly while exercising nothing."
|
|
},
|
|
{
|
|
"command": "same fixture with --stub 'du=4096\\t/some/dir'",
|
|
"result": "pass",
|
|
"evidence": "stdout 'size=[4096]' then 'BRANCH TAKEN'; the trace now records 'sudo rm -rf /some/dir'. The guarded path is reached."
|
|
},
|
|
{
|
|
"command": "Regressions: the set -e function-tail fixture, the nameref fixture, and the multi-stub git/curl fixture",
|
|
"result": "pass",
|
|
"evidence": "exit 1 with empty trace; four 'circular name reference' warnings; both network calls captured. Unchanged by the rewrite."
|
|
},
|
|
{
|
|
"command": "shellcheck + shfmt -d on meta/scripts/trace_shell_split.sh",
|
|
"result": "pass",
|
|
"evidence": "Both exit 0. SC2016 resolved by the heredoc restructure, not a suppression."
|
|
}
|
|
],
|
|
"risks": [
|
|
"A stub value is a fixed string, so a script calling the same command with different arguments and expecting different answers gets one answer for all of them. Sufficient for reaching branches; not a simulator.",
|
|
"This does not retroactively strengthen the disk_cleanup_check.sh trace, which used a silent du stub. That split's real-run-from-/tmp is what covered the populated path -- the trace alone only proved the empty-size path identical."
|
|
],
|
|
"rollback": [
|
|
"Revert the commit; --stub returns to name-only and stubs print nothing.",
|
|
"Re-run the four fixtures and confirm the same exit statuses."
|
|
]
|
|
}
|