---
id: TST-COM-FUL-063
title: Nightly inventory
kind: integration
product_area: commerce
module: fulfillment
revision: 1
status: draft
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
repository: services-commerce
files:
  - >-
    modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js
implements:
  - ATS-COM-FUL-018-15
  - ATS-COM-FUL-019-03
  - ATS-COM-FUL-019-05
  - ATS-COM-FUL-019-08
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: >-
  Run-created workspace identifiers and fixture records in the prepared test database; concurrency
  cases own their extra connections.
evidence:
  - repository: services-commerce
    path: >-
      modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js
    test_titles:
      - >-
        counts what it did: the tenant, one hold expired, three items checked, one mismatch, one
        stale unit, one low-stock SKU of two with a point, and the cost pass: three items whose
        stock no layer costs (the fixture’s bare receipts), no handoff without a relief
      - >-
        releases the expired hold (reason expiry) and raises expired_hold on it, giving the unit
        back
      - >-
        raises balance_mismatch on the item knocked out of line, with what was kept and what the
        ledgers say, and corrects nothing
      - >-
        raises low_stock on shirt L at its own reorder point with the product’s reorder quantity,
        and nothing on the cap above its point
      - raises stale_allocation on the committed unit whose obligation is cancelled
      - >-
        raises valuation_mismatch on each item whose on-hand is not Σ its layers (the bare receipts
        made none), the cost stream’s finding
      - >-
        finds the same on a second run and adds an occurrence to each open finding rather than
        another row
      - >-
        finds the tenants that hold stock across tenants, under the sweep policy, this one among
        them, and refuses that read inside another transaction
    scenario_anchors:
      - >-
        services-commerce:modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js#counts
        what it did: the tenant, one hold expired, three items checked, one mismatch, one stale
        unit, one low-stock SKU of two with a point, and the cost pass: three items whose stock no
        layer costs (the fixture’s bare receipts), no handoff without a relief
      - >-
        services-commerce:modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js#releases
        the expired hold (reason expiry) and raises expired_hold on it, giving the unit back
      - >-
        services-commerce:modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js#raises
        balance_mismatch on the item knocked out of line, with what was kept and what the ledgers
        say, and corrects nothing
      - >-
        services-commerce:modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js#raises
        low_stock on shirt L at its own reorder point with the product’s reorder quantity, and
        nothing on the cap above its point
      - >-
        services-commerce:modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js#raises
        stale_allocation on the committed unit whose obligation is cancelled
      - >-
        services-commerce:modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js#finds
        the same on a second run and adds an occurrence to each open finding rather than another row
      - >-
        services-commerce:modules/inventory/tests/integration/services/reconciliation/nightly-inventory.integration.spec.js#finds
        the tenants that hold stock across tenants, under the sweep policy, this one among them, and
        refuses that read inside another transaction
---

# Nightly inventory

## Verification Boundary

This suite checks nightly inventory against the prepared PostgreSQL database. Its entry points are the persistence and service functions used by the tests.

## What This Suite Proves

The bound scenarios identify the assertions this suite contributes. Source anchors retain the exact test cases; where a capability scenario has several contributing suites, a single binding does not imply that every branch runs here.

## What It Does Not Prove

Direct service and persistence calls do not establish the full HTTP permission contract, deployed scheduling or browser behavior. No execution result is claimed by this register.

## Real Dependencies and Test Doubles

The database and imported Commerce persistence services are real. Fixtures create the records owned by this run. Time-sensitive cases use a controlled clock where the source fixture supplies one.

## Must Not Be Doubled

Keep the database constraints, row visibility and persistence writes real when claiming this integration coverage. A canned repository response cannot replace the boundary being checked.
