---
id: DOM-ACC-TRX-006
title: Transaction Record
realises: CON-ACC-TRX-006
product_area: accounting
module: transactions
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
owned_by: SVC-ACC-TRX-transactions
custom_fields: none
identity: >-
  Document identities and references are scoped to the workspace. Numbered kinds
  use separate workspace sequences beginning at one million, while command
  retries are identified within their caller and operation scope.
attributes:
  - name: kind
    kind: enum
    required: true
    computed: false
    notes: >-
      Classifies billing, collection, credit, return, dispute and
      coordinated-operation records.
  - name: number
    kind: text
    required: false
    computed: false
    notes: >-
      Comes from an independently committed sequence allocation that allows
      unused numbers.
  - name: business unit and batch
    kind: reference
    required: false
    computed: false
    notes: >-
      Connects a posted kind to its unit's eligible transaction batch, selected
      explicitly or by assignment rules.
  - name: document and accounting dates
    kind: date
    required: true
    computed: false
    notes: >-
      Locates accounting effects in an open period and supports permitted
      correction before posting.
  - name: receivable facts
    kind: collection
    required: false
    computed: false
    notes: >-
      Records signed open-item movements with both effective dates and recording
      times.
  - name: document events
    kind: collection
    required: true
    computed: false
    notes: >-
      Retains append-only command history where the command changes a record;
      event count varies by command.
  - name: retry key
    kind: text
    required: true
    computed: false
    notes: >-
      Identifies financial command retries within their scope; email instead
      keys its communication submission.
  - name: available actions
    kind: collection
    required: true
    computed: true
    notes: >-
      Describes currently eligible actions and the reasons other actions are
      unavailable.
  - name: lock
    kind: enum
    required: false
    computed: false
    notes: >-
      Supports update or deletion protection without a corresponding setter in
      this module.
  - name: version
    kind: integer
    required: true
    computed: true
    notes: Detects stale whole-record replacement.
  - name: display status and open amount
    kind: computed
    required: true
    computed: true
    notes: >-
      Provides the explorer's lifecycle label and remaining value, suppressing
      value on dead receipts and credits.
  - name: consumed integration events
    kind: collection
    required: false
    computed: false
    notes: >-
      Deduplicates mapped processor events within the same transaction as their
      effects.
relationships:
  - to: DOM-ACC-TRX-001
    cardinality: one-to-one
    ownership: Billing and correction documents implement this shared record shape.
    cross_service: false
  - to: DOM-ACC-TRX-003
    cardinality: one-to-one
    ownership: Receipt-related documents implement this shared record shape.
    cross_service: false
  - to: DOM-ACC-TRX-004
    cardinality: one-to-one
    ownership: Credit and application documents implement this shared record shape.
    cross_service: false
  - to: DOM-ACC-TRX-005
    cardinality: many-to-one
    ownership: >-
      The customer's account reads financial positions derived from these
      records.
    cross_service: false
