Unclaimed files left in the canonical checkout. Inventory: canonical-cleanup-inventory.md (commit-as-evidence groups). detect-secrets scan clean on 2026-11-02: hits are sha256 pins, git object ids, test sentinels already in tracked tests and unit-file lines.
63 lines
3.0 KiB
Bash
Executable File
63 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Row 137 round 2 (Filbert's comment 28782): seat working.test and cli git-socket.test
|
||
# on the candidate, each singly, then one kill per new test. A kill edits working.mjs
|
||
# in place, runs working.test, which must fail on exactly the new test, and restores
|
||
# the file; the script checks the restored file's sha256 against the one it started with.
|
||
# Last, the whole seat suite. Not the full gate. Usage: r2-round.sh <worktree> <logdir>
|
||
set -uo pipefail
|
||
WT=$(cd "$1" && pwd -P); LOGS=$(mkdir -p "$2" && cd "$2" && pwd -P)
|
||
export TMPDIR="$HOME/darkwing-scratch/r137/tmp"; mkdir -p "$TMPDIR"
|
||
SRC="$WT/packages/seat/src/working.mjs"
|
||
SUM=$(sha256sum "$SRC" | cut -d' ' -f1)
|
||
restore() {
|
||
if [ -f "$SRC.orig" ]; then mv -f "$SRC.orig" "$SRC"; fi
|
||
[ "$(sha256sum "$SRC" | cut -d' ' -f1)" = "$SUM" ] || { echo "RESTORE_MISMATCH $SRC"; return 1; }
|
||
}
|
||
trap restore EXIT
|
||
echo "base $(git -C "$WT" rev-parse --short HEAD) working.mjs $SUM start $(date -u +%H:%M:%S)"
|
||
|
||
run() { # name package-dir test-file
|
||
local log="$LOGS/$1.log" start; start=$(date -u +%H:%M:%S)
|
||
(cd "$WT/$2" && timeout 600 node --test "tests/$3") > "$log" 2>&1
|
||
local rc=$?
|
||
echo "$1 rc=$rc $start-$(date -u +%H:%M:%S) $(grep -E 'ℹ (pass|fail|skipped) ' "$log" | tr '\n' ' ')"
|
||
return $rc
|
||
}
|
||
|
||
# probe name sed-expression changed-line test-name
|
||
probe() {
|
||
cp -p "$SRC" "$SRC.orig"
|
||
sed -i "$2" "$SRC"
|
||
if [ "$(grep -cF -- "$3" "$SRC")" != 1 ]; then echo "STOP $1: the edit didn't apply"; exit 1; fi
|
||
echo "$1 edit: $(grep -nF -- "$3" "$SRC" | sed 's/^\([0-9]*\):\s*/line \1: /')"
|
||
run "$1" packages/seat working.test.mjs
|
||
local rc=$? log="$LOGS/$1.log"
|
||
restore || exit 1
|
||
if [ $rc -ne 0 ] && grep -q '^ℹ fail 1$' "$log" && grep -qF "✖ $4" "$log"; then
|
||
echo "$1 KILLED: only \"$4\" failed"
|
||
else
|
||
echo "STOP $1: expected exactly that test to fail"; exit 1
|
||
fi
|
||
}
|
||
|
||
run seat-working packages/seat working.test.mjs || { echo "STOP seat-working"; exit 1; }
|
||
run cli-git-socket packages/cli git-socket.test.mjs || { echo "STOP cli-git-socket"; exit 1; }
|
||
|
||
probe kill-b1-patch-drift \
|
||
's/if (appliedId !== patch_id) refuse("patch-drift"/if (false) refuse("patch-drift"/' \
|
||
'if (false) refuse("patch-drift"' \
|
||
"a landing whose applied diff isn't the reviewed one refuses patch-drift and leaves no worktree"
|
||
probe kill-b2-against-root \
|
||
's/"merge-base", commit, "refs\/heads\/main"\])).ok) refuse("unrelated-history"/"merge-base", commit, "refs\/heads\/root"])).ok) refuse("unrelated-history"/' \
|
||
'"merge-base", commit, "refs/heads/root"])).ok) refuse("unrelated-history"' \
|
||
"once the root shares no history with a landed main, a push is checked against main, not the root"
|
||
|
||
# The whole seat suite once more, on the restored candidate.
|
||
start=$(date -u +%H:%M:%S)
|
||
(cd "$WT/packages/seat" && timeout 900 node --test tests/*.test.mjs) > "$LOGS/seat.log" 2>&1
|
||
rc=$?
|
||
echo "seat rc=$rc $start-$(date -u +%H:%M:%S) $(grep -E 'ℹ (pass|fail|skipped) ' "$LOGS/seat.log" | tr '\n' ' ')"
|
||
[ $rc -eq 0 ] || { echo "STOP seat"; exit 1; }
|
||
|
||
echo "ROUND_PASSED $(date -u +%H:%M:%S)"
|