Menu ▾ ▴

#202 CTA test ignores rows that carried no amount (konsolidat#195)

closed
nobody
None
2026-09-15
2026-09-15
Anonymous
No

Originally created by: grynn-in

Follow-up to [#196] (konsolidat#195), from the full build after [#201] merged.

What happened

assert_cta_not_zero_when_rates_differ failed on 12 entity-periods, all 2025 P11. Those entities' P11 balance files repeat P10's balances exactly (e.g. 56,559,572.06 declared in both), so after normalisation every P11 movement is 0. Nothing was translated, so a CTA of 0 is right — but the test counted the P&L rows as "translated at the average rate" because their translation_rate differs from the closing rate, whatever their amount.

The fix

having countIf(translation_rate != closing_rate and local_amount != 0) > 0: only rows that carried an amount count. Header updated.

Evidence

  • Test first: fixture assert_cta_not_zero_when_rates_differ.zero_movement.sql (a period of zero movements, P&L row at the average rate, CTA 0) → Got 1 result on main (3cb50c1) → PASS with the fix (8b73dda). The existing pass fixture still passes; the must-flag fixture still gives Got 2 results.
  • Live data, read-only: the fixed test returns 0 rows (main's version returns 12).

🤖 Generated with Claude Code

https://claude.ai/code/session_013WewQKFQgG7o2M3mUDPRR5

Related

Tickets: #196
Tickets: #201
Tickets: #203

Discussion

  • Anonymous

    Anonymous - 2026-09-15

    Originally posted by: grynn-in

    Review: one finding, taken — the guard is now group_amount != 0 (CTA is −sum(group_amount); 0% ownership zeroes group_amount while local_amount stays). Red fixture for the 0% case, then the fix; all three fixtures green (pass / zero-movement pass / must-flag Got 2); live rows flagged: 0.

     
  • Anonymous

    Anonymous - 2026-09-15

    Ticket changed by: grynn-in

    • status: open --> closed
     

Log in to post a comment.