Skip to content

Count net farm and partnership earnings in SSI and fix related state benefit budgets - #10532

Open
MaxGhenis wants to merge 33 commits into
mainfrom
ssi-earned-farm-partnership
Open

MaxGhenis wants to merge 33 commits into
mainfrom
ssi-earned-farm-partnership

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10531
Fixes #10558

What and why

Count active farm profit and qualifying partnership self-employment earnings in SSI alongside Schedule C income. The earned-income list adds farm_operations_income and partnership_self_employment_net_earnings once. It excludes passive farm rent and partnership income outside the self-employment base.

SSI nets an individual’s business results before applying the statutory deduction to positive profit. Eligible spouses use their own earnings in a month with separate facility budgets. SSI applies the working student exclusion in consecutive months and carries prior use of the annual cap across separate and joint budgets. A joint budget applies one exclusion to eligible student earnings. Parent deeming uses identified spouse pairs for the parents’ means test.

Idaho restores barred farm losses before deeming, applies its tax-paid self-employment deduction from March 17, 2022, preserves supplied SSI earnings, and rounds payments up under IDAPA §§401.04, 403.06 and 514. Indiana floors each person’s net business losses and counts the resident’s actual federal SSI. The SAPN post-eligibility budget excludes a community spouse’s income under Social Security Act §1924(b)(1).

Kentucky combines the applicant’s and ineligible spouse’s earnings before the $65 and half-earnings disregard. Both deeming budgets exclude the federal $20 general disregard. The existing threshold and child-allocation rules remain the budget inputs pending a separate §8(3) conservation correction.

Connecticut calculates an ineligible spouse’s applied earnings from the deemor’s own income. Maryland budgets each person separately. Its prospective SSI uses federal countable earnings and monthly shelter support, with SSDI-only and reported-SSI fallbacks. A separate facility budget uses the applicant’s own earnings. Minnesota measures own gross earnings before the federal deduction. Oregon applies documented losses to earnings within the financial group. New Hampshire floors combined business income before counting wages.

Governing text

  • SSI classifies active farm and qualifying partnership earnings as self-employment income. SSA divides annual net earnings across the tax year and applies losses to earned income. SSA applies a person’s unused loss against their spouse’s earned income. 20 CFR 416.1110 · 20 CFR 416.1111 · 20 CFR 404.1081 · POMS SI 00820.210
  • The federal budget deducts the employer-equivalent share (7.65%) from positive combined net business profit under 42 U.S.C. §§411 and 1382a. The source conflict register records SSA’s tax-paid condition. 42 U.S.C. §411 · 42 U.S.C. §1382a · POMS SI 00820.210 A.3
  • Idaho excludes farm losses from deductions against other income under IDAPA 16.03.05.403.06. Section 401.04 applies from March 17, 2022, and deducts 7.65% of net self-employment income when it exceeds $400 and self-employment tax is paid. PolicyEngine uses modeled tax liability as a proxy for payment and preserves supplied SSI earnings. Section 514 rounds cash payments up to the next dollar. Sections 451–453 use SSI deeming procedures. IDAPA 16.03.05, PDF pages 34, 37 and 41 · 2022 IDAPA 16.03.05, PDF pages 42, 44, 51–52 and 55
  • Indiana floors each person’s combined self-employment income under IHCPPM §3410.15.00. The MED 1 example on PDF page 14 preserves a spouse’s full Social Security when the other spouse has a business loss. Section 5005.05.00 applies budgeted income to SAPN, with the $52 allowance, $22 maximum and $30 reduced SSI amount. Social Security Act §1924(b)(1) deems no income of the community spouse available to the institutionalized spouse. IHCPPM Chapter 3400, PDF pages 12–14 · IHCPPM Chapter 5000, PDF page 2
  • Kentucky adopts the medically needy income policy under 921 KAR 2:015 §8(1). Section 8(6) combines earnings before the $65 and half-earnings disregard, and section 8(8) bars the SSI $20 general exclusion. Kentucky’s Volume IVA manual bars a business loss from reducing another business’s income (MS 2450 C.8(b)); that text remains unverified against the current official manual. PolicyEngine also keeps business losses out of wages and spouse earnings. 921 KAR 2:015 §8 · Volume IVA, MS 2450 (unverified)
  • Connecticut DSS reduces a deemor’s self-employment earnings by business costs before calculating the income to deem, so an ineligible spouse’s applied earnings come from the deemor’s own income. Maryland DHS applies the earned income disregard to the individual and describes PAA as a one-person assistance unit, so each person is budgeted separately; prospective federal SSI is computed under the federal rules. Connecticut UPM 5020.70 · COMAR 07.03.07.07 · COMAR 07.03.07.08
  • New Hampshire specifies one self-employment income amount per individual and floors it at zero. Minnesota uses SSI financial responsibility and exclusions, and measures gross income before deductions, so its gross earnings come before the federal self-employment deduction. Oregon excludes losses only from other earned income of the financial group (OAR 461-150-0095(2)). He-W 654.01 · Minn. Stat. §256D.435 · Minn. Stat. §256D.35, subd. 10

Invariants and intentional exceptions

  • Moving profit among Schedule C, active farm income and qualifying partnership income preserves SSI earned income. SSI payments are nonincreasing in that profit in the property tests.
  • The source-list differential verifies equivalence when the added sources are zero.
  • Idaho and Indiana use their state-specific business earnings bases.
  • The signed-loss cases exercise changes to spouse earnings, child allocations, student exclusions, the SGA wage test and state-specific loss rules.

Reader audit

The raw earned-income list feeds SSI, California’s Working Disabled Program and Wisconsin’s Caretaker Supplement. Monthly SSI budgets apply spousal loss offsets where the budget permits them. Federal SSI, MSP and applicable Medicaid paths use the adjusted federal earnings input. The Medicaid LTSS annual-source default sums own earnings before the federal self-employment deduction and monthly conversion. Reported monthly earnings take precedence.

Connecticut calculates an ineligible spouse’s applied earnings from the deemor’s own income, and Maryland budgets each person separately. Minnesota uses SSI’s loss-adjusted earnings for spouse pooling and deeming, and measures own gross earnings before the federal deduction. Oregon applies documented losses to earnings within the financial group. Kentucky and New Hampshire use their state-specific business calculations. SGA, Kentucky, New Hampshire and Indiana share the list of four modeled business sources.

Readers of ssi_countable_income

Five production files reference the annual variable directly. The two Medicaid formula readers are is_medically_needy_for_medicaid and is_optional_senior_or_disabled_for_medicaid. The input adapters ssi_countable_income_monthly and ca_capi_countable_income also accept the annual input. _ssi_countable_income_without_loss_offset checks for a supplied annual budget before applying state adjustments.

Readers of ssi_countable_income_monthly

Twenty production files reference the monthly variable directly.

Use Readers
SSI payments and annual compatibility uncapped_ssi, uncapped_ssi_without_spousal_deeming, ssi_countable_income
SSI parent resource deeming ssi_resources_deemed_from_ineligible_parent
Shared supplement calculations _ssi_state_supplement, _ssi_countable_income_without_loss_offset
State calculations ca_state_supplement_person, fl_oss, fl_oss_eligible, ia_ssa_federal, ia_ssa_smme_countable_income, in_ssp_rcap, la_oss, nc_sa_eligible, ny_ssp, sc_ssi_state_supplement, sc_ssi_state_supplement_eligible, sc_ssi_state_supplement_pna, tx_ssi_state_supplement_eligible, va_ag_countable_income

SNAP unearned income counts ssi and most state supplement payments, including seven of the eight whose income calculations this PR edits: ct_ssp_person, id_aabd, in_ssp, ky_ssp, md_paa, mn_msa_person and nh_ssp. Oregon’s or_ssp is not listed there. Indiana’s SAPN payment reaches SNAP through in_ssp. SNAP income sources

SGA, disability and the couple computation

SSA keeps wages in the SGA earnings test when business costs exceed receipts. PolicyEngine adds gross wages to combined net business earnings floored at zero. It compares the exact annual sum with twelve times the monthly limit. When SSI earnings are supplied, the formula uses that input and restores wage-limited pretax health premiums. The candidate us:ssi-sga-self-employment-loss records the business-loss rule. POMS DI 10505.015 D.3 · POMS DI 10510.012 B · POMS DI 10505.010 A · 20 CFR 416.975

When a spouse’s farm profit lifts earnings over the SGA threshold, the disability finding can change. SSI then uses the ineligible-spouse deeming budget instead of the disability-based couple budget. The disability and payment files contain cases for that transition and for wages that remain over the threshold despite a business loss.

Main and open pull requests

#10141 and #10146 are in main. This PR retains their identified-spouse and identified-couple calculations, monthly SSI budgets and 20 CFR 416.1163(e)(2) cap. It also retains the main-side benefit, eligibility and input handling in Medicaid, MSP and the state readers.

  • SSI applies the working student exclusion against each month’s budget and carries the annual cap across facility transitions. It applies the couple computation and spousal deeming cap monthly. Kentucky supplies its state earnings and disregard. Idaho and Indiana substitute their state earnings in the relevant budgets.
  • Connecticut keeps the monthly deeming input and calculates an ineligible spouse’s applied earnings from the deemor’s own income. Maryland retains monthly couple status and immigration-gated deeming. Its SSDI-only and reported-SSI fallbacks use federal countable earnings and monthly shelter support. The reported-SSI fallback uses own earnings in a separate facility budget. Minnesota keeps monthly earnings and spouse pooling and measures own gross earnings before the federal deduction. Oregon applies documented losses within the financial group. New Hampshire keeps parental allocations and floors combined business income before counting wages.
  • MSP and Medicaid retain main’s eligibility and monthly deeming paths. The shared federal input applies allowable spousal loss offsets. The Medicaid LTSS annual-source default measures own earnings before the federal self-employment deduction and spousal deeming.
  • The shared YAML files contain both sides’ cases. This PR appends the new parental deeming, marital earnings, California, Indiana, Maryland and New Hampshire cases. The source conflict register retains both sides’ entries.

PR #11316 edits _ssi_parental_deemed_income.py and is_ssi_ineligible_parent.py. PR #10224 shares the Indiana SAPN YAML, and PR #10382 shares the South Dakota independent-living YAML. Forty-one other open PRs share only source_conflicts/candidates.yaml.

Register overlaps are #10049, #10116, #10127, #10131, #10527, #10631, #10654, #10655, #10664, #10669, #10670, #10673, #10674, #10678, #10696, #10700, #10713, #10715, #10720, #10722, #10770, #10771, #10772, #10806, #10909, #10927, #10943, #11003, #11041, #11086, #11095, #11098, #11107, #11108, #11145, #11229, #11289, #11292, #11296, #11301, #11320.

Validation

Regression cases (monthly unless annual):

