Remove pass-through allowance variables (#414)#1640
Conversation
`trading_allowance`, `property_allowance`, and `dividend_allowance` variables each just returned their same-named parameter. Callers (`trading_allowance_deduction`, `property_allowance_deduction`, `taxable_property_income`, `taxed_dividend_income`) now read the parameter directly. The `taxable_self_employment_income` deductions list now references `trading_allowance_deduction` (the capped amount actually deductible against self-employment income) instead of the raw allowance. This gives identical taxable-income outputs since the pre-existing `max_(0, ...)` clamp already absorbed any over-deduction. Tests that previously injected these variables as inputs now override the corresponding parameter path. The obsolete test that asserted the default `dividend_allowance` value is dropped since the variable no longer exists. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MaxGhenis
left a comment
There was a problem hiding this comment.
Holding this one because a first-party data pipeline still emits two of the variables being removed. policyengine-uk-data currently sets \ and \ in ; after this PR those names no longer exist in PE-UK. I do not think we should merge the model removal until the companion uk-data cleanup lands and verifies the generated SPI/enhanced datasets still load against the new variable set. The formula changes themselves look reasonable; the blocker is the cross-repo dataset contract.
|
Clarifying the review body above: the first-party
So the blocker is not the formula simplification itself; it is merging the PE-UK variable removal before the companion uk-data cleanup verifies SPI/enhanced datasets no longer emit or rely on those columns. |
|
Fixed the blocker two ways:
Local checks here:
|
…gh-allowance-variables-414
MaxGhenis
left a comment
There was a problem hiding this comment.
Reviewed after the companion uk-data fix. This now removes the pass-through allowance variables while keeping the concrete deduction variables as the data override point; taxable_property_income uses property_allowance_deduction, matching the self-employment path. Local targeted YAML tests passed (23 cases), ruff passed, and GitHub CI is green.
Summary
trading_allowance,property_allowance, anddividend_allowance— threeVariables whose formulas only returned the same-named parameter value. Callers (trading_allowance_deduction,property_allowance_deduction,taxable_property_income,taxed_dividend_income) now read those parameters directly.taxable_self_employment_income_deductionsparameter list to referencetrading_allowance_deduction(the amount capped atself_employment_income) rather than the rawtrading_allowance. Pre-existingmax_(0, ...)meant outputs were already equivalent; this makes the intent explicit.dividend_allowancevalue.Closes #414.
Test plan
policyengine-core test policyengine_uk/tests/policy/baseline/gov/hmrc/income_tax -c policyengine_uk— 9 failed / 145 passed, identical 9 preexisting failures onmain(gift-aid/PA taper, pension annual allowance, marriage allowance); one fewer pass corresponds to the deleteddividend_allowanceoutput assertion.make test) on this branch🤖 Generated with Claude Code