UK: structural reforms gated on `*.in_effect=True` silently no-op via `simulation_modifier` path
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 policyengine_uk/reforms/reforms.py 和 src/policyengine/tax_benefit_models/uk/model.py:187-202 开始;枚举 gov.contrib.*.in_effect gates,并追踪 create_structural_reforms_from_parameters 何时在 Microsimulation.init 中运行。将 UK 路径与 tests/test_us_microsim_structural_reforms.py::test__gov_contrib_gate_runs_cleanly 进行比较。当 UK 回归测试证明该 gate 通过预期的构造路径正常工作,并且在确认存在潜在 bug 时调整了实现,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Flagged during subagent review of #300.
The UK model applies reforms via simulation_modifier_from_parameter_values after Microsimulation construction (src/policyengine/tax_benefit_models/uk/model.py:190,198), using p.update() on parameters. This means any UK structural reform that is gated on a *.in_effect=True parameter — where the structural reform class only activates inside Microsimulation.__init__'s call to create_structural_reforms_from_parameters — would silently no-op.
US recently hit this class of bug (#300) when gov.contrib.ctc.*.in_effect=True reforms crashed because the structural reform's variables were registered on the per-sim system but populations were built from the module-level system. The UK variant is subtly different: the structural reform never gets applied at all because p.update() happens post-construction.
Evidence
policyengine_uk/reforms/reforms.pycontains at least onein_effectgate (confirmed via grep).- UK uses
simulation_modifieratsrc/policyengine/tax_benefit_models/uk/model.py:187-202, which runs afterMicrosimulation.__init__has already decided which structural reforms to apply (based on base-parameterin_effect=False).
What to check
- Enumerate UK
gov.contrib.*.in_effectparameters. If any exist and activate structural reforms, this is a real latent bug. - Write a regression test along the lines of
tests/test_us_microsim_structural_reforms.py::test__gov_contrib_gate_runs_cleanlyfor a UK gate. - If confirmed, the fix is to pass UK reforms at
Microsimulation(reform=...)construction time (same pattern US uses) instead of via post-constructionp.update().
Not blocking v4.0.1; file as a v4.0.2 / v4.1 candidate.
- 主要语言
- Python
- 星标
- 8
- 派生
- 9
- 平均合并
- 15 小时 28 分钟
- 30 天内合并 PR
- 13
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PolicyEngine/policyengine.py 的其他 Issue
-
Raise the simulation cache memory warning to 16 GiB可能已有人在做 @anth-volk 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
PolicyEngine/policyengine.py#549 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
PolicyEngine/policyengine.py#473 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
PolicyEngine/policyengine.py#436 · 1 条评论 ·
维护者通常 1 天内回复
-
Certify populace-uk as the UK certified default可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
PolicyEngine/policyengine.py#408 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
PolicyEngine/policyengine.py#551 ·
维护者通常 1 天内回复
查看 PolicyEngine/policyengine.py 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 91/100
-
难度 1/5 1-3 小时 新手友好度 92/100
-
enhancement P2
难度 2/5 1-3 小时 新手友好度 78/100
Toloka/tolokaforge#1776 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
TencentCloud/Octop#1622 ·
维护者通常 1 天内回复
-
arch area:fleet priority:p3 severity:low track:hosted-product
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复