Skip to content

Honor supplied Medicaid exclusions and uprate foreign earned income exclusions from a shared input period - #10224

Merged
MaxGhenis merged 9 commits into
mainfrom
fix-order-dependent-stored-reads
Dec 3, 2026
Merged

MaxGhenis merged 9 commits into
mainfrom
fix-order-dependent-stored-reads

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Two formulas read a stored value as if it had been entered. A stored value can also be one the simulation calculated, so their results depended on what had been calculated first. This PR makes both independent of calculation order. It also lets a supplied SNAP or TANF community engagement exclusion count toward the Medicaid enrollment that SSI state supplements read.

Invariant

Order independence. For a simulation built from fixed inputs, the value of each changed variable for a period is the same whatever was calculated before it, and in whatever order. For foreign_earned_income_exclusion without Form 2555 inputs, two more things hold:

  • An input for the exact period wins. Otherwise the formula uprates the whole tax-unit array directly by the per-capita AGI index from one visible supplied period in annual units: the latest one that starts before the target. If two start together, the one that ends later wins. An explicit zero counts as an input. Calculated periods never supply an uprating base.
  • The index is held at its first and last values outside its range. If no earlier visible annual input qualifies, Core's carry-over or default applies.

1. foreign_earned_income_exclusion (no-leaf-input path)

Float32 drift. The formula uprated from the latest earlier period in holder.get_known_periods(), which includes years the simulation calculated. So 2026 computed after 2025 was uprated from 2025's float32 result, not from the 2024 input.

from policyengine_us import Simulation

def feie():
    return Simulation(situation={
        "people": {"p": {"age": {2024: 40}}},
        "tax_units": {"t": {"members": ["p"],
                            "foreign_earned_income_exclusion": {2024: 10_000}}},
        "households": {"h": {"members": ["p"], "state_code": {2024: "MA"}}},
    })

fresh = feie().calculate("foreign_earned_income_exclusion", 2026)
s = feie()
s.calculate("foreign_earned_income_exclusion", 2025)
after = s.calculate("foreign_earned_income_exclusion", 2026)
2026 asked alone 2026 after 2025
main (a2f63c1235) 11090.326171875 11090.3271484375
this PR 11090.326171875 11090.326171875

The drift persists into later years: 2035 asked after 2025–2034 differed by up to 0.125 on a $1,000,003.30 input. Of six amounts, five differed bitwise for 2026.

A crash with the same cause. An amount stored only under a branch the simulation cannot read (holder.set_input(period, value, "sibling")) was picked as the source, read back as None, and raised TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'. It now takes the legacy default.

Staggered tax-unit inputs: no change. As for other inputs, a year entered for one tax unit applies to every tax unit in the simulation. With $10,000 entered for the first unit in 2024 and $0 for the second in 2025, the 2025 array holds $0 for both, and 2026 is [0, 0]. Enter the amount for both years, or build the units separately.

Form 2555 leaf inputs: no change beyond rounding. These cases matched bitwise before and after:

  • leaf inputs in 2025 only;
  • legacy 2024 plus leaves in 2025, with 2026 asked after 2024 or after 2025;
  • legacy 2024 plus leaves in 2027;
  • two legacy inputs (2022 and 2024).

has_section_911_leaf_inputs checks the active branch's visible leaf inputs across the batch. A leaf whose period starts at or before the requested period selects the leaf path whenever the formula runs. validate_section_911_batch_inputs requires matching period coverage across tax units when a batch combines leaf and legacy inputs.

Fix. Core has tracked supplied input periods since policyengine-core#563, released in 3.32.17, and PolicyEngine US requires Core 3.37.2 or later. The formula uses visible input periods and Core’s _latest_input_key. It records the per-capita index reads on the calculating branch, as main does. These behaviours are unchanged:

  • the legacy default: no earlier input → None, so Core's carry-over or default applies;
  • the per-capita AGI index (main supplies IRS Statistics of Income values for 2015–2018);
  • the held-flat boundaries.

2. medicaid_enrolled_for_ssi_state_supplement

