Make dual-write log failed v2 copies instead of returning HTTP 503
Maintainer antworten meist innerhalb von 3 Tagen
Ein zugehöriger Pull Request wurde bereits gemerged.
- #3959 von @anth-volk — gemerged
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 18
- Forks
- 33
- Ø Merge
- 2 T. 6 Std.
- Gemergte PRs (30 T.)
- 32
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PolicyEngine/policyengine-api
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
PolicyEngine/policyengine-api#3911 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
PolicyEngine/policyengine-api#3910 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Report each day's production telemetry error groups as GitHub issuesEvtl. vergeben @anth-volk hat das vor 1 Tag übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
PolicyEngine/policyengine-api#3989 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Include each variable's quantity type (stock or flow) in the country metadataEvtl. vergeben @anth-volk hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 30/100
PolicyEngine/policyengine-api#3986 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Enforce SQLAlchemy-only database connections and Alembic-only schema changesEvtl. vergeben @anth-volk hat das vor 1 Tag übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
PolicyEngine/policyengine-api#3978 ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in PolicyEngine/policyengine-api
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
-
[Bug]: Queen's own Ollama model loses num_ctx when a running session switches to itEvtl. vergeben @anasamin26 hat das heute übernommen. Offenbug enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
aden-hive/hive#7508 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
llm translation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
BerriAI/litellm#47884 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug 🐛
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
netalertx/NetAlertX#1856 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag