transaction-per-function
IN premise
Every API function opens the database, does its work, and closes — no shared state, no connection pooling, no long-lived sessions; each invocation is fully independent.
Summary
Each API function is completely self-contained — it opens a fresh database connection, does what it needs to do, and closes it. There is no shared state between calls, which makes the system simple and stateless but means every request pays the cost of opening and closing a connection.
Dependents
These beliefs depend on this one:
- api-layer-ensures-atomic-isolated-mutations — The API layer enforces mutation safety through four mechanisms: context-managed load/save, per-function transaction scope, write-flag gating to prevent unintended persistence, and dict-only returns that prevent callers from holding live network references.
Details
| Source | entries/2026/04/23/reasons_lib-api.md |