cadrumo.application.wizard.flow_validators module¶
Flow-scope construction validator for the paged setup flow.
The substrate never runs the answers model’s own validation (raw pydantic
messages are library prose), so the review surface is the complete gate
for every construction-time cross-field invariant on the taxpayer
projection. Rather than restate one invariant per validator, this module
registers ONE flow-scope validator that re-runs the real
projection_for_taxpayer() constructor over the staged answer set and
maps each construction failure to a typed verdict.
The mapping carries catalogue KEYS and redacted context only — the raw
pydantic / DeadlineValidationError message never enters a verdict,
because library prose is exactly the leak class the mapping eradicates.
Each construction invariant is routed to a stable check token from the
error’s field signature; the model validators stay the single authority
for the invariants themselves.
- TAXPAYER_PROJECTION_VALIDATOR_ID¶
Registered id of the single flow-scope taxpayer-construction validator.
- register_taxpayer_projection_validator(definition)[source]¶
Enrol a concrete definition’s page-id → domain-key rows on the validator.
Page ids are stable catalogue tokens carrying one domain key each, so enrolment is idempotent and order-independent: composing the same definition twice re-enrols the same rows.
- Return type:
- Parameters:
definition (FlowDefinition)
- attach_taxpayer_projection_validator(definition)[source]¶
Return
definitionnaming the flow-scope taxpayer-construction validator.Enrols the definition’s page mapping and appends
TAXPAYER_PROJECTION_VALIDATOR_IDtoflow_validator_ids, so the review surface re-runs the real taxpayer constructor over the staged answers and blocks submit on a legally invalid profile. Idempotent on the flow validator id: re-applying does not duplicate it.- Return type:
- Parameters:
definition (FlowDefinition)