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

Offen
#4,164 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

  • #4165 von @anth-volk — ohne Merge geschlossen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
18
Forks
33
Ø Merge
2 T. 18 Std.
Gemergte PRs (30 T.)
105

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus PolicyEngine/policyengine-api

Alle Issues in PolicyEngine/policyengine-api

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.