forked from mosaicstack/stack
test(wake): pin the BASH_LINENO continuation convention at runtime (#973)
The denominator artifact's site coordinates assume a backslash-continuation helper call reports at its FIRST physical line. That convention was measured on a developer bash (5.3.x, Fedora); CI runs the bash baked into ci-base (node:24-alpine), which rebuilds only on push-to-main or tag — so the CI bash version floats silently between rebuilds, and an artifact validated only against a developer bash is unverified in the place the gate actually runs. wake_assert_init now runs a probe under the SAME bash binary executing the suite (subshell + continuation, the real call shape) and aborts loudly if the convention does not hold, instead of letting coordinates skew by one line under everyone. Microtest C10 proves the pin's abort arm fires, via a test-only WAKE_ASSERT_PIN_BASH interpreter override ($BASH itself cannot be spoofed — bash resets it at startup): a pin whose failure arm was never seen firing is an undertaking, not a control. Prompted by mos-dt's CI-bash-float finding (prereg addendum 4, ddea1bc7b). Written-by: pepper (sb-it-1-dt) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NsKce8iZuSuRnu3gVMCBKB
This commit is contained in:
co-authored by
Claude Fable 5
parent
10a7fe43c5
commit
8cb5866a3d
@@ -30,6 +30,10 @@
|
||||
# broken (ARMED line, no abort). C3..C6 require the ARMED line AND the
|
||||
# aborting site's ledger row (append lands BEFORE the grep runs, so an
|
||||
# abort can never shorten the count it is part of).
|
||||
# C10 the BASH_LINENO pin's abort arm fires: under a probe interpreter that
|
||||
# misreports the continuation line, wake_assert_init aborts loudly and
|
||||
# nothing past init executes — a pin whose failure arm was never seen
|
||||
# firing is an undertaking, not a control.
|
||||
set -uo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
@@ -225,6 +229,24 @@ else
|
||||
check C9 1 "rc=$rc out=$(printf '%s' "$out" | tail -n 3 | tr '\n' ' ')"
|
||||
fi
|
||||
|
||||
# --- C10: lineno pin aborts under an interpreter that breaks the convention -
|
||||
cat >"$TMP/fake-bash" <<'FAKE'
|
||||
#!/usr/bin/env bash
|
||||
# stand-in for a bash whose BASH_LINENO convention differs: misreports the
|
||||
# continuation call one line low (the exact skew the pin exists to catch)
|
||||
printf '3\n5\n'
|
||||
FAKE
|
||||
chmod +x "$TMP/fake-bash"
|
||||
out="$(WAKE_ASSERT_PIN_BASH="$TMP/fake-bash" bash -c '. "$WAKE_COMMON" && wake_assert_init && echo REACHED-PAST-INIT' 2>&1)"
|
||||
rc=$?
|
||||
if [ "$rc" -ne 0 ] &&
|
||||
! printf '%s' "$out" | grep -q 'REACHED-PAST-INIT' &&
|
||||
printf '%s' "$out" | grep -q 'WAKE-ASSERT INIT ABORT: BASH_LINENO convention violated'; then
|
||||
check C10 0 ""
|
||||
else
|
||||
check C10 1 "rc=$rc out=$(printf '%s' "$out" | tail -n 2 | tr '\n' ' ')"
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ "$fails" -gt 0 ]; then
|
||||
echo "microtest-wake-assert: FAILED ($fails check(s))" >&2
|
||||
|
||||
Reference in New Issue
Block a user