Make dual-write log failed v2 copies instead of returning HTTP 503
メンテナーはふだん 3 日以内に返信
関連するプルリクエストがすでにマージされています。
- #3959 @anth-volk による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 18
- フォーク
- 33
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 36
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信
-
Stop serving economy results cached with ×100 decile relative changes対応中かも @anth-volk が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
PolicyEngine/policyengine-api#4025 ·
メンテナーはふだん 3 日以内に返信
-
Store the metadata v3 reads in the v2 catalog, from PolicyEngine.py's public records対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
PolicyEngine/policyengine-api#4022 ·
メンテナーはふだん 3 日以内に返信
-
Request UK constituency and local-authority impacts separately from the national economy result対応中かも @anth-volk が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
PolicyEngine/policyengine-api#4021 ·
メンテナーはふだん 3 日以内に返信
PolicyEngine/policyengine-api の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
sergey-miryanov/gcmon#230 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Azure-Samples/azure-search-openai-demo#3249 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] Failed archive extraction deletes the dataset cache対応中かも @dajiaohuang が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
alibaba/GraphScope#4674 ·