Skip to content

Count New Mexico child credit children under IRC 152(c); do not halve the 65+ medical exemption for separate filers - #10047

Merged
MaxGhenis merged 14 commits into
mainfrom
nm-ctc-152c-medical-exemption
Oct 19, 2026
Merged

MaxGhenis merged 14 commits into
mainfrom
nm-ctc-152c-medical-exemption

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR fixes two New Mexico problems found while auditing the claimable-filer rules (research: nm.out.md sections 2 and 4).

  1. Child income tax credit (NMSA 7-2-18.34). nm_ctc counted children with the federal eitc_child_count. That count applies the EITC's Social Security number rule (IRC 32(c)(3)(D)). Section 7-2-18.34(J)(2) instead defines "qualifying child" as "'qualifying child' as defined by Section 152(c) of the Internal Revenue Code", plus a public-assistance support proviso, and IRC 152(c) has no identification number requirement. The new nm_ctc_qualifying_children counts 152(c) children whatever their Social Security number status. An otherwise-qualifying child with an ITIN, of an independent filer with AGI $20,000, now gets $637 in 2025 (it was $0). The count also applies 152(c)(3)(A)'s rule that a child who is not disabled must be "younger than the taxpayer claiming such individual as a qualifying child" (on a joint return, younger than either spouse; Publication 596). The shared EITC helper does not apply this rule, so before this PR a 22-year-old student sibling of a 20-year-old filer counted.
  2. 65+ medical care expense exemption (NMSA 7-2-5.9). The formula halved the $3,000 for married filing separately. Neither the statute nor the 2025 PIT-ADJ line 18 instructions ("enter $3,000 on line 18") provide for halving. The halving sentence on that PIT-ADJ page belongs to the organ donation deduction on line 19, which mirrors 7-2-36(B). Where the Legislature wants halving it says so: 7-2-18.13(B) does it for the companion medical care credit, and 7-2-36(B) does it for organ donation. This PR removes the halving.

This PR now targets main. The claimant test ("not a dependent of another individual") in nm_ctc and the filer-only age test in the exemption are already on main and are kept here.

Variable Before After Source
nm_ctc_qualifying_children (new) none Counts children who pass is_eitc_qualifying_child, the model's 152(c) test before any identification rule (relationship, and age under 19, a full-time student under 24, or permanent and total disability), and who are also younger than the older filer or disabled (152(c)(3)). No 152(b)(1) zeroing, because the section counts qualifying children, not dependents. NMSA 7-2-18.34(J)(2); IRC 152(c); 2025 PIT-RC p.10
nm_ctc Per-child amount × eitc_child_count Per-child amount × nm_ctc_qualifying_children. The claimant test and the one-half for married filing separately are unchanged. 7-2-18.34(A), (B), (G), (J)(2)
nm_medical_expense_exemption $3,000, or $1,500 for married filing separately $3,000 for every filing status NMSA 7-2-5.9(A); PIT-ADJ line 18

Decisions taken from the sources

  • No SSN requirement for the NM count. The statute is explicit. The 2025 PIT-RC worksheet asks only for the "total number of qualifying children".
  • No halving for married filing separately. The statute and the instructions agree.
  • The threshold stays at >= $28,000 (instruction reading) until Max rules (reading 1). The model already did this, so the change moves no number.

