mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 15:34:58 +00:00
* fix(balance): fix double-counting on reconciliation waypoints with same-day transactions Waypoint branch was setting start = end = waypoint and passing real flows to build_balance. Since end_balance is a PG generated column that recomputes from flows, transactions were double-counted on waypoint days and the prior gap day inherited a phantom jump. Fix: pin only the end to the API value, derive start from the day's own flows (same as current_anchor). Transaction attributed once, gap day correct, investment cash/holdings split correct. Adds regression test + GUI breakdown test verified against real PG columns through UI::Account::BalanceReconciliation. Fixes #2007. * test(balance): add investment waypoint regression test Covers reconciliation waypoint + same-day trade on investment accounts: end_balance must match API-reported total (not double-count trade flows), cash/non-cash flows must be preserved, and gap day total must be correct.