BLOCKER: YNAB transfer legs across months double Account movements #949

Open
opened 2026-10-02 20:02:50 +00:00 by kayg · 0 comments
Owner

Blocking Money import finding from #462

Reviewed job/money-ident at ae35584698192489d53bea2a5ad72b23d98632c1.
This is a static code trace. No test or server ran. All values are synthetic.

DESIGN §48 requires source calendar dates and exact Account balances to stay
the same. A Money transfer has one date for both legs.

crates/plugins/money/src/import.rs:4672 pairs CSV and JSON transfers by
Accounts, date and exact amount. A reciprocal pair with different dates does
not match. Both rows remain complete transfers, each with a generated opposite
leg. At line 729, Account checks use these normalized transfers instead of raw
source postings. Thus incorrect monthly balances can pass verification.

Small source: USD Cash Accounts a and b, zero openings, no Assignments.
JSON out on 2026-01-31: Account a, target b, amount -1000 milliunits.
JSON in on 2026-02-01: Account b, target a, amount +1000 milliunits.
Use distinct IDs. CSV equivalent: reciprocal Transfer Categories, Outflow
1.00 on January 31 and Inflow 1.00 on February 1.

Expected source balances: January a=-100,b=0; February a=-100,b=100.
Ready to Assign, Category Activity and Available are all 0. The current format
cannot preserve both Account dates; reject before retaining a preview. Actual
imports already reject transfers that cross months.

Code trace: January a=-100,b=100; February a=-200,b=200. Ready to Assign,
Category Activity and Available remain 0. Both rows generate both legs, and
the normalized Account checks agree with the doubled totals. Final balances
are wrong even without source Account balances or monthly snapshots.

Fix scope: keep raw source postings for verification. Resolve reciprocal source
legs and reject pairs whose dates cannot be represented without changing
monthly balances. Keep existing same-day FIFO behavior.

Regression idea: exercise CSV and JSON pairs across months, including dates in
reverse input order. Require an error and no retained preview or Budget. Keep
same-day repeated-pair tests. Also check different dates in one month.

Search before filing: "cross-month transfer" returned only #462; "YNAB"
returned no focused transfer-date issue. This issue has one shared adapter fix.

# Blocking Money import finding from #462 Reviewed `job/money-ident` at `ae35584698192489d53bea2a5ad72b23d98632c1`. This is a static code trace. No test or server ran. All values are synthetic. DESIGN §48 requires source calendar dates and exact Account balances to stay the same. A Money transfer has one date for both legs. `crates/plugins/money/src/import.rs:4672` pairs CSV and JSON transfers by Accounts, date and exact amount. A reciprocal pair with different dates does not match. Both rows remain complete transfers, each with a generated opposite leg. At line 729, Account checks use these normalized transfers instead of raw source postings. Thus incorrect monthly balances can pass verification. Small source: USD Cash Accounts `a` and `b`, zero openings, no Assignments. JSON `out` on 2026-01-31: Account a, target b, amount -1000 milliunits. JSON `in` on 2026-02-01: Account b, target a, amount +1000 milliunits. Use distinct IDs. CSV equivalent: reciprocal Transfer Categories, Outflow 1.00 on January 31 and Inflow 1.00 on February 1. Expected source balances: January a=-100,b=0; February a=-100,b=100. Ready to Assign, Category Activity and Available are all 0. The current format cannot preserve both Account dates; reject before retaining a preview. Actual imports already reject transfers that cross months. Code trace: January a=-100,b=100; February a=-200,b=200. Ready to Assign, Category Activity and Available remain 0. Both rows generate both legs, and the normalized Account checks agree with the doubled totals. Final balances are wrong even without source Account balances or monthly snapshots. Fix scope: keep raw source postings for verification. Resolve reciprocal source legs and reject pairs whose dates cannot be represented without changing monthly balances. Keep existing same-day FIFO behavior. Regression idea: exercise CSV and JSON pairs across months, including dates in reverse input order. Require an error and no retained preview or Budget. Keep same-day repeated-pair tests. Also check different dates in one month. Search before filing: `"cross-month transfer"` returned only #462; `"YNAB"` returned no focused transfer-date issue. This issue has one shared adapter fix.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#949
No description provided.