fix(core): a legacy close's drift before its true-up is the rule's, not one unit

Before a count is trued up, check_split flagged any drift beyond one unit. BS-partner-1 statement 6 allows a legacy last-absorbs close more than that with four or more members, so the audit raised a false finding on legitimate legacy books.

The rule does not state an audit bound; this bound is DERIVED from statement 6's per-member facts, and the derivation is in check_split's spec block: with n members and unit u, each member but the last was rounded to within u/2, and the last absorbed the sum of those roundings, so |e_last| <= (n-1)*u/2. Floored at u (statement 6's allowance for each run break and each per-close close), the pre-true-up bound is B(n) = max(u, (n-1)*u/2): 1.5 units with four members, 2 with five. A drift of exactly B(n) is legitimate and not flagged; past it is. After the true-up, statement 5's strict bound still holds: a drift of a unit or more is flagged.

WB-ledger-16 invariant 8 now states B(n) and marks it derived.

Tests: a_legacy_last_absorbs_close_drifts_by_member_count_before_its_true_up (BS-partner-1 statement 6 before the true-up, statement 5 after it; WB-ledger-16 invariant 8): four- and five-member closes at their largest legitimate drift are not flagged, one unit past it they are, and after the true-up the strict >= unit bound holds.

Co-Authored-By: Muse Wonder 1.0
This commit is contained in:
swaitsandMuse Wonder 1.0 committed 2026-11-09 14:50:38 -07:00
1 parent 5b1596f977
commit 02087ef3fb
3 files changed
+117 -10

No files matched your search

+12 -3
View File
@@ -522,9 +522,17 @@ INVARIANTS:
unit or more is a finding. The unit is the allocation's own
(`Currency::allocation_unit`, on `allocation_places`: a whole yen
for JPY, the finest a line carries for a code with no minor unit),
never a cent taken separately. Before that true-up the count may still
carry the rounding of closes made under the older rules, so only a
drift beyond one unit is. Closes under the older rules are not read.
never a cent taken separately. Before that true-up the count may
still carry the rounding of closes made under the older rules, so
only a drift beyond B(n) is a finding, where B(n) = max(one unit,
(n-1) half-units) for n members: a unit with three or fewer
members, 1.5 units with four, 2 units with five. B(n) is DERIVED:
BS-partner-1 statement 6 states the per-member facts it comes from
(a last-absorbs close rounded each member but the last to within
half a unit, and the last absorbed up to half a unit for each of
the others; under a unit for each run break and each per-close
close), not the bound itself. Closes under the older rules are not
read.
SCENARIOS:
1. The same books audited twice through one day: one run, one
workpaper; the second call files and journals nothing.
@@ -556,6 +564,7 @@ journal feature `audits`.
`control_accounts_report_differences_unattached_lines_and_overpaid_documents`,
`a_close_split_drifts_by_the_regime_it_was_made_under`,
`a_jpy_close_is_checked_at_the_allocations_unit`,
`a_legacy_last_absorbs_close_drifts_by_member_count_before_its_true_up`,
`a_count_is_trued_up_by_the_first_cumulative_close_that_posts`,
`a_reversal_without_its_own_receipt_is_info_and_only_when_the_policy_would_cover_it`,
`the_bar_setting_parses_what_it_names_and_refuses_the_rest`,