Readings for Max (for the US + core hub to queue)

  1. Medical exemption at exactly $28,000. NMSA 7-2-5.9(A) requires expenses that "exceed twenty-eight thousand dollars ($28,000)". PIT-ADJ line 18 says "of $28,000 or more", and TRD tells filers who qualify for the 7-2-18.13 credit (which uses "equal ... or more") that they also qualify for this exemption.
    • Instruction reading (current model, kept): $3,000 at exactly $28,000.
    • Statute reading: $0 at exactly $28,000.
    • Microsim records at exactly $28,000: none, in 2025 or 2026.
  2. Two spouses who are both 65 or older, on one joint return. "Any individual sixty-five years of age or older may claim an additional exemption" could allow $3,000 per qualifying spouse when each paid more than $28,000. PIT-ADJ has one line ("enter $3,000").
    • Kept: $3,000 per return.
    • Alternative: up to $6,000.
  3. A child with neither an SSN nor an ITIN (child income tax credit). 152(c) has no identification requirement, so the model counts such a child. PIT-1 asks for "your dependent's ... correct SSN or ... the correct ITIN" for each dependent listed on line 8.
    • Kept: the child counts.
    • Alternative: require an SSN or ITIN (has_tin).
    • The default dataset has no has_tin or has_itin column, so has_tin is True for everyone and the two readings give the same microsim numbers.

Out of scope: the claimable-filer readings (mixed-joint child credit, medical credit ages, LICTR extras) were handled in the former claimable-filer-nm stack, now included in main.

Invariants

These hold for every input, and Hypothesis and a seeded population check them in policyengine_us/tests/core/test_nm_ctc_children_medical_exemption_invariants.py for 2023-2026:

  1. Reference count. nm_ctc_qualifying_children equals an independent count of the 152(c) tests: a dependent who is the filer's child (not a parent or grandparent) and is either permanently and totally disabled, or younger than the older filer and under 19 or a full-time student under 24. It is 0 outside New Mexico.
  2. Superset. In New Mexico, on a return where every dependent is younger than the older filer, nm_ctc_qualifying_children >= eitc_child_count. The federal helper lacks the relative-age rule, so the two counts are not ordered otherwise.
  3. Identification invariance. Giving every dependent a Social Security number changes neither the count nor nm_ctc.
  4. Label invariance. Exchanging the head and spouse labels changes neither the count, nm_ctc nor nm_medical_expense_exemption.
  5. Separate filing. For a single adult, nm_ctc(SEPARATE) = nm_ctc / 2 (7-2-18.34(G)) and nm_medical_expense_exemption(SEPARATE) = nm_medical_expense_exemption.
  6. Reference exemption. nm_medical_expense_exemption is $3,000 exactly when a filer (not a dependent) is 65 or older and expenses are at least $28,000, and 0 otherwise.

The seeded test adds crafted units: an older or same-age student sibling, an older disabled sibling, a child younger than only one spouse, an elderly dependent parent, and a 65+ filer at exactly $28,000. It also asserts that the population reaches the cases the invariants are about: a counted child without an SSN who gets a positive credit, a child who fails the relative-age rule, single filers with a credit and with the exemption, and a return whose only 65+ person is a dependent.

Mutation check. At 9a27b36406, each fixed bug was put back in turn and the property test was run. It failed every time, and it passed on the unmutated code (5 passed).

  • SSN rule (& meets_eitc_identification_requirements). Caught by invariant 1. Minimal case: an 18-year-old NM filer with a newborn who has an ITIN counted 0 against a reference of 1.
  • MFS halving. Caught by invariant 5. A single 65-year-old with exactly $28,000 got $1,500 when filing separately.
  • No relative-age test. Caught by invariant 1 on the crafted unit of a 20-year-old filer with a 22-year-old student sibling, which counted 1 against a reference of 0.

Cost. The two tests add about 1.3 s of test time (Hypothesis 0.98 s, plus 0.07–0.09 s for each seeded year). The whole pytest process, including the model import, took 35.7 s wall time with a 1.09 GB peak resident set, measured locally on macOS with /usr/bin/time -l (not Linux CI). The file sits in policyengine_us/tests/core/, beside the existing claimable-filer invariant tests, so it runs in the same CI group and adds no job.

