docs: finalize ARCHITECTURE.md with complete layered structure and zero remaining tech debt
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

This commit is contained in:
2026-02-20 16:16:22 +01:00
parent 0148bf28dc
commit 309b3bc02d

View File

@@ -103,15 +103,23 @@ Campaign ──parent_campaign_id──▶ Campaign (recurring execution histor
### Layered Structure ### Layered Structure
``` ```
routers/ ← HTTP endpoints (input validation, auth, response shaping) routers/ ← Thin HTTP adapters (auth, params, response shaping — zero inline ORM)
services/ ← Business logic (state machines, calculations, imports) services/ ← Framework-agnostic business logic (46 service modules, ~250 functions)
models/ ← SQLAlchemy ORM models domain/ ← Pure business rules (entities, value objects, ports, errors — zero framework imports)
infrastructure/ ← Repository implementations (SQLAlchemy), Redis, mappers
models/ ← SQLAlchemy ORM models (persistence mapping only)
database.py ← Engine + session management (lazy initialization) database.py ← Engine + session management (lazy initialization)
``` ```
**Dependency rule:** routers → services → domain ← infrastructure. Dependencies always point inward toward domain.
**Transaction management:** Services never call `db.commit()`. Routers manage transactions via `UnitOfWork`. Import services and background jobs are documented exceptions (self-contained batch operations).
### Services ### Services
#### Business Logic Services #### Business Logic Services