From 2027, the formula returned the stored medicaid_enrolled whenever one existed, whether supplied or calculated. Otherwise it calculated medicaid_enrolled in a private branch, with medicaid_community_engagement_pass_through_eligible forced False, to avoid the SNAP → SSP → Medicaid recursion. A calculated medicaid_enrolled keeps that pass-through.

Order dependence on main. Each case below compares the value asked alone with the value after medicaid_enrolled (and after snap), using IN SAPN/RCAP and KS SSPP candidates and pass-through non-candidates.

  • Baseline, SNAP calculated by formula: no order dependence. Calculating medicaid_enrolled reaches this variable through pass-through → SNAP → in_ssp, before medicaid_enrolled is stored, so every order uses the branch.

  • Baseline, SNAP or the pass-through supplied as an input:

    • Non-candidates differ. The SNAP and TANF pass-through adults got False asked alone and True after medicaid_enrolled.
    • The candidates checked in these cases do not differ. Their Medicaid values matched, and the SAPN, RCAP and SSPP eligibility and amounts matched. Main also uses this helper for Ohio RSS and Utah DHHS SSP.

    At baseline, SSI recipients in Indiana (section 1634) and Kansas (SSI criteria) are in the SSI_RECIPIENT category, which the community engagement requirement does not reach. RCAP's aged, blind or disabled candidates are exempt by age (SSI's aged threshold is 65; the requirement covers ages 19–64) or by blindness or disability.

  • A candidate differs under a reform. With Indiana's SSI-recipient Medicaid coverage turned off (gov.hhs.medicaid.eligibility.categories.ssi_recipient.is_covered.IN: false), a 40-year-old institutionalized SSI recipient with no disability finding falls into the ADULT group. With the pass-through supplied, that person's SAPN depended on order:

from policyengine_core.reforms import Reform
from policyengine_us import Simulation

reform = Reform.from_dict({
    "gov.hhs.medicaid.eligibility.categories.ssi_recipient.is_covered.IN":
        {"2000-01-01.2100-12-31": False}}, country_id="us")
situation = {
    "people": {"r": {
        "age": {2027: 40}, "receives_ssi": {2027: True},
        "ssi_lives_in_medical_treatment_facility": {2027: True},
        "ssi_medicaid_pays_majority_of_care": {2027: True},
        "medicaid_community_engagement_pass_through_eligible": {"2027-01": True}}},
    "households": {"h": {"members": ["r"], "state_code": {2027: "IN"}}},
}
first = Simulation(situation=situation, reform=reform)
fresh = first.calculate("in_ssp", "2027-01")
s = Simulation(situation=situation, tax_benefit_system=first.tax_benefit_system)
s.calculate("medicaid_enrolled", 2027)
after = s.calculate("in_ssp", "2027-01")
in_ssp, 2027-01 asked alone after medicaid_enrolled
main 0 22
this PR 22 22

With the January SNAP exclusion supplied, the Indiana adult-group recipient qualifies for SAPN. The payment is $52 − $30 = $22 whether SAPN or ordinary Medicaid enrollment is calculated first.

The non-candidate case is the same shape without the reform: an Indiana adult, 40, with $5,000 of earnings and SNAP workfare, and snap supplied. medicaid_enrolled_for_ssi_state_supplement gave False asked alone and True after medicaid_enrolled on main, and False in both orders here.

Fix. The helper honors supplied Medicaid enrollment (period in holder.get_input_periods(branch_name)). When the January SNAP or TANF exclusion (medicaid_community_engagement_pass_through_eligible) is supplied, it uses ordinary enrollment. When the model must calculate that exclusion, it computes enrollment in a private branch with the exclusion disabled to break the SNAP dependency. The recursion guard is unchanged. Across these variants, all orders now agree:

  • base;
  • SNAP supplied;
  • pass-through supplied;
  • medicaid_enrolled supplied;
  • the reform with the pass-through supplied;
  • the reform with SNAP supplied.

Supplied enrollment is still honoured, including a set_input after construction (test_ssp_preserves_medicaid_inputs_set_after_initialization).