Tests

  • YAML.
    • nm_ctc.yaml: the ITIN child of an independent filer with AGI $20,000 in 2025 gets $637 (eitc_child_count 0); an SSN control also gets $637; MFS gets $318.50. The 2023 amount cases now input nm_ctc_qualifying_children.
    • New nm_ctc_qualifying_children.yaml:
      • an ITIN child, and a child with no SSN card;
      • the 152(c)(3) age edges: 18, 19, a 23- and a 24-year-old student, and a disabled 30-year-old;
      • a dependent parent (relationship test);
      • the relative-age rule: an older student sibling and a same-age student sibling both give 0; an older disabled sibling gives 1; a child younger than only one spouse gives 1 under both labellings;
      • the mixed-joint return under both labellings, and a non-NM household.
    • nm_medical_expense_exemption.yaml: MFS gets $3,000 in 2023 and 2025; $28,000 exactly gives $3,000 (instruction reading); $27,999 gives $0.
  • Python conservation. test_medical_expense_premium_conservation.py expects the full $3,000 NM medical expense exemption for eligible separate filers (NMSA 7-2-5.9; PIT-ADJ line 18), while retaining the separate-filer halving of the medical expense credit under 7-2-18.13(B).
  • Results at 9a27b36406, run locally through the shared heavy-lock runner:
    • All 73 New Mexico YAML files, plus the five other files with New Mexico cases (salt_refund_integration, alternative_minimum_tax, state_itemized_deductions, healthcare_benefit_value, household_health_benefits): 748 cases passed (357 + 391), 0 failed.
    • New invariants: 5 passed.
    • test_dependent_elsewhere_head_spouse_swap_invariance.py and the base branch's test_claimable_filer_nm_invariants.py: 12 passed.
    • This PR targets main; CI runs once it is marked ready for review (pr.yaml skips draft PRs).

Independent review

  • Round 1 (GPT-6.1 Sol, at 7c2b1b7232): REQUEST_CHANGES.
    • Blocking: the count missed 152(c)(3)(A)'s rule that the child be "younger than the taxpayer claiming such individual". Fixed.
    • Nit: the $28,000 comment presented TRD practice as verified. Reworded.
    • The reviewer confirmed the ITIN reading, the MFS removal and the arithmetic.
  • Round 2 (GPT-6.1 Sol, at 9a27b36406): APPROVE, no new findings.

Hub microsimulation impact (current head)

A real microsimulation on the default dataset, main at the merge base 83e03a92f6 against this PR's head d175a8cf44, for 2025 and 2026. The runs went one at a time under the shared heavy-job lock. Sums are weighted.

Output 2025 change 2026 change 2025 records changed (weighted) 2026 records changed (weighted)
nm_ctc +3 +3 8 (0) 8 (0)
nm_medical_expense_exemption +0 +0 0 (0) 0 (0)
nm_income_tax -3 -3 8 (0) 8 (0)
nm_eitc +0 +0 0 (0) 0 (0)
nm_medical_expense_credit +0 +0 0 (0) 0 (0)
state_income_tax -3 -3 8 (0) 8 (0)
income_tax +0 +0 0 (0) 0 (0)
household_net_income +3 +3 8 (0) 8 (0)
household_benefits +0 +0 0 (0) 0 (0)

Rerun at this head d175a8cf44 against main 83e03a92f6; it supersedes the stale-base figures in the section below.

Comparison files are in fixes/10047-impact/ on the hub host.

Microsimulation impact

Historical impact; stale base. These four microsimulation runs on the default dataset (populace_us_2024.h5@populace-us-2024-spm-20260909) compare 2025 and 2026 against the old claimable-filer-nm base, not the current main target. The runs used 11473a319d, whose variables and parameters were identical to the former base 4b0709e55f; the two differed only in tests and the changelog. Comparisons were record by record. The hub reruns the impact against main at this PR head (d175a8cf448ebcad477d7a588b1419d4bb0b0b93). The impact base predates #10055 and the final #10088 changes now in main; the historical figures below await that rerun.

