Files
accounted/lib/reconciliation
Jakob Wennberg 7494274852 fix(reconciliation): stop counting a stornerad opening balance as the IB (#1647)
* fix(reconciliation): stop counting a stornerad opening balance as the IB

getReconciliationStatus summed source_type='opening_balance' lines with
no status filter while the GL fetch includes reversed entries. A
reversed IB and its storno correctly net to zero inside gl_1930_balance
(as on the balansräkning), but the reversed IB alone was still counted
in gl_1930_opening_balance and subtracted from the period movement, so
difference = (bank - gl) + reversed_ib: a phantom diff of exactly the
cancelled amount after a perfectly correct rättelse. The IB-floor
derivation had the same gap and could raise effectiveFrom to a stray
reversed IB, silently dropping early-period movements.

Only status='posted' opening_balance lines now count as the IB, for
both the opening-balance figure and the floor: the same rule the
canonical compute_prior_opening_balances RPC (20260421180000) already
applies. Nothing else moves: the reversed pair stays in glBalance where
it cancels.

Reported via gnubok_feedback 2026-08-16 with the exact formula.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: retrigger preview build (Vercel runner hung in Running TypeScript for 45 min, BUILD_EXCEEDED_MAXIMUM_TIME)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 22:01:20 +02:00
..