From 6871abd7ee005dc6f04aed2815a4d51e42bf6ce9 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 9 Nov 2026 07:51:10 +1100 Subject: [PATCH] chore(lint): guard the messaging service's contract boundary with depguard instead of a test --- .golangci.yml | 8 +++++ cmd/archie-messaging/architecture_test.go | 39 ----------------------- 2 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 cmd/archie-messaging/architecture_test.go diff --git a/.golangci.yml b/.golangci.yml index d32d4b749..c76abc472 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -88,6 +88,14 @@ linters: - {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"} + messaging-service: + files: ["**/internal/app/archiemessaging/**", "**/cmd/archie-messaging/**"] + deny: + - {pkg: "github.com/jackc/pgx", desc: "reach the State Store through its contract"} + - {pkg: "github.com/samcharles93/archie-core/internal/infrastructure/postgres", desc: "reach the State Store through its contract"} + - {pkg: "github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore", desc: "reach the State Store through its contract"} + - {pkg: "github.com/samcharles93/archie-core/internal/domain/workflow", desc: "the workflow engine is the daemon's"} + - {pkg: "github.com/samcharles93/archie-core/internal/agentexec", desc: "agent execution is the daemon's"} shared: files: ["**/internal/app/servicekit/**", "**/internal/app/chattask/**"] deny: diff --git a/cmd/archie-messaging/architecture_test.go b/cmd/archie-messaging/architecture_test.go deleted file mode 100644 index 3ecacf93f..000000000 --- a/cmd/archie-messaging/architecture_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// The Messaging Service reaches the State Store and the workflow engine only -// through their contracts. Go imports are atomic, so one reference relinks a -// runtime, and the boundary holds only while something re-measures it. - -package main - -import ( - "context" - "os/exec" - "strings" - "testing" - "time" -) - -func TestMessagingDoesNotLinkStoreOrWorkflowRuntime(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/jackc/pgx/v5/pgxpool", - "github.com/samcharles93/archie-core/internal/infrastructure/postgres", - "github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore", - "github.com/samcharles93/archie-core/internal/domain/workflow", - "github.com/samcharles93/archie-core/internal/agentexec", - } { - t.Run(pkg, func(t *testing.T) { - if linked[pkg] { - t.Errorf("cmd/archie-messaging links %s: services reach each other only through contracts", pkg) - } - }) - } -}