Header sentence, line 13 wrap, bidi escapes in three files, inertCheck U+200E/U+200F. Patch and evidence only; the change is not applied to the tree. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
29 lines
1.9 KiB
Bash
29 lines
1.9 KiB
Bash
#!/usr/bin/env bash
|
||
# Row 102 (#1596) N4: inertCheck in bus-browser.test.mjs refuses U+200E and U+200F in shown text.
|
||
# Runs only that one test file, three times, from the row 102 worktree:
|
||
# control real bus.js, HOSTILE also carries U+200E U+200F, new inertCheck -> passes
|
||
# mutant bus.js UNSEEN no longer strips U+200E U+200F, same HOSTILE, new inertCheck -> fails in inertCheck
|
||
# gap same mutant, inertCheck as it was at HEAD -> passes (the hole N4 closes)
|
||
# Usage: n4-evidence.sh <worktree> <outdir> Restores every file it touches.
|
||
set -u
|
||
WT=$(cd "$1" && pwd); OUT=$2; mkdir -p "$OUT"
|
||
T=packages/webui/tests/bus-browser.test.mjs; B=packages/webui/src/public/bus.js
|
||
cd "$WT" || exit 2
|
||
BAK=$(mktemp -d "$OUT/.bak.XXXXXX")
|
||
cp "$T" "$BAK/test"; cp "$B" "$BAK/bus"
|
||
restore() { cp "$BAK/test" "$T"; cp "$BAK/bus" "$B"; rm -rf "$BAK"; }
|
||
trap restore EXIT
|
||
hostile() { node -e 'const f=process.argv[1],s=require("fs").readFileSync(f,"utf8");const o="evil\x27;";if(!s.includes(o))process.exit(3);require("fs").writeFileSync(f,s.replace(o,"evil\\u200e\\u200f\x27;"))' "$T"; }
|
||
strip() { node -e 'const f=process.argv[1],s=require("fs").readFileSync(f,"utf8");const o="\\u200e\\u200f\\u202a";if(!s.includes(o))process.exit(3);require("fs").writeFileSync(f,s.replace(o,"\\u202a"))' "$B"; }
|
||
oldcheck() { node -e 'const f=process.argv[1],s=require("fs").readFileSync(f,"utf8");const o="\\u200e\\u200f\\u202a";if(!s.includes(o))process.exit(3);require("fs").writeFileSync(f,s.replace(o,"\\u202a"))' "$T"; }
|
||
run() { # name
|
||
setsid -w timeout -k 10 240 node --test "$T" > "$OUT/$1.out" 2>&1; echo "$?" > "$OUT/$1.rc"
|
||
echo "$1: exit $(cat "$OUT/$1.rc"); $(grep -E '^(ℹ|#) (tests|pass|fail)' "$OUT/$1.out" | tr '\n' ' ')"
|
||
}
|
||
hostile || { echo "HOSTILE line not found"; exit 3; }
|
||
run control
|
||
strip || { echo "UNSEEN edit failed"; exit 3; }
|
||
run mutant
|
||
oldcheck || { echo "inertCheck edit failed"; exit 3; }
|
||
run gap
|