2025 2026
nm_ctc, base $167.18M $163.18M
nm_ctc, this PR $167.18M $163.18M
Weighted change +$3.11 +$3.13
Tax-unit records changed 8 (all up, at most $848) 8 (all up, at most $867)
Combined weight of those records 0.006 tax units 0.006 tax units
nm_medical_expense_exemption records changed 0 0
  • Child income tax credit. In New Mexico, the new count exceeds eitc_child_count only in the 8 records whose qualifying children have no SSN-type card, and those records carry almost no weight in this calibration. No New Mexico record has a counted EITC child who fails the relative-age rule. Weighted New Mexico qualifying children are 529,712 under both counts in 2025.
  • Medical exemption. 10 New Mexico records (6,835 weighted tax units) have the exemption in 2025, and 15 records (10,862) in 2026. None files separately, so removing the halving changes nothing in the data. It changes the result for separate filers who enter their own households.
  • Downstream. nm_refundable_credits, nm_income_tax, state_income_tax and household_net_income move in the same 8 records and by the same amounts. Federal income_tax and the New Mexico exemptions, taxable income and pre-credit tax do not change.

axiom: us-nm/statute/7-2-18.34 TheAxiomFoundation/rulespec-us#1628 queued | us-nm/statute/7-2-5.9 TheAxiomFoundation/rulespec-us#1628 queued (no module exists; the signed encode is OpenAI-billed and needs Max's approval, d1235)

Merge with main after #10087 and #10088

Merged main at dd4787f3ef79 into this branch with a merge commit. Started all 50 conflicted files from main, removed the three obsolete carried changelog fragments, and reapplied only this PR's approved eight-file change (4b0709e55f..9a27b36406).

Main's final NM EITC qualifying-child route, medical-expense premium restoration and documentation, and four added medical tests are preserved. At the merge, the diff against main was the same eight files and +869/−16: every added/deleted line matched the approved patch; only the medical file hashes and hunk offsets differed. The follow-up conservation-test correction adds a ninth changed file, updating the NM exemption expectation to $3,000 for eligible separate filers while preserving the medical expense credit's halving.

Validation after the merge: CTC 11, qualifying-child count 12, medical exemption 15, NM EITC demographics 25, and Python invariants 5 passed (68 total). Ruff 0.15.5 format/check passed on all four changed Python files; make format left all 6,997 files unchanged.

For the conservation-test follow-up, first merged main at 091a744ff2fb1b5765af0c7a131c5ad4afba7f2d as 4f49968ffedd0377ed580602246e785c9e50ac5a, the head used to reproduce the conservation failure before the correction. Main then advanced by a release-only commit to 83e03a92f6e7934b0a4af86d6425c5d272af409a, merged as 160ade0bc864fe30019a8b6983915ac119743542 before final validation. The earlier merge and validation above are historical.

Validation at d175a8cf448ebcad477d7a588b1419d4bb0b0b93: test_medical_expense_premium_conservation.py 5 passed; nm_ctc.yaml 11 passed; nm_ctc_qualifying_children.yaml 12 passed; nm_medical_expense_exemption.yaml 15 passed; test_nm_ctc_children_medical_exemption_invariants.py 5 passed; nm_eitc_demographic_eligible.yaml 25 passed. All six files ran individually in the foreground with the required thread caps. Before the expectation fix, the conservation file failed for an eligible separate filer: the model returned $3,000 against the stale $1,500 expectation.

🤖 Generated with Claude Code

MaxGhenis and others added 10 commits October 8, 2026 11:03
The federal standard deduction and 17 state formulas read only whether the
tax-unit head is claimed elsewhere, so a joint return where one spouse can be
claimed was taxed differently depending on which spouse was labelled head.
Each formula now applies its jurisdiction's rule for that case (either spouse,
single filers only, per spouse, or only when every filer is claimed), using
two new label-independent helpers. Adds swap-pair YAML cases and a Hypothesis
property test.

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

The New Mexico, Maine and Hawaii renters gates counted filers who are not
claimed elsewhere, so a tax unit with neither a head nor a spouse (252 in
the default dataset) looked like one whose every filer was claimed. A new
helper, every_filer_is_dependent_elsewhere, requires a claimed filer and no
unclaimed one.

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