Not changed here

medicare_irmaa_magi_two_years_prior reads the stored 2014 exclusion without checking that it was supplied. With $10,000 entered in 2012 and no 2014 income, benefit year 2016 gives $0 on a fresh simulation and $10,000 after the 2014 exclusion is calculated. The model's documented pre-2015 fallback expects $0. This predates the PR and is left for a separate fix.

Tests

Hypothesis is used for both sites, with derandomize=True. Each property has its reproducing case as an explicit @hypothesis.example.

  • tests/test_foreign_earned_income_exclusion_leaves.py
    • Property over entered year (2015–2030), target year, 1–4 float32 amounts, and the years calculated first, in drawn order and sometimes after the target. It asserts:
      • the target is bit-for-bit equal to the value asked alone;
      • the target equals the amounts uprated straight from their year.
    • Example tests:
      • each year uprates from the latest earlier entered year, in either order;
      • a 2012 amount is held flat until the 2015 index start;
      • an amount held only by another branch gives the default, with no TypeError. Main adds two checks that record the source and target index reads in the root and in a named branch. The merged file has 33 static cases.
  • tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/foreign_earned_income_exclusion.yaml (new)
    • the latest array, [8000, 0] for 2025 after [10000, 2000] for 2024, times the 2026-to-2025 index ratio gives [8376.333984375, 0] for 2026; the case expects [8376.33, 0] within one cent;
    • the only supplied array, [-10000, 2000] for 2024, times the 2026-to-2024 ratio, (18,810.4 / 352.304) / (16,685.9 / 346.588) (CBO AGI and population), gives [-11090.326171875, 2218.065185546875]; the case expects [-11090.33, 2218.07];
    • with $10,000 for exact 2024 and $900 for year:2024:2, 2024 returns $10,000, and the later-ending input supplies 2026: $900 × 1.1090326760420632 = $998.13.
  • tests/core/test_ssi_state_supplement_medicaid_dependency.py
    • Property over state (IN/KS), which value on the cycle is supplied (none, snap, pass-through or medicaid_enrolled), and up to four variables calculated first. It asserts that SSP enrollment, eligibility and benefits match a fresh simulation. The merged file has 35 static cases. Without Hypothesis only the property test skips.
    • Example tests:
      • the computed SNAP and TANF cases check both calculation orders;
      • an SSI recipient in the adult group with the SNAP exclusion supplied qualifies for SAPN in either order: $22 for January ($52 − $30) and $264 for the year. The test sets is_ssi_recipient_for_medicaid: False, which has the same effect as the reform above, without building a reformed system.
  • tests/policy/baseline/gov/states/in/fssa/ssp/in_ssp_sapn.yaml: new case "Indiana SAPN counts Medicaid enrollment through a supplied SNAP exclusion": medicaid_enrolled true, in_ssp_sapn_eligible true, in_ssp_sapn $22 ($52 personal needs allowance − $30 reduced SSI − $0 other income).

The adult-group example (test_ssi_state_supplement_medicaid_dependency.py:376–417) is a new test that checks both calculation orders. It expects SSP enrollment and January SAPN eligibility to be true and annual in_ssp to be $264 (12 × $22). Replaying its input on main gives false, false and $0 when SSP is calculated first, and true, true and $264 when Medicaid enrollment is calculated first. No existing expected value changed.

Earlier Linux runs, one file per process, before the latest merge with main:

  • 679 cases passed at an earlier version across 68 YAML files that read the changed variables, with 0 failures; on an earlier merge with main the same files passed 880 cases;
  • the Medicaid file passed 22 cases in 264 seconds, and 21 with one skip in 240 seconds without Hypothesis;
  • the exclusion file passed 31 cases in 94 seconds; test_section_911_batch_inputs.py passed 14.

Test cost

Local macOS measurements at the first version of this PR. User CPU is the steadier measure.

