prove-guard.sh refuses with exit 1, not the documented 2, so a mistyped find-string accuses the guard of being broken #19
Labels
No Label
P0
P1
P2
release-blocker
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: null/Project-Template#19
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The mutation step refuses two ways — the find-string is absent, or it occurs more than once — and both used
sys.exit("message")inside the embedded Python.sys.exitwith a string prints it to stderr and exits 1.What it costs
The script's header assigns those codes distinct meanings:
So a typo in the find-string returned the code reserved for "your guard is broken" — a diagnosis about the code under test, from a run that never mutated anything and never executed the guard. The two states it most matters to distinguish were indistinguishable, and the wrong one is the alarming one.
TOOLS.mdteaches callers to read these codes ("Exit code2is never a pass. These scripts distinguish 'the check ran and found nothing' from 'the check did not run', because those look identical from the outside and only one of them is evidence"). Every other refusal path in this script already exits 2 explicitly; only the Python block did not.Both codes are non-zero, so CI still goes red — this is a wrong diagnosis rather than a missed failure, hence P2 rather than P1.
What to do
Replace both
sys.exit(...)calls with a helper that prints to stderr and raisesSystemExit(2).Traps
sys.exit(str)was doing that implicitly.set -euo pipefailpropagates the interpreter's status, so the shell needs no change — but therestoretrap must still fire, and the file must come back intact on both refusal paths.Verify:
bash prove-guard.sh <file> <absent-string> X <cmd>and the ambiguous-string case both exit 2, still print their message, and still print "prove-guard: restored "; the 0, 1 and 3 paths are unchanged.