---
id: WF-ACC-BKS-007
title: Select and Render Document Content
trigger: >-
  A producing module supplies a document kind and candidate content to the
  shared resolver.
product_area: accounting
module: books
revision: 1
status: draft
design_intent: proposed
implementation_evidence: partially-observed
inference: []
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
implements:
  - CAP-ACC-BKS-014
  - CAP-ACC-BKS-015
  - CAP-ACC-BKS-017
moves:
  - STATE-ACC-BKS-003
crosses: []
idempotency: >-
  The resolver performs no writes and produces the same selection for the same
  complete input values.
concurrency: >-
  Invoice rendering loads candidates within its transaction. Configured
  references receive database protection, but no general content snapshot across
  producers or concurrent edits is established.
hops:
  - 'n': 1
    actor_or_service: 'Document producer, including the observed invoice renderer'
    action: >-
      The producer loads its document, unit choices, relevant settings and
      candidate content.
    anchor: >-
      services-accounting:modules/transactions/services/invoices/invoice-rendering.ts:renderInvoiceIn
    seam: sync
    on_failure: Stop the producer’s rendering if its required records cannot be loaded.
    left_inconsistent: The resolver has produced no persistent effect.
    observer: the caller of the producer
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/invoices/invoice-rendering.ts:renderInvoiceIn
  - 'n': 2
    actor_or_service: Books template resolver
    action: >-
      Resolve explicit content first, then valid unit or statement-default
      content, then the built-in for the document or software format.
    anchor: >-
      services-accounting:modules/books/services/document-templates/resolution.ts:resolveDocumentTemplate
    seam: sync
    on_failure: >-
      Reject a missing, wrong-kind or inactive explicit choice; reject a
      download with no built-in format when no usable custom choice exists.
    left_inconsistent: Selection itself has saved nothing.
    observer: the caller of the producer
    provenance: test
    source: >-
      services-accounting:modules/books/tests/unit/document-templates/resolution.spec.js#refuses
      an inactive template named explicitly, in Rhythm 1.0’s words
  - 'n': 3
    actor_or_service: Document producer using shared Liquid filters
    action: >-
      The producer renders selected Liquid with its document data and the Books
      filter set.
    anchor: 'services-accounting:modules/books/services/document-templates/filters.ts'
    seam: sync
    on_failure: Stop rendering when content or data cannot be processed.
    left_inconsistent: The rendering stage has no compensating write in this workflow.
    observer: the caller of the producer
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/invoices/invoice-rendering.ts
branches:
  - condition: Send statements through the examined action
    path: >-
      That action accepts its own template selection rather than invoking this
      shared resolver.
waits: []
evidence:
  - >-
    services-accounting at f47cb263:
    modules/books/services/document-templates/resolution.ts, built-ins.ts,
    filters.ts
  - >-
    services-accounting at f47cb263:
    modules/transactions/services/invoices/invoice-rendering.ts;
    modules/billing/services/actions/send-statements.action.ts (cited producers)
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-005, TC-AZ-006, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-DAT-001, TC-LOG-001, TC-LOG-002, TC-LOG-003, TC-LOG-004, TC-AVL-001, TC-AVL-004, TC-MON-001, TC-MON-002, TC-MON-004, TC-PI-001, TC-PI-002, TC-PI-003, TC-PI-004]
---

# Select and Render Document Content

## What It Does

The Books resolver supplies a deterministic choice to producers that call it. Explicit requests receive strict validation. A usable unit or workspace choice follows, with a built-in fallback where available. The producing module remains responsible for loading context, rendering and any later delivery.

## The Flow

```mermaid
flowchart TD
  h0["The producer loads its document, unit choices, relevant settings and candidate content."]
  h1["Resolve explicit content first, then valid unit or statement-default content, then the built-in for the document or software format."]
  h0 --> h1
  h2["The producer renders selected Liquid with its document data and the Books filter set."]
  h1 --> h2
```

## When Something Fails

Loading or rendering failure stops the producer. The resolver writes nothing and cannot undo or govern effects performed elsewhere. Explicit unusable content is refused; unusable configured fallback content is skipped. Invoice adoption is observed, statement selection is separate, and adoption by all remaining document producers is unverified.

## Open Design Questions

The owning document modules must establish resolver adoption. Product also needs to settle the proposed rejection of inactive receipt, statement and download content compared with described legacy behavior.
