Closing periods translate at the year's last Regular period's rates;...
Open-source Excel-native EPM and consolidation for SAP & Dynamics
Brought to you by:
konsolid-at
Originally created by: grynn-in
Follow-up to [#200] (konsolidat#199), from the first full build on the stack after it merged.
gold_consolidated_trial_balance's governed-rate guard refused the close rows — "AED->USD FY2013 P13 missing", 205 currency-years — because no Group Exchange Rate exists for the Closing period. A Closing period has no market of its own.assert_ytd_p12_equals_annual on 10,643 rows — its "annual" summed the Closing period's close.rate_period_map() (macros/governed_rates.sql), maps (fiscal_year, fiscal_period) → the period whose rates apply, from epm_staging.fiscal_periods; the guard requires the rate at that key and gold_consolidated_trial_balance joins rates on it. A period the calendar does not know maps to itself, so a genuinely missing rate still stops the build. Declared rule, not a fallback.assert_ytd_at_last_regular_period_equals_annual (renamed, still warn): YTD at the year's last Regular period equals the sum of the year's non-Closing periods, both from the declared calendar (no hardcoded 12).EUR->USD FY2025 P13 missing (e5da529); with the map the model builds and the P13 rows carry P12's rates 1.1 / 1.05 (952d8b5). Must-flag: without FY2026 P12 rates the guard still refuses. Live clone of the stack's data: gold_consolidated_trial_balance builds, ERROR=0.WARN 1 on the old logic (f86f1d0) → PASS (724f900). Live clone: 0 rows (was 10,643).🤖 Generated with Claude Code
Originally posted by: grynn-in
Review round 1: no blocking findings; the hardening note taken —
rate_period_map()now carries an explicitmappedflag and both the guard and the model branch on it instead ofrate_period = 0(an Opening period is legitimately P0). D9's three gates re-run: fixture builds (ERROR=0), must-flag still refuses, live clone builds (ERROR=0).Ticket changed by: grynn-in