---
id: ADR-ACC-BAT-002
title: Commit accounting atomically and report refused writes
product_area: accounting
module: batches
revision: 1
status: proposed
design_intent: confirmed
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
decision: >-
  Each posting or unposting task performs accounting in one transaction;
  transactional refusal rolls back that work and fails the job without
  compensating writes.
constrains:
  - DOM-ACC-BAT-003
  - SVC-ACC-BAT-batches
  - WF-ACC-BAT-005
  - WF-ACC-BAT-006
  - STATE-ACC-BAT-003
origin: >-
  DESIGN D6 (posting is a durable job, one ACID transaction replaces 1.0's
  compensation) and Andrew D7 of 2026-10-15 (a posting the database refused is
  reported failed), recorded at
  services-accounting:docs/migrations/batch-posting/DESIGN.md#D6 and
  modules/batches/services/jobs/batch-posting-job-tasks.ts (header)
alternatives:
  - option: Retain staged accounting with compensating undo.
    why_not: >-
      Independent undo failures can leave collection and ledger state
      disagreeing.
  - option: Return job success after a transactional refusal.
    why_not: >-
      The recorded ruling requires the workflow to report a refused accounting
      write as failure.
consequences:
  - >-
    A document-generation failure excludes its whole batch while allowing other
    eligible batches to complete in the same commit.
  - >-
    Settlement follows accounting commit and can produce recorded failure beside
    completed accounting.
  - >-
    The working task wraps transient database failures as refusals too, so that
    transactional path is not retried.
  - >-
    HTTP requests permit one hundred batches; internal jobs permit two hundred,
    and the task timeout is fifteen minutes.
supersedes: []
evidence:
  - >-
    services-accounting at f47cb263: docs/migrations/batch-posting/DESIGN.md
    (D6); modules/batches/services/jobs/batch-posting-job-tasks.ts,
    batch-posting-jobs.ts; services/engine/post-batches.ts
---

# Commit accounting atomically and report refused writes

## Context

Earlier execution used separate stages and compensating branches. Relational accounting supports a single transaction, while durable job settlement remains a separate operational boundary.

## Decision

The decision field restates the existing recorded direction for this design boundary. This examination does not grant a new approval.

## Alternatives Considered

The alternatives above identify the competing implementation choices and their consequences. They preserve the distinction between a recorded product ruling and a proposed engineering boundary.

## Consequences

The consequence rows describe obligations and known implementation limits at this boundary. Related artifact references retain the affected design homes.
