---
id: ATS-ACC-BAT-005
scope: CAP-ACC-BAT-005
product_area: accounting
module: batches
revision: 2
status: proposed
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
  rhythm-v2-docs: 37405d50d1465ea0571a66095d98ebec4db04175
scenarios:
  - id: ATS-ACC-BAT-005-01
    title: Automatic close uses local-minute scheduling
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-01
    preconditions: The workspace uses New York time.
    steps: >-
      Create an Open batch with an offset-bearing close timestamp and inspect
      its schedule.
    expected: >-
      The batch retains one occurrence at the corresponding local minute in the
      workspace’s zone.
    negative: false
    data_needs: Provide no fixtures beyond the stated setup.
    bound_to:
      - TST-ACC-BAT-085
      - TST-ACC-BAT-086
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#keeps
      a one-occurrence schedule of the batch at that minute, in the tenant’s
      zone
    note: >-
      Date-only interpretation remains a proposed proof requirement rather than
      a claim established by this binding.
    category: rule
    test_evidence:
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#keeps
        a one-occurrence schedule of the batch at that minute, in the tenant’s
        zone
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.queries.integration.spec.js#answers
        the optional properties a batch states: its code, description, automatic
        close and its schedule
  - id: ATS-ACC-BAT-005-02
    title: Delivery checks whether closing still applies
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-02
    preconditions: One due batch remains Open and another was closed manually.
    steps: Deliver both scheduled occurrences.
    expected: >-
      The Open batch closes and retains its ended schedule; the other occurrence
      records a skip reason.
    negative: true
    data_needs: Provide the schedule consumer in process.
    bound_to:
      - TST-ACC-BAT-085
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#skips
      a run whose batch is no longer open
    category: transition
    test_evidence:
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#closes
        the batch when its schedule runs, and keeps the ended schedule with the
        batch
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#skips
        a run whose batch is no longer open
  - id: ATS-ACC-BAT-005-03
    title: Repeated delivery does not submit another posting
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-03
      - BR-CAP-ACC-BAT-005-04
    preconditions: An Open batch contains documents and has a close schedule.
    steps: Deliver the same occurrence twice.
    expected: Only one posting job is submitted for that unit’s batch.
    negative: false
    data_needs: Provide the local job runner.
    bound_to:
      - TST-ACC-BAT-085
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#submits
      one posting job of the closed batch, in its unit, for the tenant’s
      customer (D13)
    category: invariant
    test_evidence:
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#submits
        one posting job of the closed batch, in its unit, for the tenant’s
        customer (D13)
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#posts
        nothing more when the same occurrence runs again: the batch is no longer
        open
  - id: ATS-ACC-BAT-005-04
    title: Manual removal clears the close schedule
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-05
    preconditions: Three Open batches have scheduled closes.
    steps: 'Close the first, archive the second and delete the third.'
    expected: 'Each schedule and close time disappear, preventing a later run.'
    negative: false
    data_needs: Provide no fixtures beyond the stated setup.
    bound_to:
      - TST-ACC-BAT-085
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#removes
      the schedule and the time when the batch is closed
    category: interaction
    test_evidence:
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#removes
        the schedule and the time when the batch is closed
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#drops
        an archived batch’s automatic close, as an automatic close is kept only
        on an open batch
      - >-
        services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#deletes
        an empty batch with its automatic close’s schedule
  - id: ATS-ACC-BAT-005-05
    title: Posting refusal preserves the closed batch
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-06
    preconditions: Automatic close has completed but the customer cannot be resolved.
    steps: Deliver the occurrence’s posting preparation.
    expected: 'The run retains the refusal, creates no job and leaves the batch Closed.'
    negative: true
    data_needs: Provide no fixtures beyond the stated setup.
    bound_to: []
    provenance: proposed
    source: >-
      services-accounting:modules/batches/services/auto-post/automatic-posting.ts:prepareAutomaticPosting
    category: failure
    test_evidence: []
    note: >-
      The available assertions do not execute this complete scenario; executable
      coverage remains a gap.
  - id: ATS-ACC-BAT-005-06
    title: Creation supplies a scheduled close
    category: interaction
    level: api
    proves:
      - BR-CAP-ACC-BAT-001-01
      - BR-CAP-ACC-BAT-005-01
    exercises:
      - CAP-ACC-BAT-005
      - CAP-ACC-BAT-001
    workflows:
      - WF-ACC-BAT-001
    preconditions: Today is open and tomorrow has a future close time.
    steps: Create Morning with tomorrow’s close time and retrieve its schedule.
    expected: >-
      Morning is Open and its one scheduled occurrence identifies the created
      batch.
    negative: false
    data_needs: >-
      An isolated workspace with the stated business-unit calendar, documents
      and configuration.
    bound_to: []
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/e2e/batches.e2e.spec.js#refuses
      a create naming the status 400: a new batch is always open;
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#keeps
      a one-occurrence schedule of the batch at that minute, in the tenant’s
      zone
  - id: ATS-ACC-BAT-005-07
    title: Removing the close time cancels delivery
    category: interaction
    level: api
    proves:
      - BR-CAP-ACC-BAT-003-01
      - BR-CAP-ACC-BAT-005-05
    exercises:
      - CAP-ACC-BAT-005
      - CAP-ACC-BAT-003
    workflows:
      - WF-ACC-BAT-001
    preconditions: Morning is Open with a future close occurrence.
    steps: >-
      Clear its close time through details editing and inspect the saved batch
      and schedule.
    expected: Morning stays Open without its former close schedule.
    negative: false
    data_needs: >-
      An isolated workspace with the stated business-unit calendar, documents
      and configuration.
    bound_to: []
    provenance: proposed
    source: >-
      services-accounting:modules/batches/aws/api/batches.schemas.ts:batchPatchSchema;
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#removes
      the schedule and the time when the batch is closed
  - id: ATS-ACC-BAT-005-08
    title: Manual close cancels a scheduled close
    category: interaction
    level: api
    proves:
      - BR-CAP-ACC-BAT-004-02
      - BR-CAP-ACC-BAT-005-05
    exercises:
      - CAP-ACC-BAT-005
      - CAP-ACC-BAT-004
    workflows:
      - WF-ACC-BAT-001
    preconditions: Morning is Open with a future close occurrence.
    steps: Close it manually and deliver the old occurrence after it is due.
    expected: Morning remains Closed and the old delivery cannot close it again.
    negative: false
    data_needs: >-
      An isolated workspace with the stated business-unit calendar, documents
      and configuration.
    bound_to: []
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      closing a batch that is not open;
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#removes
      the schedule and the time when the batch is closed
  - id: ATS-ACC-BAT-005-09
    title: Rolling does not duplicate a due close
    category: interaction
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-04
      - BR-CAP-ACC-BAT-010-06
    exercises:
      - CAP-ACC-BAT-005
      - CAP-ACC-BAT-010
    workflows: []
    preconditions: A populated active batch has a due close and the stream is due to roll.
    steps: Deliver close and roll occurrences in both orders using separate fixtures.
    expected: >-
      Each fixture has one replacement intake batch; the predecessor has no
      duplicate current posting.
    negative: true
    data_needs: >-
      An isolated workspace with the stated business-unit calendar, documents
      and configuration.
    bound_to: []
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#posts
      nothing more when the same occurrence runs again: the batch is no longer
      open;
      services-accounting:modules/batches/tests/integration/services/roll/batch-roller.integration.spec.js#opens
      nothing for the same occurrence delivered again, and answers the same
      batch
  - id: ATS-ACC-BAT-005-10
    title: Scheduled close submits accounting after retirement
    category: interaction
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-03
      - BR-CAP-ACC-BAT-013-03
    exercises:
      - CAP-ACC-BAT-005
      - CAP-ACC-BAT-013
    workflows:
      - WF-ACC-BAT-002
    preconditions: Morning is Open with an invoice and a due close.
    steps: Deliver the occurrence and inspect its outcome and the submitted job.
    expected: >-
      Morning closes and the run identifies one posting request for the retired
      collection.
    negative: false
    data_needs: >-
      An isolated workspace with the stated business-unit calendar, documents
      and configuration.
    bound_to: []
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#submits
      one posting job of the closed batch, in its unit, for the tenant’s
      customer (D13);
      services-accounting:modules/batches/tests/e2e/batch-postings.e2e.spec.js#posts
      a batch as a durable job: the answer is the job, and the job posts the
      batch
  - id: ATS-ACC-BAT-005-11
    title: Past close times need an explicit refusal
    category: validation
    level: api
    proves:
      - BR-CAP-ACC-BAT-005-07
    preconditions: An Open batch is writable and yesterday is before the fixed current clock.
    steps: Submit yesterday as the automatic close time.
    expected: >-
      The proposed validation result refuses the request without saving the past
      occurrence.
    negative: true
    data_needs: >-
      Owned records in an isolated workspace with the stated calendar and
      accounting setup.
    bound_to: []
    provenance: proposed
    source: FND-ACC-BAT-005
    note: >-
      Pinned code accepts past close times. This negative test specification
      remains proposed until Product resolves the disagreement and
      implementation changes.
