voyage/tests/fix-round-4-5b2-a-red.sh
2026-11-02 10:34:40 +01:00

68 lines
3.3 KiB
Bash

#!/usr/bin/env bash
# tests/fix-round-4-5b2-a-red.sh
# The red proof of fix round 4.5b2, part A (plan
# .claude/projects/2026-10-31-guard-4-5b2-part-a/plan.md, Step 5, 5b;
# decisions 91, 107 and 123), as a wrapper over the shared red script
# tests/helpers/red-round.sh. Every id of the round has tests whose names
# start with "[id]"; SFX, ESR, EVL, KIA and SIS must each fail on an assertion
# at the round's start point e2d6bec, and RXT, CNT and HDR, whose tests pass
# there, are proven red under their mutations.
# This wrapper passes the shared script:
# --base BASE, the full sha of e2d6bec;
# --ids IDS (the round's 8 ids);
# --other-ids: the ids of fix round 4-5a, of 4-5b part 1, of part 2, of
# part 3 and of part 4, read with sed from the IDS= lines of
# tests/fix-round-4-5a-red.sh, tests/fix-round-4-5b-red.sh,
# tests/fix-round-4-5b-part-2-red.sh, tests/fix-round-4-5b-part-3-red.sh
# and tests/fix-round-4-5b-part-4-red.sh and passed as ONE value, in that
# order (the shared script keeps only the last --other-ids it is given);
# a tag on that list is not judged;
# --mutations tests/fix-round-4-5b2-a-mutations.mjs (RXT-try, CNT-regex,
# HDR-header);
# the round's FILES: the two tagged test files. The keep file
# (tests/hooks/bash-guard-4-5b2-a-known.test.mjs) holds at e2d6bec by
# design and its tag is no red-proof id; the corpus test and the scripts
# test are untagged; none of the three is listed.
# No --require-sha256: the round has no SHA-256 test.
# Exit 0 all red, 1 a rule broken (the judge names it), 2 a setup failure
# (also: no ids on one of the five older IDS= lines); never 0 on a setup
# failure.
# bash 3.2 compatible, ASCII only, no arrays.
set -u
set -f
cd "$(dirname "$0")/.." || { echo "red script: setup failure: cannot cd to the repo root" >&2; exit 2; }
ROOT="$(pwd -P)"
BASE=e2d6beccb7ea38cb8d596b6a35bcad0232ae3ca1
IDS='RXT CNT SFX ESR EVL KIA HDR SIS'
FILES='tests/hooks/bash-guard-4-5b2-a.test.mjs tests/lib/fix-round-4-5b2-a-prose.test.mjs'
OTHER_A=$(sed -n "s/^IDS='\(.*\)'\$/\1/p" "$ROOT/tests/fix-round-4-5a-red.sh")
if [ -z "$OTHER_A" ]; then
echo "red script: setup failure: no ids on the IDS= line of $ROOT/tests/fix-round-4-5a-red.sh" >&2
exit 2
fi
OTHER_B=$(sed -n "s/^IDS='\(.*\)'\$/\1/p" "$ROOT/tests/fix-round-4-5b-red.sh")
if [ -z "$OTHER_B" ]; then
echo "red script: setup failure: no ids on the IDS= line of $ROOT/tests/fix-round-4-5b-red.sh" >&2
exit 2
fi
OTHER_C=$(sed -n "s/^IDS='\(.*\)'\$/\1/p" "$ROOT/tests/fix-round-4-5b-part-2-red.sh")
if [ -z "$OTHER_C" ]; then
echo "red script: setup failure: no ids on the IDS= line of $ROOT/tests/fix-round-4-5b-part-2-red.sh" >&2
exit 2
fi
OTHER_D=$(sed -n "s/^IDS='\(.*\)'\$/\1/p" "$ROOT/tests/fix-round-4-5b-part-3-red.sh")
if [ -z "$OTHER_D" ]; then
echo "red script: setup failure: no ids on the IDS= line of $ROOT/tests/fix-round-4-5b-part-3-red.sh" >&2
exit 2
fi
OTHER_E=$(sed -n "s/^IDS='\(.*\)'\$/\1/p" "$ROOT/tests/fix-round-4-5b-part-4-red.sh")
if [ -z "$OTHER_E" ]; then
echo "red script: setup failure: no ids on the IDS= line of $ROOT/tests/fix-round-4-5b-part-4-red.sh" >&2
exit 2
fi
exec /bin/bash "$ROOT/tests/helpers/red-round.sh" --base "$BASE" --ids "$IDS" --other-ids "$OTHER_A $OTHER_B $OTHER_C $OTHER_D $OTHER_E" --mutations "$ROOT/tests/fix-round-4-5b2-a-mutations.mjs" $FILES