diff --git a/.crumb b/.crumb
index c76f02f9b..31082ea69 100644
--- a/.crumb
+++ b/.crumb
@@ -94,26 +94,26 @@
},
{
"digest": "c2187196e3d4e2a28000d45435ca7fc73e5af9966aa3ce3e9094b84973971db8",
- "last_commit": "de7e72e",
+ "last_commit": "a76a010",
"name": "tests",
"purpose": "Directory tests. Purpose not yet described by a human."
},
{
- "digest": "cd1b75fea968e8ce72acd897667b41af226eed0c1b8ed3a7e67d71e5388585d1",
- "last_commit": "de7e72e",
+ "digest": "ff24f7b12ceb0448c4da80d43e8ff249a3176ad3b374c3c27cc71e537ba66a00",
+ "last_commit": "a76a010",
"name": "tools",
"purpose": "Directory tools. Purpose not yet described by a human."
}
],
- "children_root": "sha256:a1d17947cddbdaa0c40ee288a40abe396a6cf9a6ce57fd84e91fe9e77e0f2404",
- "compiled_at": "2026-10-06T14:53:35Z",
+ "children_root": "sha256:65ac921169f731711e240dc032e28191d46fd298aaf54aeb76d961bac7bbf390",
+ "compiled_at": "2026-10-06T18:54:05Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:783ee23e4d61ab72031bc0ed7253398569c7ab32c1f4e5acefd064878865fb59",
+ "digest": "sha256:3e3aca21865587866509da09ce3f67d9a1dda87a71640cba0095467077eafeff",
"evidence_files": 4743,
"evidence_root": "sha256:34547c38b5669eb80fad819b39b679c1b425c66bc3e69d11431d684390b900e9",
"files": 6579,
- "generated_at_commit": "0dc41787bfc74b6fa965a9ea99051c936d678fc8",
- "source_tree": "sha256:bb23a3b914c0ac66ca6e6b2a45c16648e935d2ff2cf3931a739dbf97ca8a42b0"
+ "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed",
+ "source_tree": "sha256:0ba2f92be88283d807dea7027c98c8c98720ae7e41f77fc492a40733a745444a"
},
"owner_lane": "",
"provenance": {
diff --git a/tools/.crumb b/tools/.crumb
index d1f0be3fc..a1d587066 100644
--- a/tools/.crumb
+++ b/tools/.crumb
@@ -56,14 +56,14 @@
}
],
"children_root": "sha256:8a042dc49a250f0d1b7ae1358fc70bf7bdc9eff651a5ff7c9ee41fd49d329041",
- "compiled_at": "2026-10-06T14:35:34Z",
+ "compiled_at": "2026-10-06T18:54:05Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:cd1b75fea968e8ce72acd897667b41af226eed0c1b8ed3a7e67d71e5388585d1",
+ "digest": "sha256:ff24f7b12ceb0448c4da80d43e8ff249a3176ad3b374c3c27cc71e537ba66a00",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"files": 137,
- "generated_at_commit": "de7e72ece2c55f53ed3b8ddbbeed5461e1123ae2",
- "source_tree": "sha256:50ddbb0c1517a9997b7dba7c982e52d6bb3174fe3f4d2e5899cb63a342cb0412"
+ "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed",
+ "source_tree": "sha256:3d545c18e409b44f2cc8d0d4d8fabfe622fbb3872c93a9bc7e457458747a6d1d"
},
"owner_lane": "",
"provenance": {
diff --git a/tools/chipwait_campaign.sh b/tools/chipwait_campaign.sh
index 73a590f10..d84db4cee 100755
--- a/tools/chipwait_campaign.sh
+++ b/tools/chipwait_campaign.sh
@@ -59,6 +59,14 @@ if [ -e "$cdir/campaign.json" ] || compgen -G "$cdir/run-00*" > /dev/null; then
echo "chipwait_campaign: $cdir already holds campaign.json or a run-00N entry; refusing to reuse it" >&2
exit 2
fi
+# Lane receipt guard (omega #315): m19r_qualify.sh runs `make clean`, which removes
+# build/qual-runs. Refuse while an earlier window lane's receipt (WINDOW_LANE_OUT, the
+# window directory a ladder keeps .lane-guard/ and R11-living/ in) or any R11 receipt in
+# the build directory m19r_qualify.sh cleans is unarchived. Nothing is created first.
+. "$HERE/window_lane_guard.sh" || exit 2
+build_dir=${CHIPWAIT_BUILD_DIR:-$(realpath -m "$HERE/../${OUT_DIR:-build}")}
+wl_guard_build "${WINDOW_LANE_OUT:-}" chipwait "$build_dir" || {
+ echo "chipwait_campaign: lane receipt guard refused (see above); nothing was run" >&2; exit 2; }
mkdir -p "$cdir" || { echo "chipwait_campaign: cannot create $cdir" >&2; exit 2; }
runner_sha=$(git -C "$HERE" rev-parse HEAD 2> /dev/null || echo unknown)
diff --git a/tools/test_chipwait_campaign.sh b/tools/test_chipwait_campaign.sh
index 0e182fe18..04f9e5ed4 100755
--- a/tools/test_chipwait_campaign.sh
+++ b/tools/test_chipwait_campaign.sh
@@ -25,6 +25,8 @@ while [ $# -gt 0 ]; do
shift
done
n=${id#run-}; n=$((10#$n))
+# STUB_CLEAN=1: what m19r_qualify.sh does to build/ (make clean), on CHIPWAIT_BUILD_DIR.
+[ "${STUB_CLEAN:-0}" = 1 ] && rm -rf "$CHIPWAIT_BUILD_DIR"
[ -e "$root/campaign.json" ] && echo "$id saw campaign.json" >> "$root/../stub-order.log" ||
echo "$id NO campaign.json" >> "$root/../stub-order.log"
echo "stub stdout $id"; echo "stub stderr $id" >&2
@@ -38,6 +40,8 @@ printf '{"status":"%s"}\n' "$s" > "$root/$id/verdict.json"
STUBEOF
chmod +x "$STUB"
export CHIPWAIT_QUALIFY=$STUB
+# The build directory the lane receipt guard inspects (never the real build/ here).
+export CHIPWAIT_BUILD_DIR=$TMP/build; unset WINDOW_LANE_OUT
S40=$(printf 'a%.0s' $(seq 40)); P40=$(printf 'b%.0s' $(seq 40))
run() { # run
[extra args]; sets rc
local d=$1; shift
@@ -95,6 +99,34 @@ check "unknown flag" '"$CW" --bogus > /dev/null 2>&1; [ $? = 2 ]'
check "error text on stderr" '"$CW" --runs 0 2>&1 >/dev/null | grep -q usage'
check "bad usage created no campaign dir" '[ ! -e "$TMP/b1" ] && [ ! -e "$TMP/b2" ]'
+echo "lane receipt guard (omega #315): R11 evidence is archived before the make-clean lane"
+B=$CHIPWAIT_BUILD_DIR; WD=$TMP/window
+mkdir -p "$B/qual-runs/r16/R11" "$B/qual-runs/r11/R11"
+printf '{"gate":"PASS","from":"R16 ladder rung"}\n' > "$B/qual-runs/r16/R11/rx_aien_faculty_receipt.json"
+printf '{"gate":"PASS","from":"r11 lane"}\n' > "$B/qual-runs/r11/R11/rx_aien_faculty_receipt.json"
+s16=$(sha256sum "$B/qual-runs/r16/R11/rx_aien_faculty_receipt.json" | cut -c1-64)
+s11=$(sha256sum "$B/qual-runs/r11/R11/rx_aien_faculty_receipt.json" | cut -c1-64)
+c=$TMP/g1; STUB_CLEAN=1 run "$c"
+check "no WINDOW_LANE_OUT, R11 receipts in build: refused (exit 2)" '[ $rc = 2 ]'
+check "refusal names the R11 receipt" 'grep -q "REFUSED: lane chipwait would clean .* R11 receipt" "$TMP/err.log"'
+check "refused before anything ran: no campaign dir, receipts intact" '[ ! -e "$c" ] && [ -s "$B/qual-runs/r16/R11/rx_aien_faculty_receipt.json" ] && [ -s "$B/qual-runs/r11/R11/rx_aien_faculty_receipt.json" ]'
+( . "$HERE/tools/window_lane_guard.sh"; wl_begin "$WD" r11; wl_r11_archive "$WD" "$B" )
+c=$TMP/g2; WINDOW_LANE_OUT=$WD STUB_CLEAN=1 run "$c"
+check "only the newest R11 receipt archived: still refused" '[ $rc = 2 ] && [ ! -e "$c" ] && [ -d "$B" ]'
+( . "$HERE/tools/window_lane_guard.sh"; wl_begin "$WD" ladder )
+( . "$HERE/tools/window_lane_guard.sh"; wl_r11_archive_all "$WD" "$B" )
+c=$TMP/g3; WINDOW_LANE_OUT=$WD STUB_CLEAN=1 run "$c"
+check "a pending ladder lane is refused by name" '[ $rc = 2 ] && grep -q "lane ladder has an unarchived receipt" "$TMP/err.log"'
+( . "$HERE/tools/window_lane_guard.sh"; wl_no_receipt "$WD" ladder )
+c=$TMP/g4; WINDOW_LANE_OUT=$WD STUB_CLEAN=1 run "$c"
+check "everything archived: the campaign runs (exit 0)" '[ $rc = 0 ] && [ "$(verdict "$c")" = PASS ]'
+check "the campaign's clean removed build/" '[ ! -e "$B" ]'
+check "both R11 receipts survive under their sha256 names" 'cmp -s "$WD/R11-living/rx_aien_faculty_receipt.$s16.json" <(printf "{\"gate\":\"PASS\",\"from\":\"R16 ladder rung\"}\n") && cmp -s "$WD/R11-living/rx_aien_faculty_receipt.$s11.json" <(printf "{\"gate\":\"PASS\",\"from\":\"r11 lane\"}\n")'
+mkdir -p "$B/qual-runs/r11/R11"; printf '{"gate":"FAIL","from":"a later r11 run"}\n' > "$B/qual-runs/r11/R11/rx_aien_faculty_receipt.json"
+c=$TMP/g5; WINDOW_LANE_OUT=$WD STUB_CLEAN=1 run "$c"
+check "a new, different R11 receipt is not covered by an old archive: refused" '[ $rc = 2 ] && [ ! -e "$c" ] && [ -s "$B/qual-runs/r11/R11/rx_aien_faculty_receipt.json" ]'
+rm -rf "$B"
+
echo "nothing deleted"
find "$TMP" -type f | sort > "$TMP/files.before"
run "$TMP/after-all" ; run "$TMP/fail" ; run "$TMP/inc"
diff --git a/tools/window_lane_guard.sh b/tools/window_lane_guard.sh
index 6f8543171..08f63455c 100644
--- a/tools/window_lane_guard.sh
+++ b/tools/window_lane_guard.sh
@@ -3,6 +3,9 @@
# . "$(dirname "$0")/window_lane_guard.sh" (or from tools/ in the omega worktree)
# It keeps a lane's receipts from being lost when a later lane runs `make clean`
# (tools/m19r_qualify.sh does, and removes build/ with every receipt in build/qual-runs).
+# tools/chipwait_campaign.sh (the chipwait lane) sources this file and calls wl_guard_build
+# before every campaign; a ladder exports WINDOW_LANE_OUT= and archives its R11
+# receipts (wl_r11_archive / wl_r11_archive_all) first, or the campaign refuses (exit 2).
#
# wl_begin declare that will produce receipts that must be archived
# wl_archive copy to /.. (never overwrites,
@@ -10,6 +13,9 @@
# wl_no_receipt mark archived when it produced no receipt (explicit, logged)
# wl_r11_archive the r11 lane: archive the newest R11 receipt written by this run
# into /R11-living/ under its sha256 name
+# wl_r11_archive_all archive every R11 receipt under /qual-runs
+# wl_guard_build wl_guard_clean plus: refuse while any R11 receipt in
+# /qual-runs is unarchived (chipwait_campaign.sh calls it)
# wl_guard_clean call before any lane that runs `make clean`: returns 2 and says
# which lane while an earlier lane's receipt is still unarchived
#
@@ -54,3 +60,34 @@ wl_guard_clean() { # out lane
done
[ "$bad" = 0 ] || return 2
}
+
+# wl_r11_archive_all : archive EVERY R11 receipt under /qual-runs
+# (the ladder lane's R16 rung and the r11 lane both write one) into /R11-living/.
+wl_r11_archive_all() { # out build_dir
+ local out=$1 b=$2 f n=0
+ for f in "$b"/qual-runs/*/R11/rx_aien_faculty_receipt.json; do
+ [ -e "$f" ] || continue
+ wl_archive "$out" r11 "$f" "$out/R11-living" || return 1; n=$((n + 1))
+ done
+ [ "$n" -gt 0 ] || { echo "wl_r11_archive_all: no R11 receipt under $b/qual-runs" >&2; return 1; }
+}
+
+# wl_guard_build : called by tools/chipwait_campaign.sh (whose
+# m19r_qualify.sh runs `make clean`) before anything is cleaned. Returns 2 when
+# * is set and an earlier lane's receipt is unarchived (wl_guard_clean), or
+# * any R11 receipt under /qual-runs has no byte-identical copy under
+# /R11-living/ (or is empty): the clean would destroy R11 evidence.
+wl_guard_build() { # out lane build_dir
+ local out=$1 lane=$2 b=$3 f sha bad=0
+ if [ -n "$out" ]; then wl_guard_clean "$out" "$lane" || bad=1; fi
+ for f in "$b"/qual-runs/*/R11/rx_aien_faculty_receipt.json; do
+ [ -e "$f" ] || continue
+ sha=$(sha256sum "$f" | cut -c1-64)
+ if [ -z "$out" ] || [ ! -f "$out/R11-living/rx_aien_faculty_receipt.$sha.json" ]; then
+ echo "REFUSED: lane $lane would clean $b while R11 receipt $f (sha256 $sha) is unarchived;" \
+ "set WINDOW_LANE_OUT= and run wl_r11_archive_all $b first" >&2
+ bad=1
+ fi
+ done
+ [ "$bad" = 0 ] || return 2
+}