Rivane

Accounting
made smart

ERP Use CasesTier 2Published June 29, 2026

Partial Failure Mid-Posting: Atomic Rollback / Saga Compensation

Partial Failure Mid-Posting: Atomic Rollback / Saga Compensation for US and UK finance teams: ERP requirements, controls, audit evidence, data model, APIs, state transitions, and implementation checks.

Platform / Transaction Integrity is where ERP discipline either begins or breaks.

Partial Failure Mid-Posting: Atomic Rollback / Saga Compensation looks operational from far away. In a real finance team, it is a chain of assertions: the right actor started the work, the required records existed, the control policy was applied, the state change was preserved, and the outcome can be explained later without rebuilding the transaction from emails and spreadsheets.

The expected business outcome is specific: Every multi-step posting is all-or-nothing from the reader's perspective; partial failures self-heal via rollback or compensation; the ledger never holds an unbalanced or half-applied state.

The control flow a finance team actually needs.

Workflow map showing control steps, exceptions, and evidence for this ERP process.All Same-Datasto...Start conditionCross- Steps Use...Required checksEvery Step Idemp...Owner and SLANo Partial State...System updateFailed Operation...Exception handlingAudit packetEvidence trailException loopPlatform / Transaction Integrity should preserve every override and rejection.
Workflow map for this ERP process, including exception handling and audit evidence.

Step 1

All Same-Datastore Steps Of A Money/...

Step 2

Cross- Steps Use A Saga With Explicit...

Step 3

Every Step Idempotent So Retry Is Safe

Step 4

No Partial State Visible To Readers

Step 5

Failed Operations Surface A Clear,...

The ERP surface involved.

Module

Platform / Transaction Integrity

Actors

Posting Service, Database, Downstream Systems (ledger, FGA, integrations)

Tier

Tier 2

Finance area

Cross-Cutting Edge Cases & Failure Modes

Region lens

US and UK finance teams

Publication date

June 29, 2026

all same-datastore steps of a money/`display_id` write run in ONE transaction (atomic commit or full rollback); cross-system steps use a saga with explicit compensating actions; every step idempotent so retry is safe; no partial state visible to readers (no orphan debit/credit, no paid-without-cash); failed operations surface a clear, recoverable error, not a silent half-state; compensations and retries are logged; outbox/transactional-messaging pattern for emitted events so an event is never sent for a rolled-back write.

US and UK teams have different compliance hooks, but the same control problem.

US teams usually care about clean evidence for audit support, vendor records, payment controls, tax reporting, and management review. UK teams usually care about VAT-ready records, approval evidence, digital-record discipline, and traceable postings. The country-specific details differ, but the operating pattern is the same: the ERP needs controlled records, explicit ownership, defensible state changes, and evidence that survives beyond the person who completed the task.

The control matrix.

