Skip to content

CAP-ACC-CLS-008Complete a guarded month-end close

Markdown

CAP-ACC-CLS-008

Complete a guarded month-end close

Markdown
  • DocumentDraft
  • Product intentConfirmed
  • ImplementationPartially observed

KindCapabilityProduct areaAccountingModuleMonth-End ClosingRevision1

Read atservices-accounting f47cb263react-console baf6dae3

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
Repeated requests resolve to the original run when their command content matches.Required blockers discovered during execution leave the month open.Completed closes retain the requester and the evidence evaluated by the run.
Surfaces
consoleapijob
Preconditions
The selected period is open and next in the closing sequence.
Postconditions
The run completes with retained evidence, releases the period after refusal, or retains it for recovery after failure.
Constraints
The request returns a successful response containing its run; asynchronous acceptance status needs shared dispatcher support.
Intent sources
services-accounting:docs/milestones/plans/ACCT-M4-plan.md#4a row 74 (class A: close runs as a job with six steps, one active run per period)services-accounting:docs/milestones/ACCT-M4-contracts-and-events-for-commerce.md#Rulings recorded during the milestone

Controls

30 controls apply, from the corpus control catalogue.

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-005 TC-AZ-006 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-DAT-001 TC-LOG-001 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

Permissions

KeyChecked atScope
accounting.fiscal-periods.closeapitenant

Business Rules

14 rules, 13 to be proved before approval. A rule's product intent is derived from its origin: 14 confirmed by a product decision, the rest inheriting this capability's confirmed.

IdRuleKindEnforced atProvenance
01must prove
Confirmed
A close request requires a trimmed key of one to 255 characters and accepts an optional note up to two thousand characters and at most fifty warning acknowledgements; invalid or additional fields are refused.
validationapitest
02must prove
Confirmed
The close permission is required to submit a close request.
origin: services-accounting:docs/milestones/plans/ACCT-M4-plan.md#4a row 73 (class A: authorised)
permissionapitest
services-accounting:modules/fiscal-close/tests/e2e/fiscal-close-runs.e2e.spec.js#refuses a principal without accounting.fiscal-periods.close with 403
03must prove
Confirmed
Repeating a key with the same command returns its run without another job, while a changed period, note or acknowledgement set is refused.
policyservice, databasetest
services-accounting:modules/fiscal-close/tests/integration/services/jobs/close-job.integration.spec.js#refuses the same key with another body as idempotency-key-reused (409)
04must prove
Confirmed
The product should refuse another person’s command under an idempotency key already used by a requester.
✗ A colleague’s matching command currently receives the original requester’s run.
policydocumented
05must prove
Confirmed
A period accepts no competing run while one is queued or running, or while a failed run retains it in closing or reopening state.
origin: services-accounting:docs/milestones/plans/ACCT-M4-plan.md#4a row 74 (class A: one active run per period)
invariantservice, databasetest
services-accounting:modules/fiscal-close/tests/integration/services/jobs/close-job.integration.spec.js#refuses another key while the first run holds the period, as period-run-active
06must prove
Confirmed
The request rejects an unavailable period or invalid sequence immediately, but accepts incomplete readiness for the job to assess.
validationservicetest
07must prove
Confirmed
The final period of a fiscal year creates a year-close run; other periods create period-close runs.
policyservicetest
08must prove
Confirmed
A close job locks, revalidates, recognizes revenue, skips cost of goods sold, finalizes and rolls years forward, starting after the request transaction commits.
origin: services-accounting:docs/milestones/plans/ACCT-M4-plan.md#4a row 74 (class A: close runs as a job with six steps)
lifecycleservicetest
09must prove
Confirmed
Steps through finalization lock the period and reuse committed results on replay; roll-forward executes separately after closure.
origin: fiscal-close design L9 (Rhythm 1.0 CLOSE-9 fixed)
invariantservice, databaseobserved
10must prove
Confirmed
Revalidation stores readiness and refuses required blocked, pending or error checks, releasing the month and failing the run without retry.
origin: services-accounting:docs/milestones/plans/ACCT-M4-plan.md#4a row 74 (class A; plan approved 2026-10-21)
policyservicetest
11must prove
Confirmed
Unacknowledged warning outcomes do not stop execution and are recorded in a run event.
policyserviceobserved
12must prove
Confirmed
The console reviews warning outcomes and requires their acknowledgement before asking for the exact month label as confirmation.
policyconsoleobserved
13must prove
Confirmed
Finalization atomically records the closed period, requester and close time, close snapshot, aging request and successful run, with the year following its final month.
origin: services-accounting:docs/milestones/plans/ACCT-M4-plan.md#4a row 74 (class A; plan approved 2026-10-21)
lifecycleservice, databasetest
14
Confirmed
Job authorization uses the system caller’s grants; the requester’s close grant is checked at submission.
permissionservicedocumented
services-accounting:docs/migrations/fiscal-close/README.md#Decisions and departures from the brief

Scenarios

IdGivenWhenThenProvenance
01September is clean and August is closed.The controller confirms September in the console with no warnings.Six steps settle, the empty recognition and cost steps are skipped, and the completed month has a close record.test
02September has an unposted batch and a close request is submitted directly.The job evaluates readiness.Revalidation fails, returns September to open and identifies the batch blocker.test
03A command has a saved run and an unchanged request body.The same keyed command is submitted again.The response returns that run without another job.test

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.