fix(core): every reversal is dated on or after its original (D-73)
A correction comes after what it corrects (Pacioli ch. 31; B-9). Until now only document reversals and depreciation/schedule runs were held to it; a plain posted entry could be reversed with an earlier date, leaving the books carrying the opposite of an entry that doesn't exist yet at the reversal's date. The owner's decision D-73 (2026-11-08) makes it one rule for every kind of entry; bookspec BS-ledger-5 states it. - Ledger::check_reversal refuses date < original.date() with one error, ReversalBeforeOriginal (it replaces DocumentReversalBeforeOriginal, which was the document-only wording). Same-day reversals are allowed. - Not on replay (B-28): the check sits behind is_replaying(), so a journal an earlier version wrote, holding a reversal dated before its original, reopens with the same figures. - The store's own date check for depreciation runs and schedule months (InvalidSchedule / AssetEntryIrreversible wording) was the same rule for a narrower case; it is removed so there is one variant for all. Store::check_reverse_entry, books.reverse_entry (preview and post), and the document voids all reach the refusal through check_reversal; the only construction path for a reversal is reverse_entry_steps, which calls it first. Tests: store reversal_dates.rs (plain entry refused before it, nothing journaled, same day and later taken; a journal with an earlier-dated reversal written the old way opens with the same figures); ledger-cli spec_mcp (preview, unconfirmed and confirmed post all refuse alike). Existing tests changed: store assets.rs (three expectations move to the new variant); core spec_asset_basis.rs (it backdated a reversal on purpose to check the trial balance carries -100.00 between the dates; it now replays one, as an old journal would); model.rs (the model oracle's `reverse` requires the date, as the Lean/bookspec rule does); bookspec common.rs (the pinned depreciation example words this refusal "entry_irreversible"); spec_documents.rs (variant rename). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5fc16cad6
commit
bb5008edb5
14 files changed
+278
-69
No files matched your search
+1
-1
@@ -27,7 +27,7 @@ in CI that the floor never falls between commits.
|
||||
| Trial balance as of a date | Reports → Trial Balance (as of) | done | hand-verified fixture; golden-covered (`tests/golden_reports.rs`, the fixture company extended with a three-leg entry, a January close and a February entry; `golden/trial_balance_as_of.json`, `golden_trial_balance_as_of`; worksheet `plan/golden-worksheets/trial-balance-as-of.md`) |
|
||||
| Statement of changes in members' equity | Reports → Statement of Changes in Equity | done | hand-verified two-member fixture incl. rounding and a close; golden-covered (`golden/members_equity_two_member.json`, `statements.rs::golden_members_equity_two_member`; worksheet `plan/golden-worksheets/members_equity_two_member.md`) |
|
||||
| Tax line mapping + tax summary | Accounts → Tax line mapping; Tax reports | done | hand-verified fixture (50% meals, nondeductible, contra income); golden-covered (`golden/tax_summary_form_1065.json`, `tax.rs::golden_tax_summary_form_1065`; worksheet `plan/golden-worksheets/tax_summary_form_1065.md`) |
|
||||
| Reversing entries | Reverse transaction | done | linked via `reversal_of` |
|
||||
| Reversing entries | Reverse transaction | done | linked via `reversal_of`; dated on or after its original, every kind of entry (D-73) |
|
||||
| Canonical report snapshots (JSON) | — (our oracle format) | done | `reports::snapshot` |
|
||||
| Fixed-asset register + straight-line depreciation | Fixed Asset register | done | `assets.rs`; golden-covered schedule; idempotent runs; disposal with gain/loss; posted (the books') vs scheduled, in-service vs acquired dates, the §723, depreciable and §704(c) figures (P3) |
|
||||
| Cash flow statement (direct, with the reconciliation schedule and noncash disclosures) | Reports → Cash Flow | done | R-FUTURE-3; rules.md B-14 (P3 defect 1) |
|
||||
|
||||
Reference in new issue
Block a user