Repository navigation
UK spine: refuse malformed FRS claimant roles directly; check every supplied role reaches the engine - #1205
Draft
MaxGhenis wants to merge 2 commits into
Draft
UK spine: refuse malformed FRS claimant roles directly; check every supplied role reaches the engine#1205MaxGhenis wants to merge 2 commits into
MaxGhenis wants to merge 2 commits into
Conversation
…le reaches the engine The spine took is_claimant_or_partner as adult-table membership and relied on the UC claimant mask to refuse a benefit unit without one or two adult records. That mask reads DEPCHLDB, so where DEPCHLDB is 0 beside child records it lets through a unit with no adult record (its child becomes the claimant) and a lone adult whose child it counts as a partner, leaving is_uc_claimant and is_claimant_or_partner disagreeing. policyengine-uk derives is_uc_claimant from is_claimant_or_partner from 2.107.0, so UC and every other programme would see different families. frs_claimant_or_partner now refuses a unit without one or two adult records itself (mirroring uk-data#524's derivation), and the spine refuses any person whose two supplied roles differ. The stage spec's claim that the claimant derivation already refused such units is corrected; source pins regenerated. The policyengine-uk adapter checks that is_claimant_or_partner and is_hbai_dependent_child, like is_uc_claimant, reach the model as unchanged inputs: microcosm now locks policyengine-uk 2.122.2, which reads both. Tests: example refusals, a UPERSON-2 dependant, and Hypothesis properties (one or two roles per unit, never a child record, everyone 20+ and every head, record-order invariance) plus a differential test against the UC mask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the mirrored map_columns scope and the graph JSON that hashes it move; the fixture's person, benunit and household tables are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP (draft): the H2 parity fixture regeneration, the full test run and an independent review are still to come.
Follow-up to #1095's person types (6900190), which supplies
is_claimant_or_partneras FRS adult-table membership (uk-data#524).What was wrong
The spine and the stage spec both said that the UC claimant mask "already refuses a benefit unit without one or two adult records". It does not. The mask counts head, or adult with dependants, or any member of a unit whose DEPCHLDB is 0. Where DEPCHLDB is 0 beside child-table records:
is_claimant_or_partneris false for everyone in the unit.is_claimant_or_partnersays dependant. policyengine-uk 2.107.0 and later deriveis_uc_claimantfromis_claimant_or_partner, so with both supplied, UC would see a couple and every other programme a single adult.Both cases were executed against main's own spine on the fabricated test fixture before the fix: both built without error.
What this changes
frs_claimant_or_partner(infrs_spine.py) refuses a benefit unit with zero or three or more adult-table records itself, mirroring uk-data#524'sderive_is_claimant_or_partner_from_frs_microdata.is_uc_claimantdiffers fromis_claimant_or_partner.is_claimant_or_partnerandis_hbai_dependent_childreach the model as unchanged inputs, as it already did foris_uc_claimant. microcosm locks policyengine-uk 2.122.2, which reads both, so a loader that dropped either would silently bring back age inference.Impact
None on the pinned FRS 2024-25. The aggregate-only measurement on the raw tabs (34,966 people in 18,850 benefit units) found:
is_uc_claimantequal to adult-table membership for every person.So no built column changes. The refusals guard the next vintage.
Invariants (tested)
is_uc_claimantequalsis_claimant_or_partner, enforced at build time.axiom: n/a: microsim data-pipeline change.
🤖 Generated with Claude Code