voyage/tests/fix-round-4-5b2-a-mutations.mjs
2026-11-02 10:34:40 +01:00

62 lines
2.2 KiB
JavaScript

// tests/fix-round-4-5b2-a-mutations.mjs
// The mutations of fix round 4.5b2, part A (plan
// .claude/projects/2026-10-31-guard-4-5b2-part-a, Step 5, 5a; decisions 91,
// 107 and 123), for the shared red script (tests/helpers/red-round.sh,
// through tests/helpers/red-mutate.mjs).
// An id named here has tests that pass at the round's start point e2d6bec and
// is proven red under its mutations instead:
// - RXT: the try already holds the regex reading's escape limit at e2d6bec
// (the round adds only its test, which forces an error there through a
// preload); the mutation opens the try after the regex reading, in
// e2d6bec's hook, so that error escapes it.
// - CNT: the first-<< search already takes a line continuation between the
// two < at e2d6bec; the mutation drops that branch, in e2d6bec's hook.
// - HDR: the false-stops header is corrected in the working tree's tests/
// that the script copies into the clone; the mutation puts the wrong red
// base back.
// Every span must match exactly once in the clone (e2d6bec's code with the
// working tree's tests/). Data only; never matched by `npm test`.
export const MUTATIONS = [
{
key: 'RXT-try',
id: 'RXT',
what: 'the try opens after the regex reading',
spans: [
{
file: 'hooks/scripts/pre-bash-executor.mjs',
find: ' let argsVerdict = null;\n try {\n',
replace: ' let argsVerdict = null;\n',
},
{
file: 'hooks/scripts/pre-bash-executor.mjs',
find: ' let bodyFrom = Infinity;\n',
replace: ' try {\n let bodyFrom = Infinity;\n',
},
],
},
{
key: 'CNT-regex',
id: 'CNT',
what: 'the first-<< search loses its continuation branch',
spans: [
{
file: 'hooks/scripts/pre-bash-executor.mjs',
find: 'const h = /<(?:\\\\\\n)*</.exec(text);',
replace: 'const h = /<</.exec(text);',
},
],
},
{
key: 'HDR-header',
id: 'HDR',
what: 'the false-stops header names the wrong red base again',
spans: [
{
file: 'tests/hooks/bash-guard-false-stops.test.mjs',
find: 'loads at 591f3c4',
replace: 'loads at 12bca8b',
},
],
},
];