Bug
TaxBenefitSystem.clone() followed by parameter.update() breaks ParameterNodeAtInstant.__iter__ for directory-based ParameterNodes. This causes silent calculation failures when the API applies reforms.
Reproduction
The bug manifests in the API's reform path (country.py):
system = self.tax_benefit_system.clone()
for parameter_name in reform:
parameter = get_parameter(system.parameters, parameter_name)
parameter.update(start=..., stop=..., value=...)
# Later, a formula iterates a ParameterNode:
cats = p.loss_eligible_categories # directory-based ParameterNode
for cat in cats: # fails after clone() + update()
total += max_(add(person, period, cats[cat]), 0)
Cannot reproduce locally with Reform.from_dict() or even with manual clone() + update() — the failure is specific to the deployed API environment. The exact mechanism is unclear.
Impact
Expected behavior
ParameterNodeAtInstant.__iter__ should work correctly after clone() + parameter.update(), the same as it does with Reform.from_dict().
Context
- API version: 1.592.4
- Only directory-based ParameterNodes are affected (not
unit: list parameter files)
Reform.from_dict() works fine — only the clone path breaks
Bug
TaxBenefitSystem.clone()followed byparameter.update()breaksParameterNodeAtInstant.__iter__for directory-based ParameterNodes. This causes silent calculation failures when the API applies reforms.Reproduction
The bug manifests in the API's reform path (
country.py):Cannot reproduce locally with
Reform.from_dict()or even with manualclone()+update()— the failure is specific to the deployed API environment. The exact mechanism is unclear.Impact
Expected behavior
ParameterNodeAtInstant.__iter__should work correctly afterclone()+parameter.update(), the same as it does withReform.from_dict().Context
unit: listparameter files)Reform.from_dict()works fine — only the clone path breaks