feat(reconciliation): statement continuity + completeness assertion across account-months - #152
Merged
Merged
Conversation
…146) - Add coverage module with AccountPeriodCoverage, CoverageReport types - Detect gaps, duplicates, discontinuities from ingested tx data - Wire as AssertCoverage action on ledgerr_reconciliation tool - commit_stage refuses to commit when coverage gaps/duplicates exist
…s_duplicate_source_refs Test asserted !report.has_gaps immediately before asserting report.gaps.len() == 11 — these can never both hold if has_gaps tracks gaps.is_empty(). The other 11 months of 2023 genuinely have no coverage in this fixture, so has_gaps should be true.
elasticdotventures
force-pushed
the
issue-146-statement-continuity
branch
from
August 9, 2026 07:01
9eb27fd to
22f837d
Compare
|
|
||
| let mut by_period: BTreeMap<(String, i32, u32), AccountMonthAccum> = BTreeMap::new(); | ||
|
|
||
| for (_tx_id, tx) in tx_rows { |
|
|
||
| let mut by_period: BTreeMap<(String, i32, u32), AccountMonthAccum> = BTreeMap::new(); | ||
|
|
||
| for (_tx_id, tx) in tx_rows { |
Comment on lines
+158
to
+170
| if (next.year == prev.year && next.month == prev.month + 1) | ||
| || (next.year == prev.year + 1 && prev.month == 12 && next.month == 1) | ||
| { | ||
| if prev.closing_balance != next.opening_balance { | ||
| discontinuities.push(Discontinuity { | ||
| account_id: account_id.clone(), | ||
| from_period: format!("{:04}-{:02}", prev.year, prev.month), | ||
| to_period: format!("{:04}-{:02}", next.year, next.month), | ||
| expected_opening: prev.closing_balance.to_string(), | ||
| actual_opening: next.opening_balance.to_string(), | ||
| }); | ||
| } | ||
| } |
Comment on lines
+158
to
+170
| if (next.year == prev.year && next.month == prev.month + 1) | ||
| || (next.year == prev.year + 1 && prev.month == 12 && next.month == 1) | ||
| { | ||
| if prev.closing_balance != next.opening_balance { | ||
| discontinuities.push(Discontinuity { | ||
| account_id: account_id.clone(), | ||
| from_period: format!("{:04}-{:02}", prev.year, prev.month), | ||
| to_period: format!("{:04}-{:02}", next.year, next.month), | ||
| expected_opening: prev.closing_balance.to_string(), | ||
| actual_opening: next.opening_balance.to_string(), | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #146
assert_account_coverageassert_coverageaction onledgerr_reconciliationtool