---
id: ADR-COM-FUL-013
title: Maintain stock balances through movement and allocation ledgers
product_area: commerce
module: fulfillment
revision: 1
status: proposed
design_intent: proposed
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
decision: >-
  Maintain stock balances through movement and allocation triggers and derive
  available stock in the database.
constrains:
  - DOM-COM-FUL-005
  - SVC-COM-FUL-inventory
  - WF-COM-FUL-015
  - WF-COM-FUL-016
  - WF-COM-FUL-017
  - WF-COM-FUL-019
origin: >-
  The architecture package's inventory decision (ADR-15 as the code names it),
  cited by services-commerce:modules/inventory/db/inventory-items.table.ts;
  docs/migrations/data-operations/README.md#D-C-16; FND-COM-FUL-040
alternatives:
  - option: Permit direct service balance writes alongside ledger entries.
    why_not: Independent balance writes can diverge from the ledgers that explain them.
  - option: Derive all availability from ledgers on each read.
    why_not: Claims need current constrained balances while their transaction runs.
consequences:
  - The nightly check can compare stored balances with ledger derivation.
  - 'Imports, observations and corrections change stock through movements.'
  - Application column grants exclude direct writes to the six balances.
supersedes: []
evidence:
  - >-
    services-commerce at c8b66a98:
    modules/inventory/db/inventory-items.table.ts, inventory-movements.table.ts,
    inventory-allocations.table.ts;
    db/migrations/20261018024147_merchandise_and_inventory.sql.
---

# Maintain stock balances through movement and allocation ledgers

## Context

Concurrent promises and physical movements need balances backed by retained facts.

## Decision

Maintain stock balances through movement and allocation triggers and derive available stock in the database.

## Alternatives Considered

Permit direct service balance writes alongside ledger entries. Independent balance writes can diverge from the ledgers that explain them.

Derive all availability from ledgers on each read. Claims need current constrained balances while their transaction runs.

## Consequences

Opening imports and corrections use ledger movements. Reconciliation can rederive balances without silently assigning replacements.
