Make dual-write log failed v2 copies instead of returning HTTP 503
Maintainer thường phản hồi trong vòng 3 ngày
Một pull request liên quan đã được merge.
- #3959 của @anth-volk — đã merge
Đá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
- 35/100
Hướng nghiên cứu
Start with mirror_policy_after_commit and the policy, saved-policy, and household mirroring services; trace how failures reach the API routes after the v1 commit. Check the Stage 10 and Stage 11 migration docs for their failure sections. Done means post-commit copy failures are logged and return the normal v1 response, invalid selectors still return HTTP 503, and the migration docs describe the behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
With DB_WRITE_POLICY or DB_WRITE_HOUSEHOLD set to dual_write, the Public API copies each committed v1 policy, saved policy and household into Supabase in the same request. If that copy fails, the route returns HTTP 503, even though the v1 write has already committed:
mirror_policy_after_commitraises on any failure, including a Supabase outage, a policy the v2 catalog cannot translate (PolicyCatalogValidationError,LegacyPolicyTranslationError) and a missing catalog version (MetadataCatalogVersionNotFoundError). A retry repeats a translation failure, so that reform can never be saved.- A failed household copy also returns 503, and a retried POST creates a second v1 household row.
Policy writes happen on every reform save and every report run, so turning dual-write on in production would let any copy failure block users.
Proposed change
Make dual-write fail open: when the copy fails after the v1 commit, log the failure and return the normal v1 response.
- Keep the mirroring services' existing behavior: log the failure with its metric (
v1_policy_mirror_operations,v1_user_policy_mirror_operations,v1_household_mirror_operations) andfailure_category, and leave saved-policy and household events pending. - Log the cases the services never see (no snapshot, revision or event to copy, or an unexpected error outside the service) with the same metrics.
- Keep HTTP 503 for invalid database selectors, which are rejected before anything is written.
- Update the failure sections of the Stage 10 and Stage 11 migration docs.
This is needed before dual-write is turned on in production.
- Ngôn ngữ chính
- Python
- Star
- 18
- Fork
- 33
- Merge trung bình
- 2 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 36
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 3 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 3 ngày
-
Stop serving economy results cached with ×100 decile relative changesCó thể đã có người làm @anth-volk đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
PolicyEngine/policyengine-api#4025 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Store the metadata v3 reads in the v2 catalog, from PolicyEngine.py's public recordsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PolicyEngine/policyengine-api#4022 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Request UK constituency and local-authority impacts separately from the national economy resultCó thể đã có người làm @anth-volk đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
PolicyEngine/policyengine-api#4021 ·
Maintainer thường phản hồi trong vòng 3 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 76/100
aws-samples/sample-per-model-bedrock#464 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
lesson-submission pending-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Ikalus1988/MisakaNet#3789 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python Volcengine provider returns failures instead of raising themCó thể đã có người làm @Ricardo-M-L đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
agent-infra/sandbox#248 ·
-
[Bug] cloud JSON directory loading assumes a Key field in fsspec listingsCó thể đã có người làm @Ricardo-M-L đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
hiyouga/LlamaFactory#10910 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bundled uv is never updated and trusts the compromised eMudhra certificatesCó thể đã có người làm @FabienDanieau đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100