Search docs
Docs searchValidation rule
Back to Rule CatalogAP-DOM-005Domain Model QualityCross-aggregate modification risk
Flags workflows that modify multiple aggregates without clear coordination.
warningviolationNo auto-fix
How to fix
- Move coordination into an application service.
- Use events/outbox for eventual consistency when appropriate.
- Keep each aggregate responsible for its own state changes.
What the rule validates
A workflow writes across aggregate boundaries in a way that may bypass each aggregate's invariants.
Why it matters
Cross-aggregate writes need explicit orchestration, transaction, or event strategy.
Common causes
- A service updates several model roots directly.
- A migration path temporarily combines unrelated writes.
- No event or application workflow owns the coordination.
Typical violation example
One method directly updates organization, billing subscription, and invitation records with no coordination model.Typical compliant example
An onboarding workflow coordinates aggregate-owned operations and documents consistency expectations.Related rules
AP-DOM-001 - Anemic domain modelAP-DOM-002 - Aggregate boundary violationAP-DOM-003 - Oversized aggregate/service boundaryAP-DOM-004 - Domain logic scattered across layers
Adjacent categories
Related files/config
apps/api/src/modulespackages
Related CLI commands
archpilot validatearchpilot validate --ci