Files
stack/agents/darkwing/work/queue-54-review/r1/mut/mutate.py
T
jason.woltjeandClaude Opus 5.5 8a3ded5335 review(row54): round 1 packet, changes (darkwing)
Review of #1543 candidate dba2429e: gate green with Docker, 31 mutants
(26 killed), Node, import and Chromium probes. Posted as comment 27186.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-10 15:47:54 -05:00

54 lines
4.0 KiB
Python

# Row 54 round 1 mutants: exact text, must match once. Run from the worktree root.
import sys
A = "packages/webui/src/public/app.js"
B = "packages/webui/src/public/bus.js"
R = "packages/webui/src/reads.mjs"
V = "packages/webui/src/serve.mjs"
C = "packages/webui/src/cli.mjs"
Q = "packages/queue/src/store.mjs"
M = {
# my four items
"D01": [(B, " clearTimeout(timer);\n const route = routeOf()", " const route = routeOf()")],
"D02": [(B, ", h1: view.contains(a) && a.tagName === 'H1'", "")],
"D03": [(B, " else if (k.h1) $('bus-view').querySelector('h1')?.focus({ preventScroll: true });\n", "")],
"D04": [(A, " $('conv-pick').replaceChildren();", "")],
"D05": [(A, " if (focused && document.activeElement === document.body) $('main').focus();\n", "")],
"D06": [(A, "if (focused && document.activeElement === document.body)", "if (document.activeElement === document.body)")],
# redaction and projection
"D07": [(R, r"""return s.replace(/(^|[\s('"`=,[{])\/[^\s'"`),;\]}]+/g, '$1<path>').replace(""", "return s.replace(")],
"D08": [(R, r""".replace(/(?<![\w.-])\d{17,20}(?![\w.-])/g, '<id>')""", "")],
"D09": [(R, "let s = unquote(String(text));", "let s = String(text);")],
"D10": [(R, "for (const [re, label] of known) s = s.replace(re, label);", "")],
"D11": [(R, "return scrub({ rows: doc.rows.map(queueSummary), notes: doc.notes, at: new Date(now()).toISOString() }, redact);", "return { rows: doc.rows.map(queueSummary), notes: doc.notes, at: new Date(now()).toISOString() };")],
"D12": [(R, "return scrub({ row, notes: doc.notes, at: new Date(now()).toISOString() }, redact);", "return { row, notes: doc.notes, at: new Date(now()).toISOString() };")],
"D13": [(R, "vars: pick(b.vars, VAR_KEYS)", "vars: b.vars")],
"D14": [(R, "vars: pick(r.vars, AGENT_KEYS)", "vars: r.vars")],
"D15": [(R, "return { service, account, role, dateKind, date, state: credentialState(service, date, now) };", "return { ...ref, service, account, role, dateKind, date, state: credentialState(service, date, now) };")],
"D16": [(R, "const fail = (code, message) => new ReadError(code, redact(message));", "const fail = (code, message) => new ReadError(code, message);")],
"D17": [(R, "return scrub({ release, business: id, notifier, at: new Date(now()).toISOString() }, redact);", "return { release, business: id, notifier, at: new Date(now()).toISOString() };")],
"D18": [(C, "(${redactor({ configDir: configDir() })(err.message)})", "(${err.message})")],
# queue child
"D19": [(R, "if (status === 2) return", "if (status === 3) return")],
"D20": [(R, "if (size > maxBytes) {", "if (false) {")],
"D21": [(R, "}, timeoutMs);", "}, timeoutMs * 1000);")],
"D22": [(R, "if (!state?.live) throw", "if (!state) throw")],
# routes
"D23": [(V, " if (req.method !== 'GET') return json(res, 405, { error: 'method not allowed' });\n const a = server.address()", " const a = server.address()")],
"D24": [(V, r"const QUEUE_ID = /^[1-9]\d{0,5}$/;", r"const QUEUE_ID = /^\d+$/;")],
"D25": [(V, " if (!reads) return json(res, 503, { error: 'not-configured', message: 'the Console has no reads configured' });\n", "")],
# views
"D26": [(B, "['not-configured', 'no-bus-host', 'queue-refused'].includes(err.code)", "['not-configured', 'no-bus-host'].includes(err.code)")],
"D27": [(B, "html = failedView(err) + (path === '/settings' ? appearance() : '');", "html = failedView(err);")],
"D28": [(B, "...decisions, ...tasks, ...rows];", "...decisions, ...tasks];")],
"D29": [(B, ", mirror: view.contains(a) ? a.dataset?.mirror : null", "")],
"D30": [(B, "if (m) { const src = $(m.dataset.mirror); src.value = m.value; src.dispatchEvent(new Event('change')); return; }", "if (m) return;")],
# store
"D31": [(Q, "return { rows: rowsArray(r.state), err: r.notes, code: 0 };", "return { rows: rowsArray(r.state), err: [], code: 0 };")],
}
for f, old, new in 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(sys.argv[1], "applied")