Skip to content

fix(vsa): move Domain.Features to Web, delete Domain.Tests - #104

Merged
mpaulosky merged 4 commits into
devfrom
squad/103-vsa-move-domain-features
Apr 24, 2026
Merged

fix(vsa): move Domain.Features to Web, delete Domain.Tests#104
mpaulosky merged 4 commits into
devfrom
squad/103-vsa-move-domain-features

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Summary

Resolves the Vertical Slice Architecture violation where CQRS handlers, commands, queries, and validators were in src/Domain/Features/ instead of the Web project.

Closes #103
Working as Sam (Backend Engineer)

Changes

Deleted

  • src/Domain/Features/ — all 13 CQRS files (5 command classes, 3 command handlers, 3 validators, 2 query classes, 2 query handlers)
  • tests/Domain.Tests/ — project deleted from solution; its handler/validator tests are fully superseded by tests/Web.Tests/ which already covers all Web.Features with richer caching-aware tests

Modified

  • src/Web/Program.cs — MediatR and FluentValidation now scan only the Web assembly (removed RegisterServicesFromAssembly(typeof(BlogPost).Assembly) and AddValidatorsFromAssembly(typeof(BlogPost).Assembly))
  • MyBlog.slnx — removed Domain.Tests.csproj entry
  • tests/Architecture.Tests/DomainLayerTests.cs — added Domain_Should_Not_Have_Features guard test

Test Results

  • Architecture.Tests: 9 passed ✅ (includes new guard)
  • Web.Tests: 84 passed ✅
  • Web.Tests.Bunit: 59 passed ✅

Decision Note

tests/Unit.Tests/ has no .csproj and is absent from the solution (artifacts only, removed in #100). tests/Web.Tests/ is the correct home for feature-level handler and validator tests, and was already complete.

Copilot AI review requested due to automatic review settings April 23, 2026 22:46
@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label Apr 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ PR Added to Squad Triage Queue

This PR has been labeled with squad and added to the triage queue.

Next steps:

  • The squad Lead will review and assign to an appropriate team member
  • A squad:member label will be added after triage

If you know which squad member should handle this, you can add the appropriate squad:member label yourself.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enforces Vertical Slice Architecture by removing CQRS “Features” from the Domain layer, tightening DI assembly scanning in Web, and deleting the now-obsolete Domain.Tests project.

Changes:

  • Delete src/Domain/Features/** CQRS commands/queries/handlers/validators and remove the tests/Domain.Tests project.
  • Update src/Web/Program.cs to have MediatR + FluentValidation scan only the Web assembly.
  • Add an architecture guard test preventing MyBlog.Domain.Features types from reappearing.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
MyBlog.slnx Removes Domain.Tests from the solution.
src/Web/Program.cs Limits MediatR + FluentValidation scanning to Web assembly only.
tests/Architecture.Tests/DomainLayerTests.cs Adds a guard test to enforce “no Features in Domain”.
tests/Domain.Tests/Domain.Tests.csproj Deleted Domain test project definition.
tests/Domain.Tests/GlobalUsings.cs Deleted (Domain.Tests project removed).
tests/Domain.Tests/Domain/Commands/CreateBlogPostCommandHandlerTests.cs Deleted (Domain.Tests project removed).
tests/Domain.Tests/Domain/Commands/DeleteBlogPostCommandHandlerTests.cs Deleted (Domain.Tests project removed).
tests/Domain.Tests/Domain/Commands/UpdateBlogPostCommandHandlerTests.cs Deleted (Domain.Tests project removed).
tests/Domain.Tests/Domain/Queries/GetAllBlogPostsQueryHandlerTests.cs Deleted (Domain.Tests project removed).
tests/Domain.Tests/Domain/Queries/GetBlogPostByIdQueryHandlerTests.cs Deleted (Domain.Tests project removed).
src/Domain/Features/BlogPosts/Commands/CreateBlogPost/CreateBlogPostCommand.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/CreateBlogPost/CreateBlogPostCommandHandler.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/CreateBlogPost/CreateBlogPostCommandValidator.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/DeleteBlogPost/DeleteBlogPostCommand.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/DeleteBlogPost/DeleteBlogPostCommandHandler.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/DeleteBlogPost/DeleteBlogPostCommandValidator.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/UpdateBlogPost/UpdateBlogPostCommand.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/UpdateBlogPost/UpdateBlogPostCommandHandler.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Commands/UpdateBlogPost/UpdateBlogPostCommandValidator.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Queries/GetAllBlogPosts/GetAllBlogPostsQuery.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Queries/GetAllBlogPosts/GetAllBlogPostsQueryHandler.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Queries/GetBlogPostById/GetBlogPostByIdQuery.cs Deleted (CQRS moved out of Domain).
src/Domain/Features/BlogPosts/Queries/GetBlogPostById/GetBlogPostByIdQueryHandler.cs Deleted (CQRS moved out of Domain).

Comment thread MyBlog.slnx
Comment on lines 8 to 12
<Folder Name="/tests/">
<Project Path="tests/AppHost.Tests/AppHost.Tests.csproj" />
<Project Path="tests/Architecture.Tests/Architecture.Tests.csproj" />
<Project Path="tests/Domain.Tests/Domain.Tests.csproj" />
<Project Path="tests/Web.Tests/Web.Tests.csproj" />
<Project Path="tests/Web.Tests.Bunit/Web.Tests.Bunit.csproj" />

Copilot AI Apr 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Domain.Tests is removed from the solution here, but the repo still has multiple scripts/CI jobs that reference tests/Domain.Tests (e.g. .github/workflows/squad-test.yml has a test-domain job running dotnet test tests/Domain.Tests). This change will break CI and local pre-push/test docs unless those references are removed or redirected to the replacement test project(s) (e.g. Web.Tests).

Copilot uses AI. Check for mistakes.
@github-actions

github-actions Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Test Results Summary

201 tests   - 12   201 ✅  - 12   14s ⏱️ ±0s
  5 suites  -  1     0 💤 ± 0 
  5 files    -  1     0 ❌ ± 0 

Results for commit eaa7e5a. ± Comparison against base commit 1eefb6a.

This pull request removes 13 and adds 1 tests. Note that renamed tests count towards both.
Domain.Domain.Commands.CreateBlogPostCommandHandlerTests ‑ Handle_RepositoryThrows_PropagatesException
Domain.Domain.Commands.CreateBlogPostCommandHandlerTests ‑ Handle_ValidCommand_AddsPostAndReturnsGuid
Domain.Domain.Commands.DeleteBlogPostCommandHandlerTests ‑ HandleRepositoryThrowsPropagatesException
Domain.Domain.Commands.DeleteBlogPostCommandHandlerTests ‑ HandleValidIdDeletesPostAndReturnsSuccess
Domain.Domain.Commands.UpdateBlogPostCommandHandlerTests ‑ Handle_ExistingPost_UpdatesAndReturnsSuccess
Domain.Domain.Commands.UpdateBlogPostCommandHandlerTests ‑ Handle_PostNotFound_ReturnsNotFoundFailure
Domain.Domain.Commands.UpdateBlogPostCommandHandlerTests ‑ Handle_RepositoryThrowsOnGet_PropagatesException
Domain.Domain.Queries.GetAllBlogPostsQueryHandlerTests ‑ Handle_EmptyRepository_ReturnsSuccessWithEmptyList
Domain.Domain.Queries.GetAllBlogPostsQueryHandlerTests ‑ Handle_RepositoryThrows_PropagatesException
Domain.Domain.Queries.GetAllBlogPostsQueryHandlerTests ‑ Handle_WithPosts_ReturnsSuccessWithList
…
MyBlog.Architecture.Tests.DomainLayerTests ‑ Domain_Should_Not_Have_Features

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.19%. Comparing base (1eefb6a) to head (eaa7e5a).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #104      +/-   ##
==========================================
- Coverage   79.88%   78.19%   -1.70%     
==========================================
  Files          52       40      -12     
  Lines         696      642      -54     
  Branches      109      107       -2     
==========================================
- Hits          556      502      -54     
  Misses         95       95              
  Partials       45       45              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mpaulosky pushed a commit that referenced this pull request Apr 23, 2026
- Remove tracked log files (test-results-latest.log, test-run-unit.log, test-run.log)
- Add *.log to .gitignore
- Delete ADR-002 decision doc (Two-Layer CQRS, superseded by VSA move)
- Clean up ARCHITECTURE.md: remove Domain/Features dir tree, ADR-002 references,
  Handler Pattern bullet, and entire Two-Layer CQRS section
- Move Domain.Features validator tests from Domain.Tests to Web.Tests with
  distinct file names (CreateBlogPostDomainCommandValidatorTests, etc.)
  to survive deletion of Domain.Tests in PR #104
- Add FluentValidation package reference to Web.Tests.csproj

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Boromir and others added 3 commits April 23, 2026 16:37
- Deleted src/Domain/Features/ (13 CQRS handler/command/query files)
  that were violating Vertical Slice Architecture by residing in Domain
- Updated src/Web/Program.cs: MediatR and FluentValidation now scan
  only the Web assembly (removed Domain assembly scans)
- Removed tests/Domain.Tests project from solution (MyBlog.slnx);
  coverage fully superseded by tests/Web.Tests which already has
  CreateBlogPostHandlerTests, DeleteBlogPostHandlerTests,
  EditBlogPostHandlerTests, GetBlogPostsHandlerTests, and all validators
- Added Domain_Should_Not_Have_Features arch guard test to
  Architecture.Tests/DomainLayerTests.cs (enforces VSA going forward)
- Updated pre-push hook to remove Domain.Tests from TEST_PROJECTS

Closes #103
Working as Sam (Backend Engineer)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Domain.Tests project was deleted in the VSA migration (issue #103).
Remove the test-domain job and all references (needs, summary, status check).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add NoWarn suppressions for test-appropriate analyzer rules:
  CA2007 (no ConfigureAwait needed in xUnit), CA1707 (underscore test names),
  CA1848/CA1873 (logging perf hints), CA5400 (intentional CRL skip),
  CA1031 (intentional broad catch in polling), CA1014 (CLSCompliant),
  CA1515 (xUnit requires public fixtures), CA1711 (xUnit Collection suffix)
- Fix CA2234: pass Uri instead of string to HttpClient.GetAsync in
  BasePlaywrightTests.cs and AspireManager.cs
- Fix CA1062: add ArgumentNullException.ThrowIfNull(test) to
  InteractWithPageAsync, InteractWithAuthenticatedPageAsync,
  InteractWithAdminPageAsync

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mpaulosky
mpaulosky force-pushed the squad/103-vsa-move-domain-features branch from 5eec022 to a8a6909 Compare April 24, 2026 00:00
… migration

- CreateBlogPostDomainCommandValidatorTests: Domain.Features.* → Web.Features.Create
- DeleteBlogPostDomainCommandValidatorTests: Domain.Features.* → Web.Features.Delete
- UpdateBlogPostCommandValidatorTests: Domain.Features.* → Web.Features.Edit;
  rename UpdateBlogPostCommand/Validator → EditBlogPostCommand/Validator

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mpaulosky
mpaulosky merged commit b4586cd into dev Apr 24, 2026
15 checks passed
@mpaulosky
mpaulosky deleted the squad/103-vsa-move-domain-features branch April 24, 2026 00:08
mpaulosky added a commit that referenced this pull request Apr 24, 2026
## Sprint 4 Release — v1.1.0

Replaces PR #105 which had a merge conflict in workflow files
(`squad-ci.yml`, `squad-test.yml`).

### Changes included

All Sprint 4 work from `dev`:
- feat: Blazor theme system (Sprint 4 issues #81#86)
- feat: VSA migration — move Domain.Features to Web (PR #104)
- fix: Resolve all 7 flaky E2E tests in AppHost.Tests (PR #102)
- refactor: Reorganize test projects (PR #100)
- ci: Central Package Management (CPM)
- ci: Fix squad-preview validate to skip AppHost.Tests/Bunit (unrunnable
on plain runners)

### Conflict resolution

`squad-ci.yml` and `squad-test.yml` had add/add and content conflicts
from main having an older version. Resolved by accepting the `dev`
versions (correct current state).

---
Closes #105

_After merging, run **squad-milestone-release** to tag and publish
v1.1.0._
mpaulosky pushed a commit that referenced this pull request Apr 24, 2026
)

- Add tests/Domain.Tests/Domain.Tests.csproj stub (unblocks Gate 3 of
  pre-push hook which references this project but it was deleted in #104)
- Register Domain.Tests in MyBlog.slnx so release build includes it

The CachingLayerTests (already committed) are [Fact(Skip)] TDD-red,
pending Sam's #110 handler refactor that adopts IBlogPostCacheService.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mpaulosky added a commit that referenced this pull request Apr 24, 2026
…ributedCache/IMemoryCache (#113)

- Add CachingLayerTests with two arch rules (previously Skipped, now active)
- Re-add Domain.Tests stub project (deleted in #104, required by Gate 3)
- Register Domain.Tests in MyBlog.slnx
- All 9 arch tests green

Closes #113

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad Squad triage inbox — Lead will assign to a member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSA: Move Domain.Features to Web — enforce true Vertical Slice Architecture

2 participants