Repository navigation
fix(widget): render the registration questions the CMS actually has - #192
Conversation
Closes #191. No optional registration question has rendered on any event since 2026-08-07. SahajCloud's four questions are `experience`, `referral`, `aspirations`, `questions`; the widget looked for `priorExperience`, `referralSource`, `healthInfo`, `accessibility`, `guests`. Zero overlap, so `enabledQuestions()` returned `[]` for every event whatever a manager had switched on. Nothing failed, and that is the part worth carrying. `RegistrationQuestionsSchema` is a plain `z.object`, so zod STRIPPED the CMS keys rather than raising: `{aspirations: true}` parsed to `{}`, and an empty form is indistinguishable from an event with no questions enabled. The guard written for exactly this — `satisfies Record<RegistrationQuestionName, …>` — could not fire, because `RegistrationQuestionName` derives from `src/types/payload/`, a CHECKED-IN copy of the upstream types. Between resyncs it compares the schema against a snapshot of its own past agreement. Running `pnpm types:cms` is what arms it, and it had not been run for 27 days and five upstream schema commits. The resync fails the build immediately, which is the guard working; the comment above the schema now says so, because "it can't drift from the backend" was read as unconditional and is not. - `src/types/payload/payload-types.ts` — resynced (generated, do not hand-edit) - `src/types/event.ts` — the four current keys, plus the caveat above - `src/mocks/events.ts`, `RegistrationForm.stories.tsx` — fixtures follow - `public/locales/en/events.json` — drop the five dead keys. Only `en` carried them; the other nine locales already held exactly the four live ones, which is why the rename looked half-adopted - `src/config/i18n-options.test.ts` — those five leave the untranslated-debt baseline, since the keys no longer exist to be translated Four new assertions in `src/types/event.test.ts`, and all four were watched FAILING against the schema reverted to the five stale keys, per `docs/testing.md`. The one that matters reads `expected [] to deeply equal [ 'referral', 'questions' ]` — that `[]` is the production defect, reproduced. A locale-parity assertion covers both directions over every bundle, so an unreachable key or a missing label reddens the lane rather than shipping. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W3bncHkCBKywbTiJSniKh8
Deploying sahajatlas-design with
|
| Latest commit: |
0e98027
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://36b9722c.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://claude-fix-registration-ques.sahajatlas-design.pages.dev |
Deploying sahajatlas with
|
| Latest commit: |
0e98027
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://122f21ed.sahajatlas.pages.dev |
| Branch Preview URL: | https://claude-fix-registration-ques.sahajatlas.pages.dev |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Holistic: the diff is the size of the problem and no larger — four schema keys, the fixtures and specs that follow them, five dead locale strings, and a generated file the author did not hand-edit. I verified the generated half rather than taking the claim: applying strip-payload-augmentation.mjs to SahajCloud main's src/payload-types.ts today produces this file byte for byte, and response-types.ts is already identical, so both halves of types:cms are genuinely fresh. I also diffed the whole five-commit drift field by field against the widget's read schemas: registrationQuestions is the only moved field the widget consumes (contactName, address, schedule, images, webPath/webUrl, registrationsFull all survive; the notificationLog→activityLog, verificationStage, quality/confidence and Client.canonical changes are inert here) — so the other ~600 generated lines carry no second silent-strip hiding behind them. That check is what makes the narrow fix the right shape.
Two things the ticket asked for are not in the diff. The user-visible half of the fix is undocumented: CHANGELOG.md is the file for "visible behaviour" a host observes and gets no entry, though this restores questions to every registration form on every embed. And acceptance criterion 3 — renders in RegistrationView — is stood in for by a spec that re-implements the view's own filter rather than calling it, so the claim in the comment and the PR body outruns the assertion. Neither is a reason to hold the PR; both are cheap now and expensive to notice later.
One shape-level note with no line to hang it on: nothing in this PR makes the guard fire any earlier next time. The only new defence is a comment, and the detector that caught this remains the Thursday survey-contracts run — 27 days after the fact. A CI step that curls the two types:cms sources and diffs them would turn "the guard is armed" into something checkable, but that is a follow-up ticket rather than this PR's job (and per the repo's own rule, not a second behaviour to smuggle into a fix).
Findings
- should-fix — no
CHANGELOG.mdentry for a change the file's own scope explicitly covers (thread,src/types/event.ts:97). - consider —
resolves the questions a CMS payload enablescopiesRegistrationView.tsx:27instead of calling it, and is the only cover for the "renders" criterion (src/types/event.test.ts:164-174). - consider — the surviving question labels diverge from upstream
EVENT_REGISTRATION_QUESTIONS, whose labels the manager email forwards; the two strings that matched verbatim are the two deleted here (public/locales/en/events.json:69-73). - consider — eight lines of #191 narrative above the schema where one imperative sentence does the work (
src/types/event.ts:89-96).
What was checked
Ticket vs diff. Read #191 (all five acceptance criteria and the verification checklist) before the diff. Criteria 1, 2, 4 and 5 are covered and asserted; criterion 3 is covered only by the re-implemented filter above; the two "live" checks the PR body lists as unverified genuinely need a preview and a key.
Generated half, verified not trusted. curl of raw.githubusercontent.com/sydevs/SahajCloud/refs/heads/main/src/payload-types.ts, then applied scripts/strip-payload-augmentation.mjs's own regex → diff against src/types/payload/payload-types.ts on this branch: identical. Same for src/collections/Events/endpoints/responseTypes.ts → response-types.ts: identical. So acceptance criterion 1 holds today.
The rest of the drift, consumer side. Extracted the Event and Client interfaces from both revisions and diffed them, then checked every changed field against EventDocSchema / AgnosticFeedEventSchema (src/types/event.ts) and ClientSchema (src/types/client.ts, whose only load-bearing read is canonical.embed for routing=path). No other consumed field moved.
Producer side. Read SahajCloud's src/lib/registrations/questions.ts — EVENT_REGISTRATION_QUESTIONS, the additionalProperties: false jsonSchema, and the label-forwarding contract. Confirmed the four names, their order (which REGISTRATION_QUESTION_NAMES and therefore the form's field order now match), and read the labels against public/locales/en/events.json.
Local blast radius. Grepped the repo for all five retired names outside src/types/payload/: every remaining hit is in the files this diff changes. Read RegistrationView.tsx (enabledQuestions, module-private), RegistrationForm.tsx:464-469 (t('questions.<name>'), so a bundle key really is the label sink), src/config/i18n-options.test.ts (the untranslated helper and the baseline the diff shrinks — the five keys cannot recur now that en no longer declares them), and .claude/workflow.json's contractStep. Checked docs/embedding.md's scope: no origin, attribute, CSP or sizing change here, so it needs nothing.
Gates. All five checks green on 1bed420 (Lint/Typecheck/Build, Smoke, Dependency Audit, both Cloudflare Pages). Nothing was run locally — node_modules is absent in this checkout, so every claim above comes from source, the diff, and the upstream files named.
Reviewer profile: read (workflow/skills/adversarial-review/reviewer-profile.md).
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
…t changed Three of the four threads from the review pass on this PR. **The spec re-implemented the filter it claimed to cover.** `event.test.ts` copied `RegistrationView`'s private `enabledQuestions` body rather than calling it, so the only assertion standing in for #191's third acceptance criterion — that an enabled question *renders* — stayed green with the real filter broken. Move the function to `lib/shape/event.ts`, where the repo puts pure per-event derivations (`isOnline`, `eventTimeZone`) and where the spec can reach it; the view now calls it instead of owning it. Watched failing at the site that would really cause it, per docs/testing.md: replacing the filter body with `[...REGISTRATION_QUESTION_NAMES]` reds both assertions (`expected [ 'experience', 'referral', …(2) ] to deeply equal [ 'referral', 'questions' ]`), where the copied version could not. The second assertion is the stale-schema case end to end — the CMS enables a name the schema does not declare, zod strips it, the view resolves an empty form — which is what #191 actually looked like from a visitor's seat. **CHANGELOG.md gets the entry it exists for.** The file's own preamble scopes it to "visible behaviour", and CLAUDE.md makes it same-PR. Putting up to four questions back on every registration form on every embed, after four weeks of showing none, is a larger visitor-visible change than several entries already under `### Fixed`. Written in that file's register — what a visitor and an organiser see now versus before, no schema names. **The schema docblock keeps its instruction and loses the incident report.** Eight lines of #191 narrative above a four-line schema, where the rule is one sentence: the `satisfies` guard only fires once `pnpm types:cms` has been run, because it compares against a checked-in copy. #191 already holds the story. The fourth thread — whether our on-screen question labels should adopt SahajCloud's `EVENT_REGISTRATION_QUESTIONS` wording — is a copy decision across nine locales and stays open for @Ardnived. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BsMzL3hwyPdNpMLR3yEfY
|
Three of the four review threads are done and resolved; one copy decision is back with you. Pushed as The one that mattered was the second: the spec standing in for #191's "renders" criterion copied The open thread is the question labels: ours and SahajCloud's have drifted, and Lean gate green on the new head: lint, typecheck (app + tests), 114 files / 1518 specs. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
The four question labels on the registration form were the widget's own
wording; SahajCloud's `EVENT_REGISTRATION_QUESTIONS` labels are what the
organiser configures and what the manager notification email prints beside
each answer. So the visitor answered one question and the organiser read the
answer under another:
experience "Have you experienced this meditation before?"
-> "Have you practised Sahaja Yoga meditation before?"
referral "How did you hear about us?"
-> "How did you hear about this event?"
aspirations "What are you looking for from meditation?"
-> "What are you hoping to get out of this?"
questions "Do you have any questions?"
-> "Do you have any questions for us?"
`experience` is the one where the two genuinely asked different things, not
merely differently-worded versions of the same thing.
Realigned on @Ardnived's instruction on #192: the widget is not live yet, so
no visitor has read the old wording and there is no migration to weigh. All
ten locale bundles are retranslated to the new source strings rather than
left to fall back to English — `hu` was carrying the English strings verbatim
and is now actually Hungarian, and two Cyrillic typos in `ru` (Latin `Y` in
"У вас", Latin `o` in "о нас") went with the rewrite.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SswRq8ZsEtxify2x9rXUkg
|
Realigned and retranslated — every thread on this PR is now answered and resolved. Your call on the copy is done: the four questions are worded as Lean gate green on this head: lint, typecheck (app + tests), 114 files / 1518 specs. CI re-runs on the push. One thing left open deliberately: the 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Ardnived
left a comment
There was a problem hiding this comment.
The problem with the en labels should be resolved when we move the whole translation schema to be being provided from the CMS instead of being defined in files on this repo. Go ahead and merge this PR
Summary
registrationQuestionskeys ~27 days ago; our zod schema still named the old ones, andz.objectstrips an undeclared key rather than raising — so{aspirations: true}parsed to{}, every form rendered zero questions, and the build stayed green throughout.satisfies Record<RegistrationQuestionName, …>pins the key set topayload-types.ts, so the next rename fails the build instead of emptying the form — oncepnpm types:cmshas been run, which is the honest limit and is written where the schema is.Every review thread is answered
Four from the review pass, one from @Ardnived. All five resolved; nothing is waiting on anyone.
CHANGELOG.mdentry### Fixedbullet under[Unreleased]enabledQuestionsmoved tolib/shape/event.ts; the view and the spec now call the same function, watched failingChanges
src/types/event.ts—RegistrationQuestionNamederived fromCmsEvent['registrationQuestions']; the schema's four keys renamed and pinned bysatisfies.src/lib/shape/event.ts—enabledQuestions, moved out ofRegistrationView. It is a pure per-event derivation with no React and no i18n, which is this file's remit (it sits besideisOnlineandeventTimeZone, which the same view already imports).src/views/RegistrationView/RegistrationView.tsx— calls it rather than owning a private copy.public/locales/*/events.json— the five unreachable question strings dropped, and the surviving four realigned toEVENT_REGISTRATION_QUESTIONS' labels in every one of the ten bundles.src/types/payload/— regenerated bypnpm types:cms, not hand-edited.CHANGELOG.md— the visitor-visible entries.event.test.ts,registration.test.ts,i18n-options.test.ts,src/mocks/events.ts.Test results
0e98027: ✓pnpm lint, ✓pnpm typecheck(app +tsconfig.test.json), ✓pnpm test:run— 114 files / 1518 specs, all exit 0.1bed420(Lint/Typecheck/Build, Smoke, Dependency Audit, both Cloudflare Pages); the two pushes since re-run them.Manual verification
Not done, and it needs a preview plus a key: open an event whose CMS record enables two questions and confirm both render on the form, then submit and confirm the answers reach the manager email. The unit lane covers the parse and the derivation; it cannot cover a live CMS payload.
Every new assertion was watched FAILING, including the one that was vacuous first
Per
docs/testing.md, at the site that would really cause it. Replacing the filter body inlib/shape/event.tswith[...REGISTRATION_QUESTION_NAMES]:resolves the questions a CMS payload enables, in schema orderexpected [ 'experience', 'referral', …(2) ] to deeply equal [ 'referral', 'questions' ]resolves nothing when the schema and the CMS payload disagreeexpected [ 'experience', 'referral', …(2) ] to deeply equal []keeps an enabled CMS question through the parseexpected undefined to be trueThe first of these was vacuous in the version this PR opened with, which is the finding worth carrying: it re-implemented
RegistrationView's filter inline instead of calling it, so it stayed green with the real filter broken, while its own comment claimed to walk "the whole chain RegistrationView walks". That is thedocs/testing.md#103 shape — a spec that can only reach a state through the door the story uses is not covering the state, it is covering the door — and it is why the function moved rather than the comment being softened.The copy realignment adds no assertion of its own, so instead the gate it relies on was confirmed live: blanking
de'squestions.referralreddensde: answers every event key but the known gapswithexpected [ 'questions.referral' ] to deeply equal []. Restored after.The retranslation, and two things it swept up
experiencereferralaspirationsquestionsexperienceis the one where the two genuinely asked different things rather than saying the same thing differently.huwas carrying the four English strings verbatim and is now actually Hungarian. The parity gate could not see it:untranslated()tests for a blank or missing value, not for one identical to English. Left alone here — it is a gate question, not this PR's.ru— a LatinYin "У вас есть вопросы?" and a Latinoin "Как вы узнали о нас?" — were in strings being replaced anyway.esandnleach mixed formal and informal across the four. Nowtúthroughout ines,jethroughout innl.What is still not covered, and the guard's real limit
The second hop is uncovered:
questions[] → t('questions.<name>')inRegistrationForm. That component takesquestionsas a prop, so an SSR spec there would pass the array in by hand — the door again. The bundle-key half is pinned in both directions bygives every locale bundle exactly the CMS question keys, so what remains is React rendering a label from a key that is known to exist.The
satisfiesguard does not fire on its own.src/types/payload/is a checked-in copy, so between resyncs the schema is compared against a snapshot of its own past agreement. The detector that actually caught this was the Thursdaysurvey-contractsrun, 27 days after the fact.And the labels are now a second copy of an upstream constant, checked by nobody — the same shape as the key drift this PR fixes, one field over. A CI step diffing the two
types:cmssources, extended to the question labels, would close both. Worth a follow-up ticket; deliberately not smuggled in here.Closes #191
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_01SswRq8ZsEtxify2x9rXUkg