Application transactions and external effects
A Toolora business transaction groups record changes that must either commit together or be rejected together. A single database function can enforce that boundary with locks, revisions and constraints. Several HTTP calls, an upload and an external provider call are separate operations even when one page starts them.
The database transaction reference owns the detailed RPC, lock and replay inventory. This article explains how that boundary affects application design and user-visible results.
Atomicity by operation
Section titled “Atomicity by operation”| Boundary | What can be committed together | Separate outcome |
|---|---|---|
| Revisioned quote draft RPC | Validated quote fields, row edits and supplied recipient split | Sending, token lifecycle and customer acceptance |
| Commercial acceptance transaction | Its accepted snapshot, state and related authoritative database changes | Later notifications and external accounting |
| Purchase-cost allocation RPC | Reviewed allocation rows, revision and source-basis checks | Supplier payment, AP approval or Fortnox bookkeeping |
| Browser contact/profile sequence | Each individual request’s own transaction | Compensation and recovery across the requests |
| Storage upload followed by metadata link | The database metadata operation | Object upload/removal and an uncertain link result |
| Provider export or delivery | Durable local intent, state and receipt operations | Provider acceptance and remote state |
A batch endpoint also needs its declared unit of success. Purchase-cost review retains a result per invoice; returning several receipts does not turn the batch into one all-or-nothing transaction. A caller must inspect each result rather than treating HTTP success as every invoice confirmed.
Revisions and current source basis
Section titled “Revisions and current source basis”The quote editor saves an already-created draft through a revisioned API/RPC. expected_updated_at describes the version the editor read. A conflicting save returns 409 rather than overwriting a concurrent change. The editor retains local work and can compare base, local and remote values.
Purchase-cost allocations additionally depend on a source fingerprint. A matching numeric revision is insufficient if the underlying invoice evidence changed. The transaction validates amounts, target projects/accounts and duplicate choices. Editing states explains what the user sees after refusal.
An idempotency key has the scope defined by its operation. It can identify a retried intent without granting permission or authorizing different payloads. A cursor, object hash, source key and transaction revision are different identities and must not be substituted for one another.
Crossing the provider boundary
Section titled “Crossing the provider boundary”flowchart LR
Review[Authorized reviewed action] --> Intent[Durable intent and operation identity]
Intent --> Provider[External provider request]
Provider --> Known{Outcome known?}
Known --> Receipt[Persist receipt and reconcile state]
Known --> Unknown[Keep outcome uncertain]
Unknown --> Reconcile[Read provider/local evidence]
Reconcile --> Receipt
A network timeout can occur after a provider accepted the action. Aborting a browser request does not cancel a database commit or remote send. Retrying requires the operation’s recovery contract: locate the existing document, message or receipt and determine whether the same intent can safely resume. Integration recovery distinguishes the current provider mechanisms and their limits.
Example: concurrent allocation edit
Section titled “Example: concurrent allocation edit”Two synthetic office sessions read allocation revision 7. The first saves reviewed rows and receives the next revision. The second submits revision 7 and the earlier fingerprint. Its request is refused; it must retain the proposed split, read current evidence and obtain a new review decision. It must not merely replace the expected revision and replay old rows.
If the first session loses its response, reading the saved allocations can establish whether the local transaction committed. It does not establish a supplier payment or accounting export, because this operation owns neither outcome.
Evidence scope
Section titled “Evidence scope”Route tests specify RPC arguments, conflict mapping and refusal before foreign-resource effects with substituted dependencies. Database tests establish atomic invariants only when executed on the stack. Provider recovery needs its named remote/local scenario. This source review makes no universal exactly-once or multi-provider transaction claim.