started crud reference
This commit is contained in:
@@ -30,7 +30,8 @@ Define consistent transaction demarcation for async SQLAlchemy so write behavior
|
||||
|
||||
- Every mutating use case must run inside an explicit transaction boundary.
|
||||
- Prefer `async with session.begin():` for write units.
|
||||
- Keep transaction ownership at service/use-case boundary, not deep in helper internals.
|
||||
- Keep transaction ownership at a service, use-case, or explicitly documented complete-operation boundary, not deep in helper internals.
|
||||
- An optional-session write may own one transaction when omitting the session clearly means standalone execution; a supplied session must remain caller-owned.
|
||||
- Read paths should not auto-upgrade into hidden write behavior.
|
||||
- On exception in a transaction block, rely on rollback semantics and propagate or map exceptions intentionally.
|
||||
|
||||
@@ -82,7 +83,7 @@ Use nested transactions only when partial failure semantics are explicitly requi
|
||||
## Anti-Patterns
|
||||
|
||||
- Multiple commits scattered across one logical use case.
|
||||
- Helper functions that commit/rollback without caller awareness.
|
||||
- Helper functions that commit or roll back without an explicit ownership contract.
|
||||
- Mixing implicit and explicit transaction styles in confusing ways.
|
||||
- Using savepoints as a default pattern rather than a targeted tool.
|
||||
|
||||
@@ -90,8 +91,8 @@ Use nested transactions only when partial failure semantics are explicitly requi
|
||||
|
||||
## Operational Checks
|
||||
|
||||
- All mutating service functions declare one clear transaction boundary.
|
||||
- No repository/helper performs hidden commit calls.
|
||||
- All mutating services and complete operations declare one clear transaction boundary.
|
||||
- No repository or helper performs hidden direct commit calls; standalone ownership is expressed through a documented transaction scope.
|
||||
- Transaction style is consistent across handlers and workers.
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user