Repository navigation
Conversation
scottish_carer_supplement paid 52 weekly rates for any positive
carer_support_payment. It now pays the weekly supplement rate for
min(52, max(carer_support_payment_pre_overlap, carer_support_payment)
/ weekly Carer Support Payment rate)
award weeks where carer_support_payment is positive (SSI 2023/302 reg
14A), so 13 weeks of Carer Support Payment after a move to England (reg
42) bring 13 weekly rates of supplement, £152.10 in 2026-27, rather than
£608.40. The formula holds 52 weekly rates in the amount's float32 dtype,
so where the model computes both amounts the supplement equals main's
bit for bit, and it guards the division against a zero rate.
The documentation names the four cases where the count differs from the
law. YAML cases worked from reg 16(1) and (1A) and Hypothesis properties
cover the bounds, payment, differential, monotonicity, whole weeks, full
year, zero rate and the disable_simulated_benefits path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Generated by Claude Code |
Aggregate impact on certified data: passBase Checks: 0 broken by this change, 1 failing on both sides, 0 fixed. Moves flagged for review: 0 (thresholds in Notes
Moves flagged for reviewNone. Spending by benefit and service
Caseloads
Household net income by decileNo household's net income changes in any year. No change in any year: receipts by tax head; government balance, each component counted once; model totals; household income totals; population; poverty rates; people in poverty; inequality; mean household net income in each side's own deciles; standard reform costings (change in gov_balance); standard reforms: change in each reform's target. Checks failing on both base and head (1)
Counted-once checkEach of 92 components was raised by £1 per unit in 2026-27, and every head of its totals was read household by household: its own head must rise by exactly £1, no other tax head may move, no other benefit may rise, and the model's own total must move by what its heads moved. A head that breaks a rule is measured again twice: with every other head held at its baseline value, and with every other head held at its value after the first £1 while the component rises again. It fails where either still shows the response. 0 failed; 0 were skipped.
Provenance
Dataset: Receipts by tax head: head levels
Spending by benefit and service: head levels
Caseloads: head levels
Government balance, each component counted once: head levels
Model totals: head levels
Household income totals: head levels
Population: head levels
Poverty rates: head levels
People in poverty: head levels
Inequality: head levels
Mean household net income in each side's own deciles: head levels
Standard reform costings (change in gov_balance): head levels
Standard reforms: change in each reform's target: head levels
|
|
Ready for hub review Head: Before starting I checked #2791: no comments, no PR, and no Changes
Findings and resolutionsI found F1 myself. F2 to F12 came from an independent three-part review (correctness, tests, writing) of the diff before I opened the PR. I verified each one before changing anything.
Tests run
Revert checkIn a scratch worktree of
MutationsI ran each mutation of the formula against both YAML files (23 cases) and the 7 property tests, and restored the mutation copy's formula afterwards.
Aggregate impactCI's report has finished: run 41630694642, comment 6604442305. Its headline is "Aggregate impact on certified data: pass", comparing base
The only rows it lists are figures that privacy rules suppress on both sides: Disabled Students' Allowance spending and caseload in every year, and two standard reform costings in 2030-31 and 2031-32 (£0 in the other years). The fiscal partition reports Skipped
Judgment calls
Generated by Claude Code |
SSI 2023/302 defines "award week" in regulation 2, which has no numbered paragraphs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ready for hub review Verdict: REQUEST_CHANGES at The formula is right. It computes the body's expression, matches FindingsP2-1. The count departs from the law in more than four cases
I ran the head (scratch worktree at
Replace "The count differs from the law in four cases." with "The count differs from the law in these cases." Then add after the sentence that ends "a report of a full year counts fewer weeks in later years.":
In the body, change "In four cases the formula counts weeks differently from the law" to "In six cases the formula counts weeks differently from the law", and add the two bullets in the same words. P2-2. "At most 13 weeks, or up to 25 in all" counts 7-day periods from the move, not award weeksThe body's "The law" section ("So such a carer receives Carer Support for at most 13 weeks, or up to 25 in all after a death in that time"), Reg 42(4) starts the 13-week period "on the date the individual ceases to be ordinarily resident in Scotland", which can be any day. Reg 42(1A) runs "12 award weeks after the first day of the award week following the award week in which the cared for person died". Take a move on a Monday (day 0, in the award week that starts on Sunday, day −1):
Reg 14A counts award weeks, and the supplement is a weekly rate for each. So the stated maxima hold for 7-day periods counted from a Sunday move, not for award weeks in general. The YAML cases still describe situations the law allows: a Sunday move gives exactly 13 and 25 award weeks. Replacement for the body:
For P3-1. The float32 quotient is 52.0, not 51.999999The body says "If the formula divided the float32 amount by the rate instead, it would count 51.999999 weeks in 2026 and pay £608.39996". F1 in the hand-off says the same. I put that division into the formula (mutation M7, The £608.39996 reproduces. In the engine, though, the float32 amount over the Python float rate stays float32 and gives exactly 52.0. The 51.999999 is the float64 quotient. The penny gap comes from multiplying 52 by £11.70 in float32, where
P3-2. "The 2027 rate above" points to nothing
P3-3. The hub's rulespec-uk#398 comment overstates what #2857 counts
Its law quotes and cases W and X are correct (see below). Checked and soundPrevious round (hand-off F1 to F12).
The law.
Code.
Cases.
Invariants and mutations. The 7 tests match invariants 1 to 7 as the body states them. Each mutation ran against both YAML files and the property file in a scratch clone, and I restored the formula after each (
Text.
Tests (local).
CI at the head. All 21 check runs from
None fails. The Aggregate impact report (comment 6604442305, updated 14:53:06Z, run 41646429313 on head Merges.
What I couldn't check
Generated by Claude Code |
juaristi22
left a comment
There was a problem hiding this comment.
Reviewed c79f7e6092102043b8fd3838cc3bd5f7ac57d3ab. COMPLETE — no critical findings or material evidence gaps; two nonblocking documentation findings remain.
A1 — Make the annual-proxy limitation list non-exhaustive. The new “four cases” statement in scottish_carer_supplement.py:25 and the description omits a supplied part-year pre-overlap award with a constant overlapping benefit. For example, £1,123.85 pre-overlap CSP for 13 award weeks and £2,000 State Pension across the year makes the existing annual CSP formula net to £0. Weekly overlap would leave £623.85 CSP during those weeks and £152.10 supplement. This is an existing annual-netting limitation, not a new underpayment caused by this patch. Document it and qualify the broad annual-week description in the filed Axiom #398 follow-up; fractional inferred weeks are also a proxy.
A2 — State the award-week alignment for the 13/25-week examples. Regulation 42 starts the residence-continuation period on the actual move date, whereas regulation 2 defines Sunday–Saturday award weeks. A Sunday-aligned 13-week period spans 13 award weeks; a Monday-starting period touches 14. Qualify the variable prose, YAML examples/header and description with the complete-award-week/Sunday assumption, including the death-continuation example. This is a scope clarification, not an allegation of 14 or 26 cash payments.
The core weekly rule, rates, tax/benefit treatment and actual filed Axiom #398 contract/companions were independently checked against official sources. One focused invocation passed 153 checks, with three final-accounting cases also verified: the conditional 13-week England receipt gives £152.10 rather than £608.40, reduces final income/spending once by £456.30 in the zero-tax case, and reduces net income by £365.04 when the tax reduction is £91.26. The fully computed steady Scottish carer is unchanged. The England cases use a justified supplied continuing award and timing assumptions; annual inputs do not reconstruct migration or historical eligibility.
Current-head CI is green. Approval is withheld while these findings remain and the PR is a draft.
|
Picking this up for the UK hub. Reply here if you're mid-change and I'll stop. Generated by Claude Code |
Name two more departures from the weekly rule in the documentation and the YAML header: a supplied part-year amount before the reduction netted against an overlapping benefit paid all year, and part weeks. Mark the list as non-exhaustive. State the 13-week and 25-week-6-day limits after a move, and that the move cases count complete award weeks from a Sunday. Name the 2027 rates the 2027 case uses, and label the partition head "Scottish Carer Supplement". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwQq6Ja7tnGtKGtfAaux53
|
Generated by Claude Code |
|
Generated by Claude Code |
|
Generated by Claude Code |
|
Generated by Claude Code |
|
Ready for hub review Head:
Findings and how I resolved themP2-1 and A1, the departures.
P2-2 and A2, the 13- and 25-week limits.
P3-1, float32. The body uses the review's sentence. My probe at the head, which divides the stored float32 amount by the rate, gives: P3-2, the 2027 rates. Partition label.
P3-3 and A1, the rulespec-uk#398 comment. Tests at the head (clean runs)
Mutations and revertsNo formula changed, so I reran no mutation or revert check. The body keeps the earlier round's tables. I removed "in 62 seconds" from the body's property-test line, since I ran those tests alongside the partition tests and didn't time them alone. Skipped
Judgment calls
Generated by Claude Code |
Split the 119-column chunk of scottish_carer_supplement's documentation, drop the repeated "of the award", and say in the YAML header's fifth departure that Social Security Scotland nets the amounts week by week. No code or expected value changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. We answered A1 and A2 in For A1, the variable's documentation now says that the count differs from the law "in these cases, among others". It names two more departures: a supplied part-year amount before the overlapping-benefit reduction, which the model nets against an overlapping benefit paid all year, and part weeks. The header of the award-week cases in For A2, the documentation, the YAML header and the description now say that a carer keeps Carer Support for 13 weeks from the day they stop being ordinarily resident in Scotland (reg 42(4)). After a death in that time, the carer keeps it for up to 25 weeks and 6 days in all (reg 42(1A)). A move on a Sunday gives 13 complete award weeks, or up to 25 after such a death, and the comments of the 13-week, 25-week and 2027 cases put the move on a Sunday. A move on any other day spreads the 13 weeks over 14 award weeks. After a Monday move, the 13 weeks end on a Sunday, day 90, and if the cared-for person dies that day, the carer keeps Carer Support until day 180: 181 days across 26 award weeks. At |
juaristi22
left a comment
There was a problem hiding this comment.
Re-reviewed adopted head 7f2ac120bba1175a5457a1739709387ce8d52cfc. COMPLETE — A1 and A2 resolved; no open findings or material evidence gaps.
The documentation and actual RuleSpec #398 addendum now describe the annual count as a proxy, name the part-year overlap and fractional-week departures, and make the list non-exhaustive. Continuation examples now state Sunday alignment; the 25-weeks-and-six-days limit and Monday/26-award-week example are correctly qualified.
Formulas and test assertions are unchanged. The retained 153 passing checks and three final-result cases were verified without rerunning models; supplied continuation awards retain their conditional-input qualification. Approval awaits the remaining current-head CI.
juaristi22
left a comment
There was a problem hiding this comment.
Approved current head 7f2ac120bba1175a5457a1739709387ce8d52cfc. COMPLETE — A1 and A2 remain resolved; no findings or material evidence gaps. Applicable current-head checks have passed.
The completed review of the adopted documentation fixes and unchanged formula is retained. Its 153 passing repository checks, three final-result cases and 10 original/source-extract pairs were integrity-checked, with the prior functional/test identity and runtime qualifications preserved. No tests or calculations were repeated for this CI-only approval.
The annual award-week/overlap approximation, conditional continuation examples and projected 2027 amounts remain explicitly documented. The actual Axiom #398 record and addendum are unchanged.
Fixes #2791
Reproducer:
policyengine_uk/tests/policy/baseline/gov/social_security_scotland/scottish_carer_supplement.yaml::Carer in England with 13 weeks of Carer Support Payment gets 13 weeks of supplementaxiom: TheAxiomFoundation/rulespec-uk#398 queued
What the formula does
scottish_carer_supplementnow pays the weekly supplement rate foraward weeks where
carer_support_paymentexceeds 0, and nothing for a carer with nocarer_support_payment. It reads both weekly rates fromgov.social_security_scotland.carer_support_payment. Onmainthe formula pays 52 weekly rates for any positive payment. A carer who moves to England on a Sunday keeps Carer Support Payment for 13 complete award weeks (13 × £86.45 = £1,123.85).maingives them £608.40 of supplement in 2026-27, where Social Security Scotland would pay 13 × £11.70 = £152.10.The formula uses four terms:
carer_support_payment > 0. Social Security Scotland pays the supplement only for an award week in which Carer Support Payment is payable (regulation 14A). Where an overlapping benefit equals or exceeds the payment, Social Security Scotland gives £0 of it that week (regulation 16(2)(b)), and the formula pays no supplement, asmaindoes.carer_support_payment_pre_overlap. Where the model computes this amount,carer_support_payment_pre_couple_limitreturns 52 weekly rates or nothing, andlimit_carer_benefit_to_one_partnerkeeps that amount or sets it to nothing. So a carer whose overlapping benefit reduces the payment but leaves some keeps all 52 weeks.carer_support_payment. Where a user supplies the payment and the model finds no amount before the reduction, as for a carer who has moved to England, the formula divides the payment by the weekly rate to count the weeks.WEEKS_IN_YEAR), so the formula never pays more than 52 weekly rates.The formula doesn't round the weeks, so for a payment that falls between whole numbers of weekly rates it counts part of a week. Social Security Scotland pays a whole weekly supplement for each award week (the last case under "Where the count differs from the law"). The formula works out the share of the year, the amount over 52 weekly rates, and pays 52 weekly supplement rates times that share, up to 1. That product equals the weekly rate times the weeks above. The engine stores amounts in float32, so the formula holds the 52 weekly rates in the amount's dtype, as
carer_support_payment_pre_couple_limitdoes for the earnings limit. For a full-year entitlement the formula then computes a share of 1, and wherever the model computes both amounts the supplement equalsmain's bit for bit. If the formula divided the float32 amount by the rate instead, it would multiply the weeks by the supplement rate in float32 and pay £608.39996 in 2026, wheremainpays £608.40002. Under a reform that sets the weekly rate to zero, the formula pays no supplement and never divides by zero.We also relabel the
scottish_carer_supplementhead inpolicyengine_uk/data/fiscal_partition.yamlfrom "Carer's Allowance Supplement (Scotland)" to "Scottish Carer Supplement", the variable's own label.The law
The Carer's Assistance (Carer Support Payment) (Scotland) Regulations 2023 (SSI 2023/302):
Regulation 14A: "An individual is entitled to Scottish Carer Supplement for each award week in which Carer Support Payment is payable to the individual."
Regulation 2: "“award week” means a period of 7 days beginning on a Sunday and ending on a Saturday".
Regulation 16: "(1) The weekly rate of payment of Carer Support Payment is £86.45. (1A) The weekly rate of payment of Scottish Carer Supplement is £11.70." Under (2), "for any award week where an individual is entitled to one or more overlapping benefit", the amount of Carer Support Payment "is to be reduced— (a) by the amount of the overlapping benefit paid, or (b) where the amount of the overlapping benefit is equal to or greater than the amount of Carer Support Payment, the value of Carer Support Payment that is to be given to the individual is £0."
Regulation 42:
So such a carer keeps Carer Support for 13 weeks from the day they stop being ordinarily resident in Scotland. After a death in that time, they keep it until 12 award weeks after the start of the award week following the death, up to 25 weeks and 6 days in all. A move on a Sunday gives 13 complete award weeks, or up to 25 after such a death, each counted from a Sunday. A move on any other day spreads the 13 weeks over 14 award weeks. After a Monday move, the 13 weeks end on a Sunday, and if the cared-for person dies that Sunday, the carer keeps Carer Support for 181 days, across 26 award weeks.
Where the count differs from the law
In these six cases, among others, the formula counts weeks differently from the law, and we name each in the variable's documentation and the header of the award-week cases in
scottish_carer_supplement.yaml:maincounts the same way, from the annual amounts ofcarer_support_paymentandcarer_support_payment_pre_overlap.Carer in Scotland the model finds eligible keeps 52 weeks of supplement with a supplied part-year payment).Carer with a supplied payment that State Pension reduced keeps 52 weeks of supplement with the amount before the reduction).gov.contrib.policyengine.disable_simulated_benefits, the reform makes a Scottish carer's reported Carer's Allowance theircarer_support_paymentand leaves the amount before the reduction to the model (the comment abovereported_careindisable_simulated_benefits.py). So the formula counts 52 weeks for a reported carer the model finds eligible, even where the report covers only part of the year. For any other reported carer, it counts the weeks the report implies at each year's weekly rate. The reform doesn't uprate the report, so for a report of a full year the formula counts fewer weeks in later years.mainalso pays £0 here.In line 166 of
docs/book/assumptions/carer-support-payment-earnings.md, the supplement "follows CSP actually payable". The formula still pays it only where Carer Support Payment is payable, so we leave that line as it is.Invariants
For single people aged 14 to 90 in each UK country, in each year from 2024 to 2030:
carer_support_paymentexceeds 0, in years with a positive supplement rate.carer_support_payment, the formula never lowers the supplement.carer_support_paymentnorcarer_support_payment_pre_overlap, the supplement equals, bit for bit,main'scsp.supplement * WEEKS_IN_YEAR * (carer_support_payment > 0), which the test rebuilds.Tests
YAML.
scottish_carer_supplement.yamlgains 9 cases. We worked each value by hand from regulation 16(1) and (1A), at £86.45 and £11.70 a week in 2026 and at the model's 2027 projections, £89.50 and £12.10. The move cases put the move on a Sunday, so they count complete award weeks from a Sunday:Carer in England with 13 weeks of Carer Support Payment gets 13 weeks of supplementCarer in England whose cared-for person dies in week 13 after the move gets 25 weeks of supplementOne week of Carer Support Payment gives one week of supplementCarer Support Payment worth more than 52 weeks gives 52 weeks of supplementCarer in Scotland with no caring inputs and 13 weeks of Carer Support Payment gets 13 weeks of supplementCarer in Scotland the model finds eligible keeps 52 weeks of supplement with a supplied part-year paymentCarer whose State Pension reduces Carer Support Payment and leaves some keeps 52 weeks of supplementCarer with a supplied payment that State Pension reduced keeps 52 weeks of supplement with the amount before the reductionCarer in England with 13 weeks of Carer Support Payment gets 13 weeks of supplement in 2027All 13 cases in the file pass, as do the 10 in
carer_support_payment_overlapping_benefits.yaml.Properties.
test_scottish_carer_supplement_award_weeks_properties.pyholds 7 tests. Each Hypothesis example puts every drawn person in one simulation, with inputs in each year from 2024 to 2030, and checks every year. Each property test draws 12 derandomised examples besides its pinned ones.test_supplied_payment_bounds_and_reference: invariants 1 to 3 with supplied payments, and sometimes supplied amounts before the reduction. It pins the 2026 cases above, and a batch in which the test supplies both amounts.test_computed_payment_bounds_and_reference: invariants 1 to 3 and 6 with State Pension below, above and equal to a year of Carer Support Payment. In a third of the batches it also supplies an amount before the reduction and checks invariants 1 to 3 only.test_supplement_is_monotonic_in_a_supplied_payment: invariant 4, with no tolerance.test_whole_weeks: invariant 5 for k from 1 to 52 and for 52, 52.001, 53, 60, 104 and 1,000 weekly rates, in each year from 2026 to 2030.test_zero_rate_gives_no_supplement(supplied and computed): invariant 7, with only the formula running undernp.errstate(all="raise").test_disable_simulated_benefits_pays_the_weeks_the_report_implies: two Scottish carers who each report £4,000 in 2025. The one who would claim keeps 52 weeks (£608.40 in 2026, £629.20 in 2027). The one who wouldn't gets 4,000 / 86.45 × 11.70 = £541.35 in 2026 and 4,000 / 89.50 × 12.10 = £540.78 in 2027.The 7 tests pass with
-n 4.Revert check. We ran these tests on a copy of
main:main's 52 weeks, £608.40 or £629.20. The other 4 pass onmain, which pays 52 weeks there too: 60 weeks, the eligible Scottish carer with a supplied part-year payment, and the two State Pension cases.main, whose supplement also never falls as the payment rises and comes to £0 when the model pays nothing.Mutations. We ran each mutation of the formula against both YAML files (23 cases) and the 7 property tests:
FloatingPointError)Tests that read these variables. Every test file that names
scottish_carer_supplementorcarer_support_payment(git grep -l) passes when we run it on its own with-n 4: 19 Python files with 229 tests, and 14 YAML files with 279 cases.test_fiscal_partition.pyandtest_aggregate_impact_partition.py, which loadfiscal_partition.yaml, pass with the new label.policyengine_uk/tests/code_healthpasses 3,091 tests. Invariant 5 oftest_carer_overlapping_benefits_properties.pystill holds. Intest_disable_simulated_benefits_carers.py, no carer's supplement changes: in a copy that logged each call, the formula ran 485 times over 1,294 person-years, 456 of them with a positive payment, and every value equalledmain's bit for bit.ruff format --check,ruff check,ruff check --select F811,F821 policyengine_ukandgit diff --checkpass.Overlap with other work
#2869 (Guardian's Allowance) and #2763 (the Budget helper variables) also change
policyengine_uk/data/fiscal_partition.yaml, and each merges with this branch without conflicts. The branch merges withmainataf9361114without conflicts.Aggregate impact
The Aggregate impact check on certified data passes and flags no move: no household's net income changes in any year from 2025-26 to 2031-32. The certified file,
enhanced_frs_2024_25.h5from policyengine-uk-data 1.58.1, storescarers_allowance_reportedbut neithercarer_support_paymentnorcarer_support_payment_pre_overlap. So the model computes both amounts for every carer in it, and by invariant 6 each supplement equalsmain's bit for bit.🤖 Generated with Claude Code