Rule Case Expected
Federal net self-employment earnings $10,000 annual farm profit $9,235 annual earnings; $342.29 countable for SSI and MSP
Separate facility budget spouses with $6,000 wages and a farm loss, one in a facility in January $500 own earnings in January; pooled $300 in February
Parent identity unrelated adult with $40,000 farm profit in the default marital unit both aged parents stay eligible
Working student timing $19,200 annual wages and a $6,000 farm loss $0 in January, $42.50 in September, $507.50 in October
Working student ownership deemor’s exclusion applies to that person’s earnings $463.50 deemed to the child
Supplied SGA earnings $18,000 supplied annual earnings and a $6,000 Schedule C loss not SGA ($1,500 a month)
Indiana SAPN $30 federal SSI; community spouse with $550 wages and a $100 farm loss $52 − $30 = $22
Idaho deduction and rounding $7,200 annual farm profit and $3,600 Social Security $524.55 countable; $21 payment
Idaho parent $37,644 parent wages and a $7,200 farm loss $545 − ($532 − $20) = $33
Kentucky general exclusion $600 annual applicant wages; $20,000 annual ineligible-spouse wages ($20,600 ÷ 12 − $65) ÷ 2 = $825.83
Connecticut deemor earnings $1,000 deemor applied earnings $65 + ($1,000 − $65) ÷ 2 = $532.50 disregard
Maryland one-person budget spouse’s farm profit $0 countable for the claimant; $610 federal budget
Oregon financial group $6,000 annual wages; spouse’s $2,400 annual farm loss $300 countable
Minnesota gross income $12,000 annual farm profit; $1,200 annual unearned $1,100 gross

Existing expectations that change, each from the 0.9235 factor on positive business profit or the corrected budgets:

  • ssi_earned_income.yaml: $100,000 → $92,350; $60,000 → $55,410; $750 → $692.625; $300 → $277.05; $2 → $1.9235.
  • ssi_engaged_in_sga.yaml: $24,000 → $22,164 (three cases); $18,000 → $16,623.
  • ssi.yaml: profit cases use $55,410 and $27,195 = ($55,410 − 12 × $85) ÷ 2; the mixed-wage case pays $6,631.50 instead of $6,402.
  • is_ssi_disabled.yaml: farm-profit payment $6,402 → $7,320 ($1,491 − ($1,847 − $85) ÷ 2 = $610 a month).
  • ssi_blind_or_disabled_working_student_exclusion.yaml: 2025 annual countable $2,560 → $2,857.50.
  • id_aabd.yaml: Cases 7 and 8 $22.50 → $23; Case 17 January $22.92 → $53.
  • in_ssp_sapn.yaml: Case 14 $0 → $22.
  • ct_ssp_countable_income.yaml: partnership-loss claimant countable $592.50 → $800.83.
  • ky_ssp_countable_income.yaml: each case rises by $10, from removing the $20 general exclusion before halving (for example $790.83 → $800.83).
  • md_paa_countable_income.yaml: each person’s own income only (for example Case 12 claimant $4,490 → $0).

A Linux run passed 677 cases across 31 YAML files on the branch and on a merge with main. The spousal-deeming fixture now uses net self-employment earnings, and the December shelter-support fixture lets Maryland and California compute countable income. Each household has a new YAML case, traced by hand. CI runs the changed files at this head.

  • Kentucky’s couple cases count $46.25 per spouse and exclude wages of the child or unrelated adult. In the two-couple case the applicants count $20,000 and $30,000 in annual spouse earnings.

Child-allocation Case 13 sets is_in_k12_school: false, which turns off main’s default school attendance, so no student exclusion applies and the case tests the farm-loss offset. The SSI annual-input test registers the loss-adjusted earnings variable in its small system.

Not changed here: Kentucky’s ineligible-spouse income conservation under 921 KAR 2:015 §8(3), which predates this PR.

impact: pending

axiom: TheAxiomFoundation/rulespec-us#1970 queued

🤖 Generated with Claude Code

MaxGhenis and others added 3 commits October 29, 2026 07:33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gets

Net excess losses between co-resident spouses before SSI, MSP and Medicaid exclusions. Keep Connecticut and Minnesota own/deemed budgets consistent, prevent negative child/student exclusions, and isolate New Hampshire self-employment losses from wages. Add vectorized property and differential coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use Kentucky's own business-source floors and preserve Minnesota gross-income premium restoration without resurrecting losses. Add SD and WY source-presence regressions and complete direct reader coverage across 23 states, including loss-to-profit monotonicity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 29, 2026 14:42
MaxGhenis and others added 4 commits October 31, 2026 05:23
…ings

POMS SI 00820.210 B.2.c binds SSI, not Connecticut's or Maryland's own
programs. UPM 5020.05 A, 5020.70 C.3 and 5030.10 A count each person's
own earnings and reduce self-employment earnings only by self-employment
expenses; COMAR 07.03.07.08 sets deductions for an individual, and
Maryland DHS states that "The assistance unit is always one person."

Connecticut's three budget readers now read ct_ssp_own_earned_income,
the person's signed SSI earnings floored at zero; spouse-deemed earnings
still net an own loss through the spouse's after-loss SSI earnings.
Maryland PAA reads ssi_marital_earned_income only under the couple
computation and the applicant's own ssi_earned_income otherwise. SSI and
its spouse-deemed amounts keep the POMS treatment.

Tests: re-derive the Connecticut spouse-loss cases and pin the hub's
probe couple; add Maryland own-earnings and reverse-direction cases, a
California supplement case with farm profit, farm and partnership SGA
cases, a couple whose farm profit ends the couple computation, the
issue #10558 parent-deeming case, and a generated property that a
spouse's loss never changes the applicant's CT or MD figures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extend the CT/MD property so that, where SSI deems no spouse income,
the applicant's Connecticut gross earned income, earned disregard and
countable earned income stay the same when only the spouse's business
loss changes, and the gross earned income equals the applicant's own
earnings. SSI itself, which Connecticut counts as unearned income, may
still change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Connecticut spouse in the generated property has a business loss.
Check that ct_ssp_own_earned_income stays at or above zero for all of
them, so an own residual loss cannot be deducted again from earnings
that SSI already nets through the spouse's after-loss amount.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POMS DI 10505.015 D.3 says a self-employment loss does not reduce total
earnings when the individual also has wages. Counting farm and partnership
earnings widened the defect main already had for Schedule C losses, so SGA
earnings are now wages plus the business net floored at zero. Losses still
net between businesses (20 CFR 404.1081(c), POMS DI 10510.012 B).
ssi_earned_income keeps the signed amount its other readers need.

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

Copy link
Copy Markdown
Contributor Author

Picking this up for the US hub. I'll post a hand-off comment here when it's ready.


Generated by Claude Code

Properties check that SGA earnings never fall below wages, rise with wages,
net losses between businesses, and match the signed sum when no business
source is negative. The backlog records us:ssi-sga-self-employment-loss:
the regulations do not settle it, so the agency's POMS DI 10505.015 D.3
reading governs.

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

Copy link
Copy Markdown
Contributor Author

Ready for hub review

Head: 45c6214a9e8691b6ad88fb9a7bd2bb45f6631c7a (two commits on 7f5467b8e1, fast-forward; main not merged).

What the item asked and how it's resolved

  1. The reader. ssi_engaged_in_sga.py:23-49 computes SGA earnings as wages plus the net of the other entries in gov.ssa.ssi.income.sources.earned, floored at zero. It's written as ssi_earned_income + max(-business_net, 0) plus the existing premium restore (lines 33-46). With ssi_earned_income computed, that equals employment_income + max(business_net, 0), and it keeps working where a test supplies ssi_earned_income directly, as several SSI, MSP, state and partner files do. Without employment_income in the list, the result is the floored net. POMS DI 10505.015 and DI 10510.012 are added to reference; the comment at lines 29-32 gives the reason. ssi_earned_income is unchanged.
  2. YAML, ssi_engaged_in_sga.yaml:80-163, 2026, SGA $1,690 a month:
Case (line) SGA earnings a month Main 8cd756f5f5 Old head 7f5467b8e1 New head
Wages 21,600 + farm loss 6,000 (84) 1,800 engaged not engaged (1,300) — fails engaged — passes
Wages 21,600 + Schedule C loss 6,000 (96) 1,800 not engaged (1,300) not engaged — fails engaged — passes
Wages 21,600 + partnership loss 6,000 (107) 1,800 engaged not engaged — fails engaged — passes
Farm 30,000 + partnership −6,000, no wages (118) 2,000 not engaged engaged — passes engaged — passes
Farm 24,000 + partnership −6,000, no wages (129) 1,500 not engaged not engaged — passes not engaged — passes
Farm loss 6,000, no wages (141) 0 not engaged passes passes
Wages 21,600, pretax premiums 2,400, Schedule C loss 3,000 (151) 1,800 not engaged (1,550) not engaged — fails engaged — passes

