---
id: TST-ACC-CLS-020
title: Period locking against posting and late effects
kind: integration
product_area: accounting
module: close
revision: 1
status: draft
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
  - >-
    modules/fiscal-close/tests/integration/services/jobs/close-concurrency.integration.spec.js
implements:
  - ATS-ACC-CLS-003-01
  - ATS-ACC-CLS-003-04
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: >-
  The suite owns test-identifier workspaces and fixture records, removed by its
  teardown.
binding_policy: >-
  Each binding identifies the assertions this suite executes; combined scenarios
  may require other bound suites. Existence is not a recorded execution result.
evidence:
  - >-
    services-accounting:modules/fiscal-close/tests/integration/services/jobs/close-concurrency.integration.spec.js
  - provenance: test
    source: >-
      services-accounting:modules/fiscal-close/tests/integration/services/jobs/close-concurrency.integration.spec.js
    assertion_titles:
      - a close against what posts into its period (integration)
      - finalize and a transaction holding the period FOR SHARE
      - waits on the period row while the FOR SHARE is held
      - leaves the period closing while it waits
      - closes the period once the holder commits
      - posting into a closing period
      - holds the period closing (premise)
      - refuses a batch dated in the closing period
      - >-
        posts a reconciliation dated in it on the first open period, October 1,
        flagged late after close
limitations:
  - >-
    The protected-date assertion calls batch creation. It is not ordinary
    posting or unposting proof.
findings:
  - FND-ACC-CLS-073
real_dependencies: >-
  PostgreSQL row locks, production task handlers, batch creation and
  reconciliation’s period guard are real. A separate client holds the competing
  lock, and the clock is fixed.
product_intent: proposed
implementation_evidence: observed
---
# Period locking against posting and late effects

## Verification Boundary

The suite checks its declared service or persistence boundary against local PostgreSQL. Bindings identify the assertions it contributes to a capability case; they do not establish every assertion in a combined case.

## What This Suite Proves

Separate database connections check that finalization waits for a shared period lock. Other assertions refuse batch creation in the protected month and check that reconciliation’s writable-period guard returns a following open date with a late marker. The latter assertion calls the guard; it does not post a reconciliation entry.

## What It Does Not Prove

The protected-date assertion calls batch creation. It is not ordinary posting or unposting proof.

## Real Dependencies and Test Doubles

PostgreSQL row locks, production task handlers, batch creation and reconciliation’s period guard are real. A separate client holds the competing lock, and the clock is fixed.

## Must Not Be Doubled

Keep production queries, writes, mappings, application-role privileges and database constraints real wherever they are the subject of an assertion. Recording financial ports establish invocation behavior; actual recognition and reversal require the suite using the real posting service.
