R1 and R3 block: a late broker reply shifts later replies on the host IPC channel, and a dangling workspace symlink passes the gate. R2 (close waits on an open launch.sock client) should be fixed in the same round. Probes, mutants and suite outputs alongside. Comment 26995 on #1523, queue rev 247. Co-Authored-By: Claude Opus 5.5 <[email protected]>
41 lines
2.3 KiB
Python
41 lines
2.3 KiB
Python
# mutate.py <file> <id>: apply one named mutant (exact text, must match once).
|
|
import sys
|
|
M = {
|
|
"Ma-late-signals": ("packages/harness/src/runner.mjs",
|
|
' process.on("SIGTERM", stop);\n process.on("SIGINT", stop);\n\n let session, cap;',
|
|
' let session, cap;', ),
|
|
"Mb-runs-set-early": ("packages/bus/src/broker.mjs",
|
|
" const session = { ...record, address: record.address ?? null, human: false };\n",
|
|
" const session = { ...record, address: record.address ?? null, human: false };\n this.#runs.set(key, session);\n"),
|
|
"Mc-no-run-ended": ("packages/bus/src/broker.mjs",
|
|
" fail('run-ended');\n } else", " void 0;\n } else"),
|
|
"Md-no-instance-running": ("packages/cli/src/launcher.mjs",
|
|
' if (registry.running(b.id, instance)) throw new Refusal("instance-running");\n', ""),
|
|
"Me-no-authorize": ("packages/cli/src/launcher.mjs",
|
|
' await host.op({ op: "authorizeLaunch", cap, instance });\n', ""),
|
|
"Mf-no-exit2-wrapper": ("packages/harness/src/bundle.mjs",
|
|
"${quote(files.policy)} || exit 2`", "${quote(files.policy)}`"),
|
|
"Mg-no-founder-check": ("packages/harness/src/runner.mjs",
|
|
" const found = FOUNDER_ENV.filter((k) => env[k] !== undefined);", " const found = [];"),
|
|
"Mh-no-close-sigkill": ("packages/cli/src/launcher.mjs",
|
|
' if (startTimeOf(s.pid) === s.startTime) process.kill(s.pid, "SIGKILL");', " void 0;"),
|
|
"Mi-recover-no-kill": ("packages/cli/src/launcher.mjs",
|
|
' process.kill(s.pid, "SIGKILL");', " void 0;"),
|
|
"Mj-no-stdin-cap": ("packages/harness/src/runner.mjs",
|
|
" if (input.length > 4096) reject", " if (false) reject"),
|
|
"Mk-launch-line-max": ("packages/cli/src/launcher.mjs",
|
|
" if (buf.length > LINE_MAX) return reply", " if (false) return reply"),
|
|
"Ml-gate-pattern": ("packages/harness/src/gate.mjs",
|
|
"/(^|[/\\\\])\\.\\.([/\\\\]|$)/.test(pattern)", "false"),
|
|
"Mm-no-revoke": ("packages/bus/src/broker.mjs",
|
|
" fail('launch-revoked');", " void 0;"),
|
|
"Mn-recover-no-end": ("packages/cli/src/launcher.mjs",
|
|
' await endRun(s.run, "host-lost", null);\n', ""),
|
|
}
|
|
f, old, new = M[sys.argv[1]]
|
|
s = open(f).read()
|
|
n = s.count(old)
|
|
if n != 1: sys.exit(f"{sys.argv[1]}: {n} matches in {f}")
|
|
open(f, "w").write(s.replace(old, new))
|
|
print(f)
|