#!/bin/bash # Row 58 (#1547) mutants. Each edits one source file in the build worktree, runs the test file that # should fail it, then restores the file from the worktree index, which holds the candidate. Only # the one test file runs, since other seats' suites shared the machine; the gate runs every suite. export TMPDIR=~/darkwing-scratch/r58/tmp cd ~/darkwing-scratch/r58/wt B=packages/bus/src/broker.mjs; W=packages/webui/src/public/bus.js BT=packages/bus/tests/task-read.test.mjs; WE=packages/webui/tests/bus.test.mjs; WB=packages/webui/tests/bus-browser.test.mjs run() { # name file sed-expr test-file sed -i "$3" "$2" if git diff --quiet -- "$2"; then echo "$1: MUTATION DID NOT APPLY"; return; fi env -u NODE_TEST_CONTEXT node --test --test-timeout=60000 "$4" > ~/darkwing-scratch/r58/tmp/mut-$1.log 2>&1 echo "$1: rc=$? $(grep -E '^ℹ (pass|fail) ' ~/darkwing-scratch/r58/tmp/mut-$1.log | tr '\n' ' ')" grep -E '^✖ ' ~/darkwing-scratch/r58/tmp/mut-$1.log | sed 's/ ([0-9.]*ms)$//; s/^/ /' | sort -u | head -4 git checkout -q -- "$2" } # The broker's 'tasks' rows. run tasks-verb-unchanged $B 's/ if (verb === .tasks.) return this.#taskRows(s.business);/ if (verb === "tasks") return this.#store.all("SELECT * FROM task_current WHERE business=? ORDER BY task_ref", s.business).map((r) => ({ ...r, fields: JSON.parse(r.fields) }));/' $BT run no-priority $B 's/ const priority = fields.priority ?? null;/ const priority = null;/' $BT run zero-priority-null $B 's/ const priority = fields.priority ?? null;/ const priority = fields.priority || null;/' $BT run tombstone-priority-zero $B 's/ const priority = fields.priority ?? null;/ const priority = fields.priority ?? 0;/' $BT run requirement-by-ref $B "s/ const taskId = (ref) => ref.slice(ref.indexOf('\/') + 1);/ const taskId = (ref) => ref;/" $BT run requirement-last-wins $B 's/ if (!requirement.has(taskId(e.subject))) requirement.set/ requirement.set/' $BT run requirement-any-business $B "s/ FROM events WHERE business=? AND kind='task.created' ORDER BY seq\",/ FROM events WHERE (business=? OR 1) AND kind='task.created' ORDER BY seq\",/" $BT run requirement-undefined $B 's/requirement: requirement.get(taskId(r.task_ref)) ?? null }/requirement: requirement.get(taskId(r.task_ref)) }/' $BT run task-view-adds-keys $B 's/ const parse = (r) => ({ ...r, fields: JSON.parse(r.fields) });/ const parse = (r) => ({ ...r, fields: JSON.parse(r.fields), priority: null, requirement: null });/' $BT # The endpoint passes both keys through. run endpoint-drops-keys $B 's/ return { ...r, fields, priority, requirement: requirement.get(taskId(r.task_ref)) ?? null };/ return { ...r, fields };/' $WE # The Tasks view. run list-requirement-from-trail $W 's/ requirement: row.requirement ?? created?.body?.requirement ?? null,/ requirement: created?.body?.requirement ?? null,/' $WB run no-requirement-column $W "s/\['Task', 'Requirement', 'Assignees'/['Task', 'Assignees'/; s|