---
id: WF-ACC-BAT-007
title: Preview what would stop a posting
trigger: The console requests validation or posting readiness for selected batches.
product_area: accounting
module: batches
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
inference: []
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
implements:
  - CAP-ACC-BAT-012
crosses:
  - SVC-ACC-BAT-batches
idempotency: >-
  Preview does not persist accounting, so repetition has no write effect;
  changing underlying records can change the answer.
concurrency: >-
  Preview holds shared locks on affected fiscal periods for the duration of its
  read transaction, coordinating with close but not reserving later posting
  admission.
hops:
  - 'n': 1
    actor_or_service: Batches API
    action: >-
      Validate up to one hundred selected batch identifiers and synchronously
      invoke the live accounting task function.
    anchor: >-
      services-accounting:modules/batches/services/preview/batch-posting-preview.ts:previewBatchPostings
    seam: sync
    on_failure: Invalid requests or failed function invocation return an error.
    left_inconsistent: Preview creates no accounting state to repair.
    observer: The validation interface
    provenance: observed
    source: >-
      services-accounting:modules/batches/aws/api/batch-postings.routes.ts
      (previewBatchPostings)
  - 'n': 2
    actor_or_service: 'Posting task function, posting engine'
    action: >-
      Read workspace collections, identify explicit eligibility problems, and
      dry-run document generation and account resolution for candidates.
    anchor: >-
      services-accounting:modules/batches/services/engine/preview-batches.ts:previewBatchPostings
    seam: sync
    on_failure: An engine exception becomes a preview error without accounting writes.
    left_inconsistent: No generation commits.
    observer: The validation card and readiness message
    provenance: observed
    source: >-
      services-accounting:modules/batches/services/engine/preview-batches.ts:periodProblemOf
  - 'n': 3
    actor_or_service: Console
    action: >-
      Render candidate and refusal information, including missing product
      accounting configuration.
    anchor: >-
      react-console:lib/accounting/transactions/http/batch-delivery.ts:createBatchDeliveryApi
    seam: sync
    on_failure: Request errors appear in the validation interface.
    left_inconsistent: Previously displayed information can remain stale until refresh.
    observer: The reviewing finance user
    provenance: observed
    source: 'react-console:components/accounting/batches/batch-validation-card.tsx'
branches:
  - >-
    An otherwise eligible Error batch is returned as a candidate with prior
    errors for context.
waits: []
evidence:
  - >-
    services-accounting at f47cb263:
    modules/batches/services/preview/batch-posting-preview.ts;
    services/engine/preview-batches.ts; services/persistence/posting-periods.ts;
    aws/batches.module.ts
  - >-
    react-console at baf6dae3:
    components/accounting/batches/batch-validation-card.tsx,
    batch-posting-readiness.tsx;
    lib/accounting/transactions/http/batch-posting.ts, batch-delivery.ts
controls: [TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, 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]
---

# Preview what would stop a posting

## What It Does

Preview helps staff locate generation problems before committing accounting. It shares generation and account-resolution logic with posting, but it does not apply every admission guard or reserve the collection for a future task.

## The Flow

```mermaid
flowchart LR
  C[Console validation] --> A[Preview API]
  A --> T[Synchronous task invocation]
  T --> D[Read and dry-run generation]
  D --> R[Return candidates and problems]
```

## When Something Fails

A preview error leaves accounting untouched. A passing preview can still precede a refusal for status or edit lock, or become stale when records change. Shared period locking protects this read, not a later posting request.

## Open Design Questions

Product should decide whether preview must share the full posting-admission check and how the interface communicates the remaining time-of-check boundary.
