Files
archie/internal/infrastructure/configuration/curator_validate_test.go
T
sam 500b00cf02 feat(curator): definition-driven engine with tool-carrying passes
Phase 1 of dynamic curator definitions (archie-core-trnd.1):

- ToolBuilder implementation resolves declared tool names from the
  daemon's process-wide tool registry, returning exactly the declared
  set and failing closed on an unknown name.
- curatorLLMRunner now carries ChatRequest.Tools and MaxSteps into
  core.GenerateOptions and widens ChatResult with the executed tool
  calls so a pass can attribute its actions.
- One generic DefinitionEngine interprets a Definition (Manifest +
  name/enabled/instructions): its pass composes instructions with the
  built declared tool set, runs the model loop, and records an action
  per tool invocation.
- [[curators]] config definitions carry the Manifest shape verbatim plus
  name/enabled/instructions; a definition missing interval is refused,
  never defaulted.
- Idle curators are observable: the runtime logs a debug line when Check
  reports not-due.
2026-09-22 15:05:24 +10:00

70 lines
1.7 KiB
Go

package configuration
import (
"testing"
"time"
"github.com/samcharles93/archie-core/internal/config"
)
func TestValidateCurators(t *testing.T) {
tests := []struct {
name string
mutate func(cfg *config.Config)
wantErr bool
}{
{
name: "no curators",
mutate: func(cfg *config.Config) {},
},
{
name: "valid curator",
mutate: func(cfg *config.Config) {
cfg.Curators = []config.CuratorDefinition{{Name: "project", Enabled: true, Interval: config.Duration(time.Hour)}}
},
},
{
name: "missing interval",
mutate: func(cfg *config.Config) {
cfg.Curators = []config.CuratorDefinition{{Name: "project", Enabled: true}}
},
wantErr: true,
},
{
name: "zero interval",
mutate: func(cfg *config.Config) {
cfg.Curators = []config.CuratorDefinition{{Name: "project", Enabled: true, Interval: config.Duration(0)}}
},
wantErr: true,
},
{
name: "negative interval",
mutate: func(cfg *config.Config) {
cfg.Curators = []config.CuratorDefinition{{Name: "project", Enabled: true, Interval: config.Duration(-time.Minute)}}
},
wantErr: true,
},
{
// A definition must be valid seed data whether or not it is
// currently enabled: flipping Enabled on later must not silently
// default the interval.
name: "disabled curator still requires interval",
mutate: func(cfg *config.Config) {
cfg.Curators = []config.CuratorDefinition{{Name: "project"}}
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cfg := minimalValidConfig()
tt.mutate(&cfg)
err := Validate(&cfg)
if (err != nil) != tt.wantErr {
t.Fatalf("Validate() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}