DDD Aggregate Transaction Boundary
One transaction should update one aggregate. If multiple aggregates must change, model coordination explicitly.
Workflow
Identify every aggregate loaded or modified by the use case.
Mark which aggregate owns the command's true invariant.
Keep that aggregate in the synchronous transaction.
Move other aggregate updates behind domain events, an outbox, a saga, or a process manager.
Define compensating behavior for failures and retries.
Checks
A use case that saves two aggregate roots is suspect.
Repository calls from inside aggregates are violations.
Database foreign keys do not define aggregate consistency boundaries.
If the business demands immediate consistency across roots, challenge whether the boundary is wrong.
Detailed Reference
For non-trivial implementation, review, or refactoring work, read references/details.md before giving final guidance. It contains the detailed rules, examples, smells, and migration notes that do not belong in the short invocation body.
Output
Return the current transaction map, the corrected command flow, events/messages, idempotency strategy, and residual consistency risk.