Committing State Before Rendering a Success Result
A response should represent the final state promised to callers. A provisional write inside one transaction does not yet establish that state.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a constraint failure
A handler creates a local record object and attempts to store it. A later database error prevents the commit. Rendering the stored success address before completion gives misleading feedback. Transaction lifecycle explains why.
Test both outcomes
Verify a committed request and a rejected request whose local work began normally. Unknown results after a timeout remain a separate observation for the client.[1]
Verify success from an independent read path
A handler can calculate a new value and prepare success output before commit finishes. If the commit fails, the displayed success would be incorrect. The durable success result should correspond to completed storage under the endpoint contract. See redirect after saving.
Validate form
Stage DB changes
Commit → success or failure
On success, serve a link whose ordinary read shows the committed state
Consider that response delivery can fail after commit
A persisted record can exist even if the client never receives its success response. Repeatable request identity can help reconcile that. Test failure before commit and loss of response afterward.