File (CI group) Tests User CPU Peak RSS CI on main, for the group
test_foreign_earned_income_exclusion_leaves.py (remaining) 25 → 31 18.4 s → 24.4 s 1.18 → 1.37 GB file 2.9 s; group 15:52 wall, 7.66 GB max RSS
core/test_ssi_state_supplement_medicaid_dependency.py (heavy-a) 15 → 22 117.6 s → 123.7 s 4.72 → 4.63 GB file 157 s; group 5:08 wall, 5.51 GB max RSS (at a2f63c1235)

The added cases build small situations only. The Medicaid file's peak comes from the existing all-states poverty test. No job, matrix entry or group assignment changes.

Impact

Microsimulation impact: pending.

Household results:

  • Foreign earned income exclusion. Using supplied inputs directly removes float32 drift where intermediate years were calculated first. When two inputs start together, the later-ending one wins whatever the storage order: with exact 2024 $10,000 stored first and year:2024:2 $900 second, 2026 is $998.13 here and $11,090.33 on main. A calculation that sees only another branch's $10,000 input returns $0 here; main raises TypeError.
  • SSI state supplement Medicaid enrollment. Where the SNAP or TANF exclusion is supplied, a candidate who relies on it now counts as enrolled: the Indiana adult-group resident gains $22 for January.

Overlapping PRs. #9462 also edits core/test_ssi_state_supplement_medicaid_dependency.py, and #10532 also edits in_ssp_sapn.yaml. #10164, #10170, #10161 and #10176 have merged. The merge with main keeps both Indiana SAPN cases, the broader Medicaid scope and supplied-input handling, the Section 911 eligibility helper, and the index tracing. The changed paths were traced by hand, and CI runs the suite at this head.

axiom: n/a: calculation order and stored inputs; no rule changes

🤖 Generated with Claude Code

MaxGhenis and others added 3 commits October 14, 2026 06:16
…nputs

Without Form 2555 leaf inputs, foreign_earned_income_exclusion uprated from
the latest earlier period in holder.get_known_periods(), which includes years
the simulation had calculated. A 2026 value computed after 2025 was uprated
from the float32-rounded 2025 result instead of the 2024 input, so its bits
depended on calculation order (2024 input 10,000: 11090.326171875 fresh,
11090.3271484375 after 2025).

Mirror Core's uprating (policyengine-core#563, released in 3.32.17): take the
latest earlier same-unit period from Holder.get_input_periods for this branch,
breaking ties with Core's _latest_input_key. The legacy default, carry-over
and held-flat index behaviour are unchanged.

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

From 2027, medicaid_enrolled_for_ssi_state_supplement returned
simulation.get_array("medicaid_enrolled") whenever any value was stored,
calculated or supplied, and otherwise calculated enrollment in a private
branch with the SNAP/TANF community-engagement pass-through forced False.
A calculated medicaid_enrolled keeps the pass-through, so the result
depended on whether medicaid_enrolled had been calculated first. With SNAP
or the pass-through supplied (so the SNAP -> SSP cycle does not compute this
variable on the way), a pass-through adult got False fresh and True after
medicaid_enrolled. Under a reform that removes Indiana's SSI-recipient
Medicaid coverage, a working-age reported SSI recipient in a medical
facility falls into the adult group, and Indiana SAPN changed from $0 fresh
to $22 after medicaid_enrolled.

Read medicaid_enrolled directly only when it is a supplied input this branch
reads (Holder.get_input_periods); otherwise always use the private branch.
The recursion guard is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
foreign_earned_income_exclusion: a Hypothesis property over entered year,
target year, amounts and the years calculated first asserts the target is
bit-for-bit the same as asked alone and equals the entered amount uprated
straight from its year; the 2024 -> 2026-after-2025 repro is an explicit
@example. Example tests pin the latest-entered-year source, the held-flat
index before 2015, and the default when only an unreadable branch holds an
amount (previously a TypeError).

