Tidy: type after param, drop duplicate test, Financial constraint, fire/flood phrasebank - #18
Conversation
…cial subcategory constraint; CRISIS_FIRE_FLOOD_LOCATION phrasebank Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Thanks for this.
Tidy PR.
One small follow-up thought: the existing fire/flood tests all start sessions at CRISIS_FIRE_FLOOD_LOCATION, which is why the missing phrasebank entry slipped past CI. A tiny regression test that starts at GATE0, selects 6, and asserts the rendered text doesn't include [Missing phrase: would protect any future safeguarding-adjacent prompt from the same class of bug. Not blocking, more a thought for the backlog.
| * Returns terminal output when all required fields are collected. | ||
| */ | ||
| function routeToNextProfileQuestion(session: SessionState, after?: string): RoutingResult { | ||
| function routeToNextProfileQuestion(session: SessionState, after?: 'age' | 'gender' | 'lgbtq' | 'convictions' | 'nrpf' | 'children'): RoutingResult { |
There was a problem hiding this comment.
Nice work on this bit, good follow up from the last PR review.
It's worth considering one extra step:
needProfileRequirements just above this is still typed as Record<string, string[]>, so a typo like 'agee' in any of the requirements arrays would silently produce a never-matching branch in here. If we life the union to a shared alias and reuse it, the same protection applies to both.
Not blocking anything, just a small ergonomics win while we're in this file.
There was a problem hiding this comment.
Just to flag, this is a real bug fix worth calling out. Without these entries, anyone selecting option 6 at GATE0 would have seen [Missing phrase: CRISIS_FIRE_FLOOD_LOCATION] rendered through the phrase() fallback in shared.ts. Mirroring the CRISIS_UNDER16_LOCATION pattern is the right call here.
Nice work.
Summary
routeToNextProfileQuestionafter?param to a union of the six valid field names (no runtime change; catches bad call sites at compile time).Financialentry toneedSubcategoryConstraintsinserviceMatcher.ts, mirroring theHealthandWorkpattern — scopessupportmatches todebt-financial-problemsandmoney-management.CRISIS_FIRE_FLOOD_LOCATIONand__SUPPORTERphrasebank entries (previously called fromcrisis.tsbut never defined in the phrasebank). Matches adjacentCRISIS_UNDER16_LOCATIONpattern: 7 WMCA LAs + "Somewhere else".Test plan
npm test— 96 / 96 pass locally, including the fire/flood council-number tests that exercise the new phrasebank entries and the surviving PNTS-on-children regression test.🤖 Generated with Claude Code