api-uses-with-network-context-manager
IN premise
`api.py` uses a `_with_network` context manager to ensure load-operate-save atomicity for all network mutations.
Summary
All code in api.py that modifies the belief network goes through a single context manager that loads the current state, lets the operation run, and then saves the result. This guarantees that no mutation can partially complete — if anything fails mid-operation, the network stays in its previous consistent state, preventing corrupted or half-applied changes.
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.
- three-layer-stack-has-clean-boundaries — The architecture enforces strict layer separation: pure data model at bottom, context-managed API with dict returns in the middle, and pure-formatter CLI at the top
Details
| Source | entries/2026/04/23/scan-ftl-reasons.md |