Files
improvise/scripts/assemble-stamp.sh
T
Edward Langley 8af37d44a1 feat(ci): two conventions become gates (improvise-w8ih, improvise-4ktt)
The stamp gate is scripts/assemble-stamp.sh, taking FILE PATTERN pairs, and
scripts/assemble-stamp-test.sh is its check_the_checker. Deleting the final
`test -z "$missing"` makes four of its eight cases fail; before the extraction
that same deletion was invisible, both misses printing while assemble.sh exited
0. It is a separate script because exercising it inside assemble.sh would need a
fabricated web/pkg, which is a second answer to "what does the site assemble
from" (improvise-vvl3). Wired into the `build` job, first, because it needs
nothing and guards a step in that job.

web/tests/bundle_freedom.test.js refuses a flat web/tests/ file that names the
bundle directory -- the constraint keeping the `js` job at seconds rather than
~4m30s, stated in prose and checked by nothing. It scans its own filename too,
so it cannot become the place a violation hides, and its companion asserts
web/tests/bundle/ still holds a test that DOES use the bundle: a scoping rule is
uninteresting if nothing falls outside it.

Both faults were injected and watched to fail; evidence in
context/test-evidence/tooling.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FC2jVn8Au7E9JPkw6bwXXH
2026-09-20 21:11:08 -07:00

39 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# Every cache-bust stamp web/assemble.sh writes must be readable back.
#
# Usage: scripts/assemble-stamp.sh FILE PATTERN [FILE PATTERN ...]
#
# It RECORDS every miss and fails once at the end, naming all of them. Exiting
# on the first named one file and never reached the rest, so a shape change
# that broke two stamps cost two wasm-pack rebuilds to diagnose -- the slowest
# loop in this repo (improvise-x4wv).
#
# It lives here rather than inside assemble.sh because the gate is the whole
# guard and deleting it was invisible: both misses still printed and the
# assembly exited 0 (improvise-w8ih). Exercising it in assemble.sh would need a
# fabricated web/pkg, which is a second answer to "what does the site assemble
# from"; exercising it here needs nothing. scripts/assemble-stamp-test.sh is
# the check_the_checker, and CI runs it.
set -eu
test $# -ge 2 || { echo "usage: assemble-stamp.sh FILE PATTERN [FILE PATTERN ...]" >&2; exit 2; }
test $((($# % 2))) -eq 0 || { echo "assemble-stamp: FILE and PATTERN come in pairs" >&2; exit 2; }
missing=""
while [ $# -ge 2 ]; do
file=$1
pattern=$2
shift 2
if [ -f "$file" ] && grep -q "$pattern" "$file"; then
grep -n "$pattern" "$file"
else
echo "assemble: $file is missing the cache-bust stamp: $pattern" >&2
missing="${missing} $file"
fi
done
test -z "$missing" || {
echo "assemble: refusing to ship; unstamped:${missing}" >&2
exit 1
}