Skip to content

feat(tests): enforce project boundaries with ArchUnitNET - #172

Merged
e128 merged 1 commit into
mainfrom
feature/project-boundary-architecture-tests
Nov 16, 2026
Merged

e128 merged 1 commit into
mainfrom
feature/project-boundary-architecture-tests

Conversation

@e128

@e128 e128 commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Executive Summary

Architecture.Tests loaded only the Core assembly, so nothing stopped one production project from depending on another. This PR adds a frozen project-boundary baseline. Each production assembly may not depend on a production assembly outside its transitive project-reference closure.

Code Changes

  • ProjectReferenceBaseline loads the five production assemblies by name.
  • ProjectBoundaryTests holds one rule per assembly. The allowed graph is a literal, not computed from the current graph.
  • Architecture.Tests.csproj references all five production projects, including the executables Cli and Web.
  • The rules exclude the Microsoft.CodeCoverage.Instrumentation.Static.Tracker namespace. Coverage injects a type with one full name into every instrumented assembly. ArchUnitNET merged it and failed 3 rules under scripts/coverage.sh.
  • Lode: architecture-testing.md and terminology.md describe the new rules.

Tests and Tooling

  • scripts/check.sh --all: shell lint, format, build (0 warnings), and tests all pass.
  • ProjectBoundaryTests: 5 of 5 ran and passed. The other four Architecture test classes still pass.
  • scripts/coverage.sh --filter "": passes with the tracker exclusion.
  • Not run: benchmarks.

Review Guide

  • Check the frozen graph in ProjectBoundaryTests: Analyzers and Core have no production references, CodeFixers references Analyzers, Cli and Web reference Core.
  • Check that Architecture.Tests now references executable projects.
  • Known inaccuracy: lode/dotnet/analyzers.md in this commit says Directory.Build.props sets AnalysisModeSecurity, AnalysisModeReliability, and AnalysisModePerformance. That edit to Directory.Build.props did not ship, so fix the Lode text or add the properties before merge.

Rollback

Revert the commit. No production code changed.

🤖 Generated with Claude Code

Add ProjectReferenceBaseline and ProjectBoundaryTests. Each production
assembly may not depend on a production assembly outside its frozen
transitive project-reference closure. The rules exclude the coverage
tracker namespace that Microsoft.CodeCoverage injects into instrumented
assemblies. Update the matching Lode files.

Co-Authored-By: Claude
@e128
e128 merged commit 6309656 into main Nov 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant