Skip to content

CAP-ACC-BAT-006Remove an unused batch safely

Markdown

CAP-ACC-BAT-006

Remove an unused batch safely

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

KindCapabilityProduct areaAccountingModuleBatch ManagementRevision1

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
Unused eligible collections can be removed without leaving recurring intake pointed at a deleted batch.
Surfaces
api
Intent sources
services-accounting:docs/milestones/ACCT-M1-books-and-invoices.md#D11

Controls

21 controls apply, from the corpus control catalogue.

TC-IAM-001 TC-IAM-002 TC-IAM-004 TC-IAM-005 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-PI-001 TC-PI-003 TC-PI-005

Permissions

KeyChecked atScope
accounting.batches.deleteapitenant

Business Rules

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

IdRuleKindEnforced atProvenance
01must prove
Proposed
Deletion requires the batch-delete permission.
permissionapiobserved
02must prove
Proposed
Posted and Downloaded batches reject deletion.
lifecycleservicetest
03must prove
Proposed
A remaining document, posting or ledger entry prevents deletion, with an in-use refusal identifying the dependency.
invariantdatabase, servicetest
services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#answers 409 naming the batch for every table whose restrict foreign key names a batch, never a 500 (DEF-ACT-0012)
04must prove
Proposed
Either kind of record lock prevents batch deletion.
policyserviceobserved
05must prove
Proposed
Period-close system batches cannot be removed through ordinary deletion.
policyservicetest
services-accounting:modules/batches/tests/e2e/system-batches.e2e.spec.js#refuses DELETE 409 system_batch, the batch still there
06must prove
Proposed
An unused active batch can be deleted, clearing its recurring configuration’s active reference until a later roll supplies another.
policydatabase, servicetest
services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#deletes the batch a recurring batch names as its active batch and clears the reference (DEF-ACT-0012)
07must prove
Proposed
Deletion also removes the automatic-close schedule and resolves the batch’s outstanding posting attention item.
lifecycleservicetest

Scenarios

IdGivenWhenThenProvenance
01An accidental Open batch has no references preventing removal.An authorized caller deletes it.A subsequent read reports that the batch does not exist.test
02Payments and credits still reference an Open batch.Staff request its deletion.An in-use refusal identifies those dependencies and preserves the batch.documented
services-accounting:docs/milestones/plans/ACCT-M1-plan.md#D11. Four repairs that already landed and carry a product choice

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.