medicaid_enrolled_for_ssi_state_supplement: a Hypothesis property over state,
which value on the SNAP-SSP-Medicaid cycle is supplied, and the variables
calculated first asserts the SSP enrollment, eligibility and benefit match a
fresh simulation; the SNAP-supplied, medicaid_enrolled-first repro is an
explicit @example. Example tests cover SNAP and TANF pass-through adults and
an SSI recipient placed in the adult group, whose SAPN was $22 or $0
depending on order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
@MaxGhenis MaxGhenis changed the title Make two formulas that read stored values independent of calculation order Honor supplied Medicaid exclusions and uprate foreign earned income exclusions by tax unit Nov 30, 2026
MaxGhenis and others added 5 commits November 30, 2026 08:55
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Drop the per-unit input history. An entered year applies to every tax
unit in the simulation, as it does for other inputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis MaxGhenis changed the title Honor supplied Medicaid exclusions and uprate foreign earned income exclusions by tax unit Honor supplied Medicaid exclusions and uprate foreign earned income exclusions from a shared input period Dec 1, 2026

@DTrim99 DTrim99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Program review

Base repository: PolicyEngine/policyengine-us
PR number: 10224
Reviewed head SHA: 3c14d9e
Merge base SHA: 50756f2
Mode: full
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-review-sources.json
Review status: COMPLETE

Source Documents

Critical

None.

Should Address

None.

Suggestions

S1 — The new Indiana SAPN YAML case passes with main's helper, so it does not guard the fix (OPEN)

  • Location: policyengine_us/tests/policy/baseline/gov/states/in/fssa/ssp/in_ssp_sapn.yaml:124-142.
  • Trigger: the policyengine-core YAML runner checks outputs in the order they are listed (policyengine_core/tools/test_runner.py:324, for key, expected_value in output.items()). The case lists medicaid_enrolled first. That calculates and stores enrollment before the SSP asks for it. Main's helper then returns the stored value, so SAPN is $22 on main as well.
  • Evidence: pr-10224-review-code-diag/diag2.py swaps main's helper formula in through a reform. Main's formula in YAML order gives medicaid_enrolled true, in_ssp_sapn_eligible true and in_ssp_sapn 22, which matches the expected values. Main's formula with the SSP first gives 0 and false. The PR formula gives 22 and true in both orders. Raw output is in pr-10224-review-code-diag/diag2.log.
  • Impact: none on behavior. The change already has a test that fails without it: test_ssi_recipient_in_the_adult_group_gets_the_same_sapn_in_either_order with first=(). The YAML case only documents the end state.
  • Suggested fix: list in_ssp_sapn and in_ssp_sapn_eligible before medicaid_enrolled, or drop the medicaid_enrolled output, so the YAML case runs the SSP-first order.

S2 — The FEIE fallback can grow an amount at the ceiling past the 911(b)(2)(D) limit (already on main) (OPEN)

  • Location: policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/foreign_earned_income.py:24-63, the branch used when no Form 2555 inputs are supplied. The growth factor is set at lines 60-63.
  • Trigger: One tax unit, no Form 2555 inputs, foreign_earned_income_exclusion = $126,500 supplied for 2024 only. That is the full 2024 ceiling for one qualifying person with no housing amount.
  • Expected vs observed: Under the statute the ceiling for one person becomes $130,000 in 2025 and $132,900 in 2026, a 5.06% rise over 2024 that follows C-CPI-U. When I ran this case on the snapshot, the model returned $133,989.53 for 2025, $140,292.63 for 2026 and $144,665.80 for 2027, because it grows the amount by per-capita AGI (×1.10903 from 2024 to 2026). For 2026 that is $7,392.63 more than the ceiling allows unless the person has a housing exclusion or deduction of at least that size. The model has no parameter for the section 911 ceiling, so nothing caps the grown amount.
  • Impact and why it is not new here: Only exclusion amounts at or near the ceiling are overstated in years after the supplied year. Main uses the same per-capita AGI index and factor; this PR only changes which supplied year is the starting point, so it does not introduce the overstatement. Its new YAML tests use amounts well below the ceiling ($900–$10,000) and do not lock in an overstated result. The local policyengine-us-data checkout never supplies this variable, so microsimulation exposure appears limited. I did not establish this for every build.
  • Severity: SUGGESTION. Follow-up: add a parameter for the 911(b)(2)(D) amount, or grow amounts at the ceiling with the statutory index. This PR does not need to change.
  • Sources:
    • 26 U.S.C. 911(b)(2)(A) and (D) (/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-policy-sources/usc26-911.txt)
    • Rev. Proc. 2023-34 sec. 3.39 (page 18), Rev. Proc. 2024-40 sec. 3.39 (page 18) and Rev. Proc. 2025-32 sec. 3.39 (page 25)
    • IRS "Figuring the foreign earned income exclusion"
    • Run: /tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-policy-diag/feie_cap.py, output in /tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-policy-diag/feie_cap.log (exit 0; imports resolved to the snapshot)

