Menu ▾ ▴

#211 Declared configuration instead of literals: materiality macro, NCI account from the group, variance by scenario type, D365 off by default (#209, #208, #206, #207)

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

Originally created by: grynn-in

Declared configuration instead of literals. Closes konsolidat#209 (step 1), [#208], [#206] and [#207].

Pairs with konsol PR [#217] (konsol#214). Deploy this first, then [#217]. [#217]'s variance readers filter on the new budget_scenario_id column.

What changes

  • #209 step 1: one materiality_floor() macro replaces 45 copies of 0.005 across 12 models and tests. The build result is identical (live clone PASS=204/WARN=1/ERROR=0 before and after). A python test keeps the literal out of the project.
  • #208: the intercompany NCI line posts to the group root's declared nci_account, the same account the acquisition journal uses. A group that hasn't declared one still posts to the NCI placeholder, and the new warn test assert_ic_nci_account_declared names it. The unused var('ic_nci_account') is gone.
  • #206: gold_variance_analysis, gold_variance_quarterly and gold_variance_ytd pick actuals and budgets by the scenario's declared scenario_type (active only), not by the codes 'ACTUAL'/'BUDGET'. Budgets authored in konsol now reach variance. Each budget scenario keeps its own rows, with a new last column budget_scenario_id. gold_variance_at_hierarchy_node groups by it too, so actuals are no longer counted once per budget scenario. The hierarchy node models alias hierarchy_dimension (it was output as lc.hierarchy_dimension).
  • Behaviour change: budget_amount / ytd_budget are NULL, not 0, where a budget scenario has no line for that grain. A missing budget is not treated as a budget of zero.
  • #207: D365 can be switched off.
  • The canonical staging loop compiles to empty relations of the same shape when erp_sources is empty.
  • The 11 bronze models that referenced D365 staging directly are guarded.
  • The 16 D365 staging models get the same enable switch the ERPNext models have.
  • erp_sources now defaults to [], matching the user's decision that the trial-balance upload is the canonical source. List d365_fo or erpnext to build a connector.

Verified

  • Every row went red, then green, through the scratch-schema gate.
  • The live-clone build is unchanged at every step until the default flips. With D365 off, the end-to-end balance sheet test still passes.
  • dbt parse with erp_sources: [] finds 0 compilation errors.
  • Python tests pin the literal and the guards.

Review round 1 fixes

  • Actuals pair only with budget scenarios that budget that entity and year (analysis, quarterly, ytd). An entity-year with no budget appears once, under ''.
  • The variance tests now catch a repeat of the double count: one actual row per budget scenario, and the node budget is compared NULL-safely.
  • assert_scenario_rows_declared (error) names rows under an undeclared or inactive scenario. On the live data it passes: only ACTUAL from the GL, which is declared and active.
  • GL rows are stamped with the site's declared actual scenario, falling back to 'ACTUAL' when none or several are declared.

🤖 Generated with Claude Code

https://claude.ai/code/session_013WewQKFQgG7o2M3mUDPRR5

Related

Tickets: #206
Tickets: #207
Tickets: #208
Tickets: #209
Tickets: #217

Discussion

  • Anonymous

    Anonymous - 2026-09-15

    Originally posted by: grynn-in

    Review round 1. Point 1 (konsol's hierarchy variance sums across budget scenarios) is already fixed in konsol PR [#217], which merges right after this one. Points 2–4 are accepted as rows:

    • D8a–c: actuals pair only with budget scenarios that budget that entity and year (one row per model).
    • D9: the variance tests would catch a repeat of the double count.
    • D7a: an error test for rows under an undeclared or inactive scenario.
    • D7b: the GL branch is stamped with the site's declared actual scenario instead of 'ACTUAL'.
     

    Related

    Tickets: #217

  • Anonymous

    Anonymous - 2026-09-15

    Originally posted by: grynn-in

    Round 1 fixed:

    • D8a–c: actuals pair with the same entity-year's budgets.
    • D9: stronger variance tests.
    • D7a: assert_scenario_rows_declared.
    • D7b/D7bb: the GL branch uses the declared actual scenario.

    Live-clone build PASS=189 WARN=1 ERROR=0.

     
  • Anonymous

    Anonymous - 2026-09-15

    Originally posted by: grynn-in

    CI: the fresh TB-only site fixture has no scenario_definitions rows, so D7a's new test fails there. A real site gets ACTUAL/BUDGET/FORECAST from konsol's Scenario fixtures. Row D7c makes the CI fixture declare them; the test is not loosened.

    Review round 2: points 2–4 hold. Test gaps accepted as rows:

    • D7d: assert_scenario_rows_declared names several active actual scenarios; its header is clarified about forecasts.
    • D9b: the uncovered '' variance rows are checked.
     
  • Anonymous

    Anonymous - 2026-09-15

    Originally posted by: grynn-in

    Round 2 fixed: D7c (CI fixture declares its scenarios; fresh-site job green), D7d (several active actual scenarios named), D9b (uncovered '' variance rows checked).

     
  • Anonymous

    Anonymous - 2026-09-15

    Ticket changed by: grynn-in

    • status: open --> closed
     

Log in to post a comment.