Files
improvise/scripts/assemble-stamp.sh
T
Edward Langley 1d4d9107cf fix(tooling): three findings from reviewing this branch against itself
1. A self-test case that was a duplicate wearing different clothes. "a heading
cargo's listing does not carry is an orphan however the source reads" passed on
an empty listing -- which is the first case in the table, already. Once defined
comes from cargo, the Rust beside a fixture is not read at all, so four cases
for the four source shapes would be four copies of one assertion dressed as
coverage. Deleted; the evidence for those shapes is the real-tree injection, and
context/code/tooling.md now says which half a fixture can carry and which it
cannot. This is exactly the shape improvise-84wp's prose, applied two commits
ago, tells a reviewer to look for.

2. assemble-stamp.sh grepped its patterns as REGEXES, inherited from the inline
version it was extracted from. The `.` in improvise_wasm_client.js?v=abc matches
any character, so a stamp corrupted in that position read as present -- a pass in
the one direction a guard must not fail in. grep -F, plus a case proved by
injection: dropping the -F flips it.

3. A missing cargo raised a traceback out of --check-evidence. It now names the
flag that takes a saved listing instead.

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

41 lines
1.6 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
# -F, because every pattern is a literal and `.` as "any character" would
# let a corrupted stamp match -- a pass in the direction that looks like one.
if [ -f "$file" ] && grep -qF "$pattern" "$file"; then
grep -nF "$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
}