S3 — A new YAML test locks in a negative exclusion, which section 911 does not allow (OPEN)

  • Location: policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/foreign_earned_income_exclusion.yaml:21-38 ("Signed exclusions uprate directly from the year entered")
  • Trigger: A 2024 input of −$10,000 is expected to become −$11,090.33 in 2026.
  • Expected vs observed: Section 911(a) lets a taxpayer elect to exclude foreign earned income and the housing cost amount. The excluded amount cannot be below zero. The model's own Form 2555 path also floors worksheet line 2c at zero ("if zero or less, enter zero"). The new case treats a negative supplied value as a legitimate amount to grow. Main already kept the sign of supplied values; the test is new.
  • Impact: No effect on any lawful household. The test documents how the model handles an invalid input.
  • Severity: SUGGESTION. Say in the case that it covers sign handling for an invalid input, or replace the −$10,000 with a non-negative amount.
  • Sources: 26 U.S.C. 911(a), (b)(2)(A) (/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-policy-sources/usc26-911.txt); Form 1040 instructions, Foreign Earned Income Tax Worksheet, PDF page 37 (/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-policy-sources/i1040gi.txt).

S4 — The new SAPN test relies on an SSI recipient who is neither aged, blind nor disabled (OPEN)

  • Location:
    • policyengine_us/tests/policy/baseline/gov/states/in/fssa/ssp/in_ssp_sapn.yaml:124-142 (new case "Indiana SAPN counts Medicaid enrollment through a supplied SNAP exclusion")
    • policyengine_us/tests/core/test_ssi_state_supplement_medicaid_dependency.py:377-417
  • Trigger: The test uses a 40-year-old with receives_ssi: true and no blindness or disability input. It also sets is_ssi_recipient_for_medicaid to false, although Indiana is a section 1634 state, and supplies the January SNAP exclusion.
  • Expected vs observed: Under section 1614(a)(1), a person under 65 can get SSI only if blind or disabled. Such a person is a specified excluded individual under 42 CFR 435.554(c)(5)(i)(A), and in Indiana an SSI recipient gets Medicaid through the SSI-recipient group anyway. So in law this person is enrolled without the SNAP exclusion. The test's expected results are still correct under the sources: medicaid_enrolled true, SAPN eligible, and $22 = $52 − $30 (PM 5000, page 2). Only the test's name and premise describe a route to Medicaid that a lawful SSI recipient cannot take.
  • Impact: None on model outputs or expected values. The test checks how the code handles a supplied input, not a situation that occurs in law. The PR body admits it simulates turning off SSI-recipient coverage.
  • Severity: SUGGESTION. Add a comment saying the input combination is a modeling device, or name the test after the input-handling behavior it checks.
  • Sources: 42 U.S.C. 1382c(a)(1) (/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-policy-sources/usc42-1382c.txt); 42 CFR 435.554(b) and (c)(5)(i)(A), (c)(7) (/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10224-policy-sources/ecfr-435-554.txt); Indiana Medicaid PM 5000, page 2.

S5 — YAML placement and naming conventions in the new FEIE file (OPEN)

  • tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/foreign_earned_income_exclusion.yaml sits one directory above where it should. The variable lives in .../adjusted_gross_income/above_the_line_deductions/foreign_earned_income.py, so the mirrored test path would be under above_the_line_deductions/.
  • The new case names in the FEIE file and in in_ssp_sapn.yaml lack the Case N, ... . form that cases 1-4 of in_ssp_sapn.yaml use.
  • FEIE YAML cases 1 and 2 also give the same result on main: with no intermediate year calculated, main picks the same source period. They are regression guards. Case 3 (the tie-break) and the Python tests are the ones that tell the fix apart from main.

