e37b864c40
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 .
36 lines
1.6 KiB
Go
36 lines
1.6 KiB
Go
package server
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.a-wan.net/alan/pipelines/internal/protocol"
|
|
"git.a-wan.net/alan/pipelines/internal/stage"
|
|
)
|
|
|
|
// TestResumedRunStatePublishesPersistedCapturedPaths proves the field is rebuilt
|
|
// from every persisted completed step's captured paths (rebuildRunState →
|
|
// recordChanges), deduplicated and first-seen-ordered, so a resumed run keeps the
|
|
// same server evidence available to any stage that still asks for it.
|
|
func TestResumedRunStatePublishesPersistedCapturedPaths(t *testing.T) {
|
|
detail := &protocol.RunDetail{Input: map[string]any{"prompt": "task"}}
|
|
detail.Steps = []protocol.RunStep{
|
|
{Sequence: 1, Stage: "implementer", Status: "completed", Output: stage.Values{"changed_files": []any{"a.go"}}, FileChanges: &protocol.StageFileChanges{Files: []protocol.FileChange{{Path: "a.go"}, {Path: "a.go"}, {Path: "b.go"}}}},
|
|
{Sequence: 2, Stage: "reviewer", Status: "completed", Output: stage.Values{}, FileChanges: &protocol.StageFileChanges{Files: []protocol.FileChange{{Path: "b.go"}, {Path: "c.go"}}}},
|
|
}
|
|
state := rebuildRunState(detail, protocol.RunStep{Target: "committer", Output: stage.Values{}})
|
|
state.publishServerChangedFiles()
|
|
got, ok := state.memory["input"].output[serverChangedFilesField].([]string)
|
|
if !ok {
|
|
t.Fatalf("resumed input memory has no %s list: %v", serverChangedFilesField, state.memory["input"].output)
|
|
}
|
|
want := []string{"a.go", "b.go", "c.go"}
|
|
if len(got) != len(want) {
|
|
t.Fatalf("captured paths = %v, want %v", got, want)
|
|
}
|
|
for i := range want {
|
|
if got[i] != want[i] {
|
|
t.Fatalf("captured paths = %v, want first-seen %v", got, want)
|
|
}
|
|
}
|
|
}
|