Files
pipelines/internal/pipeline/legacy_test.go
T
alan e37b864c40 stage turns: replace JSON results with file-based markdown turns
Each model visit now gets <run>/stages/<seq>-<stage>/ with input.md,
memory.md, output.md, private/ and a shared run-level public/. The model
reads the two input files, follows the stage's instructions verbatim and
returns complete markdown; only the # outcome section is parsed.

- add internal/turn layout, render and output parsing
- write input.md/memory.md before a visit and output.md from the final
  message; inventory all turn files as stage artifacts
- accumulate completed turns and system-written public file additions in
  memory, including across retries and resume
- remove the JSON envelope, strict field validation, line format and the
  repair ladder for model stages
- republish pipeline authoring prompts and docs in the new style

Checks: go build ./..., go vet ./..., go test -count=1 ./..., gofmt -l .
2026-10-19 22:27:44 +01:00

33 lines
1.3 KiB
Go

package pipeline
import (
"strings"
"testing"
)
func TestAutomaticInputDefinitionAndLegacyExecution(t *testing.T) {
source := Template([]string{"first", "second"}, true)
if strings.Contains(source, "```input") {
t.Fatal("template still has input contract")
}
graph, err := Parse(source)
if err != nil || len(graph.Stages) != 2 {
t.Fatal("new definition requires an input block", err)
}
legacy := strings.Replace(source, "```prompt", "```input\nobsolete input contract\n```\n\n```prompt", 1)
if _, err := Parse(legacy); err == nil {
t.Fatal("new submissions accepted obsolete input")
}
if _, err := Parse(ExecutionSource(legacy)); err != nil {
t.Fatal("historical execution cannot ignore retired contract", err)
}
withLiteral := strings.Replace(source, "Describe the task.", "Mention this literal:\n```input\nnot a stage block", 1)
if ExecutionSource(withLiteral) != withLiteral {
t.Fatal("legacy adapter modified prompt text")
}
definition := StageDefinition(Stage{Key: "first", Blocks: map[string]string{"input": "legacy"}, Output: "output", Prompt: "task", Configs: map[string]string{"provider": "opencode-go", "model": "deepseek-v4.1-flash", "retries": "0"}})
if _, exists := definition.Blocks["input"]; exists {
t.Fatal("adapter retained obsolete input contract")
}
}