Monetary parsing
Reject exponent notation, non-finite values, unsupported precision, and malformed canonical decimals before persistence.
Financial correctness
Ledger treats billing rows as financial evidence. Exact storage, declared authority, deterministic methods, two reconciliation boundaries, immutable publication, and versioned explanations make results reproducible.
Up to 38 total digits, including 18 after the decimal point. Agent Mode stores an equivalent canonical decimal string, so money never passes through floating-point arithmetic.
No ambient float conversion and no hidden display-time recalculation.
Every reconciliation and Cost Pool retains its billing currency.
Published values retain links to normalized rows and their exact source objects.
A worked result
The answer is not a generated summary. It is a persisted calculation over two normalized records, under a declared basis and authority, with an exact zero reconciliation difference.
Controls
The system does not depend on one final total check. Each boundary protects a different class of error.
Reject exponent notation, non-finite values, unsupported precision, and malformed canonical decimals before persistence.
Validate mandatory fields, conditional relationships, enums, timestamps, currencies, and evidence locations.
Compare every supported cost basis by currency between source evidence and Normalized Charges.
Compare materialized results with the authoritative normalized total under the calculator contract.
Prepare complete results before making one logical billing-period publication current.
Persist method, version, formula, basis, authority, rounding, and lineage references with the Cost Pool.
Lineage
A published amount can be followed through the calculated service cost, evidence links, normalized records, dataset manifest, adapter report, source row, and immutable import object.
Correction history
When a provider issues a corrected export, Ledger creates a new evidence object, normalized dataset, calculation run, and publication. The previous chain remains inspectable and is explicitly marked as superseded.
Evidence for engineering discipline
Financial behavior is covered by adapter conformance fixtures, exact-money boundary tests, PostgreSQL pipeline tests, deterministic golden totals, rollback cases, and browser workflows.