turn: keep the body written before a trailing outcome

ParseOutput returned only the text after the outcome value, so a stage that wrote
its result first and "# outcome" last handed the next stage "(no output)" — the
probe's Compose and Critique turns were both lost this way. The body is now the
whole document with just the outcome heading and value line removed, in order,
byte for byte. Tests cover a trailing and a mid-document outcome.
This commit is contained in:
2026-10-19 23:31:06 +01:00
parent ccb97e424b
commit b1482b554b
4 changed files with 37 additions and 15 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ func TestLayoutRenderAndParseRoundTrip(t *testing.T) {
t.Fatalf("memory.md = %q, %v", got, err)
}
outcome, body, err := ParseOutput(output, []string{"success", "approved", "error"})
if err != nil || outcome != "approved" || body != "\n# Findings\n\nnone\n" {
if err != nil || outcome != "approved" || body != "# Notes\n\nChecked the diff.\n\n\n# Findings\n\nnone\n" {
t.Fatalf("ParseOutput() = %q, %q, %v", outcome, body, err)
}
missing, _, err := ParseOutput("# Notes\n\nno heading\n", []string{"success"})