evidence:
  - services-accounting at f47cb263: 'Inspected references: scenario-bound tests in modules/batches/tests.'
  - >-
    Pinned design objects, state models and workflows identify invariant and
    interaction obligations; scenario test anchors remain in test_evidence.
product_intent: proposed
coverage:
  rule: covered
  transition: 'gap: FND-ACC-BAT-059'
  validation: covered
  permission: 'gap: FND-ACC-BAT-059'
  edge: 'gap: FND-ACC-BAT-059'
  failure: covered
  boundary: 'gap: FND-ACC-BAT-059'
  concurrency: 'gap: FND-ACC-BAT-059'
  invariant: covered
  interaction: covered
coverage_notes:
  validation: >-
    Create and update authorization for scheduling, past and date-only times,
    concurrent close and roll delivery, and refusal recovery need proof.
    Past-time rejection is proposed and contradicts current acceptance of past
    times.
  permission: >-
    Create and update authorization for scheduling, past and date-only times,
    concurrent close and roll delivery, and refusal recovery need proof.
    Past-time rejection is proposed and contradicts current acceptance of past
    times.
  edge: >-
    Create and update authorization for scheduling, past and date-only times,
    concurrent close and roll delivery, and refusal recovery need proof.
    Past-time rejection is proposed and contradicts current acceptance of past
    times.
  boundary: >-
    Create and update authorization for scheduling, past and date-only times,
    concurrent close and roll delivery, and refusal recovery need proof.
    Past-time rejection is proposed and contradicts current acceptance of past
    times.
  concurrency: >-
    Create and update authorization for scheduling, past and date-only times,
    concurrent close and roll delivery, and refusal recovery need proof.
    Past-time rejection is proposed and contradicts current acceptance of past
    times.
