v1 household copies to v2 fail when the household leaves out group collections

Ouverte
#4,164 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

  • #4165 par @anth-volk — fermée sans fusion

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
backend

Piste de recherche

Start with translate_legacy_household and its normalization step, which rejects people records that do not list every country-supported collection, and with _failure_category, which reports those rejections as translation. Compare them with policyengine-core's SimulationBuilder.build_from_entities, specifically add_default_group_entity and the last step of add_group_entity, to see which default groups it creates. Done when the two affected US households translate with those groups added, the UK and extra-key households still fail as unsupported, and the two events can be copied with process-v1-household-mirror-event.yml.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Problem

From 2026-10-29 to 2026-11-02, four production v1 household creates in the Public API (three US, one UK) logged V1 household immediate copy completed with outcome error and failure_category translation. Their household_mirror_events records stay pending, so those households have no v2 copy.

Cause

translate_legacy_household requires every person to be listed in a group of every collection the country supports. policyengine-core, which the Public API's v1 calculations use, does not. When it builds a simulation from a v1 household (SimulationBuilder.build_from_entities):

  • a group collection that is omitted, or null, gets one group that holds every person (add_default_group_entity);
  • a person that a present collection's groups leave out gets a group of their own (the last step of add_group_entity).

Two of the US households list people and households, and leave out some or all of families, tax_units, spm_units and marital_units. v1 calculates them, but the translation's normalization rejects them with people record memberships must identify every country-supported entity collection, which _failure_category reports as translation.

The other two households are not valid v1 households, and v1 cannot calculate them either:

  • one US household has an extra top-level key that is not an entity collection;
  • the UK household has no people collection, and a person record at the top level.

policyengine-core raises SituationParsingError for both. The translation rejects them as legacy household contains unsupported collections, which is correct, so this issue leaves them pending.

Fix

Make the translation create, for each collection, the groups that policyengine-core creates: one group of everyone for an omitted or null collection, and a group of their own for each person a present collection leaves out. These groups have stable IDs after the named groups, no source_name (the v1 household has no name for them) and no values.

After the fix deploys, copy the two affected events with process-v1-household-mirror-event.yml, one event at a time.

Langage dominant
Python
Étoiles
18
Forks
33
Merge moyen
2 j 21 h
PR mergées (30 j)
93

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de PolicyEngine/policyengine-api

Toutes les issues de PolicyEngine/policyengine-api

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.