Skip to content

test(arch): architecture fitness tests (ArchUnitNET) β€” encode the layering laws once /design rules themΒ #398

Description

@genwave-radio

πŸ›οΈ What

Add an architecture fitness-test layer (NetArchTest.Rules / maintained fork / ArchUnitNET β€” evaluate at adoption time) that turns our architectural rules into red tests, extending the existing structural-pin culture (Story278 route sweeps, disclosure contracts, zero-diff gates) down to the generic layer the csproj graph can't see.

🎯 Why

  • The build loop is agents-under-review β€” every rule converted from reviewer judgment into a red test makes builders self-correcting and reviews cheaper (same reasoning as the house mutation-test standard).
  • docs/ARCHITECTURE.md is internal-only; an arch-test project is the shipped, executable subset of the architecture β€” the one form that can't drift (see the 2026-08-07 /document pass for how much prose had).
  • For GenWave Business: edition boundaries ("Business assemblies depend on Core, never on demo/spectator internals") are exactly the silently-eroding kind of rule fitness tests hold forever β€” and "here's the test that fails if the layering breaks" is the answer an auditor wants.

πŸ“ Candidate starter rules (encode rulings, not habits β€” see dependency below)

  1. GenWave.Core stays framework-free (no ASP.NET/Npgsql/Dapper types) β€” CLAUDE.md law
  2. Npgsql/Dapper types appear only inside the repository layer (GenWave.MediaLibrary.Station)
  3. HttpClient construction only at designated client seams (CatalogProxyService etc.) β€” SSRF surface control
  4. DTO/record immutability conventions in Core.Abstractions
  5. Namespace discipline inside Host (Api / Theming / middleware boundaries)

Rules that restate a csproj reference are dead weight β€” only encode what the compiler can't see. Domain-specific pins (routes, disclosure) stay bespoke; this is the generic layer beneath them.

⛓️ Dependency

Blocked on a /design session ruling the architecture laws first ("once we decide on them" β€” Dean, 2026-08-07). Compile-time alternatives (NsDepCop / custom Roslyn analyzers) fit the -warnaserror culture but cost more to author; xUnit fitness tests are the idiomatic entry point given the existing spec culture.

(From a 2026-08-07 discussion; full rationale in the conversation that created projects #3–#9.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions