---
id: WF-ACC-REC-007
title: Post reconciliation ledger requests with the operational batch
trigger: Staff post or unpost an operational batch carrying reconciliation requests.
product_area: accounting
module: reconciliation
revision: 3
status: draft
design_intent: confirmed
origin: >-
  ACCT-M8 plan D7 (ledger entries at finalize), approved by Andrew 2026-10-22;
  services-accounting docs/reconciliation/architecture.md §16.2, agreed with the
  batch posting owner 2026-10-17
implementation_evidence: observed
inference: []
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
implements:
  - CAP-ACC-REC-014
  - CAP-ACC-REC-018
moves: []
crosses:
  - SVC-ACC-REC-reconciliation
idempotency: >-
  Posted status is derived from unreversed batch postings and original
  reconciliation entries. Reconciliation does not retain an independent posted
  flag.
concurrency: >-
  Request writers share-lock the operational batch. Exact posting locks and job
  recovery remain Batch Management responsibilities.
hops:
  - 'n': 1
    actor_or_service: 'Reconciliation command (finalize, reverse, write-off)'
    action: Append balanced role-labelled requests to the selected operational batch.
    anchor: >-
      services-accounting:modules/reconciliation/services/persistence/reconciliation-ledger-postings.ts:recordPostings
    seam: sync
    on_failure: Request failure aborts its causing command.
    left_inconsistent: No orphan request commits.
    observer: The command response reports failure.
    provenance: observed
    source: >-
      services-accounting:modules/reconciliation/services/persistence/reconciliation-ledger-postings.ts:assignPostingBatch
  - 'n': 2
    actor_or_service: Batch Management posting engine
    action: >-
      Read reconciliation requests as an in-process posting source during the
      later batch job.
    anchor: 'services-accounting:modules/batches/services/engine/posting-documents.ts'
    seam: sync
    on_failure: >-
      Source loading or conversion can fail the batch, including missing
      foreign-currency rate evidence.
    left_inconsistent: Requests remain pending after approval.
    observer: Batch job errors and close readiness expose the gap.
    provenance: observed
    source: >-
      services-accounting:modules/reconciliation/services/persistence/reconciliation-ledger-postings.ts:listPostingsInBatches
  - 'n': 3
    actor_or_service: Batch Management entry rules
    action: >-
      Generate one balanced subledger entry for each request with the correct
      line roles.
    anchor: >-
      services-accounting:modules/batches/services/rules/reconciliation-entry-rules.ts:generateReconciliationEntry
    seam: sync
    on_failure: Accounting failure aborts the affected posting transaction.
    left_inconsistent: The request still lacks a completed posting.
    observer: Batch job progress reports the failure.
    provenance: observed
    source: >-
      services-accounting:modules/batches/services/rules/reconciliation-entry-rules.ts:generateReconciliationEntry
  - 'n': 4
    actor_or_service: Batch Management
    action: >-
      Unpost operational entries so the derived request state becomes pending
      again.
    anchor: 'services-accounting:modules/batches/services/engine/posting-documents.ts'
    seam: sync
    on_failure: Recovery follows Batch Management’s own unposting behavior.
    left_inconsistent: Approved explanation accounting may cease to be currently posted.
    observer: Readiness reports pending requests again.
    provenance: documented
    source: >-
      services-accounting:modules/reconciliation/README.md#Ledger requests ride
      in batches
  - 'n': 5
    actor_or_service: Reconciliation readiness
    action: >-
      Read unreversed postings to identify pending requests and compare clearing
      with outstanding positions.
    anchor: >-
      services-accounting:modules/reconciliation/services/close-readiness/assess-period.ts:assessReconciliationReadiness
    seam: sync
    on_failure: Evaluation outside a caller transaction is refused.
    left_inconsistent: No assessment write persists.
    observer: The controller sees readiness findings.
    provenance: observed
    source: >-
      services-accounting:modules/reconciliation/services/close-readiness/assess-period.ts:assessReconciliationReadiness
branches:
  - A command with an empty plan needs no operational batch.
waits:
  - No reconciliation schedule automatically posts operational batches.
evidence:
  - >-
    services-accounting at f47cb263:
    modules/reconciliation/services/persistence/reconciliation-ledger-postings.ts;
    db/reconciliation-postings.table.ts;
    modules/batches/services/engine/posting-documents.ts;
    modules/batches/services/rules/reconciliation-entry-rules.ts;
    modules/reconciliation/README.md;
    tests/integration/services/batch-lifecycle/finalize-posts-to-subledger.integration.spec.js.
controls: [TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, TC-IAM-006, TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-AZ-006, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-DAT-001, TC-LOG-004, TC-LOG-005, TC-PI-001, TC-PI-003, TC-PI-005]
---
# Post reconciliation ledger requests with the operational batch

## What It Does

Reconciliation stores the requested accounting; Batch Management owns ledger execution. Request completion is a read of operational posting history.

## The Flow

```mermaid
sequenceDiagram
  participant R as Reconciliation command
  participant D as Accounting database
  participant S as Staff
  participant B as Batch posting engine
  participant C as Readiness
  R->>D: requests in the operational batch
  S->>B: post the operational batch
  B->>D: read reconciliation requests
  B->>D: one balanced subledger entry each
  C->>D: posted = held by an unreversed posting
  S->>B: unpost (optional)
  B->>D: delete entries; requests pending again
```

## When Something Fails

Approval can precede ledger completion, and unposting returns requests to pending. Readiness exposes that accounting gap; foreign-currency conversion can also prevent the operational batch from posting.

## Open Design Questions

Requests currently require two-decimal currencies and an accepting selected batch. Batch job recovery belongs to its owning module.
