Files
alan a48e4a5b6a Replace starters with four graded examples seeded into new databases
The template catalog is now Example 1-4: one stage, two stages (handoff),
feedback loop (runner-owned limits, retries, timeout) and human decision
(type=human approve/revise/abort with notify hooks). All read-only or leave
changes uncommitted; none commits, pushes or deploys.

A brand-new database (schema created by this Open) gets the examples once at
server start, bound to the configured default model and harness. A
server_settings marker records the decision, so removed examples never come
back and existing installs are marked without any pipeline being added or
rewritten.
2026-11-03 19:35:47 +00:00

49 lines
1.2 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{"one-stage", "two-stages", "feedback-loop", "human-decision"} {
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)
}
})
}
}