Repository navigation
Conversation
trading_loss (a loss as a positive amount, separate from the profit in self_employment_income) now reaches each programme by its own rule: - Income Tax: trade loss relief against general income (ITA 2007 s.64) reduces net income, and so adjusted net income, for the loss-making year. It is limited to net income (s.25(4)) and to the s.24A cap, the greater of £50,000 and 25% of adjusted total income (s.24A(5), (8)). It comes off non-savings income first, then savings, then dividends. - Class 4 and Class 2 NICs: the relief reduces trading profits only (SSCBA 1992 Sch 2 para 3(4); s.11(3) relevant profits), with losses brought forward (loss_relief, s.83). - Tax credits: the claimants' losses come off their income (SI 2002/2006 reg 3(1) Step 4). - Market income and HBAI household income count the loss as negative income. - Means tests read neither the loss nor anything net of it, so it never offsets other earnings (UC reg 57, HB reg 38(10), IS reg 38(11) etc.). loss_relief now holds only losses brought forward (s.83). It no longer adds the previous year's trading_loss, which relief against general income may already have used. trading_loss is uprated like self-employment income. Tests: YAML cases for the relief, cap, ordering, Class 4, tax credits and household income; Hypothesis properties for the relief definition, a differential against income cut in s.25 order, monotonicity and bounds, means tests seeing the loss only through tax, tax credit income, and the channels HBAI income can move through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 2, 2026
This was referenced Oct 3, 2026
…it loss - adjusted_total_income follows s.24A(8): Step 1 total income (taxable components, losses brought forward added back) less own pension contributions given relief, up to the greater of £3,600 and relevant UK earnings (FA 2004 s.190) and none from age 75 (s.188(3)(a)). - net_income_before_trade_loss_relief is the one base for adjusted net income, the relief limit and the savings/dividends part; it counts basic income where a reform makes it taxable. - UC sets a trading loss against the person's other trades' profits before the minimum income floor, never against employed earnings (UC Regs 2013 reg 57(2) Steps 1-3). - Tax credits subtract only the claimants' losses, not a child's. - New input ni_class_4_losses_brought_forward for losses carried forward for Class 4 only (SSCBA 1992 Sch 2 para 3(4)(b)). - The savings-then-dividends order is the model's allowance order, which s.25(2) can beat for the Personal Allowance too: documented, #2106. - YAML cases for each finding; property tests cover UC netting and children's losses, with fewer examples for CI time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nings - uc_trading_losses_set_against_profits (UC Regs 2013 reg 57(2)) is the one netting UC earnings and the reg 82 earnings tests in is_benefit_cap_exempt_earnings and is_benefit_cap_exempt_health_disability deduct, so a loss-maker's cap matches the same household with netted profits. - adjusted_total_income takes relevant UK earnings (FA 2004 s.189(2)) as taxable employment income (incl. taxable benefits and statutory pay) plus chargeable trading profits. - YAML for both review cases; the property test's netted twin compares the earnings test and the capped award; property tests run 3 examples per property with larger batches to cut CI time (#2099). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With 3 generated examples per property (to keep CI time down, #2099), a run could miss the cases that matter, and a mutant that stopped limiting relief to net income survived. Each property now also checks pinned inputs: relief limited by net income, both caps, contributions above relevant earnings, no relief from age 75, profits beside a loss, income spilling into savings and dividends, the benefit-cap household, a child's loss and a loss beside pay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 of 52 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A self-employment loss now reaches each programme by that programme's own rule. The loss is entered as
trading_loss, a positive amount kept apart from the profit inself_employment_income. That variable already existed but only reduced self-employment income. With this PR:trade_loss_relief_against_general_income= min(loss, cap,net_income_before_trade_loss_relief). It reducesadjusted_net_income, so the PA taper, HICBC, tapered annual allowance, Tax-Free Childcare and 30-hours tests, CGT bands and self-assessment student loan repayments (SI 2009/470 reg 29(4)(h)) all see itincome_tax_relief_cap;adjusted_total_income= taxable income components (losses brought forward added back, being a Step 2 relief) less the person's own contributions up to the greater of £3,600 and relevant UK earnings (taxable pay, benefits and statutory pay, plus chargeable trading profits; s.189(2)), none from age 75 (FA 2004 ss.188(3)(a), 190)trade_loss_relief_against_savings_and_dividends. That fixed order can overcharge where savings are taxed at 0%, for the Personal Allowance as much as for this relief: #2106ni_class_4_profits= max(0, profits − losses brought forward − the year's relief −ni_class_4_losses_brought_forward), read byni_class_4,ni_class_4_main,ni_class_4_maximum,ni_class_2. The new input holds para 3(4)(b) losses that Income Tax set against other incometax_credits_applicable_incomeless the claimants' losses (not a child's), never below zerouc_trading_losses_set_against_profits= min(loss, profits): deducted inuc_mif_capped_earned_incomebefore the minimum income floor and in the reg 82 benefit cap earnings tests; never against employed earningstrading_loss;self_employment_incomestays non-negativehbai_household_net_income,household_market_incomeandmarket_incomesubtract itloss_reliefnow holds only losses brought forward (s.83: "a deduction for that purpose is to be made only from profits of the trade"), which is how policyengine-uk-data's SPI build already fills it (LOSSBF). It no longer adds the previous year'strading_lossautomatically, because the new relief may already have used that loss against general income.trading_lossis uprated like self-employment income (variableupratinganduprating_indices.yaml), and it moves frombases/toinput/.Fixes the loss part of #1916 (capital allowances and the trading allowance stay open there). Companion data: PolicyEngine/policyengine-uk-data#528 fills
trading_lossfrom FRS SEINCAM2 < 0.Choices and limits
loss_relief(both taxes) orni_class_4_losses_brought_forward(Class 4 only) in later years. Computing it automatically would need each earlier year's whole Income Tax calculation.pension_contributions_relief, which depends on adjusted net income through the tapered annual allowance (a cycle) and also caps relief at the annual allowance, which in law charges excess saving rather than limiting relief.Invariants (property-tested with Hypothesis,
test_trading_loss_properties.py)Mutation check (one planted bug at a time in a scratch worktree, each run against the test that should catch it): 19 of 19 caught on f658a97, including the round-1 and round-2 fixes (UC netting and the benefit cap earnings test, children's losses in tax credits, relevant UK earnings, the age-75 rule, the s.190 limit, taxable basic income, the Class 4-only carry-forward). Each property runs 3 generated examples plus pinned cases (relief limited by net income, both caps, a loss beside pay or profits, income spilling into savings and dividends, the benefit-cap household, a child's loss), which keeps it to about 2-6 minutes.
Tests
reliefs/trade_loss_relief_against_general_income.yaml(cap at 25% and at £50,000; pension contributions, employment expenses and losses brought forward in adjusted total income; no relief on contributions from 75; Personal Allowance restored; PA wasted; overflow to savings then dividends; taxable basic income),reliefs/loss_relief.yaml(rewritten for s.83),national_insurance/class_4/ni_class_4_trading_loss.yaml(incl. the Class 4-only carry-forward),universal_credit/uc_trading_loss.yaml,tax_credits/tax_credits_applicable_income_trading_loss.yaml(incl. a child's loss),household/income/trading_loss_household_income.yaml.Impact
Real enhanced FRS runs, 2025-26 to 2030-31, of this branch at 65735bb (the figures are identical at 905b41a) on one seeded build of the companion PolicyEngine/policyengine-uk-data#528 (94bd3d7). Each comparison uses the same build, so the weights are identical. Aggregates only; any cell resting on fewer than 10 FRS households is suppressed.
trading_losszeroed, this branch and main (84f5ad4) give identical results: 38 arrays of taxes, NICs, benefits, household incomes and poverty flags, in every year.trading_lossonly as a deduction from self-employment income, and every loss-maker has none.In 2026-27, 27,000 people (61 FRS households) have a loss; 23,500 (50 households) get relief; for 6,700 (13 households) income or the cap limits the relief below the loss; 9,100 (35 households) pay less Income Tax. No means-tested benefit changes, so the tax-deduction gap in #2108 is £0 on this data. Fewer than 10 FRS households cross a poverty line, so those counts are not published.
The enhanced FRS carries less loss than the raw FRS (£314m on 27,000 people in 2024, against £1.28bn on 74,000), because calibration gives FRS loss-makers about a third of their survey weight; #528 explains.
Review
axiom: TheAxiomFoundation/rulespec-uk#429 queued
🤖 Generated with Claude Code