fix(trekbrief): every exit names Phase 7 with its auto_result

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-26 16:30:30 +01:00
commit b99081f215
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
3 changed files with 30 additions and 4 deletions

View file

@ -977,8 +977,8 @@ printed `stamped: true`, then stop and print the next step:
**With research_topics = 0**, print the manual-path output below without the
`/trekresearch` lines (Brief, then `/trekplan --project {PROJECT_DIR}`, then
`/trekexecute --project {PROJECT_DIR}`), then run Phase 7 and stop. Phase 6 is
never entered without the operator's opt-in.
`/trekexecute --project {PROJECT_DIR}`), then run Phase 7 (`auto_result: manual`)
and stop. Phase 6 is never entered without the operator's opt-in.
Ask the user via `AskUserQuestion`:
@ -1052,7 +1052,7 @@ Continue?"
| Option | Action |
|--------|--------|
| **Continue — auto** | Proceed. |
| **Cancel — do manual** | Revert to manual path (print commands, stop). |
| **Cancel — do manual** | Revert to manual path (run Phase 7 with `auto_result: cancelled`, print commands, stop). |
If cancelled → fall back to manual path output, run Phase 7
(`auto_result: cancelled`) and stop.

View file

@ -593,7 +593,7 @@ test('[#47] Phase 5: a brief with no research topics prints /trekplan --project
assert.doesNotMatch(p5, /Skip this phase if research_topics = 0/, 'Phase 5 still skips straight on with zero topics');
const opening = partAt('commands/trekbrief.md', '## Phase 5 — Auto-orchestration opt-in', (l) => l.startsWith('Ask the user'));
assert.doesNotMatch(opening, /proceed directly to Phase 6/i, 'a zero-topic brief still proceeds directly to Phase 6');
assert.match(opening, /\*\*With research_topics = 0\*\*, print the manual-path output below without the `\/trekresearch` lines \(Brief, then `\/trekplan --project \{PROJECT_DIR\}`, then `\/trekexecute --project \{PROJECT_DIR\}`\), then run Phase 7 and stop\./);
assert.match(opening, /\*\*With research_topics = 0\*\*, print the manual-path output below without the `\/trekresearch` lines \(Brief, then `\/trekplan --project \{PROJECT_DIR\}`, then `\/trekexecute --project \{PROJECT_DIR\}`\), then run Phase 7 \(`auto_result: manual`\) and stop\./);
assert.match(opening, /Phase 6 is never entered without the operator's opt-in\./);
const manual = flat(section(text, '### Manual path (default)'));
assert.match(manual, /Then: \/trekplan --project \{PROJECT_DIR\} Then: \/trekexecute --project \{PROJECT_DIR\}/);

View file

@ -29,6 +29,10 @@
// M8 /trekcontinue and /trekendsession Phase 0 stop on the parser's exit 1
// with its `errors`, and stop when the parser prints no JSON.
// M10 /trekendsession Phase 2 reads the label from the parser's `tail`.
// M13 /trekbrief's research_topics = 0 exit runs Phase 7 with
// `auto_result: manual`.
// K2 /trekbrief's Step 6a "Cancel — do manual" row runs Phase 7 with
// `auto_result: cancelled`, like the sentence after the table.
// No static import of a new export: the file must load at be0b631.
// Fix the SOURCE a pin guards, not the pin.
@ -297,3 +301,25 @@ test('[M10] /trekendsession Phase 2 reads the label from tail', () => {
assert.doesNotMatch(p2, /`positional\[1\]`/, 'Phase 2 still reads <next-label> from positional[1], which splits a label at spaces');
assert.match(p2, /`<next-label>` is the parser's `tail`/, `Phase 2 does not read <next-label> from the parser's tail: ${p2}`);
});
// --- M13 / K2 ----------------------------------------------------------------------
const TREKBRIEF = 'commands/trekbrief.md';
test('[M13] the research_topics = 0 exit names auto_result manual', () => {
const opening = between(TREKBRIEF, '## Phase 5 — Auto-orchestration opt-in', 'Ask the user via `AskUserQuestion`');
const hits = sentencesWith(opening, 'research_topics = 0');
assert.equal(hits.length, 1, `Phase 5 must hold one sentence on research_topics = 0; found ${hits.length}: ${hits.join(' | ')}`);
assert.match(hits[0], /, then run Phase 7 \(`auto_result: manual`\) and stop\.$/,
`the research_topics = 0 exit does not run Phase 7 with auto_result manual: ${hits[0]}`);
});
test('[K2] the 6a row names Phase 7 with auto_result cancelled', () => {
const step6a = between(TREKBRIEF, '### Step 6a — Confirm proceed', '### Step 6b ');
const rows = step6a.split('\n').filter((l) => l.startsWith('| **Cancel — do manual** |'));
assert.equal(rows.length, 1, `Step 6a must hold one "Cancel — do manual" row; found ${rows.length}`);
assert.equal(rows[0], '| **Cancel — do manual** | Revert to manual path (run Phase 7 with `auto_result: cancelled`, print commands, stop). |',
'the 6a cancel row does not name Phase 7 with auto_result cancelled');
assert.match(flat(step6a), /If cancelled → fall back to manual path output, run Phase 7 \(`auto_result: cancelled`\) and stop\./,
'the sentence after the 6a table no longer names Phase 7 with auto_result cancelled');
});