- Hawaii's dependent standard deduction uses earned income net of the
  deductible part of self-employment tax, as the N-11 worksheet does.
- New Mexico's medical care credit needs a filer who is both 65 or older
  and not a dependent when a filer is a dependent elsewhere (NMSA 7-2-18.13).
- The federal EITC without a qualifying child requires that no filer can be
  claimed as a dependent (IRC 32(c)(1)(A)(ii)(III), Publication 596), so
  Missouri's working family credit no longer reaches such a couple.
- Hawaii's food/excise credit keeps minor children receiving public support
  (HRS 235-55.85(c)) on a joint return where one spouse can be claimed.
- Comments label the readings the law does not settle, and the property
  test covers the EITC and the food/excise exemption amount.

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

- The federal and Oregon dependent worksheets use earned income net of the
  deductible part of self-employment tax, as Hawaii's now does.
- Hawaii's food/excise minor-child count excludes children who can be
  claimed by another taxpayer and the filers themselves (Form N-311 line 3).
- claimed_as_dependent_on_another_return documents what it stands for: a
  §151 deduction for the person is allowable to another taxpayer, so a
  person whose would-be claimer files only for a refund is not one
  (Publications 501 and 596); rules on actually being claimed read it too.
- Hawaii's renters comment labels the mixed joint reading as an inference;
  the Hawaii dependent threshold cites HRS 235-2.4(a)(3) on its page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A filer who can be claimed on another return is treated as having no
dependents (IRC 152(b)(1); on a joint return either spouse counts) and has no
personal exemption (IRC 151(d)(2)); one who is claimed gets no education
credits (25A(g)(3)), student loan interest deduction (221(c)) or recovery
rebate (6428(d)(2), 6428A(d)(2), 6428B(c)(2)). The model read none of these.
Now the child tax credit and credit for other dependents, the under-13 child
and dependent care qualifying person, exemptions_count and its RI, DE, OH, OR,
WI, HI and NM readers, the recovery rebates, the education credits and the
student loan interest deduction apply them symmetrically for joint returns.
Georgia keeps its own counts; the HI, WI and Treasury exemption reforms
follow the corrected count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NMSA chapter 7 article 2 bars "a dependent of another individual" from
several credits and exemptions that the model gave anyway, and counts as
dependents only those allowed under IRC 152, which leaves a return with a
claimable filer none (IRC 152(b)(1)). Now:
- the child income tax credit (7-2-18.34) needs a filer who cannot be claimed;
- the 65+ medical care credit (7-2-18.13) needs a filer who is both 65+ and
  not claimable, and it and the 65+ medical exemption (7-2-5.9) no longer
  count a dependent's age;
- the elderly property tax rebate (7-2-18) and the 100+ exemption (7-2-5.7)
  apply per filer;
- the working families credit (7-2-18.15) applies the federal childless-filer
  dependent test and the filer-only age test;
- the child day care credit (7-2-18.1) and the deduction for certain
  dependents (7-2-39) count no dependents when a filer can be claimed.
On a joint return, a spouse who cannot be claimed keeps the credits that TRD's
PIT-RC instructions say "your spouse may still qualify to claim".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the 65+ medical exemption for separate filers

NMSA 7-2-18.34(J)(2) defines the child income tax credit's "qualifying
child" by IRC 152(c), which has no identification number requirement, but
nm_ctc counted eitc_child_count, which applies the EITC's Social Security
number rule (IRC 32(c)(3)(D)). The new nm_ctc_qualifying_children counts
152(c) children whatever their Social Security number status, so a child
with an ITIN now gets the credit. It also applies 152(c)(3)(A)'s rule that
a child who is not disabled be younger than the filer (or either spouse on
a joint return), which the shared EITC helper does not.

NMSA 7-2-5.9 and the PIT-ADJ line 18 instructions give the $3,000 65+
medical care expense exemption with no halving for married filing
separately; the halving sentence on PIT-ADJ belongs to the organ donation
deduction on the next line (7-2-36(B)). The threshold stays at the PIT-ADJ
"$28,000 or more"; the statute says expenses that "exceed" $28,000, a
reading left for review.

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

