Make dual-write log failed v2 copies instead of returning HTTP 503
Les mainteneurs répondent en général sous 3 jours
Une pull request liée a déjà été fusionnée.
- #3959 par @anth-volk — fusionnée
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 18
- Forks
- 33
- Merge moyen
- 2 j 18 h
- PR mergées (30 j)
- 36
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PolicyEngine/policyengine-api
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
PolicyEngine/policyengine-api#3911 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
PolicyEngine/policyengine-api#3910 ·
Les mainteneurs répondent en général sous 3 jours
-
Stop serving economy results cached with ×100 decile relative changesPeut-être pris @anth-volk l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
PolicyEngine/policyengine-api#4025 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
PolicyEngine/policyengine-api#4022 ·
Les mainteneurs répondent en général sous 3 jours
-
Request UK constituency and local-authority impacts separately from the national economy resultPeut-être pris @anth-volk l’a pris aujourd’hui. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
PolicyEngine/policyengine-api#4021 ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de PolicyEngine/policyengine-api
Issues similaires
-
good first issue priority: low size: XS testing
Difficulté 1/5 1-3 heures Accessibilité débutants 86/100
cubrid-lab/cubrid-mcp-server#385 ·
Les mainteneurs répondent en général sous 1 jour
-
good first issue priority: low size: S testing
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
cubrid-lab/cubrid-cookbook-python#447 ·
Les mainteneurs répondent en général sous 1 jour
-
Python PointcloudOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
ArduCAM/Arducam_tof_camera#125 ·
-
area:curator enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
CassioDalla/Scrinalia#150 ·
Les mainteneurs répondent en général sous 1 jour
-
Tutorial notebook: Find the leakOuvertedocumentation good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100