Skip to content

Fix LIHEAP program registry entries and add a registry integrity test - #9722

Open
MaxGhenis wants to merge 1 commit into
mainfrom
fix-liheap-registry
Open

MaxGhenis wants to merge 1 commit into
mainfrom
fix-liheap-registry

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the LIHEAP entries in policyengine_us/programs.yaml so every reference points at something the model defines, and adds the registry's first test.

Entry Before After Evidence
DC LIHEAP variable dc_liheap (undefined) dc_liheap_payment git grep -w dc_liheap hits only programs.yaml; dc_liheap_payment is the SPM-unit USD benefit, defined_for="dc_liheap_eligible"
Riverside County LIHEAP parameter_prefix gov.local.ca.riv.liheap (resolves to nothing) gov.local.ca.riv.cap.liheap ca_riv_liheap_countable_income reads gov.local.ca.riv.cap.liheap.countable_income.sources; sibling SHARE already uses riv.cap.*
Oregon LIHEAP in_progress, no variable removed, and OR dropped from coverage No Oregon LIHEAP code on main (git log -S or_liheap is empty); #5333 opened 2024-11-17 and closed unmerged 2026-02-23; no open PR. The registry has no not-started status (complete, partial and in_progress only), and the only other in_progress implementation without a variable (IA SSP) has an open PR (#8017)
DC, MA, IL no parameter_prefix gov.states.dc.doee.liheap, gov.states.ma.doer.liheap, gov.states.il.dceo.liheap Each resolves and holds all of that state's LIHEAP parameters, matching the TX neighbour
TX CEAP note "the FY2024-only SMI limit" "the alternative 60% SMI limit from the FY2024 state plan (applied through 2024)" uses_smi_threshold is true from 2023-10-01 until 2025-01-01, and the annual formula reads it on Jan 1, so it applies to 2024 and earlier and is off from 2025

Other checks, where the entries already matched the code:

  • MA (ma_liheap), IL (il_liheap) and TX (tx_ceap, partial) name existing SPM-unit benefit variables.
  • Riverside's ca_riv_liheap_eligible exists and is eligibility-only, consistent with status: complete plus "Only includes eligibility rules", as in the il_fpp / il_ibccp / il_ihwap entries.
  • No code reads programs.yaml by variable name. system.py:102 only sets modelled_policies. policyengine-core's add_modelled_policy_metadata only yaml.loads it, with no validation. build_metadata.py only fingerprints the file.
  • Org-wide code search finds no consumer that keys on dc_liheap or on the OR entry.

New test: policyengine_us/tests/test_programs_registry.py

Invariants, checked for every program and state implementation:

  • status is one of complete, partial or in_progress.
  • Implementation state codes are valid StateCode values.
  • Program ids and implementations are unique.
  • Every variable is in system.variables.
  • Every parameter_prefix resolves through system.parameters.get_child.

On main the test fails on exactly the two LIHEAP defects above. On this branch it passes: 620 passed and 10 skipped.

The whole-registry scan also found 10 unresolved references outside LIHEAP: csfp, clean_vehicle_credits, sf_wftc and montgomery_county_eitc variables, and the fdpir, social_security, dc_power, dc_gac, la_expectant_parent and montgomery_county_eitc prefixes. They are listed in KNOWN_UNRESOLVED and skipped for now. A companion test fails if a listed key starts resolving or disappears, so the list can only shrink. Fixing them is a follow-up, kept out of this PR to keep it LIHEAP-scoped.

Mutation checks:

  • An unknown status, an invalid state code and a typo'd variable each fail the test.
  • A resolvable key added to KNOWN_UNRESOLVED fails the stale-allowlist check.

CLAUDE.md's registry section now documents the test, and says to remove a dead in_progress entry rather than invent a status.

Downstream effect

This was computed by running policyengine-model's own fetchPrograms.ts and programStatus.ts on its current registry snapshot.

  • LIHEAP: today the coverage page shows the whole program as "In progress", because the OR entry outranks the registry's partial. After this change it shows "Partial". The stat cards move from 10 Partial / 5 In progress to 11 Partial / 4 In progress.
  • Riverside LIHEAP: the Parameters and Tests buttons return 404 today and will resolve. Its Variables button will then 404, because the model site derives all three links from parameter_prefix and Riverside's variables live under riv/liheap, not riv/cap/liheap. SHARE has the same split. The field is the parameter prefix, so this PR sets it to the parameter path, and a follow-up covers the site and the directory layout.
  • Propagation: the page updates on the next policyengine-model deploy. api.policyengine.org serves policyengine-us 1.764.6 until policyengine-api bumps its bundle.

Notes

  • Conflict with Add Kansas LIEAP regular heating assistance #9663: draft Add Kansas LIEAP regular heating assistance #9663 (Kansas LIEAP) edits the same coverage line. After this merges, that line should read DC, Riverside County, MA, IL, KS, TX.
  • Out of scope, filed as follow-ups:
    • ma_liheap lacks unit = USD.
    • DC's benefit matrix and IL's natural-gas matrix have no FY2025 (2024-10-01) values, so FY2024 amounts carry through Sep 2025; this is unverified against the source PDFs.
    • IL crisis assistance is an input-only flag.
    • TX reads TANF enrollment in January only and SNAP eligibility in December only.
    • Whether DC, IL and MA should stay complete given their assumed IRS-gross-income concept.
    • Stale in_progress statuses: summer_ebt and chapter_7_bankruptcy have no code and no open PR; section_8 has shipped code.
  • Issue Oregon LIHEAP #273 (Oregon LIHEAP) stays open; this PR only stops the registry from listing it as in progress.

axiom: n/a: program registry metadata and a registry test; no policy rule changes

🤖 Generated with Claude Code

- DC LIHEAP pointed at `dc_liheap`, which does not exist; the benefit
  variable is `dc_liheap_payment`.
- Riverside County LIHEAP's parameter_prefix `gov.local.ca.riv.liheap`
  resolved to nothing; its parameters are under
  `gov.local.ca.riv.cap.liheap`.
- Remove the Oregon LIHEAP implementation (status in_progress, no code on
  main; PR #5333 closed unmerged 2026-02-23) and drop OR from coverage.
  The registry has no not-started status.
- Add parameter prefixes for DC, MA and IL, which resolve.
- Texas CEAP note: the SMI alternative limit is applied through 2024.
- New tests/test_programs_registry.py checks statuses, state codes, and
  that every variable and parameter_prefix resolves; ten pre-existing
  unresolved references elsewhere are listed in KNOWN_UNRESOLVED, which
  must shrink as they are fixed.

Refs #273

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant