From 045fc5fc31230f7fd5b3661473535d2115a4349a Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 9 Oct 2026 11:42:39 +1100 Subject: [PATCH] test(archieui): restore the archie-ui import-boundary check Only the daemon owns containers, and the dashboard consumes a harness session over its gRPC contract. Go imports are atomic, so a single reference relinks a runtime, and the boundary holds only while something re-measures it. cmd/archie-ui/architecture_test.go enforced this until it was purged with the test suite; nothing enforced it since. The restored check runs go list -deps . and fails if the dashboard links internal/container, internal/app/archied or internal/agentexec. It is transitive, which is what "links" means, and runs in the existing test step. --- cmd/archie-ui/architecture_test.go | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 cmd/archie-ui/architecture_test.go diff --git a/cmd/archie-ui/architecture_test.go b/cmd/archie-ui/architecture_test.go new file mode 100644 index 000000000..24c251e43 --- /dev/null +++ b/cmd/archie-ui/architecture_test.go @@ -0,0 +1,41 @@ +// This file enforces the dashboard's process boundary +// (docs/prds/external-agent-harness.md, "Session contract", Transport): the +// dashboard must not link the container or daemon internals, because only the +// daemon owns containers. Go imports are atomic, so a single reference +// relinks a runtime, and the boundary holds only while something re-measures +// it. archie-core-h3s0 names this check; it was purged with the test suite and +// is restored here. + +package main + +import ( + "context" + "os/exec" + "strings" + "testing" + "time" +) + +func TestDashboardDoesNotLinkContainerRuntime(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + out, err := exec.CommandContext(ctx, "go", "list", "-deps", ".").Output() + if err != nil { + t.Fatalf("go list -deps .: %v", err) + } + linked := map[string]bool{} + for line := range strings.SplitSeq(strings.TrimSpace(string(out)), "\n") { + linked[line] = true + } + for _, pkg := range []string{ + "github.com/samcharles93/archie-core/internal/container", + "github.com/samcharles93/archie-core/internal/app/archied", + "github.com/samcharles93/archie-core/internal/agentexec", + } { + t.Run(pkg, func(t *testing.T) { + if linked[pkg] { + t.Errorf("cmd/archie-ui links %s: only the daemon owns containers", pkg) + } + }) + } +}