26. arch-go architecture fitness tests, enforced in CI
Status
Accepted — implemented prior to this record; this closes the documentation gap found by the 2026-10-04 ADR audit, and the stale "deferred" claim this same audit found in ADR 0001 (now corrected there).
Context
ADR 0001 accepted, as a known
weakness, that nothing in the compiler stops a use case importing
net/http or kafka-go directly — the inward-only dependency rule was
upheld only by code review. Every sibling context in this fleet closed that
gap with arch-go, a dependency-rule
checker driven by a Go API rather than a separate CLI config file.
Decision
internal/architecture/fitness_test.go encodes this context's
architecture rules as arch-go dependency assertions, run as a plain go test and gated by the CI arch-test job:
- The hexagonal rule from ADR 0001:
internal/domainimports nothing from this module outside itself;internal/applicationimports onlyinternal/domain; adapters may import inward (application,domain) but nothing may import an adapter package from outsidecmd/. TestMCPAdapterDependencyRule(ADR 0009): the MCP inbound adapter may depend only onapplication/domain, and — the direction that actually matters for keeping it additive — nothing else in this module may importinternal/adapters/inbound/mcp.TestNoSiblingContextOutboundCalls(ADR 0017): this context never makes an outbound REST/gRPC call to another bounded context, preserving the choreography-only posture of ADR 0003.
Because these are ordinary go test functions (not a separate binary or
config format), they run inside the existing test/arch-test CI jobs
with zero additional CI plumbing, and fail the build — not just a review
comment — the moment a rule is violated.
Consequences
- The dependency rule is enforced mechanically, not only by reviewer
attention; a PR that imports
kafka-gointointernal/applicationfails CI, full stop. - New adapters (MCP, the future frontend's own API surface if one is ever added) get the same enforcement for free by adding one more assertion, not a parallel tool.
arch-go's own API surface is a dependency this repo now carries ingo.mod; a breakingarch-gorelease is a real (if rare) maintenance cost, accepted in exchange for a compiler-adjacent guarantee instead of a purely social one.