Evidence Gaps

No material gaps reported.

Notes

  • Both changes do what the PR says, and results no longer depend on calculation order. The FEIE fallback now grows only from supplied inputs, the same way core 3.37.2 does its own uprating. A $10,000 input for 2024 gives the same 2026 value in the root simulation, a branch and a nested branch, even after 2025 is calculated first.
  • Counting a supplied SNAP or TANF community engagement exclusion as Medicaid enrollment for state supplements is right. Indiana SAPN (PM 5000 p. 2) and Kansas SSPP require receiving Medicaid without limiting which Medicaid group counts. Under 42 CFR 435.554(b) and (c)(6)–(7), a person covered by the SNAP or TANF exclusion has no community engagement condition.
  • The FEIE ceiling (policy-1) is already a problem on main and the model has no parameter for it, so it suits a follow-up issue rather than this PR.

Validation Summary

Local tests at the reviewed head (review venv, policyengine-core 3.37.2, matching uv.lock; imports resolved to the snapshot): 79 pytest tests passed (3 deselected) and 116 YAML cases passed, with 0 failures. Every other branch that changes behaviour has a test that fails on main. The all-states poverty test was left to CI because the PR doesn't change it. Sources: 11, including Rev. Procs. 2023-34, 2024-40 and 2025-32, Indiana PM 5000 and 42 CFR 435.554; the manifest check passed. CI: 35/35 checks pass at 3c14d9e.

Timing

setup seconds: 5.00s; scope seconds: 60.00s; parallel review seconds: 447.40s; policy role seconds: 368.10s; code role seconds: 447.40s; adjudication seconds: 90.00s; consolidation cleanup seconds: 1287.60s; elapsed seconds: 1888.00s

Review Severity

APPROVE. Open findings: 0 critical, 0 should address, 5 suggestions.

@MaxGhenis
MaxGhenis merged commit c10fbe5 into main Dec 3, 2026
35 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

US + core hub merge audit, us#10224 at 3c14d9ed5ee828f12d849e163eac81603ad3f94b (squash): Honor supplied Medicaid exclusions and uprate foreign earned income exclusions from a shared input period.

  • Reviews:
    • Human review on GitHub: APPROVED by DTrim99.
    • Independent closure-check review (Sol lane) at 3c14d9ed5ee828f12d849e163eac81603ad3f94b returned VERDICT: APPROVE, closing the remaining P1 documentation question on the adult-group example (test_ssi_state_supplement_medicaid_dependency.py:376–417).
  • Gates & combination verification:
    • Pull request workflow run 46485191691 and all 35 checks passed at 3c14d9ed5ee828f12d849e163eac81603ad3f94b.
    • Overlapping areas (gov/irs/income/taxable_income, gov/states/in) verified by combining 3c14d9ed5ee828f12d849e163eac81603ad3f94b onto current main (50af7fba6908a17bff784c297440acd179252136): test_ssi_state_supplement_medicaid_dependency.py (35 passed), foreign_earned_income_exclusion.yaml (3 passed), in_ssp_sapn.yaml (6 passed), test_foreign_earned_income_exclusion_leaves.py (33 passed), full gov/states/in baseline folder (598 passed), shrink guards (test_no_engine_time_randomness.py 20 passed, test_no_group_variables_in_person_adds.py 10 passed), and test_source_conflicts.py (251 passed).
    • Replayed the new adult-group fixture on main (50af7fba6908a17bff784c297440acd179252136) in both calculation orders ((False, False, 0.0) SSP-first vs (True, True, 264.0) medicaid_enrolled-first), confirming main's order dependence vs branch consistency.
  • Axiom: n/a: calculation order and stored inputs; no rule changes.

@MaxGhenis
MaxGhenis deleted the fix-order-dependent-stored-reads branch December 3, 2026 13:06
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.

2 participants