Skip to content

feat(reconciliation): statement continuity + completeness assertion across account-months - #152

Merged
elasticdotventures merged 3 commits into
mainfrom
issue-146-statement-continuity
Aug 9, 2026
Merged

feat(reconciliation): statement continuity + completeness assertion across account-months#152
elasticdotventures merged 3 commits into
mainfrom
issue-146-statement-continuity

Conversation

@elasticdotventures

Copy link
Copy Markdown
Member

Implements #146

  • New coverage module with assert_account_coverage
  • Detects missing months, duplicate source documents, balance discontinuities
  • Wired as assert_coverage action on ledgerr_reconciliation tool
  • commit_stage refuses to commit when coverage issues exist

…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
elasticdotventures force-pushed the issue-146-statement-continuity branch from 9eb27fd to 22f837d Compare August 9, 2026 07:01

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(),
});
}
}
@elasticdotventures
elasticdotventures merged commit 34851bc into main Aug 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants