Skip to content

Port capital gains structure, salary sacrifice, and student loan stages #684

Description

@juaristi22

Workstream E8 of the UK-migration master epic #665; child of #145. Order constraint: after the SPI channel (income before capital gains and before salary-sacrifice stage 2).

Capital gains — the adjudicated split (2026-08-14)

The incumbent builds CGT in three moves: (1) incidence by doubling the dataset and running an unseeded torch optimization that splits each household's weight between its has-gains and no-gains copies to match the Advani-Summers incidence table; (2) amounts from a percentile spline (stops at p95); (3) a top tail of 30 donor households per HMRC size band at band-exact weights. The adjudication:

  • Port the structure: doubling with household_is_capital_gains_clone + the 780 band donors (household_is_cgt_band_donor) — the population needs support for both states and for large gains, the certified spine's record count assumes it, and calibration needs the support to bind CGT band targets.
  • Keep the merged Impute capital gains amounts from the published joint distribution #560 amounts stage (HMRC table-3 joint-distribution redraw — better tail than the spline; signed difference vs the incumbent).
  • Drop the torch sigmoid-blend: clones get an equal mass split at importance kind; WS-D's calibration against the chronicle CGT band facts does the blending the torch loop used to do. Signed difference with the named WS-D dependency. (The incumbent's blend loop is unseeded, and torch is not a microcosm-build dependency.)

Salary sacrifice

QRF stage 1 on the asked-subset (reported values kept exactly); the 5.4m headcount conversion as a declared anchor with its OBR provenance (a top_up_to_stock-style operation, seeded).

Student loans

Rule-based cohort assignment (plan by estimated university start year; PLAN_4 never imputed — documented UK-specific) plus below-threshold top-up to SLC liable-to-repay stocks. SLC stocks are chronicle-fact-fed (wave 1 carries the SLC facts) — coordinate with @juaristi22 before wiring any chronicle feed (wave-2 pieces are in flight).

Acceptance

  • The pre-clone record-count identity reproduced: (base + 10k SPI) × 2 + 780 donors.
  • CGT amounts vs the published surface per Impute capital gains amounts from the published joint distribution #560's embedded tests; the weight-mechanism divergence signed with measured incidence deltas.
  • Determinism per the WS-E harness; support gate declared for donor-backed families.

UK-specificity note (required in the PR)

HMRC band structure, SLC plan rules, and the OBR anchor are UK; cloning, donor stacking, and stock top-up should be generic operations. List anything beyond that and why.

Depends on: E7 (income), E5 (student_loan_balance); related: #552, #364, #467.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions