refactor(architecture): nine modular-monolith modules + NetArchTest guardrails (task 1.13, SDK-01) #71

Merged
amiryahaya merged 1 commit from feat/1.13-modular-monolith into main 2026-11-06 11:29:07 +01:00
Owner

Closes #41 — ADR-010 §16.2 made enforceable (guardrails-as-code extended to structure).

Physical organization — src/FailSulit.Api/Modules/<M>/{Features,Services} for the nine modules (Identity, Org, Keys, Files, Sharing, Activity, Notifications, Integration, Admin). 189 files moved, namespaces updated, zero behavior change (837/0/39 identical before/after). EF entities keep their migration-pinned Data.Entities namespaces; ownership lives in the machine-readable ModuleMap.

Cross-cutting services reclassified as rank-0 infrastructure (FailSulit.Api.Services): AuditService, EmailService/IEmailService, NotificationService, PushService, FileActivityService(+Cleanup) — referenced by every module, so they anchor nothing. The Activity module keeps its entity, query endpoints and the SDK audit sink.

One inversion fixed properly — device revocation now flows downward: IDeviceRevocationListener (Identity) is implemented by Keys' DeviceWrapCleanup and composed in Program, replacing Identity's direct DeviceKeyWrap delete. Org-domain handlers (SwitchTenant, ListTenantUsers) moved out of Identity with routes unchanged (self-mapped on the Org side).

ArchitectureTests (NetArchTest.Rules, in api-ci):

  • R1 downward-only rank DAG across the nine modules
  • R2/R2b EF entity privacy per ModuleMap ownership (Identity as strict root)
  • R3 Middleware composes, never references module features
  • Upward seams are an explicit shrinking list (ModuleMap.UpwardSeams): Auth registration flows → Org (Phase 2 identity switch), Files → Sharing (Phase 7 file consolidation). Each names its target phase; the list can only shrink — growth fails the build.

Exit criterion verified: a deliberately violating fixture (Identity class referencing Share) failed the suite naming the type — output captured, then removed per the task.

Suite 841/0/39 Release ×3 (4 new arch tests); coverage gate 84.50% ≥ 80.

Closes #41 — ADR-010 §16.2 made enforceable (guardrails-as-code extended to structure). **Physical organization** — src/FailSulit.Api/Modules/&lt;M&gt;/{Features,Services} for the nine modules (Identity, Org, Keys, Files, Sharing, Activity, Notifications, Integration, Admin). 189 files moved, namespaces updated, **zero behavior change** (837/0/39 identical before/after). EF entities keep their migration-pinned Data.Entities namespaces; ownership lives in the machine-readable ModuleMap. **Cross-cutting services reclassified as rank-0 infrastructure** (FailSulit.Api.Services): AuditService, EmailService/IEmailService, NotificationService, PushService, FileActivityService(+Cleanup) — referenced by every module, so they anchor nothing. The Activity module keeps its entity, query endpoints and the SDK audit sink. **One inversion fixed properly** — device revocation now flows downward: `IDeviceRevocationListener` (Identity) is implemented by Keys' `DeviceWrapCleanup` and composed in Program, replacing Identity's direct DeviceKeyWrap delete. Org-domain handlers (SwitchTenant, ListTenantUsers) moved out of Identity with routes unchanged (self-mapped on the Org side). **ArchitectureTests (NetArchTest.Rules, in api-ci)**: - R1 downward-only rank DAG across the nine modules - R2/R2b EF entity privacy per ModuleMap ownership (Identity as strict root) - R3 Middleware composes, never references module features - Upward seams are an explicit shrinking list (ModuleMap.UpwardSeams): Auth registration flows → Org (Phase 2 identity switch), Files → Sharing (Phase 7 file consolidation). Each names its target phase; the list can only shrink — growth fails the build. **Exit criterion verified**: a deliberately violating fixture (Identity class referencing Share) failed the suite naming the type — output captured, then removed per the task. Suite 841/0/39 Release ×3 (4 new arch tests); coverage gate 84.50% ≥ 80.
refactor(architecture): nine modular-monolith modules + NetArchTest guardrails (task 1.13, SDK-01) (#41)
All checks were successful
API CI / build-and-test (pull_request) Successful in 4m3s
d63f0952a6
Closes #41

- Physical organization into the nine ADR-010 §16.2 modules (Identity, Org,
  Keys, Files, Sharing, Activity, Notifications, Integration, Admin) under
  src/FailSulit.Api/Modules/<M>/{Features,Services}; 189 files moved,
  namespaces updated, zero behavior change (837/0/39 pre/post)
- Cross-cutting services reclassified as rank-0 infrastructure (referenced by
  all modules): AuditService, EmailService/NotificationService/PushService,
  FileActivityService(+Cleanup) -> FailSulit.Api.Services
- Device revocation inverted into a downward hook: IDeviceRevocationListener
  (Identity) implemented by Keys' DeviceWrapCleanup, composed in Program —
  Identity no longer references Keys upward
- Org-domain handlers moved out of Identity: SwitchTenant + ListTenantUsers
  (routes unchanged, now self-mapped on the Org side)
- ArchTests (NetArchTest.Rules): R1 downward-only rank DAG; R2 entity privacy
  per ModuleMap ownership (entities keep migration-pinned namespaces);
  R2b Identity as strict root; R3 Middleware composes, no module features.
  Upward seams are an explicit shrinking list in ModuleMap (Auth registration
  flows -> Org, Files -> Sharing) with target phases
- Exit criterion verified: deliberately violating fixture (Identity -> Share)
  failed the suite naming the type, then removed
- New: middleware purity + revocation-listener patterns documented in-code
Sign in to join this conversation.
No description provided.