rule_coverage:
  - rule: BR-CAP-ACC-BAT-005-01
    scenarios:
      - ATS-ACC-BAT-005-01
      - ATS-ACC-BAT-005-06
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#keeps
      a one-occurrence schedule of the batch at that minute, in the tenant’s
      zone
  - rule: BR-CAP-ACC-BAT-005-02
    scenarios:
      - ATS-ACC-BAT-005-02
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#skips
      a run whose batch is no longer open
  - rule: BR-CAP-ACC-BAT-005-03
    scenarios:
      - ATS-ACC-BAT-005-03
      - ATS-ACC-BAT-005-10
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#submits
      one posting job of the closed batch, in its unit, for the tenant’s
      customer (D13)
  - rule: BR-CAP-ACC-BAT-005-04
    scenarios:
      - ATS-ACC-BAT-005-03
      - ATS-ACC-BAT-005-09
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#posts
      nothing more when the same occurrence runs again: the batch is no longer
      open
  - rule: BR-CAP-ACC-BAT-005-05
    scenarios:
      - ATS-ACC-BAT-005-04
      - ATS-ACC-BAT-005-07
      - ATS-ACC-BAT-005-08
    provenance: proposed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#removes
      the schedule and the time when the batch is closed
  - rule: BR-CAP-ACC-BAT-005-06
    scenarios:
      - ATS-ACC-BAT-005-05
    provenance: proposed
    source: >-
      services-accounting:modules/batches/services/auto-post/automatic-posting.ts:prepareAutomaticPosting
  - rule: BR-CAP-ACC-BAT-005-07
    scenarios:
      - ATS-ACC-BAT-005-11
    provenance: proposed
    source: FND-ACC-BAT-005
