Originally created by: grynn-in
The dbt half of F2. konsol half: grynn-in/konsol#116.
gold_entity_ownership — the one resolved answerHow much of an entity a group owns in a period, and how it is consolidated. It
reads epm_staging.consolidation_ancestry — the link closure konsol writes from
the tree — and multiplies each link's dated percentage.
That is what makes consolidation multi-level. Every consolidated model
joined an entity to its immediate parent group only:
| before | after | |
|---|---|---|
| GROUP_CORP | JPMF, USMF | JPMF, USMF, DEMF, GBMF |
| GROUP_EMEA | DEMF, GBMF | DEMF, GBMF |
A sub-group's entities never reached its parent's consolidated result at any
percentage. They do now, at the chain product, and gold_fully_consolidated_tb
still sums to zero per group.
The fallback chain is gone with it. if(x != 0, ...) across ownership_periods,
gold_consolidation_hierarchy and the consolidation_groups seed read a
deliberate 0% as "unset" and substituted another source's figure. A chain with a
link that has no period covering the date now yields 0 with
has_complete_chain = 0 rather than a plausible-looking number, and
assert_ownership_chain_complete fails the build naming the entity.
consolidation_method is the weakest link on the chain
(full < proportional < equity < none): an entity below an equity-held sub-group
is excluded from that group's line consolidation while still consolidating into
the sub-group itself.
Seeds materialise into epm_gold (dbt_project.yml), so
seeds/consolidation_groups.csv and ConsolidationGroup.CH_TABLE were the same
ClickHouse table — two writers, last one wins. dbt ls --select
+tag:domain:consolidation --resource-type seed listed it, so publishing a
Consolidation Group triggered the governed build that re-seeded the table and
reverted the publish.
Proven on the live stack: one dbt seed --select consolidation_groups turned
AMDE from 100% back to 75%, deleted GROUP_EMEA entirely, and rebuilding the
consolidated TB then showed DEMF and GBMF under two groups at once. The seed
is deleted; epm_gold.consolidation_groups is a declared source created by
konsol's ensure_reference_tables().
gold_consolidation_hierarchy also loses effective_ownership_pct: it held the
direct percentage and had no date grain, so it could never expire.
gold_consolidated_trial_balance, gold_nci_movement_schedule,
gold_ic_eliminations, gold_equity_method_associates — all read
gold_entity_ownership, all keyed on the period, because ownership is dated.
The unused resolve_period_ownership macro (which implemented the deleted
fallback) and the unreferenced test_consolidation_hierarchy seed are removed.
assert_ownership_fallback asserted the behaviour this PR deletes. Replaced by:
assert_effective_ownership_is_chain_product — recomputes the product asexp(sum(log(...))) straight from the ancestry and the periods. A genuinelyassert_ownership_chain_complete — no entity reaches a consolidated resultassert_effective_ownership_in_range (wasassert_hierarchy_effective_ownership) — plus the invariant that makes theFive further tests moved off the deleted seed, keeping their original strictness
(assert_equity_rate_coverage still returns its baseline 7).
dbt build --full-refresh ends with the same three errors that predate this
branch (gold_spread_budget's orphaned branch,
assert_silver_gl_debit_credit_balance, assert_equity_rate_coverage). Those
three are also what skips the consolidation chain in a governed build, so the
chain was run directly: 9/9 on the ownership and consolidation assertions.
One note for the reviewer: assert_cta_zero_for_same_currency fails when run
against a freshly built chain, because CTA is -sum(group_amount) and AMHQ's
local GL is out of balance by 17.4m — baseline failure [#3], not this change. It
is skipped behind that failure in any governed build.
Ticket changed by: grynn-in