fix(hooks): set -e killed the hook on the gate's no-op exit
The gate exits 5 for ALREADY PUBLISHED and byte-identical - a no-op, not a refusal, and what re-pushing a release tag legitimately produces. These hooks run under set -e, so the non-zero exit aborted the script before $? could be read: the push died with no message at all, and the block that exists to explain a refusal never ran. A gate that fails silently is worse than no gate. Wrapped in an if, which is the form set -e tolerates.
This commit is contained in:
1 parent
763d74aba6
commit
b7bfb36452
1 file changed
+9
-2
+9
-2
@@ -222,8 +222,15 @@ if [ -n "$release_tag" ]; then
|
||||
# after made argparse exit 2, which this block read as a refusal - so the
|
||||
# hook printed REFUSED without the gate ever having run, and the first
|
||||
# "verification" of this wiring was itself wrong.
|
||||
python -m invisible_core.release --project-root . check --verify-index
|
||||
gate_rc=$?
|
||||
# `if` rather than a bare call: these hooks run under `set -e`, so a command
|
||||
# exiting non-zero aborts the script BEFORE `$?` can be read - and exit 5
|
||||
# here is a NO-OP, not a failure. The result was a push that died with no
|
||||
# message at all, which is the worst shape a gate can fail in.
|
||||
if python -m invisible_core.release --project-root . check --verify-index; then
|
||||
gate_rc=0
|
||||
else
|
||||
gate_rc=$?
|
||||
fi
|
||||
# 5 is ALREADY PUBLISHED and byte-identical: nothing to do, not a refusal.
|
||||
# It is what re-pushing or back-filling a release tag legitimately produces,
|
||||
# and the gate gives it its own code precisely so a caller can tell it from
|
||||
|
||||
Reference in new issue
Block a user