Files
stack/agents/darkwing/work/s40-review/mut/mutate.py
T
jason.woltjeandClaude Opus 5.5 c31bb13d1e docs(review): row 40 slice 1 S5 round 2 review, changes (darkwing)
Candidate 5cbf22c0, comment 27001 on #1522. T1 blocks: the terminal's
input hold is drained by an earlier chunk's run, so text typed after
Ctrl-G then Ctrl-T is refused and cleared. Suites, probes and 16 mutants
(13 killed; the 3 survivors checked by hand) in the packet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 20:48:54 -05:00

28 lines
2.0 KiB
Python

# mutate.py <id>: apply one named mutant (exact text, must match once). Prints the file.
import sys
C = "packages/conversation/src/"; W = "packages/webui/src/"
M = {
"Ma-no-approve": (C + "pi-pin.mjs", '"--no-themes", "--no-approve"]', '"--no-themes"]'),
"Mb-seal-command": (C + "controller.mjs", "if (this.engine.sealed && (", "if (false && ("),
"Mc-engine-keys": (C + "controller.mjs", "if (extra !== undefined) throw", "if (false) throw"),
"Md-env-inherit": (C + "pi-pin.mjs", ' for (const k of [...ENGINE_ENV, ...envKeys]) if (typeof source[k] === "string") env[k] = source[k];', " Object.assign(env, source);"),
"Me-escalating": (C + "controller.mjs", " if (this.escalating === s.id) this.escalating = null;\n", ""),
"Mf-queue-catch": (C + "terminal.mjs", "this.queue.catch(() => {}).then(", "this.queue.then("),
"Mg-no-hold": (C + "terminal.mjs", " this.held = s.slice(i + 1);\n break;\n", ""),
"Mh-manager-env": (C + "cohort.mjs", "env: { ...manager, ...env }", "env"),
"Mi-bus-post": (W + "serve.mjs", " if (req.method !== 'GET') return json(res, 405, { error: 'method not allowed' });\n return busRead", " return busRead"),
"Mj-subject": (W + "serve.mjs", "if (!subjectOk(subject))", "if (false)"),
"Mk-copy-safe": (W + "public/bus.js", "SAFE.test(String(d.id)) && SAFE.test(String(o.key))", "true"),
"Ml-option-inert": (W + "public/bus.js", "${txt(o.text)}", "${o.text}"),
"Mm-timeout-kill": (W + "bus.mjs", "const timer = setTimeout(() => { child.kill('SIGKILL'); done(", "const timer = setTimeout(() => { done("),
"Mn-max-bytes": (W + "bus.mjs", "if (size > maxBytes)", "if (false)"),
"Mo-status": (W + "bus.mjs", "'human-required': 403,", "'human-required': 502,"),
"Mp-business-id": (W + "cli.mjs", "if (!ID_PATTERN.test(value)) throw", "if (false) throw"),
}
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)