volt: CHECK leg 4 reads HEAD's archive, not the worktree (Q142)
Leg 4 built its copy from the worktree, so a dirty tree broke the leg that exists to prove a copy grades itself. It now extracts wizard-work/quill from HEAD with git archive; legs 2 and 3 remain the worktree readings, and the script sets pipefail so a failed archive cannot read as an empty tarball.
This commit is contained in:
1 parent
54451e4f6d
commit
8216c2576e
1 file changed
+33
-24
@@ -12,6 +12,7 @@
|
||||
#
|
||||
# Exit codes: 0 all legs passed, 1 a leg failed, 2 a leg could not be graded.
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 2
|
||||
ROOT="$(pwd)"
|
||||
@@ -60,32 +61,40 @@ else
|
||||
failed=$((failed + 1))
|
||||
fi
|
||||
|
||||
# --- leg 4: a copy grades the copy, not this tree ----------------------------
|
||||
# --- leg 4: the COMMITTED artifact grades a copy of itself -------------------
|
||||
# The copy comes from HEAD (git archive), not from the worktree, so this leg is a
|
||||
# reading of the committed bytes and is unaffected by an uncommitted edit that
|
||||
# legs 2 and 3 already fault.
|
||||
mkdir -p "$WORK/lane" || exit 2
|
||||
cp "$LANE"/*.md "$LANE"/draft-compliance-report-2026-10-31.tsv \
|
||||
"$LANE"/draft_compliance_rule.py "$LANE/draft_compliance_report.py" \
|
||||
"$LANE/verify_draft_compliance.py" "$WORK/lane/" 2>/dev/null
|
||||
if python3 "$WORK/lane/verify_draft_compliance.py" >"$WORK/copy-clean.out" 2>&1; then
|
||||
clean_rc=0
|
||||
else
|
||||
clean_rc=$?
|
||||
fi
|
||||
# move one row's line count in the COPY's TSV: the copy must notice
|
||||
awk -F'\t' 'BEGIN{OFS="\t"} NR==3{$2=$2+1} {print}' \
|
||||
"$WORK/lane/draft-compliance-report-2026-10-31.tsv" >"$WORK/mut.tsv" \
|
||||
&& mv "$WORK/mut.tsv" "$WORK/lane/draft-compliance-report-2026-10-31.tsv"
|
||||
if python3 "$WORK/lane/verify_draft_compliance.py" >"$WORK/copy-mut.out" 2>&1; then
|
||||
mut_rc=0
|
||||
else
|
||||
mut_rc=$?
|
||||
fi
|
||||
if [ "$clean_rc" -eq 0 ] && [ "$mut_rc" -eq 1 ]; then
|
||||
row copy-parity "PASS clean copy rc=0, mutated copy rc=1"
|
||||
passed=$((passed + 1))
|
||||
else
|
||||
row copy-parity "FAULT clean copy rc=$clean_rc (want 0), mutated rc=$mut_rc (want 1)"
|
||||
head -5 "$WORK/copy-clean.out" "$WORK/copy-mut.out"
|
||||
if ! git -C "$ROOT" archive HEAD wizard-work/quill 2>"$WORK/archive.err" \
|
||||
| tar -x -C "$WORK/lane" 2>>"$WORK/archive.err"; then
|
||||
row copy-parity "FAULT cannot archive HEAD"
|
||||
cat "$WORK/archive.err"
|
||||
failed=$((failed + 1))
|
||||
else
|
||||
COPY="$WORK/lane/wizard-work/quill"
|
||||
if python3 "$COPY/verify_draft_compliance.py" >"$WORK/copy-clean.out" 2>&1; then
|
||||
clean_rc=0
|
||||
else
|
||||
clean_rc=$?
|
||||
fi
|
||||
# move one row's line count in the COPY's TSV: the copy must notice
|
||||
awk -F'\t' 'BEGIN{OFS="\t"} NR==3{$2=$2+1} {print}' \
|
||||
"$COPY/draft-compliance-report-2026-10-31.tsv" >"$WORK/mut.tsv" \
|
||||
&& mv "$WORK/mut.tsv" "$COPY/draft-compliance-report-2026-10-31.tsv"
|
||||
if python3 "$COPY/verify_draft_compliance.py" >"$WORK/copy-mut.out" 2>&1; then
|
||||
mut_rc=0
|
||||
else
|
||||
mut_rc=$?
|
||||
fi
|
||||
if [ "$clean_rc" -eq 0 ] && [ "$mut_rc" -eq 1 ]; then
|
||||
row copy-parity "PASS HEAD copy rc=0, mutated copy rc=1"
|
||||
passed=$((passed + 1))
|
||||
else
|
||||
row copy-parity "FAULT clean copy rc=$clean_rc (want 0), mutated rc=$mut_rc (want 1)"
|
||||
head -5 "$WORK/copy-clean.out" "$WORK/copy-mut.out"
|
||||
failed=$((failed + 1))
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
Reference in new issue
Block a user