Skip to content
Purview Dev logo

Policy reference

Stable Architests Reviewed 2026-10-16 purview-dev/architests Star on GitHub architecture architecture-tests csharp dependency-rules dotnet nuget roslyn static-analysis tunit

The policy is .config/architecture-policy.json. It is validated against the schema embedded in the package before any rule runs, so a field the reader understands but the schema rejects is a bug.

The authoritative definition is architecture-policy.schema.json.

FieldTypeDefaultMeaning
$schemastring—Pointer to the published schema, so an editor validates as you type.
versioninteger ≥ 1—The document version. The current version is 2.
descriptionstring—Free text.
conventionsobject—qualifiedNameSeparator and dependencyArrowMeaning, for humans and editors.
sourceRootsstring[]["src"]Repo-relative folders holding the projects. An empty array scans the repository root.
responsibilitiesobject[]—Required, at least one. The responsibility catalogue.
discouragedProjectNamesobject—Names that describe a category, with a reason.
assemblyRulesobject—The type-level check. Off unless enabled is true.
waiversobject[][]Deliberate, reviewed departures.

Version 2 removed the rules object (noCycles, noProductionToTestReferences, implementationsMustNotReferenceComposition, siblingImplementationsIndependent), whose flags were deserialised but never consulted. Use SkipRule or a waiver to opt out of a rule. A version-1 policy that set rules must delete the block; a version-1 policy that did not still validates.

FieldTypeRequiredMeaning
namestring✅A single PascalCase segment, with no dots.
aliasesstring[]Recognised alternative names; an established project using one is not renamed.
categoryenum✅domain, application, infrastructure, composition, host or shared.
purposestring ≥ 20✅Why the responsibility exists; quoted in failure messages.
mayDependOnstring[]✅Responsibilities this one may reference. An empty array means it depends on nothing.
mustNotDependOnstring[]✅Responsibilities this one must never reference.
forbiddenPackagePrefixesstring[]NuGet identifier prefixes that must not appear, e.g. Microsoft.EntityFrameworkCore.
forbiddenFrameworkReferencesstring[]Framework reference prefixes that must not appear, e.g. Microsoft.AspNetCore.App.
siblingIndependencebooleanWhen true, qualified implementations of this responsibility must not reference one another.
separateProjectWhenstring ≥ 10Documentation only.
mayRemainCombinedWhenstring ≥ 10Documentation only.
FieldTypeDefaultMeaning
enabledbooleanfalseWhether the type-level check runs. It reads compiled assemblies, so it needs a build to have produced them.
assemblyRootsstring[][]Repo-relative folders to scan. An empty array scans the test output directory.
assemblyGlobsstring[]["*.dll"]File globs matched under each root.
FieldTypeRequiredMeaning
projectstring✅The project the waiver applies to, exactly as it appears on disk.
mapsTostringThe responsibility the project actually has. Keeps every dependency rule in force while excusing the name.
rulesstring[]✅The rule ids this waiver excuses. At least one.
reasonstring ≥ 40✅Why the departure is acceptable.
reviewedOndateWhen the departure was last reviewed.

Any rule id may be waived, including siblingIndependence and assemblyDependencyMatrix. An unknown id is a waiverIntegrity failure, so a typo cannot silently excuse nothing.

Rule idCatches
graphDiscoveryNo production projects were discovered, so every other rule would pass vacuously. Not waivable.
namingA production project whose name maps to no responsibility or alias.
discouragedNameA project named after a category, so nothing can be kept out of it.
dependencyMatrixA declared ProjectReference the matrix forbids or does not permit.
assemblyDependencyMatrixA type reference the matrix forbids or does not permit, including one that arrives transitively or through a package.
siblingIndependenceA qualified implementation referencing a qualified sibling.
compositionBoundaryA non-composition, non-host project referencing a project whose category is composition.
forbiddenPackageA package matching a forbidden prefix for the responsibility.
forbiddenFrameworkA <FrameworkReference> matching a forbidden prefix for the responsibility.
cycleA cycle in the project dependency graph, reported readably.
testReferenceA production project referencing a test project.
waiverIntegrityA waiver that is stale, unjustified, malformed, or excuses an unknown rule. Not waivable.

Both dependencyMatrix and assemblyDependencyMatrix apply the same three-way rule:

  1. Same responsibility is always allowed. A qualified implementation referencing its unqualified sibling is the same box on the diagram.
  2. mustNotDependOn is a violation.
  3. mayDependOn is permitted.

A reference the matrix neither permits nor forbids is a violation: silence on a dependency is not permission, it is a gap in the policy. Add the responsibility to mayDependOn if the dependency is intended.

A project is a test project when its name ends with Tests, or its path contains a tests directory. Test projects are excluded from every rule — a test references everything by design. Everything else is a production project.