Menu ▾ ▴

#148 IC elimination is dormant, and the engine over-eliminates when woken (F10)

closed
nobody
None
2026-09-13
2026-09-11
Anonymous
No

Originally created by: grynn-in

Two findings from [#146], kept together because they compound.

1. IC elimination is dormant, and the rules that would wake it are wrong

gold_ic_eliminations produces 0 rows on the demo stack. The three shipped
IC Elimination Rules reference accounts that do not exist in the demo ledger:

rule accounts in the ledger?
IC_001 1300 / 2100 1300 no
IC_002 4000 / 5000 neither
IC_003 8100 / 3200 neither

The deleted seeds/ic_elimination_rules.csv carried two more, and they were the
only ones whose accounts exist — but they had never fired, because the dbt model
read the seed only when the staging table happened to be empty:

rule accounts what they are
IC_004 4030 / 5030 Intercompany Revenue / Expense — correct
IC_005 1100 / 2010 plain Accounts Receivable / Accounts Payable — wrong

IC_005 was briefly shipped as a fixture in [#146] and reverted before merge.
Measured while it was live, it eliminated 31.5M against a total accounts-payable
balance of 14.5M
— more than twice the entire balance, on third-party accounts.
It must not be reinstated as written.

2. The elimination engine over-eliminates regardless

gold_ic_eliminations has no intercompany-counterparty filter. ic_balances
sums the whole group_amount per (group, account, entity) from the
consolidated TB, then joins every ordered debit-entity × credit-entity pair and
emits least(abs(debit_balance), abs(credit_balance)) for each. For N entities
in a group that is N×(N−1) rows, each consuming full balances, and
gold_fully_consolidated_tb adds all of them.

Measured with IC_004 (the correct rule) live: it eliminated 2,614,288
against an intercompany revenue balance of 2,561,389 — slightly more than
the entire balance it is meant to cancel. Small here because the demo has three
entities; it grows with the square of the group.

Suggested fix

Both belong with F10 ("verify IC elimination fires at the lowest common
ancestor — never audited"), which is the open architecture-review item for this
area.

  1. Give the elimination a counterparty. Either the source data carries an IC
    counterparty dimension, or the elimination is capped at
    min(sum(debit side), sum(credit side)) once per (group, rule, period)
    rather than per entity pair.
  2. Add an assertion that total elimination per account never exceeds that
    account's consolidated balance — the invariant that would have caught both
    of these.
  3. Then decide which rules the demo should ship. IC_004 is on the right
    accounts; IC_001-003 reference accounts the demo does not have; IC_005
    should be dropped or repointed at genuinely intercompany accounts.

Verified on konsolidat.local, 11 September 2026.

Related

Tickets: #146
Tickets: #175

Discussion

  • Anonymous

    Anonymous - 2026-09-13

    Originally posted by: grynn-in

    Decided by the user on 13 Sep 2026 (recorded in HANDOFF with the group-2 work). The elimination gets a counterparty from a partner-entity column on every ledger and trial-balance row (grynn-in/konsol#159). Rows on intercompany accounts are paired (entity, partner) with (partner, entity); the matched amount is eliminated and the difference is booked to an intercompany-difference account per consolidation group; rows without a partner are never eliminated and are listed as unmatched. An assertion that elimination never exceeds an account's consolidated balance is added.

     
  • Anonymous

    Anonymous - 2026-09-13

    Originally posted by: grynn-in

    Decided by the user on 13 Sep 2026 (decisions 12–14). (12) Intercompany pairs are matched, and differences measured, on the full 100% translated amount, never the ownership-weighted group amount; each side is eliminated at the share the group view holds and the minority owners' portion goes to the NCI line, so ownership never shows as a difference. (13) One intercompany-difference account per group; each difference is labelled by cause (booking vs FX) and only booking mismatches count against the tolerance. (14) Balance-sheet intercompany accounts (receivables, payables, loans) are compared on the period-end balance; profit-and-loss accounts on the period movement.

     
  • Anonymous

    Anonymous - 2026-09-13

    Ticket changed by: grynn-in

    • status: open --> closed
     

Log in to post a comment.