Control areaRequirementAcceptance proof
Control 1
all same-datastore steps of a money/display_id write run in ONE transaction (atomic commit or full rollback
Given a multi-step posting operation spanning invoice creation, cash allocation, customer balance update, and ledger event emission
Control 2cross-system steps use a saga with explicit compensating actions
when a failure occurs mid-operation (e.g., ledger emit times out after cash allocation
Control 3every step idempotent so retry is safethen all same-datastore steps roll back atomically (no orphan debit/credit), cross-system saga compensations undo completed steps, the user sees a clear recoverable error, no partial state is visible to readers, and the operation is safely retried
Control 4no partial state visible to readers (no orphan debit/credit, no paid-without-cash
negative) when an event is emitted for a rolled-back write the system must suppress it via outbox pattern, else 500 with error code outbox_consistency_failure.
Control 5failed operations surface a clear, recoverable error, not a silent half-stateEvery multi-step posting is all-or-nothing from the reader's perspective; partial failures self-heal via rollback or compensation; the ledger never holds an unbalanced or half-applied state.
Control 6compensations and retries are loggedEvery multi-step posting is all-or-nothing from the reader's perspective; partial failures self-heal via rollback or compensation; the ledger never holds an unbalanced or half-applied state.

Audit evidence is a chain, not a folder.

Evidence layerWhat should be preserved
Business event
A multi-step operation - e.g., post an invoice, allocate cash, update the customer balance, emit a ledger event, push to an external system - fails partway (DB error, downstream timeout). For steps inside one datastore the whole unit commits or rolls back atomically (single transaction), so the books never show a half-posted document. For steps spanning systems that cannot share a transaction, a saga issues compensating actions to undo the already-completed steps, and the operation is retried idempotently. The user never sees a debit without its credit, or an invoice marked paid with no cash applied.
Control rules
all same-datastore steps of a money/display_id write run in ONE transaction (atomic commit or full rollback);
cross-system steps use a saga with explicit compensating actions;
every step idempotent so retry is safe;
no partial state visible to readers (no orphan debit/credit, no paid-without-cash);
failed operations surface a clear, recoverable error, not a silent half-state;
compensations and retries are logged;
outbox/transactional-messaging pattern for emitted events so an event is never sent for a rolled-back write.
Acceptance proof
Given a multi-step posting operation spanning invoice creation, cash allocation, customer balance update, and ledger event emission;
when a failure occurs mid-operation (e.g., ledger emit times out after cash allocation);
then all same-datastore steps roll back atomically (no orphan debit/credit), cross-system saga compensations undo completed steps, the user sees a clear recoverable error, no partial state is visible to readers, and the operation is safely retried;
(negative) when an event is emitted for a rolled-back write the system must suppress it via outbox pattern, else 500 with error code outbox_consistency_failure.
Data record
posting_saga { id: string, steps: json, status: enum, compensations: json, external_id: string, created_at: timestamp };
outbox_event { id: string, saga_id: string, event_type: string, payload: json, status: enum, emitted_at: timestamp };
(reference, product may differ).
System event
POST /v1/invoices/{id}/post -> 202 { saga_id } for async;
or 201 for sync same-datastore;
GET /v1/posting-sagas/{saga_id} -> { status, steps, compensations };
emits invoice.posted only after successful commit via outbox;
failed saga emits posting.failed event.
Lifecycle state
PENDING -> IN_PROGRESS -> COMMITTED;
terminal ROLLED_BACK or COMPENSATED;
guard: no partial visible state between steps;
outbox event only emitted post-commit;
compensation steps logged individually;
retry idempotent via external_id.

The useful version of this workflow is not only fast. It is inspectable. A controller, auditor, or operator should be able to move from source event to system record to state transition to final business outcome without guessing.

Implementation contracts.

Reference data model

`posting_saga` { id: string, steps: json, status: enum, compensations: json, external_id: string, created_at: timestamp }; `outbox_event` { id: string, saga_id: string, event_type: string, payload: json, status: enum, emitted_at: timestamp }; (reference, product may differ).

API and events

`POST /v1/invoices/{id}/post` -> 202 { saga_id } for async; or 201 for sync same-datastore; `GET /v1/posting-sagas/{saga_id}` -> { status, steps, compensations }; emits `invoice.posted` only after successful commit via outbox; failed saga emits `posting.failed` event.

State transitions

`PENDING -> IN_PROGRESS -> COMMITTED`; terminal `ROLLED_BACK` or `COMPENSATED`; guard: no partial visible state between steps; outbox event only emitted post-commit; compensation steps logged individually; retry idempotent via `external_id`.

Common implementation traps.

Treating the workflow as data entry

If the ERP only stores the final record, the team loses the decision trail that explains how the record became valid.

Hiding exception logic

Exceptions need owners, reason codes, and time stamps. A vague pending state is not a control.

Posting without recovery design

Retries, duplicate submissions, and partial failures must be explicit so the system does not create inconsistent records.

Skipping evidence design

A workflow that cannot produce evidence on demand will eventually push finance teams back into manual screenshots and spreadsheets.

Where Rivane fits.

Rivane is built for finance workflows where automation must stay tied to source documents, approvals, state transitions, ledger impact, reporting, and audit evidence. Use this guide as a checklist for evaluating whether an ERP workflow is merely digitized or actually controlled.

References and source basis.

These sources provide the standards, regulatory, or government context around the flow. They are included so the guide is useful to finance operators, auditors, and implementation teams, not only buyers reading software copy.

Back to ERP use cases