Economy routes return 500 for Israel when a policy ID of 0 means current law
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in policyengine_api/utils/get_current_law.py, where the lookup covers only uk, us, ca and ng, then check how policyengine_api/routes/economy_routes.py calls it for the single-year and budget-window routes. The COUNTRIES list in policyengine_api/constants.py includes il, so that is the case to reproduce. Done means Israel with policy ID 0 either resolves to a stored current-law ID or returns a clear 4xx, with no 500. Confirm first whether Israel has a stored current-law policy, since that choice decides the fix.
由索引模型根据 Issue 内容生成。
描述
The single-year and budget-window economy routes (/<country_id>/economy/<policy_id>/over/<baseline_policy_id> and its budget-window variant in policyengine_api/routes/economy_routes.py) treat a policy ID of 0 as "current law" and resolve it with get_current_law_policy_id(country_id).
get_current_law_policy_id (policyengine_api/utils/get_current_law.py) only knows uk, us, ca and ng, but COUNTRIES in policyengine_api/constants.py also includes il, so validate_country lets Israel through. For country_id="il" with either ID set to 0, the dictionary lookup raises KeyError, which the generic error handler turns into a 500.
Expected
Either Israel resolves to its current-law policy ID, or the route returns a clear 4xx saying current law is not available for Israel.
Notes
- Found while documenting the code for the ruff docstring rules; behaviour was left unchanged there.
- Worth checking whether Israel has a stored current-law policy at all before choosing between the two fixes.
- 主要语言
- Python
- 星标
- 18
- 派生
- 33
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 18
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PolicyEngine/policyengine-api 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
PolicyEngine/policyengine-api#3911 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
PolicyEngine/policyengine-api#3910 ·
维护者通常 1 天内回复
-
Enable ruff security, logging and debugging rules (S, T20, LOG, G, DTZ, ERA, TD, FIX, EXE)可能已有人在做 @anth-volk 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 18/100
PolicyEngine/policyengine-api#3914 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
PolicyEngine/policyengine-api#3912 ·
维护者通常 1 天内回复
-
validate_country prints "Validating country" on every request可能已有人在做 @anth-volk 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 25/100
PolicyEngine/policyengine-api#3909 ·
维护者通常 1 天内回复
查看 PolicyEngine/policyengine-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
onyx-dot-app/onyx#16016 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
black --check exits 0 and prints All done when a multi file run is interrupted可能已有人在做 @jiteshgulati 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
Non-positive worker counts wait for results without starting workers可能已有人在做 @IlyaKhalafi 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复