The Web UI and messaging channels now read and write Archie's runtime settings through one versioned, audited control-plane API hosted on the State Store's existing gRPC server: catalog, query, command, watch. Each feature owns its resource, validation and commands; storage only writes versions and audit records. Workflows move with it. Definitions become portable YAML compiled through a closed, typed step registry and stored as a control-plane resource, so the yaegi interpretation paths (internal/gate, wfeval, wfextract, gateeval, gateextract, skillbuild) are deleted rather than carried. The UI process reads definitions as data: the JSON projection lives in internal/domain/workflow/task so a dashboard decodes the stored collection without linking the workflow engine, which cmd/archie-ui's deletion gate forbids. Shipped definitions ride the catalog descriptor rather than a bespoke REST route, keeping the API to its four operations. archie-messaging gains -state-store-target/-state-store-token and reads channel settings from the database, failing closed when the State Store is unreachable: the database is authoritative for those settings.
27 lines
1.1 KiB
Go
27 lines
1.1 KiB
Go
package agent
|
|
|
|
import "testing"
|
|
|
|
func TestPersonaCollectionValidate(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tests := []struct {
|
|
name string
|
|
collection PersonaCollection
|
|
wantErr bool
|
|
}{
|
|
{name: "valid", collection: PersonaCollection{Default: "archie", Personas: []Persona{{Name: "archie", Prompt: "baseline"}, {Name: "concise", Prompt: "brief"}}}},
|
|
{name: "missing default", collection: PersonaCollection{Default: "missing", Personas: []Persona{{Name: "archie", Prompt: "baseline"}}}, wantErr: true},
|
|
{name: "duplicate normalized name", collection: PersonaCollection{Default: "archie", Personas: []Persona{{Name: "Archie", Prompt: "baseline"}, {Name: " archie ", Prompt: "other"}}}, wantErr: true},
|
|
{name: "empty prompt", collection: PersonaCollection{Default: "archie", Personas: []Persona{{Name: "archie"}}}, wantErr: true},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
t.Parallel()
|
|
if err := tt.collection.Validate(); (err != nil) != tt.wantErr {
|
|
t.Fatalf("Validate() error = %v, wantErr %v", err, tt.wantErr)
|
|
}
|
|
})
|
|
}
|
|
}
|