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

Economy runs fail with 400 SPM_CONFIGURATION_UNAVAILABLE while the simulation worker lags an API deploy

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

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

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

  1. 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.
  2. Status code: return 503 (with Retry-After) for SPM_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.
  3. Stuck reports: reports created during the window stay pending with no active run (4524, 4525). Consider marking them error with 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

环境准备

从这里开始

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

PolicyEngine/policyengine-api 的其他 Issue

查看 PolicyEngine/policyengine-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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