Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

UK: structural reforms gated on `*.in_effect=True` silently no-op via `simulation_modifier` path

未关闭
#302 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
python
领域
backend

调研方向

从 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.py contains at least one in_effect gate (confirmed via grep).
  • UK uses simulation_modifier at src/policyengine/tax_benefit_models/uk/model.py:187-202, which runs after Microsimulation.__init__ has already decided which structural reforms to apply (based on base-parameter in_effect=False).

What to check

  1. Enumerate UK gov.contrib.*.in_effect parameters. If any exist and activate structural reforms, this is a real latent bug.
  2. Write a regression test along the lines of tests/test_us_microsim_structural_reforms.py::test__gov_contrib_gate_runs_cleanly for a UK gate.
  3. If confirmed, the fix is to pass UK reforms at Microsimulation(reform=...) construction time (same pattern US uses) instead of via post-construction p.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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PolicyEngine/policyengine.py 的其他 Issue

查看 PolicyEngine/policyengine.py 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。