invariants:
  - id: INV-DOM-ACC-TRX-006-01
    statement: >-
      Workspace isolation hides other workspaces' records and rejects changes
      across that boundary.
    enforced_at:
      - database
      - api
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/invoices.e2e.spec.js#it
      answers 404 to issuing the other tenant’s invoice in this tenant, and
      leaves it a draft
  - id: INV-DOM-ACC-TRX-006-02
    statement: >-
      Receivable facts describe financial movements and support reconstruction
      by effective date and knowledge cutoff.
    enforced_at:
      - service
      - database
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/as-of.integration.spec.js#it
      answers, as of today and known now, exactly the live balance of every open
      invoice (FC-07)
  - id: INV-DOM-ACC-TRX-006-03
    statement: >-
      Financial retry completion commits with its effects, while no-op edits can
      emit no event and paid-money release can emit events for multiple
      receipts.
    enforced_at:
      - service
      - database
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/document-edits/detail-edits.ts:updateDocumentDetails;
      services-accounting:modules/transactions/services/payments/free-paid-money.ts:freePaidMoneyForMemo
  - id: INV-DOM-ACC-TRX-006-04
    statement: >-
      Reusing a financial retry key with the same body returns its stored
      result, with altered bodies refused and rolled-back commands leaving the
      key available.
    enforced_at:
      - api
      - service
      - database
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/idempotency.integration.spec.js#it
      refuses the second request 409 idempotency_key_reused
  - id: INV-DOM-ACC-TRX-006-05
    statement: >-
      Where declared, document retry-key uniqueness prevents a second caller
      from using that key for another document in the workspace.
    enforced_at:
      - service
      - database
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/idempotency.integration.spec.js#it
      refuses the second person 409 idempotency_key_in_use, never an unhandled
      error (DEF-ACT-0800)
  - id: INV-DOM-ACC-TRX-006-06
    statement: Identical competing keyed commands create the financial effect once.
    enforced_at:
      - service
      - database
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/idempotency.integration.spec.js#it
      issues the invoice once and refuses the other issue invoice_not_draft
  - id: INV-DOM-ACC-TRX-006-07
    statement: >-
      Batch reassignment targets an open or in-error transaction batch belonging
      to the record's unit.
    enforced_at:
      - service
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/batches-for-documents.integration.spec.js#it
      refuses a system batch, which is period close’s: a transaction batch only
      (batch_not_open)
  - id: INV-DOM-ACC-TRX-006-08
    statement: >-
      Reassignment cannot move records into or out of posting, posted or
      downloaded batches.
    enforced_at:
      - service
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/document-edits/reassign-and-edit.integration.spec.js#it
      is refused batch_not_open on a reassignment out of the batch
  - id: INV-DOM-ACC-TRX-006-09
    statement: >-
      Permitted date correction retains earlier facts and appends offsetting
      old-date and replacement new-date effects.
    enforced_at:
      - service
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/document-edits/reassign-and-edit.integration.spec.js#it
      negates the facts on the old accounting date and restates them on the new
      one, the originals untouched
  - id: INV-DOM-ACC-TRX-006-10
    statement: Detail updates can clear optional text but cannot erase a required reason.
    enforced_at:
      - service
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/document-edits/reassign-and-edit.integration.spec.js#it
      never clears a required field (a credit’s reason), and changes its memo
  - id: INV-DOM-ACC-TRX-006-11
    statement: >-
      Action execution checks the caller's permission and the record's current
      eligibility again.
    enforced_at:
      - api
      - service
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/invoices.e2e.spec.js#it
      answers 409 to the issue action on an issued invoice
  - id: INV-DOM-ACC-TRX-006-12
    statement: >-
      Mapped processor event delivery is deduplicated by a consumed-event row
      committed with its effect.
    enforced_at:
      - service
      - database
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/integrations/integration-events.integration.spec.js#it
      records every event it handles or ignores by id in the handling
      transaction, and a replay is ignored by the row, not by a lookup
  - id: INV-DOM-ACC-TRX-006-13
    statement: >-
      Service-created documents retain the service actor and any supplied
      originating person.
    enforced_at:
      - service
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/service-calls/service-caller.integration.spec.js#it
      records the service principal as the actor of what it creates
  - id: INV-DOM-ACC-TRX-006-14
    statement: >-
      Dataset access requires its query permission and respects workspace
      isolation.
    enforced_at:
      - service
      - database
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-view.integration.spec.js#it
      answers tenant B’s reader its own invoice alone, its customer’s name null
      where CRM has no such contact
  - id: INV-DOM-ACC-TRX-006-15
    statement: >-
      Lifecycle purge removes transaction rows before dependent configuration
      and refuses an active workspace.
    enforced_at:
      - service
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/lifecycle/transactions-participant.integration.spec.js#it
      refuses to purge a live tenant, with nothing removed
  - id: INV-DOM-ACC-TRX-006-16
    statement: >-
      Shared record, fact and event storage has no custom fields and module
      registration omits a custom-field capability declaration.
    enforced_at:
      - api
      - service
    provenance: documented
    source: >-
      services-accounting:docs/milestones/plans/ACCT-M2-plan.md#7a. Entity
      capabilities (R2-ARCH-001)
physical:
  - receivable_events
  - document_events
  - consumed_integration_events
  - receivable_event_change_events
  - transactions_v
  - idempotency_keys (service-wide)
evidence:
  - >-
    services-accounting at f47cb263:
    modules/transactions/db/receivable-events.table.ts,
    document-events.table.ts, consumed-integration-events.table.ts,
    transactions.view.ts, transaction-kind.views.ts, document-vocabularies.ts;
    services/actions/*, document-edits/*, batches-for-documents.ts,
    persistence/document-numbers.ts, document-events.ts, receivable-events.ts;
    services/lifecycle/transactions-participant.ts.
  - >-
    services-accounting at f47cb263:
    docs/architecture/accounting-2.0/06-integrity-model.md §5 to §8;
    docs/accounting/record-actions.md, queries.md, change-events.md;
    docs/row-level-security.md.
---
# Transaction Record

## What It Models

Transaction Record describes common financial-document identity, accounting context, history and available work. Individual document kinds retain their own storage and lifecycles.

## Identity and Attributes

The shared shape supports workspace-scoped references, document numbering and dated financial evidence. Retry completion and document history are related records with command-specific behavior.

## Relationships

Billing, receipt and credit records use this structure, while the customer account derives financial position from their facts. Batch management owns the referenced posting groups.

## Invariants

The structured guarantees identify isolation, retry, history and batch protections. They account for no-op edits, commands affecting several documents and event deliveries with no resolvable workspace.

## How It Is Stored and Shared

Transactions owns receivable facts, document events and consumed integration events. Registered datasets and exports expose financial records, while change events provide the Commerce integration surface.

## Open Design Questions

Document lock ownership and a record-history read surface remain unresolved. Reconciliation of receivable facts against the posting control balance and Commerce’s position view still lacks independent proof.
