refactor: simplify pass (trekexecute)

Decision 41's rerun is scoped to below plan_version 1.8 in the executor and Handover 4 (as the helper and the exit-2 row already say), the decision-30 sentence names the one exception, and the Fixed and Known-issues slicers share one subsection helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-14 18:45:25 +02:00
commit 3abf3d7238
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
3 changed files with 8 additions and 17 deletions

View file

@ -324,17 +324,18 @@ test('CHANGELOG: parseDoors reads the Unreleased section\'s door lines, none bad
`one door line names plan_version 1.9: ${JSON.stringify(d.entries.map((e) => e.text))}`);
});
// The Unreleased section's `### Known issues` body, up to the next heading.
const knownIssues = (body) => {
// A `### <name>` body of the Unreleased section, up to the next heading.
const subsection = (body, name) => {
const lines = body.split('\n');
const start = lines.findIndex((l) => /^### Known issues\s*$/.test(l));
assert.ok(start >= 0, 'the Unreleased section has a "### Known issues" heading');
const start = lines.findIndex((l) => l.replace(/\s+$/, '') === `### ${name}`);
assert.ok(start >= 0, `the Unreleased section has a "### ${name}" heading`);
let end = lines.length;
for (let i = start + 1; i < lines.length; i++) {
if (/^###? /.test(lines[i])) { end = i; break; }
}
return lines.slice(start + 1, end).join('\n');
};
const knownIssues = (body) => subsection(body, 'Known issues');
test('CHANGELOG: the Unreleased section\'s Known issues name the session split', () => {
const body = unreleasedBody();
@ -484,17 +485,7 @@ test('CHANGELOG: the old rerun wording is gone from the Unreleased section', ()
// 38. The Known-issues bullets are read from that slice only (knownIssues
// above), so the round-1 Fixed bullet that names `4b6460e5` never counts.
// The Unreleased section's `### Fixed` body, up to the next heading.
const fixedSlice = (body) => {
const lines = body.split('\n');
const start = lines.findIndex((l) => /^### Fixed\s*$/.test(l));
assert.ok(start >= 0, 'the Unreleased section has a "### Fixed" heading');
let end = lines.length;
for (let i = start + 1; i < lines.length; i++) {
if (/^###? /.test(lines[i])) { end = i; break; }
}
return lines.slice(start + 1, end).join('\n');
};
const fixedSlice = (body) => subsection(body, 'Fixed');
test('CHANGELOG: round 3 — the decision-41 door line, two Fixed bullets and the findings deferred by decision 42', () => {
const body = unreleasedBody();