chore(lint): guard the dashboard's daemon boundary with depguard instead of a test
This commit is contained in:
2 files changed
+6
-41
No files matched your search
@@ -82,6 +82,12 @@ linters:
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "the daemon is another service"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archiegateway", desc: "the Gateway is another service"}
|
||||
- {pkg: "github.com/nats-io", desc: "the State Store serves gRPC only"}
|
||||
dashboard-service:
|
||||
files: ["**/internal/webui/**", "**/internal/app/archieui/**", "**/cmd/archie-ui/**"]
|
||||
deny:
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/container", desc: "only the daemon owns containers"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/agentexec", desc: "only the daemon owns containers"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "the daemon is another service"}
|
||||
shared:
|
||||
files: ["**/internal/app/servicekit/**", "**/internal/app/chattask/**"]
|
||||
deny:
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
// 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user