Repository navigation
Conversation
UC Regs 2013 reg. 49(1) and its legacy equivalents (HB Regs 2006 reg. 47, HB (SPC) Regs 2006 reg. 45, IS Regs 1987 reg. 49, JSA Regs 1996 reg. 111, ESA Regs 2008 reg. 113, SPC Regs 2002 reg. 19) calculate capital at market or surrender value less 10% where a sale would incur expenses and less any encumbrance secured on it. The model summed every capital source at full value. Each programme gets a capital.sale_expenses node (rate 0.1 and the sources whose sale incurs expenses: land, property and corporate_wealth, not cash savings). A shared helper applies the 10% before the encumbrance and never values an encumbered asset below nil. New household inputs carry debt secured on other residential property, non-residential property and land; the Enhanced FRS has none, so they default to zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Each programme's sale-expense parameters now cite its GB and NI regulations, the guidance paragraph that orders the 10% before the encumbrance, and per-asset guidance with exact PDF page anchors (DMG ch 52 for ESA, HBGM Annex F for HB savings, H1656/H1665/H1673-H1675 for UC). - The source-list descriptions and changelog say plainly that corporate_wealth also holds unit trusts, ISAs, employee share options and, in datasets built before the pension split, non-DB pension wealth. - The helper and secured-debt docs say debts net within a source category. - The property-test oracle fixes the sale-expense assets and the 10% itself instead of reading the parameters, checks pension-age HB, and runs on larger populations. New hand-computed cases cover HB second homes and premises, per-source flooring between two encumbered sources, pension-age HB, and a monthly secured debt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HBGM W1.430 states only the general 10% rule; the rule that real property always has costs of sale comes from R(IS) 21/93, as DMG 29622 applies it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Coordination note from #1950 (UC capital income). If this PR lands after #1950, please update the "reg 49 is #1960" notes #1950 adds:
Those cases enter £10,000 of property as capital. At 90% that is 12 tariff steps, not 16, so either update the expected values or restate the input as a property value of £11,111.11. If #1950 lands second, I'll do it on rebase. #1950's merge is waiting on a decision from Max (over the £1bn/yr line). 🤖 Generated with Claude Code |
|
#1950 merged (770bc06), so this PR is second. Please update the "reg 49 is #1960" notes:
At 90% valuation, £10,000 of property is 12 tariff steps, not 16, so either update the expected values or enter £11,111.11. 🤖 Generated with Claude Code |
Resolve the capital variables onto main's claimant/partner allocation and person-level sources, valuing household sources through valued_capital. Update the let-property tests #1950 added: £10,000 of property is now £9,000 of capital under reg. 49(1), so 12 tariff steps, not 16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two tests main added after this branch's earlier base assumed full-value capital: - The CTR savings-credit-only case holds savings 10,000 and a 7,000 second property: capital is 10,000 + 90% of 7,000 = 16,300 (SPC Regs 2002 reg. 19(a)), still over the 16,000 limit, so CTR stays nil. Deemed income is 13 steps x 52 = 676, Pension Credit income 13,314 + 676 = 13,990, and savings credit 60% of (12,376 - 208.07 x 52) less 40% of (13,990 - 12,376) = 288.22. - The reported-capital property test's proxy oracle now values land, property and shares at 90% and savings at face value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The six capital sources lists (UC, HB, IS, JSA, ESA, PC) name directly_held_shares, unit_and_investment_trusts and stocks_and_shares_isa in place of corporate_wealth, plus a new formula variable, unitemised_corporate_wealth = max(0, corporate_wealth - components), for whatever a dataset does not itemise. Datasets without the components keep counting corporate_wealth in full; datasets that build corporate_wealth as the components' exact sum count the same total, now itemised, so each component can carry its own valuation rule (the sale-expense deduction stacked on #1969 exempts unit trusts and ISAs). No dataset's capital changes: a differential property test checks that every programme's assessable capital equals the same holdings entered as one corporate_wealth. Review nits: the growth-factor sentence now matches uprating_indices.yaml exactly; the variable docs cite the DMG for the legacy benefits, the expert valuation of unquoted shares and the quoted-share rule for investment trusts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le-expense-share-split
…eduction corporate_wealth is now itemised in the capital sources lists (#1974), so the sale-expense lists name directly_held_shares, which DWP values less 10% for costs of sale (ADM H1665; DMG 29671/52671/84763; HBGM W1.513), and unitemised_corporate_wealth, which keeps the previous flat treatment on datasets that do not itemise. Unit trusts have no costs of sale even when sold through a broker (ADM H1673-H1674; DMG 29680-29681, 52680-52681, 84771-84772; HBGM W1.530-W1.531), and an ISA is valued at what the holder would get by withdrawing it, with no paragraph applying the 10% (ADM H1656-H1658; DMG 29662-29664, 52662, 84748-84750). The survey bucket of unit and investment trusts is treated as having no costs of sale; investment trusts were 8.2% and 6.9% of the pooled funds in stocks and shares ISAs at 5 April 2022 and 2025 (HMRC ISA Table 9.6). The property tests keep their own legal asset set and assert each programme's list against it, and gain the split invariants: the residual, backward compatibility with every component nil, conservation at a zero rate, split effect = rate x (trusts + ISA), and no double counting. #1974's itemising-invariance test no longer holds by design and is replaced by them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Stacked follow-up: #2131 lists only 🤖 Generated with Claude Code |
vahid-ahmadi
left a comment
There was a problem hiding this comment.
Thanks Max. Reviewed at head 22274cad.
The law is right in every programme. I re-fetched each provision from legislation.gov.uk:
-
UC Regs 2013 reg 49(1): "Capital is to be calculated at its current market value or surrender value less— (a) where there would be expenses attributable to sale, 10%; and (b) the amount of any encumbrances secured on it."
-
The same rule appears, in older wording ("10 per cent", "encumbrance/incumbrance"), in:
- SPC Regs 2002 reg 19;
- HB Regs 2006 reg 47 and HB (SPC) Regs 2006 reg 45;
- IS Regs 1987 reg 49;
- JSA Regs 1996 reg 111;
- ESA Regs 2008 reg 113.
The regulation numbers are right (JSA 111 and ESA 113).
-
CTR Prescribed Requirements SI 2012/2885 Sch 1 para 32 has the same 10% rule for pension-age CTR.
-
SPC Sch V has no disregard that touches share, unit trust or ISA valuation. Para 9 is business assets only.
The helper follows the guidance. valued_capital takes the 10% off gross value before the debt (ADM H1608) and floors each encumbered source on its own (H1615-H1616).
Probes all match hand arithmetic:
- savings £5,000 +
corporate_wealth£12,000 gives £15,800 for UC, HB and IS, and £15,800 for PC at 70 (main: £17,000); - a £100,000 second home with £95,000 debt plus £3,000 savings gives £3,000;
- a second home of £20,000 with £25,000 debt plus premises of £10,000 gives £9,000.
Tests:
- At the head: properties, PC reported capital and stock periods, 9 passed. DWP, family and CTR YAML, 967 passed.
- Merged into current main
b5b09231(the merge is clean; the branch is 280 commits behind): the same YAML set, 1,274 passed. But two of the new property tests fail; see finding 1. The green CI is from the stale merge ref.
Findings:
-
Blocking (rebase). On main + this branch,
test_valuation_matches_the_regulation_and_never_adds_capitalandtest_cash_only_households_have_no_deductionfail (2 failed, 8 passed). The valuation isn't the problem; the test's oracle is out of date.- Main now sets HB capital to nil for anyone on UC, IS, income-based JSA or income-related ESA (HB Regs Sch 6 para 5,
housing_benefit_on_passporting_benefit). It also switches the pension-age rules onhousing_benefit_pension_age_regulations_applyrather than age 67. - So a working-age single person with £2,441.62 of cash now has HB capital of nil (on main too), while
applies()attests/test_capital_valuation_properties.py:127still expects their savings. - I reproduced the cash-only failure directly. The other failing test uses the same
applies()predicate, so it is most likely the same cause. - Fix: rebase and key the pension-age branch on
housing_benefit_pension_age_regulations_apply. Then either skip units wherehousing_benefit_on_passporting_benefitis true, or give the generated units enough earnings to stay off UC. Skipping alone would hollow out the working-age HB branch, because the strategy's no-income singles are nearly all on UC.
- Main now sets HB capital to nil for anyone on UC, IS, income-based JSA or income-related ESA (HB Regs Sch 6 para 5,
-
Blocking (merge order with #1974). Git merges this branch and #1974 cleanly, but together they undo this PR:
- #1974 takes
corporate_wealthout of everycapital.sourceslist, while this PR'ssale_expenses.sourcesstill names it. So the 10% on shares silently stops. - On a 1969 + 1974 tree, the probe above goes back to £17,000. Seven YAML cases fail: 3 in
capital_valuation.yaml, and 2 each in the IS and ESA capital files. - #2131 fixes this. So either merge #1974 first and then this PR and #2131 together, or merge this PR and then #2131 retargeted to main (it carries #1974).
- A cheap guard in
tests/test_capital_valuation_properties.py: assertset(sale_expenses.sources) <= set(capital.sources)for each programme. The existing check at line 160 intersects both sides withcounted, so it can't see a stale name.
- #1974 takes
-
Should fix (body, disclosure). In "A few records carry each figure", the UC, PC and HB bullets, and the poverty bullet, attribute most of each year's change to one or a handful of records, with percentages and counts. Read against the impact table, that is effectively a record-level weighted amount. Keep the caveat ("driven by a handful of records; not an estimate") and drop the percentages, record counts and the median gain.
-
Nit.
parameters/gov/dwp/income_support/means_test/capital/sale_expenses/rate.yaml:9. This starts on 2010-01-01, to matchsources. IS reg 49 has applied the 10% since 11.4.1988. Add a sentence saying the date follows the sources list, as the HB and PC files already explain their own dates. -
Nit.
utils/capital_valuation.py:18-19. Netting debt across assets within a category is documented. H1616 actually allows it where one debt is secured on several assets. You could cite that, so the approximation reads as partly lawful rather than purely a data limitation. -
Coordination with #1965. Merged with #1965 there is no textual conflict, but the holding comes off at 100% while it is counted at 90%: savings £5,000 + a £10,000 holding gives £4,000 instead of £5,000. I've put the fix on #1965, since it rebases second.
Keep main's recorded benefit-unit capital (benunit_reported_capital), which replaces the valued household sources as recorded, and register the secured-debt inputs beside main's uprating entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
£20,000 of shares is £18,000 of Pension Credit capital (SPC Regs 2002 reg. 19(a)), still over the CTR limit: deemed income 16 x 52 = 832, Pension Credit income 14,146, savings credit 933.816 - 0.4 x 1,770 = 225.82. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uprating_indices.yaml grows owned_land_secured_debt with per capita GDP, but the growth factors page left it out of that list. The page's list now matches the index file's per capita GDP entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3DAwvyhPgY7sU1r3AiycF
|
Generated by Claude Code |
|
Ready for hub review Head:
Late writerBefore I started (03:23Z), at each push, and again before posting, Review of brief 1031's commitsI read every resolution in
Task 1's benefit unitOne person aged 70 with a £4,000 cash ISA, £3,000 of savings and a £100,000 second home carrying a £60,000 mortgage. By hand: the cash ISA moves to its holder at face value (4,000), savings count 3,000, and the home counts 100,000 − 10,000 − 60,000 = 30,000, so 37,000 in UC, HB, IS, JSA, ESA and PC. The merge's case in Council tax reduction's household route against #1969's valuationRun on hand-built households at the head (
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve three conflicts and keep main's person-level ISA allocation: - shard_durations.toml: main's regenerated table, with this PR's three renamed share-component tests (same durations). - growthfactors.md: main's text, which already lists the three secured-debt inputs this PR documents and moves main_residence_value and other_residential_property_value to house prices. - uc_assessable_capital.py: this PR's sale_expenses.sources wording with main's prose, and the stocks and shares ISA at its withdrawal value. Main (#2712, through #1969) moves each stocks and shares ISA balance out of share_like_capital into its holder's unit. This PR replaces share_like_capital in every capital list with its two parts, so counted_person_sources would have dropped the ISA person source. The ISA now maps to share_like_capital_without_sale_expenses, which holds it because gov.dwp.share_like_capital.without_sale_expenses lists stocks_and_shares_isa; no programme's sale-expense list names that part, so each means test counts the balance at face value. The parameter and variable descriptions name the new household source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch values stocks and shares ISAs without the deduction for expenses of sale (ADM H1656-H1658), and the ISA person source now comes out of share_like_capital_without_sale_expenses. Main's person ISA cases expected 90%, so each counted ISA rises by a tenth. Cases 13 to 15 test a boundary, so their inputs move to keep it: a 30,600 ISA in Case 13, and household totals of 16,000 and 6,000 in Cases 14 and 15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's tests valued all of share_like_capital, and each stocks and shares ISA, at 90%. On this branch only share_like_capital_with_sale_expenses takes the deduction, and the ISA person source comes out of share_like_capital_without_sale_expenses at face value. The helpers now value each part by whether the programme's sale_expenses.sources lists it, and the hand-worked cases follow: the producer-shape households give UC capital of 10,900, 8,950, 14,000 and 11,000, and the list-reform test drops share_like_capital_without_sale_expenses, the source that holds the ISA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test checked each total to within £0.011, and CI at df8c1ea failed it. The engine holds totals in float32. Its float32 sum can round a penny under the exact total, which the test's docstring allows, and it then stores that figure to float32's step, which the £0.011 bound didn't allow for above about £16,000. CI drew a household the test expects at £16,834.13: the engine gives £16,834.12, held as 16,834.119, which is £0.0109 under, and the test's own float32 subtraction read £0.0117. The check now subtracts in float64 and allows a penny plus one float32 step at the expected value. Two households are pinned: CI's, and one expected at £37,747.34 that the engine holds as 37,747.328, which is £0.0119 under and fails the old bound in float64 too. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
@MaxGhenis, delta review at a418a00 (my last was at 1efee62b). Status of my October findings:
- the savings-credit-only case expects £621.82;
- the reg 77 holding now leaves the pool and a complete override at 90%. Probes at this head give £5,000 and £14,000;
- #1974 landed and its
share_like_capitalrename is carried through; - the record-level figures are gone from the body.
- the generic sale-list guard is only partly addressed: #1974's
test_lists_name_share_like_capital_onlycovers the share case, but there is still no general "every sale-list name is counted" check (test_capital_valuation_properties.py:224still intersects withcounted). Low risk now that #1974 has landed.
One thing came in with the merges of #1974 and #2839 and needs a merge condition.
Itemised ISAs and unit trusts now lose 10%. Main counts them in full.
- Person route (
utils/capital_valuation.py:86-89).valued_person_capitalvaluesstocks_and_shares_isa_countable_capital, a balance tied to a named holder, at 90% throughHOUSEHOLD_SOURCE_OF. Main'sperson_isa_capital.yamlexpectations fall: Case 2's child from £9,000 to £8,400 (:79), Case 7's PC from £9,000 to £8,800 (:221) and Case 9 from £11,000 to £10,700 (:281). - Household route (
:46-53).valued_capitaltakes 10% off all ofshare_like_capital, which since #1974 is built from itemisedstocks_and_shares_isaandunit_and_investment_trustswhere they exceedcorporate_wealth. Main'stest_isa_balances.pyandtest_stored_household_totals.pyare edited to count a stored £2,000 stocks and shares ISA at £1,800. - The guidance. ADM H1674: unit-trust holders "apply to the manager of the trust to withdraw their money so there are no costs of sale". H1656 values an ISA at "what people would get if they withdrew their investment" (ADM H1, pp.55 and 59).
- This PR's text says the same. The
sale_expenses/sources.yamldescriptions say the deduction reaches these "until the data separate them". On main the data already do, for both the person balances and the household components. - Merge condition. The body defers the fix to #2131, a draft stacked on this branch. Please land #2131 together with this PR (or fold it in), so main never counts an itemised ISA or unit trust below its current value.
Review drafted with AI assistance and checked against the code at a418a00.
The without_sale_expenses description and the changelog fragment now say the model counts a stocks and shares ISA at its full withdrawal value because H1656 says nothing about costs of sale, not that a paragraph exempts it. The description also notes that employee share options, which the survey asks about with employee shares, take the deduction as an approximation. A comment on COMPONENTS says every name on the exempt list must be one of them, since the formula reads only COMPONENTS to decide whether a household itemises. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
valued_capital reads only each programme's capital.sources, so a name on capital.sale_expenses.sources outside them is never valued. The property now asserts the sale list is a subset of the counted sources for all six programmes, which the intersection check alone could not see. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omments #1969's changelog fragment said the 10% reached all of share_like_capital, unit trusts included, "until the data separate them". It now names what takes the deduction after the split: land, property, directly held shares and any corporate_wealth a dataset does not itemise. The ISA docs named share_like_capital as the source the stocks and shares ISA balances leave. They now name share_like_capital_without_sale_expenses, and say every means test counts that part at withdrawal value. The test comments and the parameter description say the model reads ADM H1656's silence on costs of sale as no deduction, rather than saying H1656 rules one out. The COMPONENTS comment notes that share_like_capital sums the same names, and invariant 7 allows float32's step as well as a penny. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the delta review at
CI is running on the combined tree. The description's Validation and Impact sections will give the results, and an independent review of |
#1969 now values unit trusts and stocks and shares ISAs at full value in every means test, through share_like_capital_without_sale_expenses, and takes the 10% only from share_like_capital_with_sale_expenses. This branch held #1969 at 59a1c4a, before that split. Each of the six sale-expense lists keeps #2688's overseas and other real estate and names the part with sale expenses, and Pension Credit's capital sources name both parts. test_isa_balances.py and test_stored_household_totals.py take #1969's full-value ISA expectations, which reverses e041345. test_property_wealth_components.py now checks the two parts, and the property-wealth docs say which part takes the 10%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pany deductions consistent under reforms Answers review fold-r1 at 8f755b9. - P1: household_sources(law) replaces the HOUSEHOLD_SOURCE_OF constant. It maps a stocks and shares ISA balance to the share-like part that holds the household's ISAs under the period's gov.dwp.share_like_capital.without_sale_expenses. counted_person_sources, pooled_person_capital (now given parameters by all six formulas) and valued_person_capital read it, so a reform that takes stocks_and_shares_isa off the exempt list nets the balance out of the part with sale expenses and values it less 10%. stocks_and_shares_isa_countable_capital bounds balances by that part where it falls short of min(stocks_and_shares_isa, share_like_capital) by more than share_like_capital's float32 spacing; rounding alone leaves it short by at most half that, so nonnegative holdings keep today's bound. - P2: the part with sale expenses is held between nil and share_like_capital where the itemised sum is positive, so signed holdings can't push the parts apart. The property test draws signed components, includes the 1e9 / -1e9 / 1 case, and asserts the parts sum to the total within half its float32 spacing. - P3: household_uc_company_holding_pool_scale is nil when UC's sources don't list share_like_capital_with_sale_expenses, so no holding leaves the pool; the owner's own assessment still takes it off a report. - P4: the CTR docstring says the household route doesn't yet count share_like_capital, and older datasets may mix it with pension wealth. - P5/P6: the share-split fragment, the exempt parameter, the ISA docs page and two test docstrings name the six DWP capital assessments instead of every means test; the ISA docs page and the touched docstrings describe the routing and bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rings Comments and documentation strings only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e the means-test wording Review fold-r2 P1: the rounding exception bounded a balance by the part that holds the ISAs only where the part fell short by more than share_like_capital's float32 spacing, so exact signed cancellation could leave a pound the part does not hold (2**23 shares, -1 trusts, a 1 ISA). The bound is now the smallest of stocks_and_shares_isa, share_like_capital and the holdings behind the part: the listed holdings' float32 sum, clamped as the part with sale expenses clamps it (nil where the itemised sum is not positive), or, under a reform that moves the ISAs, the part with sale expenses itself, which rounds once from that complement. Adds the witness, its mirror and an unitemised case as regressions, and an exact sweep over signed holdings near powers of two with the ISA exemption on and off and UC counting each part or both. P3: scope the each-means-test claims in the ISA variable, the docs page and the person-ISA test to the six DWP capital assessments, with Council Tax Reduction using them only through its UC and Pension Credit routes, and state the share parts' ranges for signed itemised sums. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sweep counts the parts under Universal Credit only, so the module docstring now says so rather than claiming every programme. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and round the reform-route complement once On the baseline route the bound read only the listed holdings, so a direct input or a reformed formula of either share part could leave the part that holds the ISAs short while the balances kept their value, sending the pool below nil (a lodger's UC capital fell from £5,000 to £2,500). Where the stored part falls short of the holdings behind it by more than share_like_capital's float32 spacing, which the parts' own formulas never do for a list of two holdings, the stored part now bounds the balances, on either route. Under a reform that takes the ISAs off the exempt list, the holdings behind the part with sale expenses are now share_like_capital less the listed holdings computed in float64, so they round once. The stored part rounds the listed float32 sum and then the subtraction, so for a list of two holdings it could fall a pound short of a balance the holdings cover. One-name lists, the default reform included, give the same holdings as before. Rename the £100.01 test, whose name described the old slack rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ls short Review r3 (P2). The fallback in stocks_and_shares_isa_countable_capital switched to the stored part only where it fell more than share_like_capital's float32 spacing short of the holdings behind it, so it could not tell the parts' own rounding from a direct input or a replaced or neutralised formula within that spacing. With share_like_capital of 2**23, a £1 ISA balance and the part that holds the ISAs entered as nil, the holder kept £1 the part did not hold: UC for a holder and a lodger sharing £10,000 of savings came to [£5,000.50, £4,999.50], or [£5,000.45, £4,999.55] with the ISAs off the exempt list, instead of [£5,000, £5,000]. The rounding allowance now applies only where both stored parts equal the split the parts' own formulas give. formula_split recomputes share_like_capital_with_sale_expenses with its own formula from the same share_like_capital, itemised holdings and exempt list, casts it to float32 as the engine stores a formula result, and takes the other part as share_like_capital less it, as that part's formula does. The same float32 operations on the same values give the same result, so the formulas' own split always matches and keeps its rounding allowance exactly as before. Where either stored part differs, the stored part bounds the balances wherever it falls short of the holdings. Values equal to the formulas' split, however supplied, give the formulas' results. The variable's documentation and the ISA assumptions page say so. Adds the reviewer's two witnesses (both routes) and structural variants, replacing either part's formula or neutralising the part, as regressions that fail at 45c48dc, and a test that a replacement giving the formulas' values changes nothing while an input of the other part still bounds the balances by the part that holds the ISAs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r3 (P3). Invariant 10 and the docstring of test_a_stored_part_short_of_its_holdings_bounds_the_balances said a directly supplied part falling short of its holdings forces the balances below it, while the code at 45c48dc switched to the part only beyond share_like_capital's float32 spacing. With the previous commit the claim holds for any shortfall once either stored part differs from the formulas' split. Invariant 10 now says the balances exceed the stored part only where both parts are the formulas' split, and then by no more than that spacing; that an input or a replaced or neutralised formula making either part differ bounds them by the stored part however little it falls short; and that values equal to the formulas' change no result. The test docstring notes its shortfalls all exceed the spacing and points to the test of those within it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l or less, holdings for NaN Invariant 10, the variable's documentation and formula comment, and the ISA assumptions page said the balances hold no more than the stored part that holds the ISAs, and that the pool never counts less than nil of it. That overstates the guarantee. bounded_holdings floors the bound at nil, so a stored part below nil cannot bound the balances below nil. With the part entered as -1, or given as -20 by the formulas' own split (the verifier's cases), the balances hold nil and the pool counts the negative part as it stands. A missing (NaN) stored part is never the formulas' split and never less than the holdings, so the holdings stay the bound. Each passage now says what the code does: the balances hold no more than the stored part, or nil where it is nil or less, plus at most share_like_capital's float32 spacing where both parts are the formulas' split, and a NaN part leaves the bound at the holdings. The claim that the pool never counts less than nil now covers only overridden parts of nil or more; the stored-part test's docstring says its parts are all nil or more. Text only: no formula, assertion or expected value changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review r4 found that invariant 10, the variable documentation and comment, and the ISA assumptions page state the stored-part bound without exception. Where stocks_and_shares_isa or share_like_capital is missing (NaN), household_total and so the overall bound are NaN, the comparisons are false, and bounded_holdings leaves finite balances of nil or more unchanged, so a balance can exceed the stored part. Each passage now limits the guarantees to the case where none of the bound's three amounts is missing, and says what happens otherwise. The text also said a missing stored part "leaves the bound at the holdings". That is true of the holdings term only: the bound is still the smallest of stocks_and_shares_isa, share_like_capital and the holdings. It now says the missing part never replaces the holdings as a bound, and the code comment says "overall bound" where it means the final one. Text only: no executable line, assertion or expected value changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings #1969's answers to its fold-r1 review: person ISAs routed by the exempt list, share parts that sum under signed inputs, no company-holding deduction from trusts after a source-list reform, the CTR docstring, and "the six DWP capital assessments" in place of "every means test". No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1969's later rounds bound person ISA balances by the holdings behind their stored part, round the reform-route complement once, and qualify the bound text for missing aggregates. The merge is clean on top of 6e4c632, which keeps review r1's two text fixes (CTR's capital route and the capital table). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #1960.
Reproducer:
policyengine_uk/tests/policy/baseline/gov/dwp/capital_valuation.yaml::UC values a mortgaged holiday home as in ADM H1602,policyengine_uk/tests/policy/baseline/gov/dwp/capital_valuation.yaml::UC shares valued less sale expenses bring capital within the limit,policyengine_uk/tests/test_capital_valuation_properties.py::test_valuation_matches_the_regulation_and_never_adds_capital,policyengine_uk/tests/policy/baseline/gov/dwp/capital_valuation.yaml::A Lifetime ISA value given as an input is counted as given,policyengine_uk/tests/test_capital_valuation_properties.py::test_lifetime_isa_reformed_value_is_kept_as_stored,policyengine_uk/tests/test_isa_balances.py::test_person_isa_balances_count_in_full_in_every_means_testThe model now values capital as the regulations require in Universal Credit, Housing Benefit, Income Support, income-based JSA, income-related ESA and Pension Credit. It takes 10% off market value where a sale would incur expenses, then deducts any debt secured on the asset.
Land, property, directly held shares and any
corporate_wealtha dataset does not itemise take the 10%. Savings, cash ISAs, unit and investment trusts and stocks and shares ISAs count at full value. The helper floors each encumbered source at nil, so negative equity in one source can't reduce another.This PR includes PolicyEngine/policyengine-uk#2131, which values share-like capital by asset type. This branch now carries all its commits, so GitHub closed it as merged. See that PR for its full record.
The law
The decision maker takes the 10% from gross value before debt, and only where a sale incurs expenses; real property always has them (ADM H1604–H1608). The decision maker then deducts only the debt secured on that source (ADM H1615–H1616). Each programme's parameters start from its existing capital-source list and cite the provision in its own instrument.
Which sources take the 10%
directly_held_shares)unit_and_investment_trusts)stocks_and_shares_isa, and balances tied to a person)corporate_wealththat a dataset does not itemiseWhat changes
Valuation and rounding
capital.sale_expenses.rate: 0.1, an explicit list of sources and its owncapital.round_downrule.valued_capitalapplies the deduction before secured debt, in float64. UC's existing property route uses the same rate.exact_amountrecovers an unambiguous whole penny from float32 storage below £131,072 and preserves other stored amounts. Above that boundary, original pennies can be ambiguous, so a result can differ by a penny either way. This PR can't recover digits that float32 storage lost before valuation.defined_formask through Core's entity mapping and keeps Core's stored value outside it. It calculates the mask first and runs the formula only when at least one person applies.Share-like capital by asset type
On main, #1974 builds
share_like_capitalfromcorporate_wealth, or from the sum of its itemised components (directly_held_shares,unit_and_investment_trusts,stocks_and_shares_isa) where they exceed it beyond float32 rounding. This PR splits it in two:share_like_capital_with_sale_expensesholdsshare_like_capitalless the holdings thatgov.dwp.share_like_capital.without_sale_expenseslists, kept between nil andshare_like_capital. The list holds unit and investment trusts and stocks and shares ISAs. Where the itemised holdings sum to nil or less, this part keeps all ofshare_like_capital, so data that carry onlycorporate_wealthkeep the flat 10%.share_like_capital_without_sale_expensesholds the rest: between nil andshare_like_capitalwhere the itemised holdings sum to more than nil, and nil otherwise.The formula caps the part with sale expenses at
share_like_capital, so the two parts add up toshare_like_capitalwithin half its float32 spacing, whatever the signs of the holdings. With only a floor at nil, shares of £1 billion, trusts of −£1 billion and a £1 ISA would split their £1 total into £1 billion and −£1 billion.All six capital lists name both parts beside savings and cash ISAs. All six sale-expense lists name the part with sale expenses and not the part without, and none names savings or cash ISAs.
The exempt list starts on 7 October 1996, the earliest start of the six capital lists, and the formula sums it from zero, so an empty list works. The formula reads only
COMPONENTSto decide whether a household itemises. A comment there says that every exempt name must be one of them.Stocks and shares ISAs
Main sums
cash_isaandstocks_and_shares_isafrom each person's balance (#2712). Since #2839, it counts each balance tied to a member in the holder's own benefit unit (cash_isa_countable_capital,stocks_and_shares_isa_countable_capital). It subtracts that balance from the household source that holds it before it allocates the rest.stocks_and_shares_isa, so a stored household total, or the sum of person balances, sits in the part without sale expenses. Each of the six assessments counts it at its withdrawal value.household_sourcesreads the exempt list for the period and mapsstocks_and_shares_isa_countable_capitalto the part that holds the household's ISAs: the part without sale expenses while the list namesstocks_and_shares_isa, and the part with them once a reform removes it. The formulas subtract, value and bound each balance against that part. No sale-expense list names the part without sale expenses, so at baseline each assessment counts a member's balance at face value in the holder's unit.valued_capitalthe household sources less those balances (pooled_person_capital).valued_capitalvalues the remainder less 10% wheresale_expenses.sourceslists the source, then less any debt secured on it.valued_person_capitalvalues each balance asvalued_capitalvalues its household source.uc_assessable_capitalkeeps main's~coveredmask. A reporting unit's claimant's and partner's ISAs stay in the pool, valued with it, and the formula subtracts the report.A reform that removes
stocks_and_shares_isafrom the exempt list moves the balances with the household's ISAs into the part with sale expenses, so each assessment counts them at 90%. Intest_a_reform_that_takes_isas_out_of_the_exempt_list_values_person_isas_less_10_percent, each household's share-like capital is £5,000 of ISAs held as person balances. Under the reform, the five working-age assessments count a sole holder's £5,000 as £4,500, and Pension Credit does the same for a pension-age holder. Where a tenant and a lodger share £1,000 of savings and the lodger holds the ISA, capital moves from [£500, £5,500] to [£500, £5,000].The bound on person ISA balances
Main bounds a household's stocks and shares ISA balances by the smaller of
stocks_and_shares_isaandshare_like_capital.stocks_and_shares_isa_countable_capitaladds a third bound: the holdings behind the part that holds the ISAs. Without it, a balance could count capital that part doesn't hold, and the pool would net the balance out of nothing. For example, shares of £8,388,608, trusts of −£1 and a £1 ISA balance leave the part without sale expenses at nil. The balance now holds nil, and with the part with sale expenses off UC's lists, UC counts nothing, where the two-way bound counted £1.holdings_without_sale_expensestakes the float32 sum of the listed holdings, kept between nil andshare_like_capitalwhere the itemised holdings sum to more than nil, and nil otherwise. The part with sale expenses subtracts that same sum. The stored part without sale expenses comes from a second subtraction, which can round it below the sum, so the bound reads the sum.holdings_with_sale_expensestakesshare_like_capitalless the listed holdings, computed in float64 and kept the same way, or all ofshare_like_capitalwhere the itemised holdings sum to nil or less. Float64 holds those sums exactly unless one amount exceeds 2^29 times another, so the bound rounds once, to float32.share_like_capital's float32 spacing of them. A longer list can round its sum more than once, and that guarantee doesn't extend to it.The stored part can still fall short of these holdings, through its own rounding, or because a direct input, a replaced formula or a neutralised formula sets either part.
formula_splitrecomputes the part with sale expenses with its own formula, from the storedshare_like_capitaland itemised holdings, and casts the result to float32 as the engine stores a formula result. It takes the other part asshare_like_capitalless that, and reports whether both stored parts equal these values.stocks_and_shares_isa_countable_capitalthen sets the bound:share_like_capital's float32 spacing, and the pool absorbs that rounding. Past one spacing, the stored part bounds them. For example, a sole holder's £100.01 balance in £20,000.01 ofcorporate_wealthkeeps all £100.01 against a stored part of £100.009765625, and UC counts £18,010.01.bounded_holdingsfloors the bound at nil, so where the stored part falls below nil, the balances hold nil and the pool counts the negative part as it stands.stocks_and_shares_isaorshare_like_capitalmakes the overall bound missing, andbounded_holdingsthen leaves finite balances of nil or more unchanged, as it does on main. No committed test covers the missing-value cases.The bound tests check Universal Credit; the other five assessments read the same
stocks_and_shares_isa_countable_capital.Regulation 77 company holdings
UC disregards an owner-manager's company shares under reg 77(2), and selling shares incurs expenses.
HOLDINGS_SOURCEnamesshare_like_capital_with_sale_expenses, so the UC pool budgets company holdings against that part and never deducts them from unit trusts or ISAs.uc_assessable_capitaltakes a disregarded holding off the pool and off any complete override at 90%, as UC values shares, and off a recorded financial total in full. In its place, it adds the claimant's or partner's share of the company's capital (reg 77(2)), outside the sale-expense helper. On data that don't itemise, both sources give the same value.household_uc_company_holding_pool_scalereturns nil when UC'ssourcesdoesn't listshare_like_capital_with_sale_expenses. A reform that stops UC counting that part then takes no holding out of the pool, so no holding removes unit trusts or ISAs in its place. With £30,000 of shares, £10,000 of trusts and a disregarded £30,000 holding, such a reform leaves the £10,000 of trusts in the pool: [£5,000, £5,000] for the owner's and a lodger's units. With a £40,000 report for the owner's unit, the owner's own assessment still takes the holding off the report, and the report takes the £10,000 pool: [£10,000, £0].Secured debt
Three household inputs hold the debt secured on other residential property, non-residential property and land. Main's #2447 added the first two. This PR adds
owned_land_secured_debtand deducts all three in every programme that counts the asset. UC counts no land, so the land input changes the five legacy means tests only. Each input defaults to zero.uprating_indices.yamllists each once, and the growth factors page listsowned_land_secured_debtunder per capita GDP.Council tax reduction
The council tax reduction formula takes Pension Credit's capital on a savings-credit-only award. It takes UC's capital for a working-age applicant with a UC award, except under Scotland's scheme from April 2022. It inherits their valuation on those routes.
Elsewhere, outside the routes that disregard all capital,
council_tax_reduction_assessable_capitaltakes its own household route (main's #1995). That route counts savings at face value, and land and property other than the home less 10% and less the debt secured on them. This PR addsowned_land_secured_debtto itsSECURED_DEBT, as councils deduct it under SI 2012/2885 Sch 1 para 32(b) and its equivalents.The route floors a negative source or debt at nil, works in float32 and keeps fractions of a penny.
valued_capitaluses a negative source or debt as given, works in float64 and rounds each valuation to the penny. Both take the 10% before the debt and floor each encumbered source at nil. No test shows a wrong result from those differences, so this PR leaves them.CI shard table
Main's
shard_durations.tomlnames three share-component tests that this PR replaces, andtest_ci_test_shards.pyfails on a line that names a missing test. This PR points those lines at the successors and keeps their measured durations.Methodology limits
corporate_wealthtakes the 10%. That aggregate can still fold in unit trusts, ISAs and, on datasets that predate the private pension split, non-defined-benefit pension wealth.gov.dwp.share_like_capital.without_sale_expenses. The person balances follow the list. Applying the 10% to part of a holding, such as the investment trusts in the bucket, would need a weight parameter and a formula change.Existing tests whose expected values move
Against main at
83c2554b2:person_isa_capital.yaml(main's Count each person's ISAs in their own benefit unit's capital #2839):corporate_wealth. The £3,000 left in the pool counts as £2,700, split £1,800 to the parents and £900 to the child's unit. That unit adds the ISA at face value, so UC and HB capital move from [2,000, 7,000] to [1,800, 6,900].test_person_isa_capital.py(main's Count each person's ISAs in their own benefit unit's capital #2839): the pound-counts-once checks value each part ofshare_like_capitalat the share each programme counts, and allow each programme's penny rounding.test_household_only_data_keep_todays_capital, UC capital moves from [8,000, 4,000] to [7,800, 3,900]: the 2,000 ISA counts at face value and the other 3,000 ofcorporate_wealthat 2,700.test_person_balances_without_household_totals_count_with_their_holders, UC capital moves from [11,000, 9,000, 14,000, 11,000] to [10,900, 8,950, 14,000, 11,000]. The first pool's 1,500 of directly held shares count less 10%. Pension Credit stays at 19,000.test_both_forms_in_one_dataset_add_up_to_the_stored_total, UC and Housing Benefit round each unit's capital to the nearest penny, so a household's two units can come to a penny over its total; the test allows that penny.share_like_capital_without_sale_expenses, the source that holds the ISA, where main droppedshare_like_capital.pension_credit_income.yamlCase 4 (main's Treat income derived from capital as capital in the legacy means tests #1995): the £55,370 let property counts less 10%. Capital moves from £55,825 to £50,288 and deemed income from £92 to £81 a week. Guarantee credit moves from £7,592 to (238 − 81) × 52 = £8,164.pension_credit_income.yamlCase 5: £87,285 of savings and £12,650 ofcorporate_wealthcount as £98,670, where main counted £99,935. Deemed income falls from £9,360 to £9,256 a year, and guarantee credit rises from £3,016 to £3,120.test_savings_credit_only_receipt_properties.py(main's Treat income derived from capital as capital in the legacy means tests #1995): main gave the owner £12,000 of savings and £4,400 of property, so Pension Credit's £16,400 exceeds the £16,000 limit and council tax reduction's £15,960 doesn't. Pension Credit now counts the property at £3,960 too. The test adds £500 ofcorporate_wealth, which Pension Credit counts at £450 and the council tax route leaves out. The savings credit stays £621.82 a year.test_isa_balances.py(main's Model the ISA subscription limits, with per-person ISA subscriptions and balances #2712) andtest_stored_household_totals.py(main's Keep stored household ISA totals after 2032 #2781) keep main's expected values: £6,000 × growth in 2027, and 6 × savings in every year from 2025 to 2040. Both now also check that capital equals its parts at face value, andtest_isa_balances.pythat the ISA sits in the part without sale expenses.test_capital_share_components.py(main's Itemise corporate_wealth's share-like components for the means tests #1974): the split's tests replace main's, which expected oneshare_like_capitalsource in every list.Expectations in these existing files also change, and their new comments cite the 10% or the programmes' penny rounding:
is_UC_eligible.yaml,uc_company_analogous_business.yaml,uc_property_capital.yaml,pension_credit_deemed_income.yamlandcouncil_tax_reduction_pension_credit.yaml;test_uc_company_owner_properties.py,test_uc_company_override_properties.py,test_uc_property_capital.py,test_uc_property_capital_mock.py,test_pension_credit_reported_capital_properties.pyandtest_uc_capital_allocation.py.For example, income-related ESA now counts £1,000 of savings and £9,500 of land, shares and property as £9,550, where main counted £10,500.
Invariants
This PR adds
capital_valuation.yaml(27 cases),capital_valuation_share_split.yaml(10 cases),council_tax_reduction_capital_valuation.yaml(1 case) andtest_capital_valuation_properties.py. It also adds tests totest_isa_balances.py,test_capital_share_components.pyandtest_stock_capital_periods.py.The capital property suite (
test_capital_valuation_properties.py) checks valuation against an oracle that specifies, from the law and independently of the parameters, which assets take the 10%. It maps the part with sale expenses tocorporate_wealthand the part without to nil. It raises aKeyErrorfor any source it doesn't map, and it generates cash ISAs as well as savings.It now also asserts, for all six programmes, that the counted
sourcesinclude every name onsale_expenses.sources(d6cf32529;test_capital_valuation_properties.py:235at0f35157f9).valued_capitalreads onlysources, so it would never value a listed name outside them, and the intersection check can't see that name.test_capital_share_components.pyuses Hypothesis on pounds-and-pence inputs that the engine stores as float32:share_like_capitalkeeps the suppliedcorporate_wealthunless the itemised holdings exceed it beyond float32 rounding, and then equals their sum.share_like_capitaland the other part holds nil. Otherwise the first equalsshare_like_capitalless trusts and ISAs, kept between nil andshare_like_capital. The property draws signed holdings, from −£5,000 to £200,000, and checks in exact arithmetic that the two parts add up toshare_like_capitalwithin half its float32 spacing.1e-5.test_stored_household_totals_grow_past_the_projection_horizonchecks that UC capital equals savings plus the stored cash and stocks and shares ISA totals, and keeps one ratio to savings, in every year from 2025 to 2040.Fixed cases pin these results:
corporate_wealthas £11,800 in 2012.corporate_wealthbeside £8,000.01 of trusts and an £8,000 ISA leaves nil with sale expenses and £16,000 without.test_stock_capital_periods.py).test_capital_share_components.pyalso tests the ISA routing, the bound and the company-holding budget on cases worked by hand:test_a_reform_that_takes_isas_out_of_the_exempt_list_values_person_isas_less_10_percent: the reform figures under "Stocks and shares ISAs", for all six assessments.test_a_balance_its_listed_holdings_cover_keeps_its_whole_value: the £100.01 case. Beside it, £6,000 of shares, −£5,000 of trusts and a lodger's £5,000 balance leave the part without sale expenses at nil, so the lodger holds nil and UC counts [£2,700, £2,700].test_a_balance_counts_nothing_the_holdings_behind_its_part_do_not_hold: the £8,388,608 case and two like it, one with the itemised holdings summing below nil and one with the ISAs off the exempt list. Each balance holds nil.test_isa_balances_stay_within_the_holdings_behind_their_part: 1,440 sole adults with signed holdings at and beside 2, 2^10, 2^23, 2^24 and 2^25, under the baseline list and two lists without the ISAs, with UC counting both parts or either one. Exact rational arithmetic on the float32 inputs gives each bound, part and UC total.test_a_balance_the_complement_covers_keeps_its_whole_value: an exempt list of shares and trusts, with £16,777,216 of shares, £3 of trusts, a £3 balance and £16,777,222 ofshare_like_capital, whose float32 spacing is £2. The part with sale expenses holds £2, the £3 of holdings behind it cover the balance, and the holder keeps £3. With the other part off UC's lists, UC counts £2.70.test_a_stored_part_short_of_its_holdings_bounds_the_balances: a holder with a £5,000 balance and a lodger share £10,000 of savings. Entering the part without sale expenses as nil gives [£5,000, £5,000], and as £2,000 gives [£7,000, £5,000]. Entering the part with sale expenses as all £5,000 gives [£7,250, £7,250]. With the ISAs off the list, entering the part with sale expenses as nil gives [£7,500, £7,500].test_an_override_within_rounding_still_bounds_the_balances: six overrides leave the part £1 short of its holdings, within the £1 spacing of £8,388,608: an input, a formula replaced to give nil, a neutralised formula and a replaced other part, and on the reform route an input and a replaced formula. Each £1 balance holds nil, and UC counts [£5,000, £5,000].test_only_a_split_that_differs_from_the_formulas_loses_the_rounding: a replacement formula that gives the same values keeps the £100.01 and the £3. Entering the part without sale expenses as nil in the £3 case leaves the holder £2, and UC counts £1.80.test_a_holding_leaves_no_pool_that_stops_counting_the_part_with_sale_expenses: the reg 77 figures under "Regulation 77 company holdings".The tests in this table fail against the code before their fix:
8f755b9811b41af993a238aa22345c48dc2eReview responses
Review of #1969 at
a418a00400f35157f9.household_sourcesreplacesHOUSEHOLD_SOURCE_OF. While the exempt list namesstocks_and_shares_isa, it maps the ISA balance to the part without sale expenses (variables/gov/dwp/_person_capital_pool.py:25-29).valued_person_capitaltakes the 10% off a balance only where a sale-expense list names that part (utils/capital_valuation.py:92), and none does.person_isa_capital.yamlCases 2, 7 and 9 keep main's £9,000 (:83), £9,000 for Pension Credit (:225) and £11,000 (:285).parameters/gov/dwp/share_like_capital/without_sale_expenses.yaml:32-35). Intest_components_alone_are_valued_by_type, UC counts £3,000 of trusts and a £5,000 ISA in full, beside £1,000 of savings and £4,000 of shares at £3,600: £12,600 (test_capital_share_components.py:1001).test_isa_balances.pyandtest_stored_household_totals.pykeep main's full-value expectations.sale_expenses/sources.yamldescriptions now name the part with sale expenses and point to the exempt list for trusts and ISAs.8f755b981rewrites the Value means-tested capital less 10% sale expenses and secured debt #1969 changelog fragment, which still applied the 10% to all ofshare_like_capitaland to unit trusts "until the data separate them".docs/book/assumptions/isa-inputs-and-capital-flows.md, which namedshare_like_capitalas the source the stocks and shares ISA balances leave.d6cf32529asserts that each programme'ssourceslist includes every name on itssale_expenses.sources(test_capital_valuation_properties.py:235at0f35157f9), before the intersection check.share_like_capitalkeeps Itemise corporate_wealth's share-like components for the means tests #1974's name, but the six capital lists now name its two parts in its place, andtest_lists_name_the_two_partsreplacestest_lists_name_share_like_capital_only. The reg 77 holding now comes off the part with sale expenses, still at 90%.Review of #2131 at
3fe76ee3e3fe76ee3e, as the review found.690a56222makeswithout_sale_expenses.yamlsay the model counts an ISA's withdrawal value in full, "a reading that rests on ADM H1656 saying nothing about costs of sale".8f755b981makes thesale-expense-share-splitchangelog fragment and the four test comments that cite H1656 say the same.690a56222adds to the same description that directly held shares include employee shares and share options, which take the deduction as an approximation.8f755b981says the survey records them as one total.COMPONENTScomment690a56222adds a comment onCOMPONENTSinshare_like_capital_with_sale_expenses.py: every exempt name must be one of them.8f755b981adds thatshare_like_capitalsums the same names, so a reform that adds a holding must add it there too.Earlier reviews
6a5a13a4found two CI failures carried from Value means-tested capital less 10% sale expenses and secured debt #1969 and Itemise corporate_wealth's share-like components for the means tests #1974; neither recurs in CI ata418a0040or3fe76ee3e. It asked for the reg 77 holding to come off the part with sale expenses, whiche78257a6bdoes and the review at3fe76ee3econfirmed. The review at3fe76ee3efollows up its other points, and the table above answers them.b4e872273raised the Lifetime ISA half pennies, the claim about large float32 values, a float32 cast outsideerrstate, thedefined_formask and cash ISAs in the property generator. The fold leaves those fixes, listed under "Valuation and rounding" and "Invariants", unchanged.Validation
CI at
0f35157f9passed every job on its second attempt. On the first, the 90-minute limit cancelled Python shard 3, and only that shard was rerun. The aggregate-impact job passed; "Impact on the certified data" gives its result.This head merges main at
83c2554b2, and main has moved on since. CI tests this head merged into current main.None of the Code changes runs at
8f755b981,1b41af993and45c48dc2e(under "Runs at earlier commits") passed every job. In each, the YAML job, lint, the builds, the smoke imports and every Python shard that finished passed, and the 90-minute limit (.github/workflows/test-suite.yaml:215) cancelled one or two shards. At45c48dc2e, shard 7 had passed all 2,074 of its tests, with 11 skipped, when the limit stopped it, and shard 2 had reached 97% with none failing. PolicyEngine/policyengine-uk#2919, still open, splits the Python tests over ten shards.After
45c48dc2e, only2d4b7adf9changes code.84bda06a1,74980bdd8and0f35157f9change docstrings, comments and documentation only.Local runs, one process at a time with a 2 GB memory cap, and
HUGGING_FACE_TOKEN,HF_TOKENandPOLICYENGINE_UK_DEFAULT_DATASETunset:test_capital_share_components.py0f35157f9test_capital_share_components.py, over 19 processes84bda06a1test_person_isa_capital.py/test_capital_valuation_properties.py/test_isa_balances.py/test_stored_household_totals.py84bda06a1test_uc_company_override_properties.py/test_uc_company_owner_properties.py/test_stock_capital_periods.py84bda06a1policyengine-core teston 17 YAML files, among themcapital_valuation.yaml,capital_valuation_share_split.yaml,person_isa_capital.yaml,uc_company_analogous_business.yaml,uc_property_capital.yamland the council tax reduction capital files84bda06a1uvx ruff@0.17.2 format --check .andcheck .0f35157f9We didn't run
test_dated_reform_routes.py,code_health/test_ci_test_shards.pyor any test that needs the Enhanced FRS locally; CI runs them.Impact on the certified data
The aggregate-impact job at
0f35157f9compared main2c570224bwith5b0b7205b, which merges0f35157f9into that main. Both ran onenhanced_frs_2024_25.h5(policyengine-uk-data 1.58.1). The job passed: no check broke,sign:vatfails on both sides, and it flagged 205 moves for review. In every row of the table from #1969's run ata418a0040(under "Runs at earlier commits"), it reports the same change, so on these data the combined tree moves those measures as #1969 alone does.That result fits #2131's finding that policyengine-uk-data (
mainate1acdf966) imputes onecorporate_wealthand none of its three components. Every Enhanced FRS household would then keep all its share-like capital in the part with sale expenses. #2131's aggregate-impact run at2f1051e9fagainst #1969's3a3241cf6also found no change in any year. Both commits predate main's person ISA route (#2839).In #1969's run at
a418a0040(under "Runs at earlier commits"), the model assessed less capital, so it paid the same or more of each of the six benefits in every year. Some lines moved the other way because of higher awards:council_tax_reduction/_legacy.py:50-53), so a larger award lowers it.universal_credit_pre_benefit_capabove nil (tax_free_childcare_program_eligible.py), unless the family gives up a smaller award (forgoes_universal_credit_for_tax_free_childcare).tv_licence_free_licence_share.py).attends_private_school.py).Microcosm's UK build writes
directly_held_shares,unit_and_investment_trustsandstocks_and_shares_isaso that they sum tocorporate_wealth(was_wealth.pyatc0513dbae). On data from that build, trusts and stocks and shares ISAs escape the 10%. CI's aggregate report doesn't cover those data.Runs at earlier commits
45c48dc2e45c48dc2ea418a0040table below shows the same change1b41af9931b41af9938f755b9818f755b9813fe76ee3e83c2554b2, #2839 included. Python shard 8 ran the dataset tests onenhanced_frs_2024_25.h5(policyengine-uk-data 1.58.1): 44 passed, 1 xfaileddf8c1ea793fe76ee3efixesa418a004059a1c4ad2,b4e872273,3a3241cf66a0d26d613a3241cf62f1051e9f3a3241cf6for 400 households that don't itemise (58 outputs, 27,616 values, 2025 to 2027 and January 2026)2f1051e9f3fe76ee3efixed a test tolerance. CI atdf8c1ea79drew a household the property expects at £16,834.13, which the engine holds as 16,834.119, £0.0109 under. The check now subtracts in float64 and allows a penny plus one float32 step. It pins that household and one at £37,747.34.Local runs at
df8c1ea79, one process at a time with a 2 GB memory cap,HUGGING_FACE_TOKENandPOLICYENGINE_UK_DEFAULT_DATASETunset:policyengine-core teston 17 YAML files, among themcapital_valuation.yaml,capital_valuation_share_split.yaml,person_isa_capital.yamland the ESA, HB, IS and JSA capital filestest_person_isa_capital.py, each test in its own processtest_isa_balances.py/test_stored_household_totals.py/test_capital_valuation_properties.pycode_health/test_ci_test_shards.pyLocal runs at
3dbdb0027(#1969, before main's last merge), afteruv sync --frozen --extra dev, with no survey data:policyengine-core testontests/policy/baseline/gov/dwp,finance/benefit/familyandcouncil_tax_reductionpytest -n 4ontest_capital_valuation_properties.py,test_uc_property_capital.py,test_uc_property_capital_mock.py,test_person_isa_capital.py,test_savings_credit_only_receipt_properties.py,test_stored_household_totals.pypytest -n 4 policyengine_uk/tests/code_healthuvx ruff@0.17.2 format --check .andcheck .Mutants, with Hypothesis shrinking off for the properties:
2f1051e9fHOLDINGS_SOURCEon all ofshare_like_capital2f1051e9f2f1051e9f6a0d26d616a0d26d61stocks_and_shares_isadropped from the exempt list, on the stored-totals testce91e92eaowned_land_secured_debtdropped from council tax reduction'sSECURED_DEBT3dbdb0027The aggregate-impact job at
a418a0040compared main83c2554b2withbed0b12b8e, which mergesa418a0040into that main. Both ran onenhanced_frs_2024_25.h5(policyengine-uk-data 1.58.1). The job passed: no check broke,sign:vatfails on both sides, and it flagged 205 moves for review.† The report rebuilds these totals without the Disabled Students' Allowance figure, which it withholds.
Coordination
1193614a6).axiom: TheAxiomFoundation/rulespec-uk#395 queued
The issue also carries the asset-type distinction and hand-computed companion cases; its ISA line predates the H1656 wording above.
🤖 Generated with Claude Code