The old-head and new-head columns were run; the main column follows from main's formula, which matches the old head apart from the source list (read, not run).
3. Couple path. ssi_spouse_farm_sga.yaml:82: the spouse has wages of $21,600 and a $6,000 farm loss. is_ssi_disabled is [false, false]; it fails at the old head (1,300 a month makes the spouse disabled) and passes now.
4. Properties, test_ssi_earned_sources_properties.py:836-919: test_sga_earnings_never_fall_below_wages_and_rise_with_wages (wages above SGA always mean SGA, and status is nondecreasing in wages); test_sga_without_business_losses_matches_signed_sum (no negative source: same as the old formula's signed sum); test_sga_nets_losses_between_businesses (moving the business net into one source changes nothing). Each test generates real cases and also carries @examples.
5. Mutants, one process each, code restored after each:

Mutant Killed by
Remove the floor (restored_loss = 0) YAML lines 84, 96, 107, 151; couple case line 82; test_sga_earnings_never_fall_below_wages_and_rise_with_wages
Floor each business source separately YAML line 129 ("net below"); test_sga_nets_losses_between_businesses (added after the first run showed only the YAML case caught it)
  1. Register. source_conflicts/candidates.yaml:9719, us:ssi-sga-self-employment-loss: program ssi, state ruled, pe_us.follows: gap-fill; sources 20 CFR 416.971 to 416.975 (regulation) and POMS DI 10505.015 D.3 (manual); the two readings; the step 2 farm-loss example; pe_us.prs → Count net farm and partnership earnings in SSI and fix related state benefit budgets #10532. No # Source conflict marker.
  2. Body. New "Self-employment losses and wages" subsection under "SGA, disability and the couple computation", with the POMS quote, main's existing Schedule C defect, and the fix for every business source. The Idaho AABD / Indiana SAPN paragraph is now a stated limit. There's a new status line, a validation paragraph for this revision, and an updated reader-audit row. impact: pending (hub), the axiom: line and the closing paragraph are kept. The changelog fragment gained one sentence.

Tests (one file per process)

ssi_engaged_in_sga.yaml 15/15; ssi_spouse_farm_sga.yaml 3/3; property file 13/13 (91 s pytest, 153 s with startup; the three new SGA tests take about 10 s of call time); test_source_conflicts.py 103/103. SSI files with wages and a business loss: working student exclusion 11, from_ineligible_parent 6, ssi_ineligible_child_allocation 5, ssi_earned_income 14, ssi_earned_income_after_spousal_loss 4, ssi_marital_earned_income 6, ssi.yaml 7, is_ssi_disabled 9. I also ran NH SSP countable 5, KY SSP countable 15, MD PAA countable 6 and MSP countable 21. All pass. ruff format, ruff check and git diff --check pass. No microsimulation, and no partner file touched or moved.

CI

The latest Pull request run at this head, 41402652626, concluded success. It was pushed 06:52 UTC and checked every 5 minutes or more.

Judgment calls

  • Formula form. I added the net loss back to ssi_earned_income instead of rebuilding wages plus the business net from inputs. The two are equal when ssi_earned_income is computed. The add-back keeps the SGA test reading the earned-income input that existing tests and partner files supply directly. A from-inputs version would have moved those cases.
  • Wages in SGA are employment_income as entered. The old formula used the signed value too, so the "no negative business source equals the old formula" property holds exactly.
  • Body readback mismatch (needs the hub). GitHub's readback of the body differs from my file in two ways, and the same happened through both REST and the MCP update tool. (1) Four long links that were already in the body came back wrapped in code spans, so they no longer render as links: the UPM 5000.01 and UPM 5025.15 links in the Connecticut reader-audit row, the OAC 317:35-5-42 link in the Oklahoma row, and the 10A NCAC 71P .0905 link in the nc_sa_eligible row. The session's GitHub write path seems to do this to long URLs. I didn't try to get around it. The hub can restore those four links from its own client. (2) The closing "🤖 Generated with Claude Code" line was dropped. Everything else matches.
  • Unverified. ssa.gov, ecfr.gov and the other sources were unreachable from this VM. The POMS DI 10505.015 D.3 quote is the brief's. My paraphrase that "20 CFR 416.971 to 416.975 do not settle the question" restates the hub's ruling, and I haven't read those sections here.

Proposed follow-up

  • Idaho AABD and Indiana SAPN: stop SSI's business-loss offset against wages. Both states bar a business loss against other income (IDAPA 16.03.05.403.06; IHCPPM 3410.15.00, an inference for SAPN), yet both read ssi_countable_income. Give each its own earned-income amount with losses floored, as NH and KY do.

Generated by Claude Code

@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Ready for hub review
VERDICT: REQUEST_CHANGES
45c6214
METHODOLOGY_CHOICE: yes

Round 2, range 6cb74d7c4e..45c6214a9e. The PR head has not moved past 45c6214a9e.

The SGA change does what the hub's ruling says. I proved its algebra, ran all seven cases at current main and at this head, and four mutants are each killed. All of round 1's findings are closed except the Kentucky #10141 gap, which is a merge-time task.

Two things block it:

Findings

P1: Idaho AABD and Indiana SAPN now let a farm or partnership loss reduce wages

  • Where: policyengine_us/variables/gov/states/id/dhw/aabd/id_aabd.py:33 and policyengine_us/variables/gov/states/in/fssa/ssp/in_ssp_sapn.py:24. Both read ssi_countable_income. The PR doesn't change either file, but its source list now feeds farm and partnership losses into them.

  • What the state rules say: the body cites IDAPA 16.03.05.403.06, "Loss of Farm Income Subtracted From Other Income", as a disallowed expense. It cites IHCPPM 3410.15.00: "Self-employment business losses cannot be used to offset or reduce other, non-self-employment income (i.e. wages)". I couldn't open either source from this VM.

  • What happens: on main, neither program saw a farm or partnership loss, so the result matched the state rule. At this head, SSI's loss offset passes through to both.

  • Idaho witness, 2026-01: age 70, Social Security $6,000, wages $1,800, id_aabd_living_arrangement: SINGLE.

    Case Main 4bfc548de3 This head
    No loss $22.50 $22.50
    Farm −$1,200 $22.50 $53.00
    Partnership −$1,200 $22.50 $53.00
    Schedule C −$1,200 $53.00 $53.00

    The Schedule C row is the same defect already on main (a follow-up). The farm and partnership rows are new here.

  • Indiana witness, 2026-01: age 70, wages $2,400, in_ssp_sapn_eligible: true, medical treatment facility.

    • Farm −$1,200: SAPN is $0 on main and $22 at this head. SSI rises to $22.50 and countable income falls to $7.50.
    • Under 3410.15.00, budgeted income stays at least the $57.50 that wages alone give, so SAPN should stay $0.
    • Schedule C −$1,200 already gives $22 on main.
  • The body's claim is false. The body (the "Limit: Idaho AABD and Indiana SAPN" paragraph) says "both still inherit SSI's offset through ssi_countable_income, as Schedule C losses already do on main. This PR does not change that". It does change it, for the two new sources.

  • Fix (smallest, NH-style): add one helper and point both readers at it. Businesses still net against each other, and a net loss stops reducing wages. In a scratch copy, this gives Idaho $22.50 and Indiana $0 for all three loss sources.

    # policyengine_us/variables/gov/ssa/ssi/eligibility/income/ssi_countable_income_without_business_loss_offset.py
    from policyengine_us.model_api import *
    from policyengine_us.variables.gov.ssa.ssi.eligibility.income._apply_ssi_exclusions import (
        _apply_ssi_exclusions,
    )
    
    
    class ssi_countable_income_without_business_loss_offset(Variable):
        value_type = float
        entity = Person
        label = "SSI countable income without a net business loss offsetting wages"
        unit = USD
        definition_period = MONTH
        reference = (
            "https://adminrules.idaho.gov/rules/current/16/160305.pdf#page=34",
            "https://www.in.gov/fssa/ompp/files/Medicaid_PM_3400.pdf#page=12",
        )
    
        def formula(person, period, parameters):
            year = period.this_year
            sources = parameters(year).gov.ssa.ssi.income.sources.earned
            business = [s for s in sources if s != "employment_income"]
            restored_loss = max_(-add(person, year, business), 0) if business else 0
            earned = person("ssi_earned_income", year)
            unearned = person("ssi_unearned_income", year)
            with_offset = _apply_ssi_exclusions(earned, unearned, parameters, year)
            without_offset = _apply_ssi_exclusions(
                earned + restored_loss, unearned, parameters, year
            )
            return (
                person("ssi_countable_income", period)
                + (without_offset - with_offset) / MONTHS_IN_YEAR
            )
    • In id_aabd.py and in_ssp_sapn.py, replace person("ssi_countable_income", period) with person("ssi_countable_income_without_business_loss_offset", period). Leave SAPN's ssi term alone: the federal payment correctly follows POMS.
    • Add the two witnesses above as YAML cases in id_aabd.yaml and in_ssp_sapn.yaml.
    • Limits: the adjustment is per person, so it approximates couple and deeming cases. Idaho's rule names only farm losses; whether Schedule C losses should also stop offsetting wages there is the hub's call. Fixing the Schedule C path too is the simplest consistent choice, and it moves cases that main already gets wrong.
    • The SGA reader computes the same max_(-business_net, 0), so a shared helper would avoid a third copy.
  • Command: a Simulation(situation=...) probe of ssi_countable_income, ssi, id_aabd and in_ssp_sapn for 2026-01, run with the same interpreter at main, at this head and at the fix tree. Outputs are as quoted above.

P2: The PR conflicts with main in five files

  • Status: GitHub reports mergeable_state: dirty. git merge-tree --write-tree origin/main pr-10532 (main 4bfc548de3, 82 commits past the merge base 8cd756f5f5) gives five content conflicts:
    • msp_countable_income.yaml, ssa/ssi/ssi.yaml and ca_state_supplement.yaml (two hunks): append/append. Keep both sides.
    • ky_ssp_countable_income.py: Count income of aged, blind, or disabled people who fail SSI's noncitizen test #10240 only added a NOTE comment above is_eligible. Keep the PR's body and main's comment.
    • md_paa_countable_income.py: take main's immigration-gated spousal_deemed block. Drop its duplicate both_eligible = line, which the PR already defines higher up.
  • Why it matters: Count income of aged, blind, or disabled people who fail SSI's noncitizen test #10240 also changed ssi_countable_income to count the income of aged, blind or disabled noncitizens. So the green CI at this head (run 41402652626: every job succeeded) predates that interaction. The landing merge needs its own CI run.

P2: After #10141, Kentucky still counts a third adult's earnings as the couple's

P3 notes

  1. Directly supplied ssi_earned_income plus a business input overstates SGA (ssi_engaged_in_sga.py:34).
    • The add-back assumes ssi_earned_income already contains the business net.
    • Witness: ssi_earned_income: 18_000 and self_employment_income: -6_000, no wages. Main says not engaged ($1,500 a month). This head says engaged: it computes $24,000, or $2,000 a month.
    • No existing test reaches this. I parsed every test YAML: 237 people supply ssi_earned_income, and none also supplies a business source.
    • The body's sentence "keeps working where a test supplies ssi_earned_income directly" holds only when no business source is also supplied. Add that condition to the body and the code comment.
  2. A negative employment_income reduces business earnings in SGA.
    • Witness: wages −$5,000 plus Schedule C $25,000 gives $20,000, so not engaged. Schedule C alone gives $25,000, so engaged.
    • Main gives the same result, so this is a follow-up, not this PR's defect. POMS D.3 speaks of wages, which can't be negative.
    • Follow-up fix: use max_(employment_income, 0) for the wage term.
    • The "matches the signed sum" property draws wages from 0 up, so it would be unaffected.
  3. The couple case doesn't separate this head from main, and it pins no payment (ssi_spouse_farm_sga.yaml:82).
    • I confirmed the spouse flip. Wages of $1,800 a month are above $1,690, so the spouse is engaged, not disabled, and an ineligible spouse at this head.
    • On main the farm source isn't counted, so is_ssi_disabled is [false, false] there too. Only the previous head fails the case.
    • Recomputed by hand: the spouse's SSI earnings after the loss are $15,600, or $1,300 a month. Deemed countable income is ($1,300 − $85) / 2 = $607.50. The head receives $1,491 − $607.50 = $883.50 a month, which is $10,602 a year.
    • Run: ssi is [10602, 0] at this head and [7602, 0] at main, since main deems $21,600 of wages ($1,491 − $857.50 = $633.50 a month).
    • Add ssi: [10_602, 0] so the case pins the loss's effect on the deemed amount.
  4. Register entry (source_conflicts/candidates.yaml:9719):
    • What matches: program: ssi, state: ruled, follows: gap-fill, code and prs all match the ruling and the code. The example matches the YAML case at line 84.
    • Gaps:
      • The entry has no years. 306 of the 311 entries carry one; add years: {from: 1975, type: calendar}, the source list's start date.
      • sources omits 20 CFR 404.1081(c) and POMS DI 10510.012 B, although the netting half of the reading rests on them. Add both.
      • The 416.971–416.975 url opens only 416.971.
      • readings.statute begins "No statute is supplied". Reword it to "No statute or regulation settles it."
    • Marker: HUB-PROTOCOL.md says markers go in only after landing, because the guard rejects a marker whose entry isn't in the pinned register. So the absence of a # Source conflict marker is correct for a ruling PR. test_source_conflicts.py passes (103).
  5. Property tests (test_ssi_earned_sources_properties.py:836-919):
    • test_sga_nets_losses_between_businesses compares two layouts of the same business net. It would also pass for a formula that ignores businesses, or for one with no floor. It catches only per-business flooring, which mutant m2 confirms. The no-loss property covers the "ignore businesses" case, so together they hold.
    • The wage test does reach cases with both wages and losses: wages run 0–40,000 and each source −30,000 to 30,000. But its monotonicity assertion holds for the old formula too, so every kill comes from its first assertion (wages above SGA imply engaged).
  6. The body's main column. I ran all seven cases at current main 4bfc548de3. All seven match the table's main column: engaged, not engaged, engaged, not, not, not, not.

Mutants

Each mutant ran in its own scratch tree, one process per file, with networking disabled (unshare -rn). I restored nothing in the real tree, and git status is clean.

Mutant Killed by
m1: no floor (restored_loss = 0) ssi_engaged_in_sga.yaml: farm, Schedule C, partnership and premium wage-loss cases (4 failed); ssi_spouse_farm_sga.yaml spouse case; test_sga_earnings_never_fall_below_wages_and_rise_with_wages
m2: floor each business separately ssi_engaged_in_sga.yaml "net below" case (1 failed); test_sga_nets_losses_between_businesses
m3 (mine): floor total earnings, not the business net (max_(-ssi_earned_income, 0)) the same 4 YAML cases, the spouse case, and the wage property
m4 (mine): drop the payroll-premium restore ssi_engaged_in_sga.yaml both premium cases; test_sga_earnings_never_fall_below_wages_and_rise_with_wages and test_sga_without_business_losses_matches_signed_sum

The unmutated control passes 3 of 3 SGA properties.

Checked and sound

  • SGA algebra. ssi_earned_income = E + B − min(max(E,0), P), where E is wages, B the business net and P the premiums. The reader returns that + max(−B, 0) + min(max(E,0), P) = E + max(B, 0) exactly. Without employment_income in the list it returns B + max(−B, 0) = max(B, 0). The rule applies in every year, since the source list starts in 1975 and the SGA parameter is read for the period, and to every person and filing status.
  • The only path. is_ssi_disabled is meets_ssi_disability_criteria & ~ssi_engaged_in_sga, and ssi_engaged_in_sga is the only SGA reader. So head and spouse read the same formula on every path. Iowa SMME's "SGA applicant" rests on is_ssi_aged_blind_disabled, which uses the same formula.
  • Hand values. The 2026 non-blind SGA amount is $1,690 (parameter read). The seven cases give $1,800, $1,800, $1,800, $2,000, $1,500, $0 and $1,800 a month, matching the YAML comments.
  • Round 1 findings, at this head:
    • P1 Kentucky sum(): closed. CI run 41402652626 is green, including the code-health shard.
    • P2 Kentucky wage reading: closed by the hub's ruling. ky_ssp_earned_income floors each source and adds wages separately.
    • P3.1 Kentucky deeming: closed. ky_ssp_earned_income_deemed_from_ineligible_spouse uses the spouse's own Kentucky earnings.
    • P3.3: closed. The body cites both settled rulings, and the code matches the NH ruling.
    • P3.4: closed. Generated properties now draw negative business income for either spouse, children and students, with NH and KY properties.
    • P3.5: closed. CT and MD now use own earnings, per the CT/MD ruling.
    • P3.6: closed. The axiom: line is now in the queued form, and impact: pending (hub) is present.
    • P3.2: still open; see the Apply 416.1163(e)(2) to deemed SSI and identify SSI couples by marriage, not tax roles #10141 finding above.
  • Tests at this head, one file per process, all passing:
    • ssi_engaged_in_sga.yaml 15, ssi_spouse_farm_sga.yaml 3, test_source_conflicts.py 103, and the property file (13 passed).
    • Every other YAML file this PR changes: msp_countable_income 21, from_ineligible_parent 6, ssi_ineligible_child_allocation 5, ssi_blind_or_disabled_working_student_exclusion 11, ssi_earned_income 14, ssi_earned_income_after_spousal_loss 4, ssi_marital_earned_income 6, ssi.yaml 7, ca_state_supplement 10, ct_ssp_countable_income 12, ky_ssp_countable_income 15, md_paa_countable_income 6, mn_msa_gross_income 4, mn_msa_person 18, nh_ssp_countable_income 5, sd_ssp_independent 2 and wy_ssp_eligible 2.
  • In the Apply 416.1163(e)(2) to deemed SSI and identify SSI couples by marriage, not tax roles #10141 merge tree (with the blocker's resolution and the KY fix above): ssi_marital_earned_income 6, ssi_earned_income_after_spousal_loss 4, ky_ssp_countable_income 15, ssi_spouse_farm_sga 3, ssi.yaml 7 and msp_countable_income 21 all pass.
  • With the Idaho/Indiana fix applied, the existing files pass: id_aabd 6, Idaho integration 8, in_ssp_sapn 4, Indiana integration 9 and edge_cases 25.
  • CI. The latest Pull request run at this head, 41402652626, concluded success. All 34 jobs succeeded, including Household API Partners.
  • Partner tests. No file under tests/policy/baseline/partners/ changed. Household API Partners and every Baseline shard pass at this head, so no partner value moves. Nothing under .github/ changed.
  • Docs. The body has impact: pending (hub), axiom: TheAxiomFoundation/rulespec-us#1970 queued and the closing line. The hand-off said the closing line was dropped; it is present in the body now. The changelog fragment's new sentence matches the code.
  • Open-PR overlap. I compared every open PR's file list with this PR's. Overlaps: Limit SSI ineligible-child allocations to co-resident children and compute SSI and Medicaid deeming by month #10146 (17 files), Apply 416.1163(e)(2) to deemed SSI and identify SSI couples by marriage, not tax roles #10141 (5), Build omitted household marital units from explicit couples and the tax-role fallback #10000 (ssi_marital_earned_income.yaml), and Store California state supplement parameters as state shares #10600 and Compute the California state supplement per person #10601 (ca_state_supplement.yaml).
  • Baseline moves, so the hub needs a population check:
    • Through SGA: anyone with wages and a net business loss (Schedule C on main too), or with farm or partnership earnings near the SGA amount.
    • Through the source list: everyone with farm or partnership earnings.
  • Variables the impact pair needs, beyond ssi, msp_part_b_premium_coverage and the state supplements:
    • SGA and disability readers: is_ssi_disabled, is_ssi_aged_blind_disabled, ssi_category, disabled_head and disabled_spouse (NH and NJ tax exemptions, the NJ property tax credit), is_hud_elderly_disabled_family and is_hud_dependent (HUD subsidies), is_in_medicaid_medically_needy_category, medicaid_work_requirement_eligible, is_optional_senior_or_disabled_for_medicaid, medicaid_optional_senior_or_disabled_income_deemed_from_ineligible_spouse (so medicaid), nm_liheap, ms_ccpp, ia_ssa, and the CA state supplement payment standard.
    • Own-income readers of the SSI source list or ssi_earned_income: ca_wdp_gross_earned_income, wi_cts_gross_earned_income, vt_aabd_ep_countable_income, _ok_ssp_income (OK SSP), sd_ssp_independent, wy_ssp_eligible, co_oap, or_ssp_countable_income, nc_sa_countable_income, oh_rss_countable_income, va_ag_countable_income, the CT SSP, MD PAA, KY, NH and MN MSA outputs, and id_aabd and in_ssp_sapn.
    • Totals: household_net_income and spm_unit_benefits.

What I couldn't check

  • Sources. ssa.gov, secure.ssa.gov, ecfr.gov and govinfo.gov were all refused by this VM's proxy (403, or host not allowed). So I did not read POMS DI 10505.015 D.3, DI 10510.012 B, 20 CFR 404.1081(c) or 416.971–975, IDAPA 16.03.05.403 or IHCPPM 3410.15.00.
    • The D.3 quote rests on the hub's fetch.
    • Whether DI 10510.012 B and 404.1081(c) support netting between businesses for SGA is unverified here. 404.1081(c) is an SE-tax NESE rule; the body cites DI 10510.012 B only as "starts from NESE".
  • Parity. rulespec-us#1970 is outside the repositories this review could read, so I couldn't compare its SGA companion rows with this YAML.
  • Population impact. That needs microdata I don't have.

Generated by Claude Code

@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Picking this up for the US hub. I'll post a hand-off comment here when it's ready.


Generated by Claude Code

… SAPN

SSI now nets farm and partnership losses against wages, and Idaho AABD
and Indiana SAPN read SSI countable income, so those losses reached both
programs. IDAPA 16.03.05.403.06 bars only a farm loss from reducing other
income; IHCPPM 3410.15.00 bars any net self-employment loss. A shared
helper restores the barred net loss and reapplies the SSI exclusions.

Also pin the spouse farm-loss SSI payment, note the SGA loss add-back's
assumption, and complete the SGA source-conflict register entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: msp_countable_income.yaml, ssi.yaml and ca_state_supplement.yaml
keep both sides' appended cases (the PR's CA farm case moves to Case 17
after main's Cases 10-16; ssi.yaml's header names both full-calculation
groups). ky_ssp_countable_income.py keeps the PR's body plus main's NOTE.
md_paa_countable_income.py takes main's immigration-gated spousal_deemed
block without its duplicate both_eligible line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main now zeroes ssi_countable_income only for people who are not aged,
blind or disabled, so the helper uses the same gate.

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

