fix(onboarding): normalize demo and input kinds in isOnboardingInputAllowed - #1832
fix(onboarding): normalize demo and input kinds in isOnboardingInputAllowed#1832hsusul wants to merge 1 commit into
Conversation
|
Thanks for this, @hsusul! Closing along with #1831 — here's the reasoning.
The strictness here is also deliberate: this is a fail-closed gate (there's even a test on main named "unknown demo kinds fail closed while onboarding is active"). Normalizing at the policy layer would make it looser than the two strict gates it sits behind, so a typo'd kind would be tolerated in one layer and rejected in two others — we'd rather it fail loudly and consistently. Thanks for looking so closely at the onboarding flow — it's brand new (#1670), so extra eyes on it are very welcome! |
Fixes #1831
Problem
In
src/helpers/onboardingInputPolicy.js:isOnboardingInputAllowedused strict case-sensitive checks againstONBOARDING_DEMO_KINDS, returningfalseduring onboarding demos ifdemoKindorinputKindhad mixed casing or whitespace (e.g."Dictation","Assistant").Solution
demoKindandinputKindwithtrim().toLowerCase().test/helpers/onboardingInputPolicy.test.js.Verification
node --test test/helpers/onboardingInputPolicy.test.js(passes, 5/5 tests)npm run typecheck(passes, 0 errors)npm run lint(passes, 0 errors)npm run i18n:check(passes)npm run build:renderer(passes)git diff --check(clean)