Files
pipelines/internal/pipeline/examples_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

49 lines
1.1 KiB
Go

package pipeline
import (
"os"
"path/filepath"
"strings"
"testing"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
func TestShowcaseDefinitions(t *testing.T) {
for _, name := range []string{"task", "review", "research", "three-stage"} {
t.Run(name, func(t *testing.T) {
source, err := os.ReadFile(filepath.Join("..", "..", "examples", name+".md"))
if err != nil {
t.Fatal(err)
}
graph, err := Parse(string(source))
if err != nil {
t.Fatal(err)
}
success, failure := false, false
for _, stage := range graph.Stages {
if stage.FallbackError {
t.Fatalf("%s should declare its error route explicitly", stage.Key)
}
if strings.TrimSpace(stage.Prompt) == "" {
t.Fatalf("%s stage %s needs a nonempty prompt", name, stage.Key)
}
for _, target := range stage.Edges {
if target == protocol.SuccessEnd {
success = true
}
if target == protocol.FailureEnd {
failure = true
}
}
}
if !success || !failure {
t.Fatal("showcase must have both terminal outcomes")
}
if graph.Settings != nil {
t.Fatalf("%s starters must stay manual-only", name)
}
})
}
}