PATCH /us/report returns 500 when the app saves a finished report's output (report 4501)
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 22/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 18
- Fork
- 33
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine-api
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
PolicyEngine/policyengine-api#3911 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
PolicyEngine/policyengine-api#3910 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
PolicyEngine/policyengine-api#3945 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Register weighted-microdata rules: weights aren't valuesCó thể đã có người làm @anth-volk đã nhận 2 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
PolicyEngine/policyengine-api#3937 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Remove the unused economy comparison moduleCó thể đã có người làm @anth-volk đã nhận 2 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 18/100
PolicyEngine/policyengine-api#3935 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của PolicyEngine/policyengine-api
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
noontide-co/mainbranch#1211 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[1.x Bug] run-operation --sql reports success but rolls back writes on transaction-capable adaptersĐang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
dbt-labs/dbt#16784 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug settings ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DewaldOosthuizen/py-tray-command-launcher#162 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
run_all sleeps after the final job despite documenting delays between jobsCó thể đã có người làm @Gambit-Checkmate đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100