Repository navigation
Description
What happens
SignupViewSignup (src/app/s/[slug]/signup-view-types.ts) declares requireEmail and sendReminders as optional. SignupViewBody (src/app/s/[slug]/signup-view.tsx) fills them in when they're missing: signup.requireEmail ?? true and signup.sendReminders ?? false. The field comments say the same: "true when left out", "false when left out, so nothing promises a reminder".
Neither fallback is ever reached:
- Live mode is the only mode that reads them. It's the branch that renders
CommitDialog, and those two lines are the only reads of either field in the view. - Every live render sets both.
src/app/s/[slug]/page.tsxbuilds its props withtoSignupViewProps, which callstoSignupViewSignup(src/app/s/[slug]/public-signup.ts). That returnsRequired<SignupViewSignup>, filling the two fromrequiresEmailandsendsRemindersinsrc/schemas/signups.ts. - The other callers don't need them. The organizer preview page also goes through
toSignupViewProps, and preview never rendersCommitDialog. The home page'sHomeExampleCardpasses a literal without either field, but it's inshowcasemode, which renders a plain span, not the dialog. That literal is the only reason the fields are optional.
So the fallbacks are a second copy of the settings defaults, and the sendReminders copy disagrees with the real rule: sendsReminders returns true when the key is missing, as the reminder dispatcher does. The only thing that exercises ?? false is a test case in signup-view.test.tsx ("promises none where nothing says whether reminders are on") that passes undefined, which no real page can.
Nobody using OpenSignup notices; every page renders the same.
Fix, in outline
- Types: make
requireEmail: booleanandsendReminders: booleanrequired onSignupViewSignup. Replace the two "when left out" comments with one sayingtoSignupViewSignupfills them from the signup's settings. TheRequired<>ontoSignupViewSignup's return type is then redundant; drop it. - View: pass
signup.requireEmailandsignup.sendRemindersstraight through, without??. - Home card: add
requireEmail: true, sendReminders: truetoHomeExampleCard'sSIGNUP. Showcase mode ignores them. - Tests: in
signup-view.test.tsx, add the same two values to the sharedSIGNUPconstant (truematches today's?? true, so no other test changes behaviour), make the one inline signup literal spreadSIGNUP, delete theundefinedreminders case, and narrowemailHelp's parameter toboolean.
Watch for
- An open PR adds embedding to this file. It adds an
embedprop beside the two fallback lines and keeps them. Whichever lands second has a small merge; its new embed page also goes throughtoSignupViewProps, so it sets both values too. - Don't add a mode-discriminated prop type to keep the fields optional in showcase. Two literal values in the home card are simpler.
- The home page must look the same. The card's markup doesn't change.
Done when
grep -rn "requireEmail ??\|sendReminders ??" srcfinds nothing, and both fields are required onSignupViewSignup.- No test passes
undefinedfor either field. pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm testpass.
Found by the pipeline's refactor scout in the participant pages (src/app/s/[slug], src/app/(site)/_components), at 2c037aa. Checked by an independent verify agent. It grepped every caller of SignupView, SignupViewBody and toSignupViewProps in src, tests and scripts, confirmed showcase and preview never render CommitDialog, then made the fields required in a scratch tree: typecheck failed only in HomeExampleCard and the test file, and after adding the values, 477 of 478 tests in src/app/s and src/app/(site) passed, the one failure being the undefined case. Then it reverted. https://claude.ai/code/session_016YZ9SU4eo5cjeZjMfXY5sy
Activity