Skip to content

Treat PE-US aggregate outputs as formula-owned#182

Open
MaxGhenis wants to merge 13 commits into
mainfrom
codex/target-alignment-audit-20260624
Open

Treat PE-US aggregate outputs as formula-owned#182
MaxGhenis wants to merge 13 commits into
mainfrom
codex/target-alignment-audit-20260624

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • treat PE-US adds/subtracts variables as formula-owned outputs in the adapter, matching direct formulas
  • keep dividend exports leaf-only: derive/export qualified_dividend_income and the non-qualified residual leaf, and block dividend_income / ordinary_dividend_income
  • keep SOI ordinary-dividend targets PE-aligned as ordinary_dividend_income, while preserving source_variable=ordinary_dividends for source/provenance semantics
  • keep Social Security exports leaf-only by routing generic PUF/legacy totals into social_security_retirement source support and blocking the aggregate social_security
  • keep partnership/S-corp exports leaf-only: PE-US computes the aggregate from partnership_income and s_corp_income; Populace no longer synthesizes a tax-unit partnership/S-corp aggregate in PUF support
  • replace release-export formula-column cleanup with a hard assertion: formula-owned columns now fail before export instead of being seeded, repaired, dropped, or stripped

TDD notes

  • added writer tests proving dividend_income, social_security, partnership_s_corp_income, and generic adds outputs such as employment_income block export
  • added release-builder tests proving formula-owned columns raise before calibrated export, while leaf-only frames still receive calibrated weights
  • added target metadata coverage for the source-vs-PE variable split on ordinary dividends
  • audited cached/current artifacts: dividend and Social Security aggregates were co-exported with leaves and inconsistent; partnership/S-corp cached artifacts did not co-export the aggregate with leaves, but this PR still blocks that future failure mode

Tests

  • uv run ruff check packages/populace-build/src/populace/build/us_runtime/fiscal_targets.py packages/populace-build/tests/test_us_fiscal_targets.py tools/build_us_fiscal_refresh_release.py
  • uv run pytest packages/populace-build/tests/test_us_fiscal_targets.py — 63 passed
  • uv run pytest packages/populace-frame/tests/test_policyengine_us_adapter.py packages/populace-build/tests/test_us_puf_support.py packages/populace-build/tests/test_us_fiscal_refresh_builder.py::test_export_frame_rejects_formula_owned_columns packages/populace-build/tests/test_us_fiscal_refresh_builder.py::test_export_frame_accepts_leaf_only_columns — 36 passed, 1 PE-US warning
  • uv run pytest packages/populace-frame/tests/test_policyengine_us_adapter.py packages/populace-build/tests/test_us_puf_aggregate_records.py packages/populace-build/tests/test_us_source_runtime.py packages/populace-build/tests/test_us_plan.py packages/populace-build/tests/test_us_puf_support.py packages/populace-build/tests/test_us_fiscal_targets.py packages/populace-build/tests/test_us_fiscal_refresh_builder.py::test_export_frame_rejects_formula_owned_columns packages/populace-build/tests/test_us_fiscal_refresh_builder.py::test_export_frame_accepts_leaf_only_columns packages/populace-build/tests/test_us_fiscal_refresh_builder.py::test_soi_component_amounts_use_source_specific_signs packages/populace-build/tests/test_us_fiscal_refresh_builder.py::test_soi_indicator_rows_flag_positive_component_items — 158 passed, 1 PE-US warning

@MaxGhenis MaxGhenis force-pushed the codex/target-alignment-audit-20260624 branch 2 times, most recently from 0bbf77f to 4ce6f23 Compare June 25, 2026 02:50
@MaxGhenis MaxGhenis changed the title Keep dividend exports leaf-only Treat PE-US aggregate outputs as formula-owned Jun 25, 2026
@MaxGhenis MaxGhenis force-pushed the codex/target-alignment-audit-20260624 branch from 4ce6f23 to a06b0a2 Compare June 25, 2026 03:12
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

This PR is green but should be merged/released after PolicyEngine/policyengine-us#8747 lands and a compatible policyengine-us release is available. The current Populace lock resolves policyengine-us==1.729.0, which does not expose ordinary_dividend_income or cbo_net_business_income; those are added in #8747 and are needed for the source-aligned target mappings here. The export-surface fix itself is assertion-only: formula-owned columns fail before export rather than being repaired or dropped.

@MaxGhenis MaxGhenis force-pushed the codex/target-alignment-audit-20260624 branch from a06b0a2 to 10d2f5c Compare June 25, 2026 03:59
@MaxGhenis MaxGhenis force-pushed the codex/target-alignment-audit-20260624 branch from a258809 to d2577fb Compare June 25, 2026 10:45
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