Conversation
The gate was a disabled, required text field: applicants 25 or over who answered "no" to the disability question got a greyed-out box they could not fill and could not get past. It also carried no fieldId (falling back to the registry default) and an `equal` rule with an error but no value, so only `required` ever fired. Now a radio with the recipe's existing `equal` gate pattern — same visibility, same copy, same policy, but answerable. Adds a recipe invariant rejecting disabled-and-required fields. Refs #2199
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
Amplify PR previews
Commit:
|
|
✅ I finished the code review, and didn't find any security or code quality issues. |
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.
Refs #2199 ("If I click no. I cant type in the free text box but its mandatory").
Problem
JobStart Plus gates applicants aged 25+ who have no disability or long-term
health condition. That gate was implemented as a disabled, required text
field in the
disability-supportstep:{ "ref": "components/generic-text", "overrides": { "isDisabled": true, "label": "Are you 25 years or older, without a disability?", "validations": { "required": { "value": true, "error": "If you are over 24, you must have a disability..." }, "equal": { "error": "If you are over 24, you must have a disability..." } }, "behaviours": [ { "type": "fieldConditionalOn", "targetFieldId": "applicant-dob", "operator": "gte", "value": "25", "transform": "yearsSince" }, { "type": "optionalIf", "targetFieldId": "has-disability", "value": "yes" } ] } }Three defects in one element:
could not type into, blocking Continue with no way forward.
fieldId. It fell back to the registry default (generic-text), so itsubmitted under a junk key and would collide with any other defaulted
generic-textfield in the step.equalrule. Anerrorwith novaluecan never fire, so onlyrequiredever did anything.Fix
Same gate, expressed the way this recipe already gates eligibility 40 lines away
(
currently-employed): a radio carryingequal. Visibility, copy and policy areunchanged — the applicant can now answer, and gets the authored message.
Verified against the real hydrated contract with the production validator
(
@govtech-bb/form-validation):has-disability!= yes)optionalIfrelaxes onlyrequired(validation-builder.ts,form-conditions/index.ts), so a conditionally-appliedequalis notexpressible — which is why the gate stays a separate age-scoped control rather
than moving onto
has-disability.Guard
recipe-invariants.spec.tsnow rejects any disabled-and-required field across all76 recipes, with a negative test proving it bites. This was the only occurrence.
Verification
nx run api:test— 1277 pass (was 1276; the new negative test)nx run api:build— greentsc -b— cleanjobstart-plus-programme.smoke.spec.tsneeds no change: it uses a 21-year-old,so the gate stays hidden
Note
Kept the hard block, since the recipe's own hint states the policy ("If you are
over 24, you must have a disability or long-term health condition to apply"). If
the intent is instead to let these applicants submit and be filtered later, say
so — that's a one-line change to drop the
equalrule.