---
id: CAP-ACC-BAT-010
title: Advance a scheduled stream and post its predecessor
feature: FEAT-ACC-BAT-02
product_area: accounting
module: batches
revision: 1
status: draft
product_intent: proposed
implementation_evidence: observed
supersedes:
- inventory CAP-ACC-BAT-007
- inventory RUL-ACC-BAT-040
- inventory RUL-ACC-BAT-042
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
intent_sources:
- 'services-accounting:docs/migrations/transaction-processing/batches/README.md#D13: automatic posting (Andrew,
  2026-10-16)'
- services-accounting:docs/migrations/transaction-processing/batches/README.md#D14 and migration 0060 (Andrew, 2026-10-16)
purpose: Scheduled rolls provide the next batch and retire the preceding batch without duplicating an occurrence.
outcomes:
- A handled occurrence identifies its new collection and the disposition of the prior collection.
concepts:
- CON-ACC-BAT-001
actors:
- ACT-ACC-014
- ACT-ACC-006
- ACT-ACC-007
surfaces:
- console
- api
- job
permissions:
- key: accounting.recurring-batches.read
  where_checked: api
  scope: tenant
rules:
- id: BR-CAP-ACC-BAT-010-01
  proved_by: [ATS-ACC-BAT-010-01, TST-ACC-BAT-116, TST-ACC-BAT-131]
  statement: A roll opens a transaction batch using the occurrence’s calendar date in the schedule zone, the configured
    templates, the unit currency and that date’s fiscal period.
  kind: calculation
  enforced_at:
  - service
  must_prove: true
  provenance: test
  source: services-accounting:modules/batches/tests/integration/services/roll/batch-roller.integration.spec.js#opens
    the new batch, dated the occurrence’s local date in Denver, and points the recurring batch at it
  origin: none
- id: BR-CAP-ACC-BAT-010-02
  proved_by: [ATS-ACC-BAT-001-14, ATS-ACC-BAT-010-02, ATS-ACC-BAT-010-09, TST-ACC-BAT-005, TST-ACC-BAT-116]
  statement: Generated names use the first available name in the unit, retaining the unsuffixed name after an empty
    predecessor is deleted and adding a numbered suffix when it remains occupied.
  kind: calculation
  enforced_at:
  - service
  must_prove: true
  provenance: test
  source: services-accounting:modules/batches/tests/integration/services/roll/batch-roller.integration.spec.js#names
    the new batch with the " (2)" suffix when the previous batch is kept and still holds the name
  origin: services-accounting:docs/migrations/transaction-processing/batches/README.md#D14 and migration 0060 (Andrew,
    2026-10-16)
- id: BR-CAP-ACC-BAT-010-03
  proved_by: [ATS-ACC-BAT-010-03, TST-ACC-BAT-006, TST-ACC-BAT-074, TST-ACC-BAT-116]
  statement: The roll repoints its active reference to the new batch, deletes an unused predecessor or closes an
    eligible Open predecessor, and leaves locked, system or non-open predecessors unchanged.
  kind: lifecycle
  enforced_at:
  - service
  must_prove: true
  provenance: test
  source: services-accounting:modules/batches/tests/integration/services/roll/batch-roller.integration.spec.js#deletes
    the previous active batch, which nothing named
  origin: none
- id: BR-CAP-ACC-BAT-010-04
  proved_by: [ATS-ACC-BAT-010-03, TST-ACC-BAT-006, TST-ACC-BAT-074, TST-ACC-BAT-116]
  statement: The roll prepares automatic posting for the predecessor left Closed and starts that posting after its
    transaction commits.
  kind: lifecycle
  enforced_at:
  - service
  must_prove: true
  provenance: test
  source: 'services-accounting:modules/batches/tests/integration/services/roll/batch-roller.integration.spec.js#posts
    the previous batch the roll leaves closed: one posting job of it, named in the run’s outcome'
  origin: 'services-accounting:docs/migrations/transaction-processing/batches/README.md#D13: automatic posting (Andrew,
    2026-10-16)'
