Files
archie/internal/infrastructure/staterpc/values_parity_test.go
T
sam d320a1a01a feat(eda): workflow inputs, optional repository and agent profiles
Workflow definitions declare inputs, repository (none, optional or
required; default required) and profile. A binding assigns each input
from a mapped parameter or a constant and may take its repository from a
parameter, which must name a configured repo; both are checked when the
binding is saved and again at dispatch. Inputs travel as structured task
data (tasks.inputs, the task brief, and a JSON block in the agent's
mission), never as body text.

A task with no repository runs in a per-task scratch workspace with no
clone and no publication grant. The agent.run step runs one mission
without a repository and finishes the task in the new completed status.

Agent profiles live under [containers.profiles.<name>]: an image and an
allowlist over the tools archie adds (MCP, scripts, plugins).
[containers].image is the default profile; an unconfigured profile parks
the task. The workflow is now pinned before the container starts so the
profile can choose its image.

Also stop two archied tests writing embedded NATS state into the package
directory, refuse an empty state_dir for embedded NATS, and drop the NATS
store files an earlier lane commit tracked.
2026-09-24 20:29:33 +10:00

52 lines
1.8 KiB
Go

package staterpc
import (
"reflect"
"testing"
"time"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
)
// TestTaskProtoCarriesEveryDomainField fills every field of task.Task with a
// distinct non-zero value and requires the proto round trip to return it
// unchanged. taskProto/taskValue assign field by field, so a field added to
// the domain type and forgotten on the wire is otherwise invisible: the task
// still crosses, just with that field silently zeroed. This test fails for the
// forgotten field by name rather than leaving it to a caller to discover in
// production (archie-core-zf8h).
func TestTaskProtoCarriesEveryDomainField(t *testing.T) {
stamp := time.Date(2026, 9, 21, 10, 30, 0, 0, time.UTC)
want := &task.Task{}
v := reflect.ValueOf(want).Elem()
for i := range v.NumField() {
field := v.Field(i)
switch {
case field.Type() == reflect.TypeFor[time.Time]():
field.Set(reflect.ValueOf(stamp.Add(time.Duration(i) * time.Hour)))
case field.Kind() == reflect.String:
field.SetString(v.Type().Field(i).Name + "-value")
case field.CanInt():
field.SetInt(int64(i) + 1)
case field.Type() == reflect.TypeFor[map[string]any]():
field.Set(reflect.ValueOf(map[string]any{"key": v.Type().Field(i).Name + "-value"}))
default:
t.Fatalf("field %s has kind %s, which this test does not know how to fill; extend it alongside the field", v.Type().Field(i).Name, field.Kind())
}
}
got := taskValue(taskProto(want))
if reflect.DeepEqual(got, want) {
return
}
for i := range v.NumField() {
name := v.Type().Field(i).Name
gotField := reflect.ValueOf(got).Elem().Field(i).Interface()
wantField := v.Field(i).Interface()
if !reflect.DeepEqual(gotField, wantField) {
t.Errorf("Task.%s did not survive the proto round trip: got %v, want %v", name, gotField, wantField)
}
}
}