Copy link
Copy Markdown
Contributor Author

Ready for hub review

Head: abd6632bde62a8d3265f8ee80d9152d215b2b231 (picked up at 45c6214a9e8691b6ad88fb9a7bd2bb45f6631c7a, which had no newer commits; the last push before this round was 13.5 hours earlier).

Commits this round:

  • 3953d3377b the Idaho/Indiana fix, SGA comment, spouse-farm ssi assertion and register entry;
  • e38f568bee changelog fragment kept to one paragraph;
  • 1479aecbcb merge of origin/main at 4cf0a98e47;
  • abd6632bde gates the helper the same way as main's new ssi_countable_income gate.

Finding 1 (P1): Idaho AABD and Indiana SAPN

  • Helper: policyengine_us/variables/gov/ssa/ssi/eligibility/income/_ssi_countable_income_without_loss_offset.py:7, ssi_countable_income_without_loss_offset(person, period, parameters, sources). It follows the reviewer's shape, with three changes:
    • The unearned pool is ssi_unearned_income + ssi_unearned_income_deemed_from_ineligible_parent + ssi_in_kind_support_and_maintenance. That matches ssi_countable_income's total_unearned, so the $20 general exclusion splits the same way.
    • The adjustment is zero where is_ssi_aged_blind_disabled is false. That is the gate ssi_countable_income uses after Count income of aged, blind, or disabled people who fail SSI's noncitizen test #10240, so the adjustment never adds income to someone whose countable income is 0.
    • Empty sources short-circuits.
    • I read _apply_ssi_exclusions(earned_income, unearned_income, parameters, period, general_exclusion=None) before relying on it. It takes annual amounts, applies the exclusions monthly and returns an annual amount, so the helper divides the difference by 12.
    • The docstring says the adjustment works person by person: couples, spousal deeming and the working student exclusion are approximate.
  • Idaho: id_aabd.py:39-43 passes ["farm_operations_income"]. The comment cites and quotes IDAPA 16.03.05.403.06. The reference now opens the IDAPA PDF at #page=34, with a # PDF pages 34, 41 comment. That replaces the separate #page=41 entry, following the one-entry-per-document rule.
  • Indiana: in_ssp_sapn.py:30-39 reads gov.ssa.ssi.income.sources.earned at the period, drops employment_income, and passes the rest. The comment cites IHCPPM 3410.15.00, and the reference adds Medicaid_PM_3400.pdf#page=12. SAPN's ssi term is unchanged.
  • SGA: ssi_engaged_in_sga.py keeps its own max_(-business_net, 0). The constraints limited SGA to its comment, so I didn't share the loss term, and SGA results are unchanged.

