PATCH /us/report returns 500 when the app saves a finished report's output (report 4501)
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in policyengine_api/routes/report_output_routes.py at the PATCH /<country_id>/report handler, and follow the call to update_report_output, which may reject completion while active_run_id is set. The exception is in the final except Exception branch, so the root cause needs the production log entry for report 4501 near 18:16 UTC; without log access, start from the run-lifecycle logic. Done means that handler no longer returns 500 for this case and returns a 4xx with a clear code when the update is rejected on purpose.
由索引模型根据 Issue 内容生成。
描述
What happened
On 2026-10-16 around 18:16 UTC, the app finished the society-wide calculation for report 4501 (reform policy 98753 over 2, US, 2026; requested_at 18:12:38 UTC, active_run_id e30158cb-0aad-4dd1-bde0-e80a50485ed9). The economy endpoint returned the result, and the page showed it. The app then saved the result to the report record with PATCH /us/report, and the API answered 500 twice (the app retries once):
[ResultPersister] Persistence failed, retrying once... Error: Failed to update report 4501: 500
at updateReport (app/src/api/report.ts)
at ResultPersister.persistToReport (app/src/libs/calculations/ResultPersister.ts)
The request body is the app's standard completed-report payload (ReportAdapter.toCompletedReportPayload):
{ "id": 4501, "status": "complete", "output": { ...economy output... } }
Effect
GET /us/report/4501 still returns status: pending, finished_at: null, no output. Clients show the report as in progress, and every visit asks the economy endpoint again (cached, so fast, but the record never completes).
Where to look
policyengine_api/routes/report_output_routes.py (PATCH /<country_id>/report): the 500 is the final except Exception branch, which logs "Unexpected error updating report #4501 for country us" with the stack trace. A guess, not verified: the record has an active_run_id (run-based report lifecycle) and update_report_output may not handle a client-side completion for a report whose run is still marked active. The same day had the SPM_CONFIGURATION_UNAVAILABLE outage (#3945), which may have left runs in an inconsistent state.
Requests
- Find the exception in the logs for report 4501 at about 18:16 UTC and fix it.
- If the update is rejected on purpose (for example, a run owns the record), return a 4xx with a clear code, not a 500, so clients can stop retrying and show the right state.
🤖 Generated with Claude Code
- 主要语言
- Python
- 星标
- 18
- 派生
- 33
- 平均合并
- 1 天 20 小时
- 30 天内合并 PR
- 27
环境准备
- 没有 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 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
PolicyEngine/policyengine-api#3910 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 22/100
PolicyEngine/policyengine-api#3945 ·
维护者通常 2 天内回复
-
Register weighted-microdata rules: weights aren't values可能已有人在做 @anth-volk 于 4 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 18/100
PolicyEngine/policyengine-api#3937 ·
维护者通常 2 天内回复
-
Remove the unused economy comparison module可能已有人在做 @anth-volk 于 4 天前认领。 未关闭
难度 3/5 半天 新手友好度 18/100
PolicyEngine/policyengine-api#3935 ·
维护者通常 2 天内回复
查看 PolicyEngine/policyengine-api 的全部 Issue
相似的 Issue
-
documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
drevendev/HungryCrab#273 ·
维护者通常 1 天内回复
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 76/100
drevendev/BeautifulRepo#19 ·
维护者通常 2 天内回复
-
Moonshot: Kimi K3 always sends `reasoning_effort="max"`, though the API now accepts `low` and `high`未关闭accepted
难度 2/5 1-3 小时 新手友好度 78/100
UKGovernmentBEIS/inspect_ai#5939 ·
维护者通常 1 天内回复
-
bug linux
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
area:data data-quality
难度 2/5 1-3 小时 新手友好度 68/100
reacher-z/Awesome-CUA#1468 ·
维护者通常 1 天内回复