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
-
Remove the v1 user routes and keep complete simulation and report results finalPeut-être pris @MaxGhenis l’a pris aujourd’hui. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
PolicyEngine/policyengine-api#4028 ·
Les mainteneurs répondent en général sous 3 jours
-
Store the metadata v3 reads in the v2 catalog, from PolicyEngine.py's public recordsPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
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
-
Publish v2 catalog regions from the Public API's own region reference filesPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
PolicyEngine/policyengine-api#4019 ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de PolicyEngine/policyengine-api
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
AstrBotDevs/AstrBot#10720 ·
Les mainteneurs répondent en général sous 1 jour
-
fix(xiaomi): curated picker list still offers six ids that return 400 (plan-limited vs retired)Ouvertecause/upstream comp/cli P2 provider/other tool/file type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
NousResearch/hermes-agent#143900 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 85/100
WLAN-Pi/wlanpi-profiler#341 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
Les mainteneurs répondent en général sous 1 jour