transition_coverage:
  - state_model: STATE-ACC-BAT-001
    transition: 1
    from: open
    to: closed
    gap: FND-ACC-BAT-059
    provenance: unknown
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#removes
      the schedule and the time when the batch is closed
    note: >-
      The existing scenario set is not an exhaustive proof of this transition
      and all its side effects.
permission_coverage:
  - key: accounting.batches.create
    surface: api
    scenarios: []
    gap: FND-ACC-BAT-059
    provenance: unknown
    source: FND-ACC-BAT-059
    note: >-
      An aggregate persona check does not establish exhaustive allow and deny
      proof for every named surface.
  - key: accounting.batches.update
    surface: api
    scenarios: []
    gap: FND-ACC-BAT-059
    provenance: unknown
    source: FND-ACC-BAT-059
    note: >-
      An aggregate persona check does not establish exhaustive allow and deny
      proof for every named surface.
executable_coverage:
  bound_scenarios: 4
  unbound_scenarios:
    - ATS-ACC-BAT-005-05
    - ATS-ACC-BAT-005-06
    - ATS-ACC-BAT-005-07
    - ATS-ACC-BAT-005-08
    - ATS-ACC-BAT-005-09
    - ATS-ACC-BAT-005-10
    - ATS-ACC-BAT-005-11
  gap: FND-ACC-BAT-059
---

# Arrange automatic close and posting: Capability Test Specification

## Coverage

The scenarios define focused checks for this outcome. The coverage map distinguishes specified checks from unresolved proof; executable bindings identify inspected assertions and carry no execution result.

| Rule | Proof Specification or Gap |
|---|---|
| `BR-CAP-ACC-BAT-005-01` | `ATS-ACC-BAT-005-01`, `ATS-ACC-BAT-005-06` |
| `BR-CAP-ACC-BAT-005-02` | `ATS-ACC-BAT-005-02` |
| `BR-CAP-ACC-BAT-005-03` | `ATS-ACC-BAT-005-03`, `ATS-ACC-BAT-005-10` |
| `BR-CAP-ACC-BAT-005-04` | `ATS-ACC-BAT-005-03`, `ATS-ACC-BAT-005-09` |
| `BR-CAP-ACC-BAT-005-05` | `ATS-ACC-BAT-005-04`, `ATS-ACC-BAT-005-07`, `ATS-ACC-BAT-005-08` |
| `BR-CAP-ACC-BAT-005-06` | `ATS-ACC-BAT-005-05` |
| `BR-CAP-ACC-BAT-005-07` | `ATS-ACC-BAT-005-11` |

## Interactions With Related Capabilities

Creation supplies a scheduled close. Removing the close time cancels delivery. Manual close cancels a scheduled close. Rolling does not duplicate a due close. Scheduled close submits accounting after retirement. These checks use the related capability’s outcome as part of the setup or verification. Unbound interactions remain proposed until a suite executes the complete chain.
