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
4.2 KiB
Bash
Executable File
63 lines
4.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Dewey's row 124 review runs, in Sage's slot. Usage: run.sh <r124 worktree>.
|
||
# 1. Every candidate test file plus the tests of the changed modules, one node --test at a time.
|
||
# 2. probes.mjs (p1 timestamp gap, p2 claude-code symlink/cut/oversize behaviour).
|
||
# 3. One mutant, d1: the claude-code project-directory open without O_NOFOLLOW, against transcript.test.mjs.
|
||
set -uo pipefail
|
||
WT=$(cd "$1" && pwd) || exit 2
|
||
OUT=$(cd "$(dirname "$0")" && pwd) || exit 2
|
||
mkdir -p "$OUT/single" "$OUT/mutants" "$OUT/backup" "$HOME/dewey-scratch/tmp/lt" || exit 2
|
||
export TMPDIR=$HOME/dewey-scratch/tmp
|
||
status=0
|
||
counts() { grep -E '^ℹ (tests|pass|fail|skipped) ' "$1" | awk '{printf "%s=%s ", $2, $3}'; }
|
||
check() { (cd "$WT" && sha256sum -c --quiet "$OUT/candidate-manifest.sha256"); }
|
||
echo "start $(date -u +%FT%TZ) head $(git -C "$WT" rev-parse --short HEAD)"
|
||
check || { echo "manifest check failed"; exit 2; }
|
||
for f in \
|
||
packages/bus/tests/usage.test.mjs packages/bus/tests/usage-broker.test.mjs packages/bus/tests/usage-runtime.test.mjs \
|
||
packages/bus/tests/usage-migration.test.mjs packages/bus/tests/schema.test.mjs packages/bus/tests/store.test.mjs \
|
||
packages/bus/tests/chief-of-staff.test.mjs packages/bus/tests/comment-migration.test.mjs packages/bus/tests/name-migration.test.mjs \
|
||
packages/bus/tests/spec-migration.test.mjs packages/bus/tests/thread-migration.test.mjs packages/bus/tests/broker.test.mjs \
|
||
packages/plugins/tests/transcript.test.mjs packages/harness/tests/runner.test.mjs packages/cli/tests/usage.test.mjs \
|
||
packages/webui/tests/usage.test.mjs packages/webui/tests/usage-browser.test.mjs packages/webui/tests/views.test.mjs \
|
||
packages/webui/tests/reads.test.mjs packages/cli/tests/launcher.test.mjs; do
|
||
[ -f "$WT/$f" ] || { echo "MISSING $f"; status=1; continue; }
|
||
log="$OUT/single/$(echo "$f" | tr / _).log"
|
||
if [ "$f" = packages/cli/tests/launcher.test.mjs ]; then
|
||
(cd "$WT" && TMPDIR=$HOME/dewey-scratch/tmp/lt setsid -w timeout -k 10 600 node --test --test-reporter=spec "$f") > "$log" 2>&1; rc=$?
|
||
else
|
||
(cd "$WT" && setsid -w timeout -k 10 600 node --test "$f") > "$log" 2>&1; rc=$?
|
||
fi
|
||
echo "$f rc=$rc $(counts "$log")"; [ $rc -eq 0 ] || status=1
|
||
done
|
||
(cd "$WT" && setsid -w timeout -k 10 120 node "$OUT/probes.mjs") > "$OUT/probes.log" 2>&1; echo "probes rc=$?"; cat "$OUT/probes.log"
|
||
T=packages/plugins/usage-source/transcript/index.mjs
|
||
# sage-0721: the output directory exists, the backup must succeed, and the restored file must match
|
||
# the candidate manifest before exit. The trap restores on any exit once the edit may have happened.
|
||
mkdir -p "$OUT/mutants" "$OUT/backup" || exit 2
|
||
want=$(awk -v f="$T" '$2 == f || $2 == "./" f {print $1}' "$OUT/candidate-manifest.sha256")
|
||
[ -n "$want" ] || { echo "d1: $T not in manifest"; exit 2; }
|
||
[ "$(sha256sum < "$WT/$T" | cut -d' ' -f1)" = "$want" ] || { echo "d1: $T differs from manifest before the edit"; exit 2; }
|
||
cp "$WT/$T" "$OUT/backup/d1" || { echo "d1: backup failed"; exit 1; }
|
||
cmp -s "$WT/$T" "$OUT/backup/d1" || { echo "d1: backup differs"; exit 1; }
|
||
restore() {
|
||
cp "$OUT/backup/d1" "$WT/$T" || { echo "d1: restore copy failed"; exit 1; }
|
||
[ "$(sha256sum < "$WT/$T" | cut -d' ' -f1)" = "$want" ] || { echo "d1: restored hash differs from manifest"; exit 1; }
|
||
echo "d1 restored, hash matches manifest"
|
||
}
|
||
trap 'trap - EXIT; restore' EXIT
|
||
python3 - "$WT/$T" <<'PY' || { echo "d1: edit refused"; exit 1; }
|
||
import sys, pathlib
|
||
p = pathlib.Path(sys.argv[1]); t = p.read_text()
|
||
old = 'const child = openSync(at(fd, entry.name), DIR);'
|
||
if t.count(old) != 1: sys.exit(f"{t.count(old)} matches")
|
||
p.write_text(t.replace(old, 'const child = openSync(at(fd, entry.name), constants.O_RDONLY | constants.O_DIRECTORY);'))
|
||
PY
|
||
(cd "$WT" && setsid -w timeout -k 10 300 node --test packages/plugins/tests/transcript.test.mjs) > "$OUT/mutants/d1.log" 2>&1; rc=$?
|
||
trap - EXIT; restore
|
||
if [ $rc -ne 0 ]; then echo "d1 caught: $(grep -m1 -E '^not ok' "$OUT/mutants/d1.log" | cut -c1-140)"; else echo "d1 SURVIVED (claude-code project-dir open has no symlink fixture)"; fi
|
||
check || { echo "manifest check failed after"; status=1; }
|
||
echo "dirty paths: $(cd "$WT" && git status --short | grep -v node_modules | wc -l)"
|
||
echo "end $(date -u +%FT%TZ) status=$status"
|
||
exit $status
|