Repository navigation
Description
Summary
The registration form renders none of the optional questions, on every event, whatever a manager enabled in the CMS. SahajCloud's registration questions are experience, referral, aspirations, questions; the widget looks for priorExperience, referralSource, healthInfo, accessibility, guests. Zero overlap, so enabledQuestions() always returns [].
The cause is that src/types/payload/payload-types.ts has not been resynced since 2026-08-07 (c2e6e70) — five SahajCloud schema commits ago, one of them a feat(api)!. The guard written to catch exactly this (satisfies Record<RegistrationQuestionName, …> in src/types/event.ts:95) cannot fire, because it compares against that stale local copy.
Approach
pnpm types:cmsto resyncsrc/types/payload/payload-types.ts. Expect this to fail the build, and that is the guard working — it is not a silent fix.- Rewrite
RegistrationQuestionsSchema(src/types/event.ts:89-95) onto the four current keys.REGISTRATION_QUESTION_NAMESandRegistrationQuestionNameSchemaderive from it and need no change. src/types/event.test.ts:145assertsRegistrationQuestionNameSchema.parse('aspirations')throws. It pins the wrong contract and must be inverted.src/mocks/events.ts:156setsregistrationQuestionswith the old keys.public/locales/*/events.jsonalready carries translations for all nine names — the four live ones are present and unreachable. Drop the five dead ones in the same change.
Acceptance criteria
-
src/types/payload/payload-types.tsis byte-identical to SahajCloudmain'ssrc/payload-types.ts, moduloscripts/strip-payload-augmentation.mjs -
RegistrationQuestionsSchema.shapeis exactlyexperience,referral,aspirations,questions - An event whose CMS payload enables
aspirationsrenders that question inRegistrationView - No locale bundle carries a
questions.*key that is not inEVENT_REGISTRATION_QUESTIONS - A submitted answer posts under the CMS key, so SahajCloud's
additionalProperties: falseschema accepts it
Verification checklist
-
pnpm types:cms && pnpm typecheck— passes -
pnpm test:run— passes, including the invertedevent.test.tsassertion - Reintroduce the defect at its real site (revert
RegistrationQuestionsSchemato the five old keys) and watch a new spec go red before restoring — perdocs/testing.md, "A regression spec is not finished until it has FAILED" -
curl -s "$VITE_SAHAJCLOUD_URL/api/events/<id>?select[registrationQuestions]=true"returns only keys the schema now names
Notes
Filed by the Thursday survey-contracts run, from check 2 (generated type freshness).
Evidence: the full chain, measured
The two contracts, side by side. Event['registrationQuestions'] in each copy of the generated file:
SahajCloud src/payload-types.ts:324 (truth) |
SahajAtlasWeb src/types/payload/payload-types.ts:321 |
|---|---|
experience |
priorExperience |
referral |
referralSource |
aspirations |
healthInfo |
questions |
accessibility |
| — | guests |
SahajCloud's is generated from EVENT_REGISTRATION_QUESTIONS (src/lib/registrations/questions.ts:27), which is also the source of the additionalProperties: false JSON schema on Registrations.questions.
How it reaches the screen:
src/config/api/fetch.ts:585selectsregistrationQuestions: true— the raw collection field, not a reshaped feed.src/types/event.ts:199parses it throughRegistrationQuestionsSchema.nullish().- That schema (
event.ts:89-95) is az.objectof the five stale keys, all.nullish(). Zod strips unknown keys, so{aspirations: true}parses to{}— no error, every keyundefined. REGISTRATION_QUESTION_NAMES(event.ts:102) isObject.keys(...shape)→ the five stale names.enabledQuestions()(src/views/RegistrationView/RegistrationView.tsx:22-28) filters those names byquestions[name]→[].RegistrationForm.tsx:464maps over that array → no fields rendered.
RegistrationSchema.questions (src/types/registration.ts:12) is z.record(RegistrationQuestionNameSchema, …), so even a hand-built answer under a live CMS key would be rejected client-side.
Why nothing caught it. The comment above the guard says the key set "can't drift from the backend" and that a resync "fails the build here until the schema (and the form) are updated to match". Both are true — conditional on the resync being run. It has not been run for 27 days, so the guard has been comparing the schema against a copy of itself.
Corroboration that the rename is real and already half-adopted: public/locales/en/events.json under questions carries all nine keys — accessibility, aspirations, experience, guests, healthInfo, priorExperience, questions, referral, referralSource. The four current names were translated; only the type was never resynced, so they are unreachable.
Staleness measured: git log -1 -- src/types/payload/payload-types.ts → c2e6e70, 2026-08-07. SahajCloud commits touching src/payload-types.ts since: 5a4035c (feat(api)! user-messages), 2961a73 (SEO endpoint), 720fd74 (registrant voting), b4d7741 (submissions as diff), 4fbbff8 (event submissions). src/types/payload/response-types.ts is identical to SahajCloud's and is not affected — only the payload-types.ts half of pnpm types:cms is behind.
Not verified: I could not exercise a live registration against a preview, so the user-visible claim is read off the source chain above rather than observed in a browser. Every step in that chain is a cited line.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
fix(widget): cover the view's own question filter, and tell hosts wha…