Skip to content

ATS-ACC-BAT-017Protect ledger balance, immutability and workspace isolation: Capability Test Specification

Markdown

ATS-ACC-BAT-017

Protect ledger balance, immutability and workspace isolation: Capability Test Specification

Markdown
  • DocumentProposed
  • Product intentProposed

KindAcceptance test setProduct areaAccountingModuleBatch ManagementRevision2

Read atservices-accounting f47cb263react-console baf6dae3rhythm-v2-docs 37405d50

Coverage

  • Rule covered
  • Transition covered
  • Validation covered
  • Permission not-applicable
  • Edge gap: FND-ACC-BAT-071
  • Failure gap: FND-ACC-BAT-071
  • Boundary covered
  • Concurrency covered
  • Invariant covered
  • Interaction covered

Test Scenarios

10 scenarios proving CAP-ACC-BAT-017; 6 bound to an existing test.

01 Balance is enforced at commitinvariantapinegativetest
Proves
BR-CAP-ACC-BAT-017-01 INV-DOM-ACC-BAT-004-01
Preconditions
A posting record exists.
Steps
Insert a balanced entry and an unbalanced entry.
Expected
Only the balanced entry commits and can be listed under its posting.
Data
Provide no fixtures beyond the stated setup.
Bound to
Source
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#refuses an entry whose debits and credits differ, at commit, by the balance constraint
02 Conversion stores integer minor unitsboundaryapitest
Proves
BR-CAP-ACC-BAT-017-02
Preconditions
Existing ledger values use major units.
Steps
Run the currency-exponent conversion.
Expected
Line and schedule amounts become integer minor units and enforcement is restored afterward.
Data
Provide no fixtures beyond the stated setup.
Bound to
Source
services-accounting:modules/batches/tests/integration/services/persistence/ledger-minor-units.integration.spec.js#converts each line with its unit's base exponent and its transaction currency's, and each schedule entry with its schedule's
03 Ledger writes reject ordinary mutationruleapinegativetest
Proves
BR-CAP-ACC-BAT-017-03 BR-CAP-ACC-BAT-017-04 INV-DOM-ACC-BAT-004-03 INV-DOM-ACC-BAT-004-04
Preconditions
A current posted entry exists.
Steps
Update as application and owner, then delete as application.
Expected
All ordinary mutations fail; only guarded unposting and workspace purge remove rows.
Data
Provide database roles.
Bound to
Source
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#cannot be updated even by the table owner: the append-only trigger refuses it, naming the table
04 Ledger references preserve unit and workspace boundariesvalidationapinegativetest
Proves
BR-CAP-ACC-BAT-017-05 BR-CAP-ACC-BAT-017-06 INV-DOM-ACC-BAT-004-05
Preconditions
The posting belongs to the first unit.
Steps
Use another unit’s account, duplicate a document entry and reference a reversal target outside the workspace.
Expected
The database refuses each invalid reference.
Data
Provide two units.
Bound to
Source
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#refuses a second entry of the same transaction in the same posting, by the no-duplicates key
05 Purge requires workspace deletiontransitionapinegativetest
Proves
BR-CAP-ACC-BAT-017-07
Preconditions
A live workspace contains posting and reposting history.
Steps
Purge before and during Platform’s deleting state.
Expected
The live request removes nothing; deletion removes ledger and posting records before batches and configuration.
Data
Provide platform's workspace status.
Bound to
Source
services-accounting:modules/batches/tests/integration/services/lifecycle/ledger-purge.integration.spec.js#removes every batch posting table’s rows, the ledger’s first among them, and answers done with nothing left
06 Ledger reads isolate workspacesinvariantapinegativetest
Proves
BR-CAP-ACC-BAT-017-08
Preconditions
The first workspace owns a posted batch.
Steps
From another workspace, retrieve entries by batch and document.
Expected
Both reads return no ledger rows.
Data
Provide two workspaces.
Bound to
Source
services-accounting:modules/batches/tests/integration/services/posting/rebuilt-documents.integration.spec.js#answers another tenant none of the entries, by batch or by transaction (the row-level policy)
07 Generated balances survive storage enforcementinteractionapiproposed
Proves
BR-CAP-ACC-BAT-015-14 BR-CAP-ACC-BAT-017-01
Preconditions
A taxed invoice and its memo are eligible for posting.
Steps
Post them and sum stored debit and credit lines per entry.
Expected
Each stored entry balances and its document-line references remain readable.
Data
An isolated workspace with the stated business-unit calendar, documents and configuration.
Source
services-accounting:modules/batches/tests/integration/services/posting/rebuilt-documents.integration.spec.js#traces every line of every entry to a line of a document in the batch; services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#refuses an entry whose debits and credits differ, at commit, by the balance constraint
08 Guarded recovery removes only its ledgerinteractionapiproposed
Proves
BR-CAP-ACC-BAT-016-03 BR-CAP-ACC-BAT-017-04
Preconditions
Morning and Evening each have a current posting in an Open period.
Steps
Unpost Morning and list both batches’ entries including history.
Expected
Morning has no entries; Evening’s stored entries are unchanged.
Data
An isolated workspace with the stated business-unit calendar, documents and configuration.
Source
services-accounting:modules/batches/tests/integration/services/posting/unpost-deletes-entries.integration.spec.js#deletes the batch’s entries and their lines, and tells how many entries; services-accounting:modules/batches/tests/integration/services/posting/unpost-deletes-entries.integration.spec.js#is the only way to delete a ledger row: the application role is refused a direct delete
09 Immutable accounting remains readableinteractionapinegativeproposed
Proves
BR-CAP-ACC-BAT-017-03 BR-CAP-ACC-BAT-018-03
Preconditions
A posted invoice entry is visible to its workspace reader.
Steps
Read its detail, attempt an ordinary ledger mutation and read it again.
Expected
Mutation fails and the second detail agrees with the first.
Data
An isolated workspace with the stated business-unit calendar, documents and configuration.
Source
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#cannot be updated even by the table owner: the append-only trigger refuses it, naming the table; services-accounting:modules/batches/tests/e2e/subledger-entries.e2e.spec.js#names the number of the document each entry posts, never its id (DEF-ACT-0531)
10 Duplicate entry creation has one committed resultconcurrencyapinegativeproposed
Proves
BR-CAP-ACC-BAT-017-06
Preconditions
Two transactions share a current posting and the same valid document-entry identity.
Steps
Insert the same entry from both transactions and release their commits in a controlled order.
Expected
At most one transaction commits that identity and the other receives the database duplicate refusal.
Data
Owned records in an isolated workspace with the stated calendar and accounting setup.
Source
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#refuses a second entry of the same transaction in the same posting, by the no-duplicates key

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.