Witnesses (2026-01; both runs use the same inputs as the brief)

Case Head 45c6214 This head Required
ID, no loss 22.50 22.50 22.50
ID, farm −1,200 53.00 22.50 22.50
ID, partnership −1,200 53.00 53.00 53.00
ID, Schedule C −1,200 53.00 53.00 53.00
IN SAPN, farm −1,200 (SSI 22.50, countable 7.50) 22 0 0
IN SAPN, Schedule C −1,200 22 0 0
IN SAPN, partnership −1,200 22 0 0
IN SAPN, wages 1,200 + Schedule C +1,200 + farm −1,200 (new) 22 22 22

The reviewer's figures reproduced from the brief's inputs. For Indiana the facility inputs are ssi_lives_in_medical_treatment_facility: true and ssi_medicaid_pays_majority_of_care: true.

Hand computations

  • Idaho: Social Security $500 a month and wages $150 a month.
    • Countable unearned income is $500 − $20 = $480. Countable earned income is ($150 − $65) / 2 = $42.50, for a total of $522.50. The payment is $545 − $522.50 = $22.50.
    • With the $100 monthly loss netted, earnings fall to $50, below $65, so countable income is $480. $545 − $480 = $65, which caps at $53.
    • Idaho now restores only a farm loss, which gives $22.50. A partnership or Schedule C loss stays netted, which gives $53.
  • Indiana: wages $200 a month, loss $100.
    • SSI earned income is $100, so countable income is ($100 − $20 − $65) / 2 = $7.50, and facility SSI is $30 − $7.50 = $22.50.
    • SAPN budgets without the loss: ($200 − $85) / 2 = $57.50. $52 − $22.50 − $57.50 < 0, so SAPN is $0.
    • The netting case (new Case 8) has a business net of $0, so nothing is restored. Countable income is ($100 − $85) / 2 = $7.50, and $52 − $22.50 − $7.50 = $22.

Tests added: id_aabd.yaml Cases 7-10, and in_ssp_sapn.yaml Cases 5-8. Case 8 is the netting case that catches mutant (d).

Finding 2 (P2): merge of main

