Skip to content

Fix business income SECA and LSR inputs#8156

Merged
MaxGhenis merged 3 commits intoPolicyEngine:mainfrom
MaxGhenis:codex/fix-business-income-modeling
Apr 25, 2026
Merged

Fix business income SECA and LSR inputs#8156
MaxGhenis merged 3 commits intoPolicyEngine:mainfrom
MaxGhenis:codex/fix-business-income-modeling

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

@MaxGhenis MaxGhenis commented Apr 25, 2026

Summary

  • Copy direct self-employment and SSTB self-employment inputs into their before-LSR holders in household and microsimulation runs.
  • Use Schedule F farm operations income, not Schedule J farm income, for taxable self-employment income, market income, and state/program income source lists.
  • Add regression tests for the LSR wiring, farm SECA source behavior, farm operations market income, and affected MA/NJ/CT farm-income cases.
  • Avoid eager divide-by-zero warnings in self-employment response and QBI/SSTB QBI allocation shares.

Companion data PR: PolicyEngine/policyengine-us-data#828

Root cause

The household Simulation constructor iterated over the emptied employment-income holder when moving self-employment inputs into before-LSR storage. SSTB self-employment had before-LSR plumbing but no constructor transfer. SECA and multiple downstream income source lists also referenced the Schedule J-style farm_income input where they meant Schedule F farm_operations_income.

Tests

  • ruff check on touched Python files
  • .venv/bin/python -m pytest policyengine_us/tests/core/test_business_income_regressions.py policyengine_us/tests/test_parameter_files.py -q
  • .venv/bin/python -m pytest policyengine_us/tests/core/test_business_income_regressions.py policyengine_us/tests/core/test_behavioral_response_measurements.py -q
  • .venv/bin/python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/irs/self_employment/taxable_self_employment_income.yaml policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/qbid/qualified_business_income.yaml policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/qbid/sstb_qualified_business_income.yaml policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/qbid/qualified_business_income_deduction.yaml -c policyengine_us
  • .venv/bin/python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/household/income/person/market_income.yaml policyengine_us/tests/policy/baseline/household/income/household/household_market_income.yaml -c policyengine_us
  • .venv/bin/python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/states/ma/tax/income/gross_income/integration.yaml policyengine_us/tests/policy/baseline/gov/states/nj/tax/income/taxable_income/nj_gross_income.yaml policyengine_us/tests/policy/baseline/gov/states/ct/oec/c4k/ct_c4k_countable_income.yaml policyengine_us/tests/policy/baseline/household/income/person/market_income.yaml policyengine_us/tests/policy/baseline/household/income/household/household_market_income.yaml -c policyengine_us
  • .venv/bin/python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/states/ct/oec/c4k/ct_c4k_family_fee.yaml policyengine_us/tests/policy/baseline/gov/states/mi/tax/income/mi_household_resources.yaml -c policyengine_us
  • uv run python policyengine_us/tests/run_selective_tests.py --base-branch upstream/main --coverage
  • .venv/bin/python -m pytest policyengine_us/tests/core -q
  • uv run --extra dev towncrier check --compare-with upstream/main --staged

@MaxGhenis MaxGhenis force-pushed the codex/fix-business-income-modeling branch 3 times, most recently from 49894e3 to 0fea261 Compare April 25, 2026 21:30
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (20705b0) to head (605353b).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##             main     #8156       +/-   ##
============================================
+ Coverage   85.36%   100.00%   +14.63%     
============================================
  Files           3        10        +7     
  Lines          41       204      +163     
  Branches        2         4        +2     
============================================
+ Hits           35       204      +169     
+ Misses          6         0        -6     
Flag Coverage Δ
unittests 100.00% <100.00%> (+14.63%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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 marked this pull request as ready for review April 25, 2026 23:22
@MaxGhenis MaxGhenis merged commit 1ff298a into PolicyEngine:main Apr 25, 2026
24 checks passed
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