This is a pretty complex edge case I didn't consider when writing the defined_for logic. The way that defined_for works is by intercepting the entity(variable, period) calls inside a subsetted variable's formula and pre-subsetting them, so normal operations on them return the subsetted population results. But no interception happens when a formula creates a new simulation and uses outputs from simulation.calculate.
This is a pretty complex edge case I didn't consider when writing the
defined_for
logic. The way thatdefined_for
works is by intercepting theentity(variable, period)
calls inside a subsetted variable's formula and pre-subsetting them, so normal operations on them return the subsetted population results. But no interception happens when a formula creates a new simulation and uses outputs fromsimulation.calculate
.