Record why a v1 household failed to copy to v2

Aperta
#4,221 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start with _log_copy_operation in policyengine_api/services/household_mirroring.py and compare the household copy records with the policy copy records that use LegacyPolicyTranslationReason. Trace how translation failures and v2 household document rule failures are categorized, keeping personal data out of logged reasons. Done means failed records use the requested message and include the exception type and a fixed reason code for translation failures.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The record logged when a v1 household fails to copy to v2 does not say why the copy failed, so the cause of the failures in #4194 can't be read from the logs.

What happens

_log_copy_operation in policyengine_api/services/household_mirroring.py writes one v1_household_mirror_operations record per copy:

  • The message is V1 household immediate copy completed for every outcome, including outcome error at severity ERROR.
  • A failure records only its broad failure_category (translation, integrity, database, configuration or unexpected). A translation failure records nothing about which part of the v1 household could not be translated. The exception's message can't be logged as it is: several messages hold the household's names, such as legacy person '<name>' belongs to multiple benunits records.

#4194 is an error group of these records on POST /<country_id>/household (3 of 6 production requests on 2026-11-05). Each record says only that a copy failed in some category.

Expected

  • A failed copy's record says V1 household immediate copy failed.
  • It records the exception's type (error_type) and, for a translation failure, a fixed reason code without personal data (failure_reason), as the policy copy records already do (LegacyPolicyTranslationReason). A translation whose result breaks a v2 household document rule, such as a person who belongs to no record of one entity collection, records that rule's reason.
Lingua principale
Python
Stelle
18
Fork
33
Merge medio
2g 15h
PR unite (30g)
110

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PolicyEngine/policyengine-api

Tutte le issue di PolicyEngine/policyengine-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.