test(git-tools): wrapper-guard harness distinguishes tool failure from drift (#1380-FF) #1388
@@ -521,6 +521,26 @@ while IFS=$'\t' read -r want payload why remedy; do
|
||||
n=$((n + 1))
|
||||
out="$(printf '%s' "$payload" | "$GUARD" 2>&1)"
|
||||
got=$?
|
||||
# Flake containment (stack#1380-FF, pipeline 2635): a transient failure of
|
||||
# the ASSERTION TOOLING (grep/fork/alloc error under node pressure) is not a
|
||||
# contract drift, but this loop's `if !` shape made it indistinguishable
|
||||
# from one — the harness printed the advice-mismatch FAIL and failed a merge
|
||||
# verify on a run whose guard output was correct. Distinguish the two: an
|
||||
# assertion tool that itself fails is retried a bounded number of times, and
|
||||
# if it never succeeds the case reports a TOOL-ERROR line (fail=1 stays, so
|
||||
# the run is never green-on-infra-noise, but the line names the real class
|
||||
# and a re-run can be judged instead of debugged as a guard defect).
|
||||
assert_out_names() {
|
||||
local attempt rc1
|
||||
for attempt in 1 2 3; do
|
||||
printf '%s' "$out" | grep -Fq -- "$1" && return 0
|
||||
rc1=$?
|
||||
[ "$rc1" -eq 1 ] && return 1 # grep answered NO — real mismatch
|
||||
sleep 0.2 # rc>=2: grep itself errored — retry
|
||||
done
|
||||
printf 'TOOL-ERROR %s (assertion grep failed 3x; guard output was correct class — infra/tooling, not guard drift)\n' "$why" >&2
|
||||
return 2
|
||||
}
|
||||
if [ "$got" != "$want" ]; then
|
||||
printf 'FAIL %s (want exit %s, got %s)\n' "$why" "$want" "$got"
|
||||
fail=1
|
||||
@@ -530,10 +550,15 @@ while IFS=$'\t' read -r want payload why remedy; do
|
||||
# now it was invisible here: the harness read the exit code and nothing else,
|
||||
# so /issues/1/labels blocking with "use issue-create.sh" passed every run for
|
||||
# six rounds. Where a fixture states the remediation it expects, assert it.
|
||||
if [ -n "${remedy:-}" ] && ! printf '%s' "$out" | grep -Fq -- "$remedy"; then
|
||||
printf 'FAIL %s (blocked, but the advice does not name %s)\n' "$why" "$remedy"
|
||||
fail=1
|
||||
continue
|
||||
if [ -n "${remedy:-}" ]; then
|
||||
assert_out_names "$remedy"
|
||||
arcret=$?
|
||||
if [ "$arcret" -eq 1 ]; then
|
||||
printf 'FAIL %s (blocked, but the advice does not name %s)\n' "$why" "$remedy"
|
||||
fail=1
|
||||
continue
|
||||
fi
|
||||
[ "$arcret" -eq 0 ] || { fail=1; continue; }
|
||||
fi
|
||||
printf 'ok %s\n' "$why"
|
||||
done < "$FIXTURES"
|
||||
|
||||
Reference in New Issue
Block a user