Commit Graph

1 Commits

Author SHA1 Message Date
Mattsson 84ba8323b4 fix(transactions): derive pre-migration marker cutoff from imported voucher dates, not fiscal_year_end (#2047)
* fix(transactions): derive pre-migration marker cutoff from imported voucher dates, not fiscal_year_end

A SIE file exported mid-year still declares the full fiscal year in #RAR 0,
so sie_imports.fiscal_year_end is a future date for mid-year migrators and
the 'fran perioden fore din migrering' marker fired on every new bank
transaction until New Year. The cutoff now comes from the latest posted
source_type='import' entry_date (excluding the M-series omforingsverifikation,
which is deliberately dated at fiscal year end), so it tracks where the
imported bokforing actually ends and self-corrects on undo/replace.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UU5QbL3p8xNB3tSZDbyrr3

* fix(transactions): arm pre-migration cutoff on completed SIE import, exclude omforing by description

Skeptic findings on the frozen commit: (1) source_type='import' is accepted
from v1 API clients, so a never-migrated company with an API-labeled backfill
would get a false cutoff; the marker is now armed only when a completed
sie_imports row exists. (2) Imported vouchers keep the source file's voucher
series, so excluding series M dropped genuine M-series vouchers (6 prod
companies); the omforingsverifikation is now excluded by its hardcoded
description prefix instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UU5QbL3p8xNB3tSZDbyrr3

* docs(transactions): state the pre-migration cutoff residuals truthfully

The ledger duplicate guard only reaches the completed-year single-skip case
(7-day window vs a fiscal-year-end-dated aggregate omforing), so it is not
a general backstop for the skip-window gap; the gap is accepted on rarity.
Also documents the rattelse-rename fragility of the description-keyed
exclusion. Skeptic re-review condition, no code change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UU5QbL3p8xNB3tSZDbyrr3

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 23:16:34 +02:00