Repository navigation
feat: architecture policy, enforcement tests and guidance skills - #3
Merged
Merged
Conversation
The project responsibility catalogue, naming convention and dependency matrix are defined once, in .config/architecture-policy.json. The architecture tests read it rather than restating its rules, and PolicyDocumentationTests asserts the wiki tables match it, so a rule cannot be true in prose and false in code. Enforced: the dependency matrix, sibling independence, nothing depending on Composition, forbidden framework packages per responsibility, cycles, catch-all project names, and production code referencing a test project. Failures name the project, the rule, the offending reference and the direction it should run. Waivers record a deliberate departure instead of suppressing a rule silently. This repository's own Infrastructure project is the worked example: it maps to Adapters, so the name is excused and every dependency rule still applies. Adds the Project-Responsibilities and Agent-Guidance-Skills pages with Mermaid diagrams A-N, all verified to render with mermaid-cli.
…kill purview-architecture now covers naming (<Responsibility>[.<Implementation>]) and dependency direction, pointing at the policy rather than restating it. purview-architecture-testing is new: how to turn a rule a reviewer keeps repeating into a build failure without a brittle suite. It insists the matrix is defined once, that failures name the fix rather than the fact, and that existing code gets a recorded waiver instead of a weakened rule. Extends the review scenarios to cover modular monoliths, multiple persistence implementations, and a repository that already has a catch-all project name.
The policy declared "$schema": "./architecture-policy.schema.json" and no such file existed. A dangling pointer is worse than none: an editor reports no error, so the format looks validated when nothing checks it. Adds the schema (draft 2020-12), published by $id at the raw GitHub URL so editors can fetch it, matching the purview-build.json convention. Renames the policy's "exceptions" key to "waivers" so the file, the schema and the C# agree. The schema is enforced rather than decorative. PolicySchemaTests validates the policy against it, checks both files agree on the published identifier, and asserts the schema *rejects* a document missing a required field, a waiver with a token reason, and a misspelled key - a schema that cannot fail proves nothing. additionalProperties:false throughout, because a misspelled key reads as an absent rule rather than an error, which is the most dangerous mistake a policy file can carry. Validation uses JsonSchema.Net, the same library Purview.Build uses.
The rule engine now ships as Purview.Architecture.Testing, so adoption is a policy file and one derived test class rather than copying the C#. Calls out that [InheritsTests] is required: TUnit does not walk base types during discovery, so without it the class compiles, the run is green and nothing is enforced.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the project responsibility catalogue, naming convention, dependency matrix and architecture enforcement, plus the shared agent guidance skills and Mermaid diagrams A-N.
One definition per rule
.config/architecture-policy.jsonis authoritative. The architecture tests read it rather than restating its rules, andPolicyDocumentationTestsasserts the wiki tables match it, so a rule cannot be true in prose and false in code.Enforced (16 tests)
Dependency matrix, sibling independence, nothing depending on Composition, forbidden framework packages per responsibility, cycles, catch-all project names, production-to-test references, and waiver justification. Failures name the project, the rule, the offending reference and the direction the dependency should run.
Waivers
A rule suppressed silently is a rule that is a lie. A waiver records the departure and excuses the name only -
mapsTokeeps the project classified so every dependency rule still applies. This repository'sInfrastructureproject is the worked example: it holds one adapter, so it is not the catch-all the rule targets, and renaming it would churn the wiki, AGENTS.md and NamespaceRemoveSuffix for no gain.Diagrams
A-N, split across three pages. All 16 Mermaid sources were rendered with
mermaid-clito confirm they parse - they sit in```textfences because Mermaid is not enabled inmkdocs.yml.Verification
just build- 0 warnings, 0 errorsjust test- 53/53 pass (was 37)just lint-check- clean