Files
stack/agents/darkwing/work/slice1-s1/mutants-r2.sh
T
jason.woltjeandClaude Opus 5.5 d9568cec98 docs(slice1): row 36 S1 round 2 packet (darkwing)
Answers Filbert's round 1 (#1518 comment 26724): launch.by must hold
role.launch, launch is null when limits.authority drops it, a test for
cross-role narrowing, and the business file checked on its open
descriptor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 22:55:37 -05:00

22 lines
1.9 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Round 2 mutants: each edits one source file in a copy, runs the business tests, restores.
cd ~/darkwing-scratch/s1-mut
export TMPDIR=~/darkwing-scratch/tmp
run() { # name file python-replace-old python-replace-new
local name=$1 file=$2
cp "$file" "$file.orig"
python3 -c "import sys;p=sys.argv[1];s=open(p).read();o=sys.argv[2];n=sys.argv[3];assert o in s,'pattern missing';open(p,'w').write(s.replace(o,n,1))" "$file" "$3" "$4" || { echo "$name: PATTERN MISSING"; mv "$file.orig" "$file"; return; }
local fails
fails=$(node --test packages/business/tests/ 2>&1 | sed -n 's/^ℹ fail //p')
mv "$file.orig" "$file"
if [ "${fails:-0}" -gt 0 ]; then echo "$name: killed ($fails)"; else echo "$name: SURVIVED"; fi
}
run R1-launcher-role-check-off packages/business/src/business.mjs 'if (!launcher.authority.withinRole.includes("role.launch")) {' 'if (false) {'
run R2-launch-ignores-narrowing packages/business/src/resolve.mjs ' && withinRole.includes("role.launch") ?' ' ?'
run R3-filbert-M3-crossRole-not-narrowed packages/business/src/resolve.mjs ' crossRole = crossRole.filter((a) => vars["limits.authority"].includes(a));' ''
run R4-stat-check-skipped packages/business/src/util.mjs ' checkStat?.(stat);' ''
run R5-stat-check-after-parse packages/business/src/util.mjs $' checkStat?.(stat);\n text = readFileSync(fd, "utf8");\n } finally {\n closeSync(fd);\n }\n try {\n return JSON.parse(text);' $' text = readFileSync(fd, "utf8");\n } finally {\n closeSync(fd);\n }\n try {\n const parsed = JSON.parse(text); checkStat?.(fstatSync(openSync(file, "r"))); return parsed;'
run R6-follows-links packages/business/src/util.mjs ' | constants.O_NOFOLLOW' ''
run R7-not-regular-accepted packages/business/src/util.mjs ' if (!stat.isFile()) refuse' ' if (false) refuse'
run R8-fifo-blocks packages/business/src/util.mjs ' | constants.O_NONBLOCK' ''