Economy runs fail with 400 SPM_CONFIGURATION_UNAVAILABLE while the simulation worker lags an API deploy
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in policyengine_api/libs/simulation_entrypoint.py near line 408, where the canonical-spm-v1 capability is checked against /versions and SPMValidationError("SPM_CONFIGURATION_UNAVAILABLE") is raised, then read docs/canonical-spm.md for the intended deploy order. Done means that lookup failures return 503 with Retry-After, and reports created in the window are not left pending with no run. The deploy-ordering part needs maintainer input, so confirm the approach before changing code.
由索引模型根据 Issue 内容生成。
描述
What happened
On 2026-10-16, society-wide reports started from the app failed for a period after the API update 71dba65b ("Update PolicyEngine API", 06:55 UTC). Example: report 4526 (requested_at 13:42:09 UTC, reform policy 98772, US, 2026) recorded:
[SOCIETY_WIDE_CALC_FAILED] Society-wide calculation failed (400): {"status": "error", "message": "Cannot validate the selected worker's canonical SPM capability", "result": null, "errors": [{"code": "SPM_CONFIGURATION_UNAVAILABLE", ...}]}
Reports 4524 and 4525 (13:41 UTC) are still pending and never ran. Later, the same economy call for report 4526 succeeded, so the worker caught up and the reform itself was fine.
Cause (from the code)
policyengine_api/libs/simulation_entrypoint.py (~line 408) validates the selected worker's canonical-spm-v1 capability from /versions before cache access or submission, and raises SPMValidationError("SPM_CONFIGURATION_UNAVAILABLE", ...) on any lookup failure. docs/canonical-spm.md says this happens "until such a worker is deployed" (sim-API PR 703). So between the API deploy and a matching worker deploy, every new economy run is refused.
Requests
- Deploy order / readiness: deploy (or verify) the matching simulation worker before the API version that requires its capability goes live, or keep serving with the previous bundle until the worker reports a matching capability.
- Status code: return 503 (with
Retry-After) forSPM_CONFIGURATION_UNAVAILABLE, not 400. It is a server-side readiness condition; a 400 tells clients the request is invalid, so they do not retry, and the app told users to edit their reform. - Stuck reports: reports created during the window stay
pendingwith no active run (4524, 4525). Consider marking themerrorwith a retryable code, or re-queueing them once the worker matches.
The app now treats *_UNAVAILABLE 4xx errors as retryable server faults (PolicyEngine/policyengine-app-v2#1310), but the outage itself needs the API-side fix.
🤖 Generated with Claude Code
- 主要语言
- Python
- 星标
- 18
- 派生
- 33
- 平均合并
- 2 天 7 小时
- 30 天内合并 PR
- 28
环境准备
- 没有 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 ·
维护者通常 3 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
PolicyEngine/policyengine-api#3910 ·
维护者通常 3 天内回复
-
Drop the empty simulation-domain tables and retired association columns from the v2 schema可能已有人在做 @anth-volk 今天认领。 未关闭
难度 5/5 一周以上 新手友好度 20/100
PolicyEngine/policyengine-api#3961 ·
维护者通常 3 天内回复
-
Stop using the simulation-domain v2 tables and retired association columns before they are dropped可能已有人在做 @anth-volk 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 30/100
PolicyEngine/policyengine-api#3960 ·
维护者通常 3 天内回复
-
Make dual-write log failed v2 copies instead of returning HTTP 503可能已有人在做 @anth-volk 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
PolicyEngine/policyengine-api#3958 ·
维护者通常 3 天内回复
查看 PolicyEngine/policyengine-api 的全部 Issue
相似的 Issue
-
Use mhctools predictor_required=False for saved-result rescoring可能已有人在做 @iskandr 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
-
难度 1/5 1 小时以内 新手友好度 85/100
521xueweihan/HelloGitHub#4051 · 1 条评论 ·
-
bug documentation
难度 2/5 1-3 小时 新手友好度 78/100
awslabs/visual-asset-management-system#514 ·
维护者通常 1 天内回复
-
backend bug spec:REQ-053
难度 2/5 1-3 小时 新手友好度 66/100
nolte/kamerplanter#2547 ·
维护者通常 1 天内回复