Skip to content

UK v3 cleanup: household builder inputs - #1371

Merged
PavelMakarchuk merged 1 commit into
mainfrom
fix/v3-uk-household-builder-inputs
Oct 20, 2026
Merged

PavelMakarchuk merged 1 commit into
mainfrom
fix/v3-uk-household-builder-inputs

Conversation

@PavelMakarchuk

Copy link
Copy Markdown
Contributor

What changes

All changes are in the v3 report's household section. The shared builder components (HouseholdBuilderForm, VariableRow, VariableInput) only gain opt-in props, which the v3 section passes. v2 does not pass them, so v2 renders as before. models/Household.ts and the feature flags are not changed.

  1. No duplicate "Employment income" in the picker. employment_income_before_lsr was listed as "Employment income" beside the basic employment_income field. The builder sets the basic field, which the model takes in place of its formula, so the twin changed nothing. The new twinsABasicInput leaves out a *_before_lsr input when its stem is a basic person field. This applies to US and UK (both list employment_income as a basic input). The US self_employment_income_before_lsr stays: self_employment_income is not a US input or a basic field, so it is the only US self-employment input (it is also a featured tile).

  2. Curated descriptions come first. householdInputDescriptionOf (and householdInputDescription) now return our description for a featured input, else the model's documentation. The model's text for council_tax, is_disabled_for_benefits and property_income carries dataset and developer notes.

  3. UK dataset-only inputs are left out of the picker (new UK_DATASET_INPUTS, UK only): capital_gains_before_response, gross_financial_wealth, net_financial_wealth, corporate_wealth, full_rate_vat_expenditure_rate, cumulative_residential_rent, cumulative_non_residential_rent, the 12 LCFS *_consumption categories (with health_consumption), a_and_e_visits, admitted_patient_visits, outpatient_visits, rail_usage, bus_in_london_trips, other_local_bus_trips, ebr_energy_bills_credit_eligible. electricity_consumption, gas_consumption and domestic_energy_consumption stay. The UK "Health" topic is now empty, so it does not show.

  4. UK children read as children. In v3 UK, the builder shows "Your first child" and "Add variable to your first child". The person keys stay "your first dependent", so saved households, payloads and v2 are unchanged. The new personDisplayNameOf prop on HouseholdBuilderForm changes only the name shown.

  5. A UK nation report's household starts in that nation. HouseholdImpactSection now reads region. For country/scotland, country/wales and country/ni (also country/northern_ireland), the new household gets the nation's region, the capital's local_authority, and the BRMA that contains it:

    • Scotland: SCOTLAND, CITY_OF_EDINBURGH, LOTHIAN
    • Wales: WALES, CARDIFF, CARDIFF
    • Northern Ireland: NORTHERN_IRELAND, BELFAST, BELFAST

    England, UK-wide, constituency and local authority reports keep the model's defaults: England has no single region, and a mapping from a constituency to an LA and a BRMA is not simple. The analytics count of non-default inputs uses the same start, so the prefilled place is not counted. US behaviour is unchanged.

  6. Accessible names. The household inputs had no name of their own; a screen reader read the placeholder "Enter ". With the new labelInputs prop, each input gets an aria-label: "Employment income, you" for a person's input, "Rent" for a household's, and "Marital status" for the marital status select. This covers text, number, select and switch inputs.

Not changed

  • Item 7, the population picker after a rate field: not reproduced. On /us/build (800px and 600px wide) and on /uk/build with the UK v3 shell on locally (600px), I typed into a rate field and clicked "Nationwide" / "UK-wide" once. The picker opened every time. NumberInput commits on each keystroke. On blur it only sets the "saved" check, which changes no layout around the trigger, so I found no blur/focus race in the code. A repro (browser, width, which field) is needed before a fix.
  • Item 8, the dead US-only helpers in libs/flagship/householdRun.ts: open draft v3 household section: US and UK households with SPM geography, calculation provenance and UK input suggestions #1338 already removes FlagshipHouseholdInput, buildHouseholdPayload, runFlagshipHousehold and describeHouseholdInput. This PR leaves them alone to avoid duplicate work.

Overlaps

Tests

  • householdVariableGroups.test.ts: each UK dataset-only input is left out. Energy consumption inputs stay. The UK rule does not apply to the US. twinsABasicInput: a twin of a basic field is a twin; self_employment_income_before_lsr without a basic field is kept.
  • householdPickerInputs.test.ts: a featured input with model documentation shows our description (UK council_tax, US tip_income). An input that is not featured shows the model's documentation.
  • HouseholdBuilderForm.test.tsx: labelInputs names each input ("Employment income, you", "Rent", "Marital status"). Without it, no input has an aria-label, as before. personDisplayNameOf renames a person but keeps the key. Without it, "Your first dependent" shows, as before.
  • HouseholdImpactSection.test.tsx: UK passes the child name and labelInputs. The US keeps "dependent". Scotland, Wales and NI reports start the household there. Nationwide, England and constituency reports keep the defaults.
  • vitest on components/household, components/flagship, libs/flagship, models, integration/household and pathways: 147 files, 1,809 tests pass.
  • tsc --noEmit, ESLint (on the touched files, --max-warnings 0) and prettier --check pass.

🤖 Generated with Claude Code

- Leave the _before_lsr twin of a basic builder field out of the v3
  picker (employment_income_before_lsr beside employment_income), US and UK.
- Prefer the curated description of a featured input over the model's
  documentation, which carries dataset and developer notes.
- Leave UK dataset-only inputs out of the picker: imputed wealth totals,
  LCFS spending categories, NHS visit counts, transport usage series and
  similar.
- Show UK builder dependants as "your first child" in v3 (display only;
  person keys are unchanged).
- Start a UK household in a Scotland, Wales or Northern Ireland report in
  that nation: region, capital local authority and its BRMA.
- Give v3 household inputs accessible names from their labels.

Shared components (HouseholdBuilderForm, VariableRow, VariableInput) only
gain opt-in props that v3 passes; v2 renders as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
policyengine-calculator-next Ready Ready Preview Oct 20, 2026 6:55pm UTC
policyengine-website Ready Ready Preview Oct 20, 2026 6:55pm UTC

Request Review

@PavelMakarchuk
PavelMakarchuk marked this pull request as ready for review October 20, 2026 19:36
@PavelMakarchuk
PavelMakarchuk merged commit 07bb9a5 into main Oct 20, 2026
10 checks passed

This branch was successfully deployed

2 active deployments
Preview – policyengine-website — f7b0face Deployed Oct 20, 2026 by vercel[bot]
Preview – policyengine-calculator-next — f7b0face Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant