You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Under no_economic_assumptions, Simulation.dataset can hold the uprated dataset while calculations use the frozen one #2417
Under no_economic_assumptions, Simulation.dataset can hold the projected (uprated) dataset, while the simulation calculates from the frozen copy.
build_from_multi_year_dataset copies the dataset, applies reset_growthfactor_uprating to the copy, loads its inputs, and sets self.dataset to that frozen copy (L900-L902, L926).
Its callers then overwrite self.dataset with the original, un-reset object:
Reproduction on main (MOCK data: one synthetic household)
URL-cache path. The URL cache key is the source URL alone, so a default run's projected dataset is reused by a later no_economic_assumptions run. The cache is seeded with extend_single_year_dataset(single, system.parameters) under a fake hf:// key, with no download. Then Simulation(dataset=url, scenario=no_economic_assumptions) gives:
The years are 2025, 2026 and 2028. The values come from a tree whose simulation.py build paths match main b89a771.
Without the cache, no_economic_assumptions on a single-year dataset shows no gap today: the scenario applies before load, so the projection is already frozen.
With #2407. Once #2407 keeps the scenario's timing, no_economic_assumptions plus an after-load growth change ({"gov.economic_assumptions.yoy_growth.obr.average_earnings": {"year:2027-01-01:1": 0.2}}) also diverges. In the #2407 review's reproduction, sim.dataset employment income was 30,000 / 30,000 / 36,000 / 36,000 for 2025-28, while employment_income_before_lsr stayed 30,000.
Fix
Drop the five overwrites, since build_from_multi_year_dataset already sets self.dataset.
_restore_cgt_extension_provenance reads the private annotation from the dataset object it is passed, which is the original, not self.dataset. Dropping the overwrites therefore loses no provenance, but keep that call on the original.
Add MOCK tests for each build path (single-year object, file, hf:// cache, gs:// cache, generic Dataset): under no_economic_assumptions, sim.dataset[y] equals the calculated inputs for every uprated variable and year.
Add a property test asserting the same for random growth changes.
Related: #2406 and #2407 (scenario timing), #2405 (keying the URL cache on the uprating inputs, which would also remove the cache-reuse route above).
Found by #2407's review (round 2), routed by its session. The UK hub reproduced the URL-cache route on main-equivalent code.
Activity