Skip to content

clone() + parameter.update() breaks ParameterNodeAtInstant iteration #442

Description

@MaxGhenis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions