PolicyEngine / PolicyEngine/microcosm
JCT reform-vector cache can serve stale vectors across a correct full-frame checkpoint miss
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 4
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 94
Description
From the #545 confirm sweep (sol, cites verified on main). The lower reform-vector cache (REFORM_VECTOR_CACHE_CONTEXT_KEYS, builder ~:281; read ~:4218) deliberately strips seed and target_registry_version per the #217 design ('anything outside this set cannot change a reform's per-household estimate') — but that premise has decayed:
- Registry values now rescale
non_sch_d_capital_gainsbefore reform simulations (~builder:4999), sotarget_registry_versionIS a reform-vector input. - Seed controls the childcare QRF (childcare.py:294) while the JCT surface neutralizes
cdcc(fiscal_target_references.json:276), soseedreaches reform vectors too. - Only household count guards positional arrays — no selected-support identity — so a selection change with equal record count would misalign.
Consequence: even when the full-frame checkpoint correctly misses (e.g. after #545's identity fixes), the lower cache can hand back reform vectors computed on the other configuration.
Fix shape: key a canonical staged reform-input/household-identity fingerprint into the context, bump TARGET_MATERIALIZATION_CACHE_SCHEMA_VERSION, and revise the test that currently asserts reuse across seed/registry changes (test_us_fiscal_refresh_builder.py ~:7488) to assert the new invalidation instead.
Materiality: the O attempts shared seed/registry so no shipped number is known-contaminated; this is a fail-closed hardening before any run varies those knobs against a warm cache.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with REFORM_VECTOR_CACHE_CONTEXT_KEYS and the reform-vector cache builder around :281 and read around :4218, then inspect childcare.py:294 and fiscal_target_references.json:276 for the stated seed and registry inputs. Update the test in test_us_fiscal_refresh_builder.py around :7488 to cover invalidation across seed and registry changes; done means the lower cache cannot reuse vectors for a different canonical input or household identity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100