- id: BR-CAP-ACC-BAT-010-05
  proved_by: [ATS-ACC-BAT-010-03, TST-ACC-BAT-006, TST-ACC-BAT-074, TST-ACC-BAT-116]
  statement: Deleting an unused predecessor creates no posting request.
  kind: lifecycle
  enforced_at:
  - service
  must_prove: true
  provenance: test
  source: services-accounting:modules/batches/tests/integration/services/roll/batch-roller.integration.spec.js#posts
    nothing when the previous batch was empty and so deleted (RB-20, D13)
  origin: 'services-accounting:docs/migrations/transaction-processing/batches/README.md#D13: automatic posting (Andrew,
    2026-10-16)'
- id: BR-CAP-ACC-BAT-010-06
  proved_by: [ATS-ACC-BAT-005-09, ATS-ACC-BAT-010-04, ATS-ACC-BAT-010-10, TST-ACC-BAT-116]
  statement: A repeated occurrence returns the batch already generated without creating another batch or another
    posting.
  kind: invariant
  enforced_at:
  - service
  - database
  must_prove: true
  provenance: test
  source: 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
  origin: 'services-accounting:docs/migrations/transaction-processing/batches/README.md#D13: automatic posting (Andrew,
    2026-10-16)'
- id: BR-CAP-ACC-BAT-010-07
  proved_by: [ATS-ACC-BAT-010-05, TST-ACC-BAT-116]
  statement: Opening, repointing and retiring the predecessor commit together, so a failure preserves the prior
    state for a retry.
  kind: invariant
  enforced_at:
  - service
  must_prove: true
  provenance: test
  source: 'services-accounting:modules/batches/tests/integration/services/roll/batch-roller.integration.spec.js#leaves
    nothing: no new batch, the first batch still the active one, open'
  origin: 'services-accounting:docs/migrations/transaction-processing/batches/README.md#Migration: transaction processing,
    plain batches (Rhythm 1.0 collect-batches) and the recurring batch roller (Andrew''s porting rules, rule 5)'
- id: BR-CAP-ACC-BAT-010-08
  proved_by: [ATS-ACC-BAT-010-06]
  statement: An unresolvable planning refusal fails the run with an explanation and creates no batch, with the documented
    scheduler contract pausing after five consecutive failed runs.
  kind: policy
  enforced_at:
  - service
  must_prove: true
  provenance: documented
  source: services-accounting:docs/accounting/recurring-batches.md#The roll
  origin: none
  note: The cited module record documents the scheduler pause threshold; the imported scheduler implementation is
    not part of the pinned module scope.
- id: BR-CAP-ACC-BAT-010-09
  proved_by: [ATS-ACC-BAT-009-14, ATS-ACC-BAT-010-07, ATS-ACC-BAT-010-11]
  statement: A missing or inactive recurring configuration causes its occurrence to be skipped with an explanation.
  kind: policy
  enforced_at:
  - service
  must_prove: true
  provenance: observed
  source: services-accounting:modules/batches/services/roll/recurring-batch-roll.ts
  origin: none
- id: BR-CAP-ACC-BAT-010-10
  proved_by: [ATS-ACC-BAT-010-12]
  statement: Run history sorts newest first and records the plan, generated and replaced batches, disposition and
    posting job or posting refusal.
  kind: policy
  enforced_at:
  - api
  - service
  must_prove: false
  provenance: test
  source: services-accounting:modules/batches/tests/e2e/recurring-batches.e2e.spec.js#answers the run the consumer
    recorded, every property of it
  origin: none
- id: BR-CAP-ACC-BAT-010-11
  proved_by: [ATS-ACC-BAT-010-08, TST-ACC-BAT-061, TST-ACC-BAT-117]
  statement: Next-roll preview uses the roll’s planning logic without recording an occurrence and refuses inactive
    configurations, schedules with no next run and invalid plans.
  kind: policy
  enforced_at:
  - api
  - service
  must_prove: true
  provenance: test
  source: services-accounting:modules/batches/tests/integration/services/roll/preview-next-roll.integration.spec.js#refuses
    409 for a recurring batch whose schedule the system paused
  origin: none
scenarios:
- id: SC-CAP-ACC-BAT-010-01
  given: A daily card stream has a nonempty predecessor and a Denver-zone schedule.
  when: The due roll occurrence runs.
  then: The successor uses the occurrence’s local date, the predecessor is closed and posting starts, and history
    records the result.
  provenance: test
  source: react-console:acceptance/accounting/playwright/journeys/batches-posting/ACT-ACC-0516.spec.ts#ACT-ACC-0516
- id: SC-CAP-ACC-BAT-010-02
  given: The stream’s active batch is unused.
  when: Its next occurrence rolls.
  then: The predecessor is deleted, the successor uses the available base name and no posting is requested.
  provenance: test
  source: react-console:acceptance/accounting/playwright/journeys/batches-posting/ACT-ACC-0515.spec.ts#ACT-ACC-0515
- id: SC-CAP-ACC-BAT-010-03
  given: The unit has no fiscal year covering an upcoming occurrence.
  when: The administrator previews that occurrence.
  then: Preview refuses the missing fiscal context rather than generating a batch.
  provenance: test
  source: services-accounting:modules/batches/tests/e2e/recurring-batches.e2e.spec.js#answers 409 to the preview
    of a recurring batch whose unit has no fiscal year containing the batch date
edge_cases: []
constraints:
- Accounting scheduling delivers the occurrences handled by the roll.
depends_on:
- CAP-ACC-BAT-009
- CAP-ACC-BAT-013
related:
- CAP-ACC-BAT-001
- CAP-ACC-BAT-005
journeys:
- JNY-ACC-BAT-003
open_questions:
- OQ-ACC-BAT-002
evidence:
- 'Pinned services-accounting (f47cb263), examined sources: aws/api/recurring-batches.routes.ts (listRecurringBatchRuns,
  previewRecurringBatchRoll), services/roll/recurring-batch-roll.ts, batch-roller.ts, roll-ports.ts, first-batch.ts,
  services/auto-post/automatic-posting.ts, services/persistence/batches.ts (findRolledBatch, insertRolledBatch,
  renameRolledBatchAfterDeletion, closeOrDeleteRolledOutBatch); tests integration/services/roll/batch-roller.integration.spec.js,
  preview-next-roll.integration.spec.js, e2e/recurring-batches.e2e.spec.js, unit/rules/recurring-batch-rules.spec.js;
  docs/accounting/recurring-batches.md ("The roll", "The roll contract").'
- 'Pinned react-console (baf6dae3), examined sources: components/configuration/recurring-batches/run-history.tsx,
  run-status-chip.tsx, use-recurring-batch-runs.ts; journeys ACT-ACC-0515, 0516.'
controls: [TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, TC-IAM-006, TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-AZ-006, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-DAT-001, TC-DAT-004, TC-LOG-002, TC-LOG-003, TC-LOG-004, TC-LOG-005, TC-AVL-001, TC-AVL-004, TC-MON-001, TC-MON-002, TC-MON-004, TC-PI-001, TC-PI-002, TC-PI-003, TC-PI-004, TC-PI-005]
exercised_by: [FAS-ACC-BAT-02-01, FAS-ACC-BAT-02-02, FAS-ACC-BAT-02-03, FAS-ACC-BAT-02-04, FAS-ACC-BAT-02-05]
suites: [TST-ACC-BAT-005, TST-ACC-BAT-006, TST-ACC-BAT-061, TST-ACC-BAT-074, TST-ACC-BAT-116, TST-ACC-BAT-117, TST-ACC-BAT-131]
---

# Advance a scheduled stream and post its predecessor

## Purpose

Scheduled rolls provide the next batch and retire the preceding batch without duplicating an occurrence.

## How It Works

The scheduler delivers an occurrence to the roll handler. The handler derives the local batch date and renders its planned labels. It then opens the successor and changes the stream’s active reference. The predecessor is deleted, closed or left unchanged according to its current condition. A predecessor eligible for automatic posting receives a job after the roll commits. History records the outcome, and a repeated occurrence reuses the batch already produced.

## Relationships

- Prerequisite: Configure recurring batch streams, which addresses the connected batch work.
- Prerequisite: Run and monitor a batch posting job, which addresses the connected batch work.
- Related outcome: Collect a business unit’s documents in a new batch, which addresses the connected batch work.
- Related outcome: Arrange automatic close and posting, which addresses the connected batch work.