I merged origin/main at 4cf0a98e47. Main had moved past 4bfc548de3; the same five files conflicted, and nothing else did.

  • msp_countable_income.yaml: both appended blocks kept, with the PR's cases first and then main's Case 20.
  • ssa/ssi/ssi.yaml: main also rewrote the header comment and appended two railroad-retirement cases (Count railroad retirement annuities as SSI unearned income #10534). I kept both. The PR's Texas cases come before the railroad cases, and the header now reads "the Texas self-employment and railroad retirement cases after them run the full income calculation".
  • ca_state_supplement.yaml (two hunks): main appended Cases 10-16. The PR's farm case was also numbered "Case 10", so it moves to the end as Case 17 (line 664). The PR body's reader row now says "case 17".
  • ky_ssp_countable_income.py: the PR's body is kept, and main's three-line NOTE comment sits above is_eligible (around line 88). There are no other Kentucky changes and no imports from Apply 416.1163(e)(2) to deemed SSI and identify SSI couples by marriage, not tax roles #10141.
  • md_paa_countable_income.py: main's immigration-gated spousal_deemed block is taken without its duplicate both_eligible = line. The PR's line at :25 (period.this_year) stays.
  • Follow-on from Count income of aged, blind, or disabled people who fail SSI's noncitizen test #10240: ssi_countable_income now gates on is_ssi_aged_blind_disabled, so the helper uses the same gate (abd6632bde). Every PR YAML file was rerun after the merge (below).

Finding 3 (P2): Kentucky

Not touched, as instructed. ky_ssp_countable_income.py still sums person.marital_unit.sum(own_earned) and waits for #10141.

Finding 4 (P3 notes)

  1. SGA comment (ssi_engaged_in_sga.py:38-41). The comment now says the add-back assumes ssi_earned_income already holds the business net, and that a situation supplying ssi_earned_income directly together with a business source adds the loss back to an amount that never subtracted it. The body sentence carries the same condition. The formula is unchanged.
    • I ran the reviewer's case: ssi_earned_income: 18_000, self_employment_income: -6_000, no wages. This head returns ssi_engaged_in_sga true ($2,000 a month); main at 4cf0a98e47 returns false ($1,500).
  2. ssi_spouse_farm_sga.yaml (couple case, line ~117): added ssi: [10_602, 0] with the hand computation.
    • The spouse's earnings are $21,600 − $6,000 = $15,600 a year, or $1,300 a month.
    • Deemed countable income is ($1,300 − $85) / 2 = $607.50, so the head receives $1,491 − $607.50 = $883.50 a month, which is $10,602 a year. 416.1163(e)(2) cannot bind, because $883.50 is below $994.
    • Run on main at 4cf0a98e47: [7602, 0]. This head: [10602, 0].
  3. Register entry us:ssi-sga-self-employment-loss (source_conflicts/candidates.yaml:9719):
    • added years: {from: 1975, type: calendar} in the neighbours' block form;
    • added 20 CFR 404.1081(c) (https://www.ssa.gov/OP_Home/cfr20/404/404-1081.htm, the URL earned.yaml already cites) and POMS DI 10510.012 B (https://secure.ssa.gov/poms.nsf/lnx/0410510012, as in the SGA variable's reference);
    • pointed the 416.971–416.975 URL to eCFR Part 416 Subpart I (https://www.ecfr.gov/current/title-20/chapter-III/part-416/subpart-I), which holds all five sections;
    • reworded readings.statute to "No statute or regulation settles it. One reading sums wages and net self-employment earnings, so a business loss reduces wages." I dropped the redundant "and 20 CFR 416.971 to 416.975 do not settle the question".
    • No # Source conflict marker added.
    • This VM's proxy refuses ecfr.gov, ssa.gov and secure.ssa.gov, so I couldn't open the new eCFR URL. It is eCFR's standard subpart path.

PR body:

  • The "Limit: Idaho AABD and Indiana SAPN" paragraph is rewritten as "Idaho AABD and Indiana SAPN: business losses against other income". It gives both rulings with citations, the hub's quotes, the Indiana Schedule C change (SAPN goes from $22 to $0 with $2,400 of wages and a $1,200 Schedule C loss), the per-person approximation, and that SGA keeps its own loss term.
  • The reader-table rows for id_aabd and in_ssp_sapn now say "Implemented here", and the table's intro names the two exceptions.
  • The SGA sentence carries the finding 4.1 condition.
  • The impact: and axiom: lines are unchanged.
  • Write-path problem: this VM's REST write wrapped four existing long URLs in backticks: the CT UPM 5000.01 and 5025.15 links (CT row), the OK OAC 317:35-5-42 link and the NC 10A NCAC 71P .0905 link. The body read back from GitHub before my write had none. I didn't edit those rows. Fix: delete the backtick runs around those four URLs; nothing else differs.

Changelog

changelog.d/ssi-earned-farm-partnership.fixed.md gains one sentence about the Idaho and Indiana rules.

Tests (one file per process, at this head after the merge)

File Result
states/id/dhw/aabd/id_aabd.yaml 10 passed
states/id/dhw/aabd/integration.yaml 8 passed
states/in/fssa/ssp/in_ssp_sapn.yaml 8 passed
states/in/fssa/ssp/integration.yaml 9 passed
states/in/fssa/ssp/edge_cases.yaml 25 passed
ssa/ssi/income/ssi_engaged_in_sga.yaml 15 passed
ssa/ssi/ssi_spouse_farm_sga.yaml 3 passed
tests/core/test_ssi_earned_sources_properties.py 13 passed (97.7 s)
tests/code_health/test_source_conflicts.py 103 passed
hhs/medicare/savings_programs/income/msp_countable_income.yaml 22 passed
ssa/ssi/eligibility/income/deemed/from_ineligible_parent.yaml 6 passed
ssa/ssi/eligibility/income/deemed/ssi_ineligible_child_allocation.yaml 5 passed
ssa/ssi/eligibility/income/ssi_blind_or_disabled_working_student_exclusion.yaml 11 passed
ssa/ssi/income/ssi_earned_income.yaml 14 passed
ssa/ssi/income/ssi_earned_income_after_spousal_loss.yaml 4 passed
ssa/ssi/income/ssi_marital_earned_income.yaml 6 passed
ssa/ssi/ssi.yaml 9 passed
states/ca/cdss/state_supplement/ca_state_supplement.yaml 17 passed
states/ct/dss/ssp/income/ct_ssp_countable_income.yaml 12 passed
states/ky/dcbs/ssp/ky_ssp_countable_income.yaml 15 passed
states/md/dhs/fia/paa/md_paa_countable_income.yaml 6 passed
states/mn/dhs/msa/income/mn_msa_gross_income.yaml 4 passed
states/mn/dhs/msa/mn_msa_person.yaml 18 passed
states/nh/dhhs/ssp/nh_ssp_countable_income.yaml 5 passed
states/sd/dss/ssp/sd_ssp_independent.yaml 2 passed
states/wy/health/ssp/wy_ssp_eligible.yaml 2 passed
  • Before the code change, the new tests failed as intended: id_aabd.yaml had 1 failure (Case 8) and in_ssp_sapn.yaml had 3 (Cases 5-7).
  • ruff format --check . and ruff check . are clean.
  • No suites and no microsimulation were run. No partner or .github/ files were touched.

Mutants (each in its own process, code restored after each)

Mutant Killed by
(a) Idaho reads ssi_countable_income id_aabd.yaml Case 8 (farm loss)
(b) Idaho passes every business source id_aabd.yaml Cases 9 (partnership) and 10 (Schedule C)
(c) Indiana reads ssi_countable_income in_ssp_sapn.yaml Cases 5, 6 and 7
(d) Each business floored separately in_ssp_sapn.yaml Case 8 (new; added because nothing else separated net from per-business floors)

CI

Pull request run 41530441235 at abd6632bde: completed, success, with 34 jobs succeeded and none failed or cancelled.

Judgment calls

  • The helper builds unearned income the same way as ssi_countable_income, and is gated on is_ssi_aged_blind_disabled; the reviewer's sketch did neither. Neither change moves a witness.
  • The CA farm case is renumbered to Case 17 to avoid a duplicate "Case 10".
  • The ssi.yaml header is rewritten to cover both full-calculation groups.
  • The Idaho reference is merged into one #page=34 entry.
  • I also pushed the same head to this session's own working branch. The PR branch is the one under review.

Follow-ups proposed (not opened)

  • Couple-aware loss-offset bar for Idaho AABD and Indiana SAPN. The new helper adjusts each person's own income. A couple's computation or spousal deeming still lets a barred loss through the spouse's side, so the adjustment should be applied to the couple and deemed budgets too.
  • Indiana RCAP income rule. in_ssp_rcap still reads ssi_countable_income with SSI's loss offset. 455 IAC 1-3-3 couldn't be opened, so RCAP's own treatment of business losses is unverified.

Generated by Claude Code

@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Hub review in progress

Round 3 at abd6632bde62a8d3265f8ee80d9152d215b2b231. The PR head has not moved past it. Interim findings so far; the full review follows.

  • New this round (P1): the helper ignores the blind or disabled working student exclusion. A disabled full-time student under 22 with wages of $2,400 and a $1,200 farm or Schedule C loss gets Indiana SAPN of $0 at this head. The rule, main and the previous head all give $22. In Idaho the same student with Social Security of $6,000 gets AABD of $22.50; the rule and main give $53. A fix of about 15 lines (it recomputes the exclusion on the restored earnings) gives the rule's value in both cases.
  • Partly open from r2 (P2): a deemed ineligible spouse's farm loss still reaches Idaho AABD. Witness: applicant aged 70 with Social Security of $3,600; spouse aged 40 with wages of $12,000 and a farm loss of $6,000. AABD is $47.50 at this head and $0 on main. The rule (the farm loss counted as zero) also gives $0.
  • The eight witnesses in the hand-off reproduce at this head.

Generated by Claude Code

@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Ready for hub review
VERDICT: REQUEST_CHANGES
abd6632
METHODOLOGY_CHOICE: yes

Round 3 covers 45c6214a9e..abd6632bde. The PR head has not moved past abd6632bde. This round adds four commits: the Idaho and Indiana fix with the SGA comment, the spouse-farm assertion and the register entry (3953d3377b); a changelog edit (e38f568bee); a merge of main at 4cf0a98e47 (1479aecbcb); and the new gate on the helper (abd6632bde).

The Idaho and Indiana fix does what the hub ruled for one person. All eight witnesses reproduce. The four listed mutants are each killed by the case the hand-off names. The merge resolutions are correct, the PR still merges cleanly with current main, and CI is green.

Two things block it:

  • P1, new this round: the helper skips the blind or disabled working student exclusion. For a working student with a business loss, Indiana SAPN and Idaho AABD both come out wrong where main was right. The fix is about 15 lines; I ran it.
  • P2, landing: the Apply 416.1163(e)(2) to deemed SSI and identify SSI couples by marriage, not tax roles #10141 merge now conflicts in four files, not the two the body lists. One of them is in_ssp_sapn.py, which this round changed. I resolved all four and ran the result.

One r2 path stays open by design: a deemed ineligible spouse's farm loss still reaches Idaho AABD (P2 below). The docstring and body disclose it, and the hub's brief accepted the per-person approximation. I list it with a witness so the hub can decide whether it blocks.

Findings

P1: The loss-offset helper ignores the working student exclusion, so a student's restored loss is counted in full

  • Where: policyengine_us/variables/gov/ssa/ssi/eligibility/income/_ssi_countable_income_without_loss_offset.py:34-37. with_offset and without_offset apply _apply_ssi_exclusions to raw ssi_earned_income. ssi_countable_income first subtracts ssi_blind_or_disabled_working_student_exclusion from earned income (ssi_countable_income.py, the max_(pre_reduction_earned_income - blind_disabled_working_student_income, 0) line). That exclusion takes up to its monthly amount of earnings. When it covers the restored earnings too, the right adjustment is $0, but the helper adds the full difference.

  • Witnesses, 2026-01. Each person is age 19 with meets_ssi_disability_criteria: true and is_full_time_student: true. "Rule" is the same household with the barred loss set to 0, which is what both rulings mean ("counts income as if a net ... loss were 0"):

    Case Main 4e71481e19 Prev 45c6214a9e This head Rule
    IN SAPN: wages $2,400, farm −$1,200, Medicaid facility 22 22 0 22
    IN SAPN: wages $2,400, Schedule C −$1,200, Medicaid facility 22 22 0 22
    ID AABD: Social Security $6,000, wages $1,800, farm −$1,200, SINGLE 53 53 22.50 53
  • By hand (Indiana):

    • SSI earnings after the loss are $100 a month. The student exclusion takes all $100, so countable income is $0 and facility SSI is $30.
    • Under the rule, earnings are $200 a month. The exclusion takes all $200 (the run shows it at $200 for the zero-loss case), so countable income is still $0. SAPN is $52 − $30 − $0 = $22.
    • The helper skips the exclusion: ($200 − $85) / 2 − ($100 − $85) / 2 = $50, so SAPN is $52 − $30 − $50 < 0, which floors to $0.
  • By hand (Idaho): unearned income is $500 − $20 = $480. The exclusion takes all of the earnings either way, so countable income is $480 and AABD is $545 − $480 = $65, capped at $53. The helper adds ($150 − $65) / 2 = $42.50, which gives $522.50 and AABD of $22.50.

  • Why this PR: main and the previous head both give the rule's value. The Schedule C row was right on main and is wrong now. Above the student cap, the exclusion is the same on both sides, so the result is correct there. I checked wages $19,200 with a farm loss of $6,000: the helper gives $442.08, which matches the rule.

  • The docstring calls the student exclusion "approximate". It isn't approximate here: it reverses main's correct result. The fix is small.

  • Fix: replace lines 34-37 with the following (ruff-formatted):

        # ssi_countable_income takes the blind or disabled working student
        # exclusion (20 CFR 416.1112(c)(3)) off earned income before the other
        # exclusions, so take it again from the restored earnings.
        p = parameters(year).gov.ssa.ssi.income.exclusions.blind_or_disabled_working_student
        is_student = (
            person("is_ssi_blind_or_disabled_working_student_exclusion_eligible", year) > 0
        )
    
        def after_student_exclusion(amount):
            monthly = max_(amount, 0) / MONTHS_IN_YEAR
            exclusion = min_(min_(p.amount, monthly) * MONTHS_IN_YEAR, p.cap)
            return max_(amount - where(is_student, exclusion, 0), 0)
    
        with_offset = _apply_ssi_exclusions(
            after_student_exclusion(earned), unearned, parameters, year
        )
        without_offset = _apply_ssi_exclusions(
            after_student_exclusion(earned + restored_loss), unearned, parameters, year
        )
    • Then drop "and the blind or disabled working student exclusion" from the docstring's last sentence.
    • In a scratch tree with this change, all three rows give the rule's value (22, 22, 53). Every other probe case is unchanged.
    • These files pass in the fix tree, one per process: id_aabd.yaml 10, Idaho integration.yaml 8, in_ssp_sapn.yaml 8, Indiana integration.yaml 9 and edge_cases.yaml 25. ruff check is clean.
  • Tests to add:

    • In in_ssp_sapn.yaml: the Schedule C row above, expecting in_ssp_sapn: 22.
    • In id_aabd.yaml: the farm row above, expecting id_aabd: 53.
    • Both fail at this head.
  • Command: a Simulation(situation=...) probe of id_aabd, in_ssp_sapn, ssi, ssi_countable_income and the helper's return value for 2026-01. I ran the same interpreter against main, the previous head, this head and the fix tree. The outputs are as tabled.

P2: The #10141 merge now conflicts in four files, and the body lists two

P2: A deemed ineligible spouse's farm loss still reaches Idaho AABD (r2 P1, deeming path)

  • Where: the helper restores only add(person, year, sources), the applicant's own sources. ssi_income_deemed_from_ineligible_spouse still nets the spouse's farm loss. Under POMS B.2.c it also lets an applicant's residual farm loss reduce the spouse's deemed earnings.

  • Witnesses, Idaho, 2026-01, with marital_units given and the applicant SINGLE:

    Case Main Prev This head Rule (farm loss set to 0)
    Applicant 70, Social Security $3,600; spouse 40, wages $12,000, farm −$6,000 0 47.50 47.50 0
    Applicant 70, Social Security $3,600, wages $1,200, farm −$2,400; spouse 40, wages $7,800 0 22.50 5.00 0
  • By hand (row 1):

    • The spouse's earnings after the loss are $500 a month, above $497, so deeming applies. Couple countable income is ($300 − $20) + ($500 − $65) / 2 = $497.50, and $545 − $497.50 = $47.50.
    • Under the rule, the spouse earns $1,000 a month: $280 + ($1,000 − $65) / 2 = $747.50, so AABD is $0.
  • Why it matters: on main these farm losses didn't reach AABD at all. This head lets the spouse path through, which is the r2 defect for a narrower population.

  • The disclosure: the docstring and the body ("couple computations, spousal deeming and the working student exclusion are approximate") disclose this. The hub's brief accepted per-person treatment. So I don't treat this alone as blocking. Two ways to close it:

    • Restore the spouse's barred loss inside the deemed amount, which needs a spouse-level restore in ssi_income_deemed_from_ineligible_spouse's inputs.
    • Or keep the limit, and add both rows above to the hand-off's proposed follow-up as its witnesses.
  • Couples are approximate but never worse than main in the cases I ran.

    • Indiana couple (ssi_claim_is_joint), both in a facility: person 1 has wages $1,200 and farm −$1,200; person 2 has wages $600. SAPN is 18.25 each at this head, 22 on main, and 5.75 each under the rule.
    • By hand: the rule's couple budget is $60 SSI + ($150 − $85) / 2 = $92.50. The helper adds only person 1's own $7.50, against the couple's $32.50.
    • In a second couple (wages $2,400 and farm −$1,200; spouse wages $1,200), the per-person sum matches the rule's couple total, and SAPN is 0 at main, at this head and under the rule (22 at the previous head).

P3 notes

  1. The Indiana cases assert the $0 floor, a weaker claim (in_ssp_sapn.yaml Cases 5-7).
    • Any countable income of at least $29.50 gives SAPN $0. So these cases don't pin the restored amount: a helper that restored the loss twice would also pass.
    • Add a case that keeps SAPN positive. Wages $1,200, farm −$1,200, facility, age 70 gives SAPN $14.50 at this head and $22 on main. By hand: SSI earnings are $0, so SSI is $30; the budget without the loss is ($100 − $85) / 2 = $7.50; $52 − $30 − $7.50 = $14.50.
  2. The new gate is untested.
    • My mutant (e) makes the adjustment unconditional (adjustment = without_offset - with_offset). It survives id_aabd.yaml (10 passed) and in_ssp_sapn.yaml (8 passed).
    • Killing case for in_ssp_sapn.yaml: age 40, receives_ssi: true, not disabled, wages $2,400, farm −$1,200, facility, in_ssp_sapn_eligible: true. SAPN is $22 at this head and $2 under the mutant.
  3. Stale or broken body text:
    • Backtick-wrapped links. The CT row's UPM 5000.01 and 5025.15 links, the OK row's OAC 317:35-5-42 link and the NC row's 10A NCAC 71P .0905 link are wrapped in runs of backticks, so they render as code. Delete the backtick runs; for example, [UPM 5000.01 definitions](``https://...5000_01.doc?rev=...)``` becomes UPM 5000.01 definitions`. The hand-off flags this but the body still has it.
    • "These 24 files read ssi_countable_income ... A grep at this head finds no others." At this head, ca_capi.py and ca_capi_income_eligible.py no longer read it; ca_capi_person.py does (from main). id_aabd and in_ssp_sapn now read it only through the helper. A grep finds 21 direct readers plus the helper. Replace the ca_capi, ca_capi_income_eligible row's names with ca_capi_person, and change "24" to match.
    • Out-of-date revision notes. The Validation section still opens "This revision (45c6214a9e…)", and "What and why" names only the earlier merge of 8cd756f5f5. Add a line for this revision: the merge at 4cf0a98e47, the helper, and the test counts from the hand-off, which I reproduced.

Mutants

Each mutant ran in its own process in a scratch worktree, and the tree was restored afterward (git status clean).

Mutant Result
(a) Idaho reads ssi_countable_income killed by id_aabd.yaml Case 8 (farm loss)
(b) Idaho passes all four business sources killed by id_aabd.yaml Cases 9 and 10
(c) Indiana reads ssi_countable_income killed by in_ssp_sapn.yaml Cases 5, 6 and 7
(d) helper floors each source separately (sum(max_(-person(s, year), 0) for s in sources)) killed by in_ssp_sapn.yaml Case 8
(e, mine) drop the is_ssi_aged_blind_disabled gate survives both files; see P3.2 for a killing case

Checked and sound

  • The defect reproduces at main 4e71481e19.
    • Texas, age 67, $60,000 of profit, 2026. On main, farm and partnership profit each give ssi $11,928 and msp_part_b_premium_coverage $2,434.80, against $0 and $0 for Schedule C. At this head all three give $0 and $0.
  • Hand-off witnesses, at main / the previous head / this head:
    • Idaho: no loss 22.50 / 22.50 / 22.50; farm 22.50 / 53 / 22.50; partnership 22.50 / 53 / 53; Schedule C 53 / 53 / 53.
    • Indiana SAPN: farm 0 / 22 / 0; partnership 0 / 22 / 0; Schedule C 22 / 22 / 0; Case 8 (wages $1,200, Schedule C +$1,200, farm −$1,200) 0 / 22 / 22.
    • Each matches the hand-off's table and my hand computations:
      • Idaho: $480 + ($150 − $65) / 2 = $522.50, so $22.50; with the loss netted, $480, so $65 capped at $53.
      • Indiana: SSI ($100 − $85) / 2 = $7.50, so $22.50; budget ($200 − $85) / 2 = $57.50, so $0.
      • Case 8: business net $0, so $52 − $22.50 − $7.50 = $22.
  • Break attempts that hold:
    • A farm loss with no earnings (Idaho, Social Security $6,000, farm −$1,200): the helper gives $480, the same as with no loss, and AABD is $53.
    • Earnings below $65 (wages $600, farm −$300): $480 either way.
    • Not aged, blind or disabled (age 40, receives_ssi): the helper gives $0, the same as ssi_countable_income.
  • The Count income of aged, blind, or disabled people who fail SSI's noncitizen test #10240 gate. ssi_countable_income returns where(~is_aged_blind_disabled, 0, …) for the year. The helper reads the same variable for the same year and adds where(is_aged_blind_disabled, adjustment, 0). For a person who isn't aged, blind or disabled it therefore returns 0 + 0 on every path, whether couple, deemed or alone.
    • Of the PR's other changed readers, ky_ssp_countable_income keeps its stricter is_ssi_eligible gate, as main's NOTE says. md_paa_countable_income deliberately has no gate, per main's comment. The CT, MN and NH readers sit behind their own program eligibility. None of them needs the new gate.
  • The merge (git show --remerge-diff 1479aecbcb):
    • msp_countable_income.yaml: keeps both sides; 22 cases pass.
    • ssi.yaml: keeps both; the header is reworded; 9 pass.
    • ca_state_supplement.yaml: main's Cases 10-16, then the PR's farm case renumbered to Case 17. The numbering runs 3 to 17 with no duplicate; 17 pass.
    • ky_ssp_countable_income.py: keeps the PR's own deeming block, drops main's both_eligible and spousal_deemed lines (the PR defines both), and keeps main's NOTE above is_eligible.
    • md_paa_countable_income.py: takes main's immigration-gated spousal_deemed block. Its only both_eligible line uses period.this_year, as main's did.
    • git merge-tree --write-tree origin/main pr-10532 is clean against current main 4e71481e19. The six newer commits touch no SSI file.
  • The SGA comment (ssi_engaged_in_sga.py:29-35) now says the add-back assumes ssi_earned_income holds the business net, and that a directly supplied ssi_earned_income plus a business source adds the loss back wrongly. That matches the formula.
    • Rerun: ssi_earned_income: 18_000 with self_employment_income: -6_000 gives engaged at this head and not engaged at main. ssi_earned_income: 18_000 alone gives not engaged in both.
  • The couple case (ssi_spouse_farm_sga.yaml, ssi: [10_602, 0]), recomputed:
    • The spouse earns $21,600 − $6,000 = $15,600, or $1,300 a month, above $497, so deeming applies. The head has no income, so the $20 goes to earnings: ($1,300 − $20 − $65) / 2 = $607.50. $1,491 − $607.50 = $883.50 a month, or $10,602 a year.
    • The 416.1163(e)(2) cap can't bind, because $883.50 is below $994.
    • The file passes 3 of 3.
  • Register entry us:ssi-sga-self-employment-loss (source_conflicts/candidates.yaml):
    • years: {from: 1975, type: calendar} matches the source list's 1975-01-01 start.
    • sources now lists 416.971–416.975 (eCFR Part 416 Subpart I), 404.1081(c), POMS DI 10505.015 D.3 and DI 10510.012 B. The 404.1081 and DI 10510.012 URLs match those already cited in earned.yaml and ssi_engaged_in_sga.py.
    • readings.statute now opens "No statute or regulation settles it."
    • The note matches the code (floor in ssi_engaged_in_sga.py; ssi_earned_income signed).
    • No # Source conflict marker was added, which HUB-PROTOCOL.md requires for a PR that hasn't landed. test_source_conflicts.py passes 103.
  • Tests at this head, one file per process, all passing:
    • id_aabd 10, Idaho integration 8, in_ssp_sapn 8, Indiana integration 9, edge_cases 25 and in_ssp 3.
    • SGA files: ssi_engaged_in_sga 15, ssi_spouse_farm_sga 3 and is_ssi_disabled 9.
    • test_ssi_earned_sources_properties.py 13 (77 s; it needs the dev extra for hypothesis) and test_source_conflicts.py 103.
    • The other changed YAML files: msp_countable_income 22, from_ineligible_parent 6, ssi_ineligible_child_allocation 5, ssi_blind_or_disabled_working_student_exclusion 11, ssi_earned_income 14, ssi_earned_income_after_spousal_loss 4, ssi_marital_earned_income 6, ssi.yaml 9, ca_state_supplement 17, ct_ssp_countable_income 12, ky_ssp_countable_income 15, md_paa_countable_income 6, mn_msa_gross_income 4, mn_msa_person 18, nh_ssp_countable_income 5, sd_ssp_independent 2 and wy_ssp_eligible 2.
    • These match the hand-off's counts.
  • CI. The Pull request run 41530441235 at abd6632bde concluded success, with 34 of 34 jobs succeeding.
  • Scope. Nothing under .github/ or tests/policy/baseline/partners/ changed (I checked the origin/main...abd6632bde file list). Open-PR search for id_aabd, in_ssp_sapn, ssi_engaged_in_sga and ky_ssp_countable_income finds only Add Idaho LIHEAP regular heating assistance #10613 besides this PR. Add Idaho LIHEAP regular heating assistance #10613 matches on text and shares no file. r2's overlap list (Limit SSI ineligible-child allocations to co-resident children and compute SSI and Medicaid deeming by month #10146, Apply 416.1163(e)(2) to deemed SSI and identify SSI couples by marriage, not tax roles #10141, Build omitted household marital units from explicit couples and the tax-role fallback #10000, Store California state supplement parameters as state shares #10600, Compute the California state supplement per person #10601) still applies.
  • Readers of the helper: only id_aabd and in_ssp_sapn. id_aabd feeds spm_unit_benefits and the household state-benefits list. in_ssp_sapn feeds in_ssp, which feeds the same two.
  • The body's impact: pending (hub) and axiom: TheAxiomFoundation/rulespec-us#1970 queued lines are present. The changelog's new sentence matches the code.
  • Baseline moves, so the hub needs a population check. Beyond r2's list, the landing head moves:
    • Idaho AABD for recipients with a net farm loss (back toward main);
    • Indiana SAPN for recipients with any net business loss, including Schedule C, which moves away from main as the hub accepted.
    • Variables for the impact pair, in addition to r2's list: id_aabd, in_ssp_sapn, in_ssp, spm_unit_benefits and household_net_income.

What I couldn't check

  • Sources. This VM's proxy refused adminrules.idaho.gov, in.gov, ecfr.gov, govinfo.gov, uscode.house.gov, ssa.gov and secure.ssa.gov (403, or the host isn't allowed). So I couldn't read:

    • IDAPA 16.03.05.403.06. Whether it bars only a farm loss, and whether partnership and Schedule C losses stay netted, rests on the hub's reading.
    • IHCPPM 3410.15.00, including whether its page is file page 12, whether it bars every business loss, and whether it nets businesses against each other first (Case 8's premise).
    • POMS, 20 CFR 404.1081 and 416.971–975, and whether the new eCFR Subpart I URL resolves.

    The code matches the hub's readings as the brief quotes them.

  • Parity. rulespec-us#1970 is outside the repositories this review can read.

  • Population impact. That needs microdata I don't have.


Generated by Claude Code

@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Picking this up for the US hub. I'll post a hand-off comment here when it's ready.


Generated by Claude Code

MaxGhenis and others added 8 commits November 28, 2026 19:23
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Set is_in_k12_school to false in Case 13 so SSI counts the child's
$250 a month in net earnings against the allocation. Register
ssi_earned_income_after_spousal_loss in the small test system so
the monthly spouse deeming helper can read it.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
@MaxGhenis MaxGhenis changed the title Include farm and partnership earnings in SSI and correct loss netting Count net farm and partnership earnings in SSI and fix related state benefit budgets Nov 30, 2026
MaxGhenis and others added 3 commits November 30, 2026 08:55
Let Maryland and California compute countable income in the December
shelter support fixture, and add a case for each household.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 2 commits December 1, 2026 06:22
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Resolve the end-of-file conflict in source_conflicts/candidates.yaml by keeping both sides' entries.

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

@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: 10532
Reviewed head SHA: 449ed8c
Merge base SHA: 094934a
Mode: incremental from 4cab6b3
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10532-review-sources.json
Review status: PARTIAL

Source Documents

Critical

None.

Should Address

A1 — PR-caused red CI check — built-in sum() over entity calls in _ssi_earnings_precision.py (OPEN)

  • Location: policyengine_us/variables/gov/ssa/ssi/eligibility/income/_ssi_earnings_precision.py:16-19 (exact_earned_sources), added in 9978882.
  • Trigger: policyengine_us/tests/code_health/test_no_builtin_sum_over_entity_calls.py::test_builtin_sum_does_not_wrap_entity_variable_calls (on main since #8426, May 2026). CI run 46590390750, job 142447977841 ("Full Suite - Rest (Python shard 2)"): assert not ['variables/gov/ssa/ssi/eligibility/income/_ssi_earnings_precision.py:16'], 1 failed / 2,951 passed. The gate check fails with it.
  • Expected vs observed: the guard rejects sum((exact_dollar_amounts(person(name, period)) for name in sources), start=...). Reproduced locally at the snapshot (see Validation). This is not round 1's predicted NH Hypothesis flake.
  • Cause: the PR. The file exists only on this branch, and main's latest code-health run passes.
  • Fix: build the arrays first, e.g. amounts = [exact_dollar_amounts(person(name, period)) for name in sources], then add them in a loop or with sum(amounts, start=...). No behavior change.
  • Severity: should-address (PR-caused red required check).

A2 — Kentucky MS 2450 citations are marked "unverified", but the official manual verifies them (OPEN)

  • Location: policyengine_us/variables/gov/states/ky/dcbs/ssp/ky_ssp_earned_income.py, lines 13, 21 and 33 (from commit cfe6636).
  • Trigger: none; this is a citation and documentation problem.
  • Expected: a page comment such as # PDF pages 187-188 and no "unverified" wording.
  • Observed: the comment and documentation say "text and page numbers unverified against the current PDF" and "(unverified)".
  • Evidence: the official OMVOLIVA.pdf from chfs.ky.gov (fetched 2026-12-02, sha256 in the manifest) has MS 2450 (OMTL-383, R. 4/1/11) starting on physical page 187.
    • Page 187 has B.4: "To determine profit, deduct work expenses directly related to producing the goods or services".
    • Page 188 has C.7, the list of allowable deductions, and C.8(b): "DO NOT ALLOW ... Amounts claimed for depreciation, prior losses or loss from one business to another".
    • So #page=187 is correct and the rule as encoded is verified. C.8(a) also bars deducting "FICA", which supports Kentucky's raw-profit base now that SSI uses 92.35%.
  • Impact: the citation wrongly signals that the rule rests on unverified text and invites rework. Results are unaffected.
  • Proposed severity: SHOULD ADDRESS (misleading citation).

Suggestions

S1 — changelog omits two national SSI changes that alter results for households outside the farm/partnership scope (OPEN)

  • Location: changelog.d/ssi-earned-farm-partnership.fixed.md; ssi_earned_income.py (ssi_nese_deduction); ssi_blind_or_disabled_working_student_exclusion_monthly.py.
  • Trigger 1, working students with no business income: TX, age 19, disabled, full-time student, wages $19,200, Social Security $1,200 (2026). Main: SSI $551.92 every month, $6,623 a year (cap spread evenly). Head: $914 Jan–Jun, $211.50 Jul, $146.50 Aug–Dec, $6,428 a year (exclusion used from January until the $9,730 cap runs out). Head's sequencing matches POMS SI 00820.510 and the consecutive-month logic main already used for child allocations, and the YAML case "The working student uses the annual cap in consecutive months" covers it.
  • Trigger 2, the NESE deduction: every SSI or state-supplement recipient with positive Schedule C, farm or partnership profit now has countable earnings reduced by 7.65% (6.65% in 2011-2012). This flows into the roughly 20 state readers of ssi_earned_income (CO OAP, CA SSP/CAPI, IA, OH RSS, NC SA, VA AG, OK, SD, Medicaid medically needy).
  • Observed: the changelog says only "carried student exclusions across facility budget changes" and does not mention the 7.65% deduction.
  • Impact: disclosure only. The code is plausibly correct and tested. Households with no business income and no student exclusion match main exactly: single aged person, ineligible-spouse deeming, eligible couple, parent-to-child deeming, and SGA at $20,280 / $20,281, monthly and annual.
  • Severity: suggestion. Add both changes to the changelog and PR body; the policy reviewer confirms the POMS reading.

S2 — The 2011-2012 NESE rate of 6.65% is a second statute-versus-POMS choice that is recorded only in a note (OPEN)

  • Location: policyengine_us/parameters/gov/ssa/ssi/income/historical_nese_deduction_rate.yaml (2011-01-01: 0.0665); source_conflicts/candidates.yaml us:ssi-nese-tax-paid, note.
  • Trigger: any SSI self-employment case in 2011 or 2012. NESE = 93.35% of profit instead of 92.35%.
  • The statute. Pub. L. 111-312 §601(a) sets the 1401(a) rate at 10.40% "Notwithstanding any other provision of law". §601(b)(1) restores the full rate only "For purposes of applying section 1402(a)(12)" of the IRC. 42 USC 411(a)(11) uses the 1401 rates "for such year". Read literally, that gives 6.65% for Title XVI, so the PR's value follows the statute-first rule.
  • The manual. POMS SI 00820.210 A.3 applies 7.65% (.9235) to all "taxable years beginning after 1989" and says Schedule SE "already reflect[s] the .9235 adjustment". The 2011-2012 Schedule SE used .9235 because of §601(b)(1).
  • Observed: the candidate's question and readings cover only the tax-paid condition. The 2011-2012 divergence appears in a single sentence of the note, with no readings, example or test.
  • Impact: small (1% of NESE in two historical years), but CONTRIBUTING.md "Source conflicts" asks for each choice to be recorded with its readings.
  • Fix: add a separate candidate, or extend this one's question, readings and example. Add a 2011 test.
  • Proposed severity: SUGGESTION.

Evidence Gaps

  • The policy reviewer did not fetch OAR 461-150-0095(2) and CT UPM 5020.70 C.3 within the source budget, so two changes are UNVERIFIED: Oregon applying a co-resident spouse's business loss against the person's own earnings, and Connecticut deeming the spouse's raw earnings. Both move toward the rule text the code comments quote. The missing texts are https://ch461rules.odhs.oregon.gov/rules/461-150-0095.pdf and the UPM 5020.70 document cited in the code.

Notes

  • This round covers the 11 author commits since the 11-05 review and three merges of main.
  • Round-1 critical (the Idaho AABD / Indiana SAPN helper restored only the applicant's loss): RESOLVED.
    • The helper now restores every household member's barred loss, and the state adjustments, only when the household is in that state. It reruns SSI countable income on an override branch, so couple pooling and spousal and parental deeming use the restored earnings.
    • Executed: the Idaho spouse-loss and leftover-loss households give AABD 0, the couple gets 10 each and the parent-deeming child 33, all matching round 1's expected values and pinned by YAML. The same couple in Idaho, Washington and Indiana gets identical federal SSI, and only Idaho pays AABD.
    • The Indiana row now gives $22, not round 1's $0. Federal SSI now applies the community spouse's farm loss, and SAPN leaves the community spouse out under 42 U.S.C. 1396r-5(b)(1). The policy review verified that rule, so round 1's $0 is withdrawn.
  • Should 1 (flaky NH test): All 13 @settings are derandomized and the comparison uses a tolerance.
  • Should 2 (unpinned terms): Idaho AABD Case 17 pins the student cap (July drops to $0 once $9,730 is used). Kentucky Cases 19 and 20 pin the $5,964 threshold (20 CFR 416.1163(d), "more than") and the eligibility term.
  • Should 3 (rulespec-us#1970 misses the Idaho and Indiana rules) is still open, and wider than before. #1970 was last updated 11-02. It doesn't mention IDAPA 16.03.05 or IHCPPM 3410.15, and it still calls the 7.65% NESE deduction a separate follow-up although this PR implements it. Also uncovered: the IDAPA 401.04 deduction, the 1396r-5(b)(1) SAPN exclusion, Maryland PAA's own-income budget and the OR, MN and CT budget changes. Please update #1970 or open a companion pe-parity issue.
  • Suggestions 1–4 are resolved:
    • The 7.65% NESE deduction from 1990, statute-first. POMS's tax-paid condition is recorded as us:ssi-nese-tax-paid.
    • The Indiana page comment.
    • The test file naming.
    • One shared self_employment source list.
  • Suggestion 5 (Kentucky pretax premiums) is still open.
  • New behavior verified against sources:
    • Student exclusion. It runs month by month from January until the cap and applies once to a couple's combined earnings (POMS SI 00820.510 B.5, E.2). Starting in January is a modeling simplification.
    • SGA loss rule. Losses net across businesses and never reduce wages (DI 10505.015 D.3, DI 10510.012 B).
    • Idaho 401.04 deduction. Over $400, 7.65%, only when SE tax is paid.
    • Indiana. Raw profit, with the community spouse excluded.
    • Kentucky. Raw profit, with no cross-business loss (MS 2450 C.8).
    • Maryland PAA. The person's own income only (COMAR 07.03.07.07–.08; PAA 900).
  • Households with no business income mostly match main: single aged, spousal deeming, an eligible couple, parental deeming and both sides of SGA. Working students differ ($6,428 vs $6,623 a year for the executed student), and every positive business profit gets the 7.65% deduction. Both are correct, but undisclosed (code-2).
  • No main code was lost in the merges. Main's spousal-deeming logic moved into a shared helper, and main's SSI tests pass at the head.

Validation Summary

Local tests at the reviewed head (review venv, policyengine-core 3.37.2, matching uv.lock; imports resolved to the snapshot): the combined run hit its 540 s deadline under machine load after 109 YAML files (1,257 cases, 0 failures), stopping inside the Medicaid long-term care folder; CI passed all YAML shards at the head. A split pytest run gave 190 passed and 1 failed, the code-health test that reproduces code-1. Diagnostics executed the round-1 households, the cross-state couple and households with no business income on main and the head. Sources: 12 retrieved (20 CFR 416.1110–416.1112 and 416.1163, POMS SI 00820.210 and .510, DI 10505.015 and 10510.012, IDAPA 16.03.05, IHCPPM 3410.15, KY OMVOLIVA MS 2450, COMAR 07.03.07, 42 USC 1382a and 411, Pub. L. 111-312); manifest check passed. CI at 449ed8c: 34 checks pass, 2 fail (Python Rest shard 2 and its gate; see code-1).

Timing

setup seconds: 22.00s; scope seconds: 60.00s; parallel review seconds: 968.20s; policy role seconds: 512.00s; code role seconds: 968.20s; adjudication seconds: 150.00s; consolidation cleanup seconds: 74.30s; elapsed seconds: 1716.00s

Review Severity

COMMENT. Open findings: 0 critical, 2 should address, 2 suggestions.

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

3 participants