Copy link
Copy Markdown
Contributor Author

Handing off to the US + core hub.

  • Head: 9a27b3640625778ef04da406fa81dd247c2d0548. It is stacked on claimable-filer-nm at 4b0709e55f, which stacks on claimable-filer-federal (23c6229b20) and Make rules for a filer claimed elsewhere independent of which spouse is labelled head #10024. Neither stacked branch has a PR yet; the owner session is "Apply unmodeled rules for filers claimed elsewhere".
  • Independent review: two rounds of GPT-6.1 Sol.
    • Round 1, Subfleet job 20261009-122618-nmctc-152c-review: REQUEST_CHANGES (the 152(c)(3)(A) relative-age rule and a wording nit). Both fixed.
    • Round 2, at this head, job 20261010-055342-nmctc-152c-review-r2: APPROVE.
    • Verdicts are in ~/reviews/us-hub/nm-ctc-152c-medical-exemption/review/.
  • Passed locally at this head through the heavy-lock runner:
    • all 748 New Mexico YAML cases;
    • the new invariants (5 passed);
    • the swap and NM claimable-filer invariants (12 passed);
    • a mutation check in which all 3 mutations were killed.
    • Real microsims for 2025 and 2026, base vs PR: nm_ctc +$3.11 and +$3.13; no change to the medical exemption.
  • CI has not run, and cannot yet. pr.yaml runs only on PRs into main, and drafts skip CI. That is why the PR is still a draft. Once claimable-filer-nm merges:
    1. retarget to main;
    2. rebase this single commit, with git rebase --onto upstream/main <old nm head> after a squash merge;
    3. mark ready;
    4. land on green CI.
  • Axiom: Encode NMSA 7-2-18.34 (NM child income tax credit, IRC 152(c) count) and 7-2-5.9 (65+ medical care expense exemption) TheAxiomFoundation/rulespec-us#1628, queued (pe-parity, dispatch-ready). The billed-encode approval is d1235 and does not block this merge.
  • Readings for the hub to queue for Max. Each keeps a default and none blocks the merge; details are in the PR body.
    1. Medical exemption at exactly $28,000: statute "exceed" or PIT-ADJ "or more". Kept: or more. No microsim records sit at $28,000.
    2. Two 65+ spouses on one joint return: $3,000 per return (kept) or per spouse.
    3. A child with neither an SSN nor an ITIN: counted (kept), or require has_tin. There is no microsim effect.
  • Follow-ups owed. No chips, per Fleet ops; full text is in ~/reviews/us-hub/nm-ctc-152c-medical-exemption/STATE.md.
    • The federal is_eitc_qualifying_child lacks the same relative-age rule. It affects the federal EITC and the CA, CO, DC, IL, MN and WA EITCs.
    • nm_eitc sizes the credit with SSN-only children, but NMSA 7-2-18.15(A) waives the federal identification requirement.

Nothing else is pending from the opening session. The worktree ~/PolicyEngine/_worktrees/nm-ctc-152c-medical-exemption is clean and pushed.

@MaxGhenis
MaxGhenis marked this pull request as ready for review October 18, 2026 23:45
@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (909176a) to head (d175a8c).
⚠️ Report is 527 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main    #10047   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         3    -1     
  Lines           76        58   -18     
  Branches         2         0    -2     
=========================================
- Hits            76        58   -18     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaxGhenis
MaxGhenis merged commit 35124b3 into main Oct 19, 2026
36 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

US + core hub merge audit, us#10047 at d175a8cf448ebcad477d7a588b1419d4bb0b0b93 (squash): Count New Mexico child credit children under IRC 152(c); do not halve the 65+ medical exemption for separate filers.

@MaxGhenis
MaxGhenis deleted the nm-ctc-152c-medical-exemption branch October 19, 2026 01:26
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