Skip to content

[BUG-94] LeanFin: show the full balance total on short time windows - #117

Merged
jmunar merged 4 commits into
mainfrom
bug-94-show-full-balance-on-short-time-windows
Aug 29, 2026
Merged

[BUG-94] LeanFin: show the full balance total on short time windows#117
jmunar merged 4 commits into
mainfrom
bug-94-show-full-balance-on-short-time-windows

Conversation

@jmunar

@jmunar jmunar commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix accounts silently dropping out of the balance evolution total: non-bank accounts (manual, Indexa) only get a balance snapshot when their value is updated, so an account with no entries inside the selected window produced an empty series and contributed nothing to the aggregated "All accounts" total.
  • The window is now seeded with the most recent snapshot before the cutoff, so fill_balance_gaps carries the last known balance forward across the whole period.
  • Exclude archived accounts from the aggregated series, matching the account dropdown on the same page — without this, closed accounts would now carry their last balance forward into the total forever.
  • Document both behaviours in docs/requirements.md.

Test plan

  • make check (fmt + clippy + full test suite) passes.
  • New integration tests in crates/myapps-leanfin/tests/leanfin/balance_evolution.rs:
    • manual_account_without_recent_entries_still_shows_balance — an account last updated 200 days ago still renders its balance over a 90d window.
    • aggregated_series_includes_manual_account_without_recent_entries — total is 6000, not 1000.
    • aggregated_series_excludes_archived_accounts — an archived account does not inflate the total.
  • Manually: on the Balance page, pick 30d/90d with "All accounts" selected while holding a manual account not updated in that period — the total now includes it.

Note: an account whose first ever snapshot falls inside the window (e.g. a bank connected 20 days ago viewed over 90d) still steps up on that date. That is genuinely unknown history rather than a missing carry-forward, so it is left as is.

🤖 Generated with Claude Code

jmunar and others added 4 commits August 29, 2026 20:41
Manual accounts only get a balance snapshot when their value is updated
(or a CSV is imported). The balance series for a manual account was built
solely from snapshots inside the selected window, so an account untouched
for longer than the window produced an empty series and silently dropped
out of the aggregated total.

Seed the manual window with the most recent snapshot before the cutoff so
the last known balance is carried forward, and exclude archived accounts
from the aggregated series to match the account selector on the same page
(without which closed accounts would now carry their balance forward
forever).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Resolved conflicts in the non-bank balance series branch (main widened the
manual-account path to every non-bank account type for Indexa Capital) and
in the manual accounts requirements bullet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jmunar
jmunar merged commit ea4558a into main Aug 29, 2026
2 checks passed
@jmunar
jmunar deleted the bug-94-show-full-balance-on-short-time-windows branch August 29, 2026 19:05
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.

1 participant