docs: add portable VSA vs Clean Architecture decision guide#51
Conversation
A reusable, system-agnostic synthesis of the VSA-vs-Clean decision, distilled from a multi-turn architecture discussion. Written to be lifted into any project; NextAurora is the worked example at the end, not the premise. Same pattern as docs/messaging-transport-selection.md — portable reference knowledge, kept OUT of CLAUDE.md (which holds THIS repo's rules). Core points it lands: - "Clean Architecture" is two things: the DEPENDENCY RULE (always-on, not earned, not in tension with VSA) and the 4-PROJECT STRUCTURE (the only part with ceremony, the only part the "is it worth it" question is about). - VSA and Clean are orthogonal axes — organization/cohesion vs dependency direction. "Combine" = organize by feature + keep the domain decoupled. - VSA does NOT auto-enforce the dependency rule; you enforce it on a spectrum: convention → architecture tests → project split. The middle rung (NetArchTest/ArchUnitNET) gives the SAME enforcement as the 4-project split WITHOUT the ceremony, at the namespace level in a single project. Code example included. - Two meanings of "combine": orthogonal axes + per-slice complexity gradient. - Testcontainers shifted the calculus: integration-default for IO-touching code beats mock-heavy unit tests, which collapses the repository-interface-for-testability argument. But it's a Testing Trophy, not a pure rectangle — keep fast unit tests for pure domain logic; mind the Docker dependency + speed cost. - The duplication tradeoff: keep cross-cutting concerns in pipeline behaviors (not per-slice), prefer duplication over the wrong abstraction; cost scales with slice count and bites hardest on pure CRUD. - When-to-use table + common mistakes (incl. "don't add a repo interface per slice on EF", "don't 4-project-split just to get the dependency rule", "don't mix layered + sliced services in one solution"). README Documentation table updated to index it. No CLAUDE.md edit here (kept separate to avoid colliding with the open promotion-signal PR #50, which is where the in-repo deep-dive pointer will be added). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR adds a new architecture decision guide documenting Vertical Slice Architecture (VSA) and Clean Architecture as orthogonal organizational and dependency concepts, with enforcement mechanisms, testing trade-offs, and a practical NextAurora example. ChangesArchitecture Decision Guide Documentation
🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Adds a deep-dive link from the refined "Promotion signal" section to the new portable decision guide (docs/vsa-vs-clean-architecture.md, PR #51): the CLAUDE.md section is NextAurora's specific rule; the doc is the general two-meanings-of-Clean / enforcement-spectrum / testing-shift / duplication-tradeoff reference behind it. Pointer only — no rule change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/vsa-vs-clean-architecture.md (1)
1-205:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftPropagate this new architecture pattern to canonical rule artifacts before merge.
This doc encodes reusable architecture-review patterns, but the required rule-propagation updates are missing from this PR (or an explicit deferral entry in
docs/STATUS.md). Please sync the canonical governance files in the same change set or mark/document the deferral explicitly.As per coding guidelines, "when encoding a pattern discovered via review, write to CLAUDE.md (most relevant section, new section only if no fit), .coderabbit.yaml path_instructions, .claude/agents/architecture-reviewer.md checklist, .claude/skills/ (if non-trivial multi-step), docs/STATUS.md (if deferred), and supporting docs (if the why deserves more than a one-liner)".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/vsa-vs-clean-architecture.md` around lines 1 - 205, The PR added a VSA-vs-Clean Architecture guide but didn’t propagate the pattern to our canonical governance artifacts; update CLAUDE.md (add the new pattern into the most relevant section or create a new section), add path_instructions in .coderabbit.yaml to reference the new doc, extend .claude/agents/architecture-reviewer.md checklist with the new enforcement options (rung 1/2/3 and NetArchTest example), add any multi-step guidance under .claude/skills/ if needed, and either record a clear deferral entry in docs/STATUS.md or include explicit “deferred” notes in the above files per the coding guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs/vsa-vs-clean-architecture.md`:
- Around line 1-205: The PR added a VSA-vs-Clean Architecture guide but didn’t
propagate the pattern to our canonical governance artifacts; update CLAUDE.md
(add the new pattern into the most relevant section or create a new section),
add path_instructions in .coderabbit.yaml to reference the new doc, extend
.claude/agents/architecture-reviewer.md checklist with the new enforcement
options (rung 1/2/3 and NetArchTest example), add any multi-step guidance under
.claude/skills/ if needed, and either record a clear deferral entry in
docs/STATUS.md or include explicit “deferred” notes in the above files per the
coding guidelines.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 83daed9a-a04b-4b32-aa23-a5e80798e3b6
📒 Files selected for processing (2)
README.mddocs/vsa-vs-clean-architecture.md
…ject split (#50) * chore(claude): refine the Clean promotion signal — dependency rule vs project split Sharpens the "Promotion signal" section after a discussion surfaced that the prior framing ("Clean is earned / for complex services") conflated two separable things that both wear the name "Clean Architecture": - The DEPENDENCY RULE (Domain -> nothing; IO at the edges) is already in force in VSA, applies at every scale, and is NOT what the promotion signal gates. Decoupling the domain from frameworks is always worth it. - The MULTI-PROJECT STRUCTURE (4 csprojs) is the only part with ceremony and the only thing the promotion signal gates — all it buys over single-project VSA is compile-time enforcement of the dependency rule via project references. Adds the real axis: how you ENFORCE the dependency rule, escalating with the cost of a violated boundary — convention -> architecture tests -> project split. Names the middle rung most teams skip: an architecture test (NetArchTest / ArchUnitNET / Roslyn analyzer) asserting "Domain references no EF/Infrastructure namespaces" enforces the same boundary the 4-project split does, deterministically in CI, without the ceremony. So the project split is rarely needed for enforcement alone — reach for it only when domain complexity makes you want the compiler (not a test) to hold the line, or when separate deploy/versioning units justify it. New table row for the architecture-tests rung; existing "5+ aggregates" row reframed as "when you want the compiler to hold the boundary" rather than "consider Clean" (which blurred principle into structure). Notes NextAurora enforces the rule today via convention + the architecture-reviewer agent + CodeRabbit; adding architecture tests would be the next rung without changing the VSA shape (a candidate future improvement, not mandated here). Paraphrase-drift audit: run /check-rules locally to audit paraphrases against this diff. Done — the refinement is net-new nuance; no existing See-CLAUDE.md marker paraphrases the promotion signal or the dependency-rule-vs-structure distinction, and it's consistent with the "Layer Dependencies" rule it references. No drift. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore(claude): point the promotion-signal rule at the VSA-vs-Clean guide Adds a deep-dive link from the refined "Promotion signal" section to the new portable decision guide (docs/vsa-vs-clean-architecture.md, PR #51): the CLAUDE.md section is NextAurora's specific rule; the doc is the general two-meanings-of-Clean / enforcement-spectrum / testing-shift / duplication-tradeoff reference behind it. Pointer only — no rule change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
A reusable, system-agnostic synthesis of the VSA-vs-Clean decision, distilled from a multi-turn architecture discussion. Written to be lifted into any project; NextAurora is the worked example at the end, not the premise. Same pattern as
docs/messaging-transport-selection.md(#49) — portable reference knowledge, kept out of CLAUDE.md (which holds this repo's rules).Core points it lands
Scope
docs/vsa-vs-clean-architecture.mdTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit