Skip to content

v3 validation: one related score per measure and year, calibration headlines first - #1442

Merged
PavelMakarchuk merged 1 commit into
mainfrom
fix/uk-v3-validation-focus
Oct 27, 2026
Merged

PavelMakarchuk merged 1 commit into
mainfrom
fix/uk-v3-validation-focus

Conversation

@PavelMakarchuk

Copy link
Copy Markdown
Contributor

Summary

The v3 Validation tab showed too much for a UK report. On report 4828 ("UC minimum age reduction") it listed 26 related-reform rows (13 shown at first) and 88 Universal Credit calibration targets. This PR keeps the rows that inform the reader and puts the rest one click away. v3 only; v2 is unchanged.

Related reforms

  • One score per measure, period and metric (focusRelatedReformClaims). HM Treasury prints a static and a post-behavioural leg for each year of a costing, and both appeared under the same title. The static leg is kept, because PolicyEngine's runs are static (else the leg PolicyEngine marks comparable).
  • No zero-zero years. A year in which both the source and PolicyEngine score exactly £0 (a year before the measure starts) is left out.
  • The measure's own name. Rows read "Universal Credit Child Element: Remove the two child limit from April 2026" (from conditions.reform_hint, up to its first comma) instead of the publication title repeated on every row.
  • No baseline note on related reforms. "Different baselines" ran under every row; for another policy's score it says nothing about this report.
  • Closed until opened. The section shows its heading, its note and "Show N related reform scores".

Data calibration

  • Headlines first, then the largest gaps (calibrationPreviewTargets). Each group shows its largest money target and largest count target (a programme's spending and caseload), then the targets with the largest gaps, six in all. "Show all N targets" opens the rest.

Checks

  • tsc --noEmit, ESLint and Prettier pass.
  • Vitest: 181 files under components/flagship, libs/flagship and pages pass (2,150 tests). New tests: the leg collapse, the zero-zero filter, the measure title, the absent baseline note, the closed section, and the calibration preview order. Existing tests updated to open the related-reforms section first.
  • Locally on report 4828: related reforms went from 26 rows to 6 (2026-27 to 2030-31 for the two-child limit, plus the Resolution Foundation estimate); the calibration group shows UC expenditure (£76.1bn vs £76.0bn) and UC households (6.2m vs 6.2m) first, then the four largest gaps, and "Show all 88 Universal Credit targets".

Overlap

🤖 Generated with Claude Code

…n headlines first

Related reforms (RelatedReformEstimates):
- focusRelatedReformClaims keeps one score per measure, period and
  metric. A costing with a static and a post-behavioural leg for the same
  year keeps the static one, which PolicyEngine's static runs compare
  with. A year that both the source and PolicyEngine score as exactly
  zero, such as a year before the measure starts, is left out.
- A row is titled with the measure as the source describes it
  (conditions.reform_hint, up to its first comma), not the publication.
- The "Different baselines" note no longer runs under related reforms:
  they are other policies, so their own baselines say nothing about
  this report.
- The section stays closed until the reader opens it.

Data calibration (CalibrationMatchSection):
- calibrationPreviewTargets puts each group's largest money target and
  largest count target first (a programme's spending and caseload), then
  the rest by gap. Six show at once; "Show all N <group> targets" opens
  the rest.

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

vercel Bot commented Oct 27, 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 27, 2026 2:05pm UTC
policyengine-website Ready Ready Preview Oct 27, 2026 2:05pm UTC

Request Review

This branch was successfully deployed

2 active deployments
Preview – policyengine-website — bd7681d3 Deployed Oct 27, 2026 by vercel[bot]
Preview – policyengine-calculator-next — bd7681d3 Deployed Oct 27, 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