Repository navigation
chore(types): re-sync payload types past SahajCloud's intake cutover - #117
Conversation
`pnpm types:cms` against SahajCloud main. SahajCloud#801 merged
`registrations`, `event-submissions`, `user-messages` and
`form-submissions` into one `user-submissions` collection, and this
repo's copy still declared all four.
The re-sync also adds a `video` translations group upstream, which
`WEB_TRANSLATIONS_SELECT` does not fetch. `WebTranslations` marks every
group required, so the assertion in `getWebTranslations` stopped
compiling. Excluding `video` from the type keeps it describing what the
site actually reads, and keeps `t('video.…')` keys out of
`TranslationKey` until the player is wired to `useT`.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QuGTovRApxWuW3PARMJLFp
Both the JSDoc `@example` Ladle renders and the README Usage block POST to `/api/form-submissions`, which no longer exists. `UserSubmission` also requires `type`, so swapping the path alone would leave a body the collection rejects. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QuGTovRApxWuW3PARMJLFp
`WEB_TRANSLATIONS_SELECT` and `WebTranslations` both answered "which translation groups does this site have", and the re-sync made them disagree: upstream added a `video` group the site does not fetch, and the type demanded it. Moving the select into cms-types.ts and deriving the type from it leaves one answer. cms-client.ts already imported from cms-types.ts, so the dependency stays one-way. The `Pick` also drops the metadata keys the `Omit` had to name. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QuGTovRApxWuW3PARMJLFp
The `onSubmit` prop doc still named the deleted collection, five lines from the example that no longer does. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QuGTovRApxWuW3PARMJLFp
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QuGTovRApxWuW3PARMJLFp
Deploying wemeditate-design with
|
| Latest commit: |
8b53875
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8a7c567b.wm-design.pages.dev |
| Branch Preview URL: | https://claude-chore-116-resync-payl.wm-design.pages.dev |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 8b53875 | Commit Preview URL Branch Preview URL |
Sep 18 2026, 05:35 PM |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The re-sync is right, and the widening past the ticket is earned. Deriving WebTranslations from WEB_TRANSLATIONS_SELECT buys more than the body claims: under the old Omit, video would have entered TranslationKey, so t('video.general.play') would compile and render as its key path (lib/i18n.ts:199).
The gap is the producer's other half. The FormBuilder examples were repointed from SahajCloud's new schema without reading its access rules.
Findings
- should-fix — the rewritten
@examplePOST is unauthenticated and same-origin. Neither works.FormBuilder.tsx:248,README.md:35. - consider — the new rule promises one owner of the list, yet a third list survives.
docs/rules/rest-api.md:69.
What was checked
- AC 1 ✓ stripped SahajCloud
main(9669347) vs this branch'spayload-types.ts: byte-identical. AC 2 ✓ no dead slug or type survives. - SahajCloud
roles.ts:95,plugins/formBuilder/index.ts; here,lib/i18n.tsandserver/api-routes.ts, which registers no submissions path.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The rewritten @example posted to `/api/user-submissions` from the browser. Neither half works: `server/api-routes.ts` registers no such path, and the CMS grants `user-submissions` create to the `wemeditate-web-client` key, which has no `PUBLIC__` prefix and must not reach a browser. The example now posts to a route this app owns, and says which file would own it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017298GTLqXj1XHr2bvWv7bc
The new rule promised one owner of the group list while a third list survived in `sync-translations.mjs`. That script is plain node and cannot import a TypeScript constant, so the mirror stays. Naming it, and what it costs, is what the rule owed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017298GTLqXj1XHr2bvWv7bc
|
Both adversarial-review threads adopted. Pushed
Not taken: filtering that script by Lean gate green: lint, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#117 landed the same payload-types re-sync this branch carries, and answered the new upstream `video` translations group differently. It moved `WEB_TRANSLATIONS_SELECT` into `cms-types.ts` and derives `WebTranslations` from it, so the query and the type have one owner. Took that structure and dropped this branch's `video: true`, which existed only to satisfy the old all-groups-required assertion that #117 removed. Nothing reads `video.*`. FormBuilder's JSDoc and README conflicted on prose describing the `onSubmit` prop and `FormBuilderConfig`, both deleted on this branch. Kept this branch's docs: #117's substantive point — stop naming the deleted `/api/form-submissions` and forward through a route this app owns — is what `server/api-routes.ts` implements here as `POST /api/submissions`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014voCFQ728iowXEZwFzw42N
Summary
pnpm types:cmsre-syncsserver/payload-types.ts, dropping the four collections SahajCloud#801 merged intouser-submissions.pnpm typecheck, which the ticket predicted it would not. Fixed by derivingWebTranslationsfrom the select it was duplicating.onSubmitprop doc stop naming the deleted/api/form-submissions, and now post to a route this app would own rather than to the CMS.Changes
server/payload-types.ts— regenerated, byte-identical to SahajCloudmainwith thedeclare module 'payload'block stripped.server/cms-types.ts— hostsWEB_TRANSLATIONS_SELECT;WebTranslationsis nowPick<…, keyof typeof WEB_TRANSLATIONS_SELECT>.server/cms-client.ts— imports that constant instead of declaring it.components/organisms/FormBuilder/FormBuilder.tsx,README.md— the example posts to/api/submissions, and both say the CMS key is server-side only.docs/rules/rest-api.md— says where the select lives, that the type derives from it, and thatsync-translations.mjsis the one list that does not.Preview
Both built green on
7cfee27. This push is docs-only on top of it.Contract impact
Consumes SahajCloud's generated types.
sydevs/SahajAtlasWeb#214is the same drift in the other consumer, where it is a live break rather than quiet staleness. This PR is types only and changes no request this repo sends.Test results
tsc --noEmit,vitest run(70 files, 655 tests)pnpm buildManual verification
/api/submissionsexample.Notes for reviewer
The ticket's central claim was wrong, and that is the judgement call worth checking. It stated the re-sync needed no code change. It does: upstream added a
videotranslations group,WEB_TRANSLATIONS_SELECTdoes not fetch it, andWebTranslationsrequired every group, soreturn translations as WebTranslationsstopped compiling. Acceptance criterion 3 ("no file outsidepayload-types.tsand the two FormBuilder docs changes") cannot hold. I fixed it rather than handing the ticket back, and widened the diff by three files.Why derive instead of excluding
video. Two reviews independently flagged that adding'video'to theOmitlist just re-synchronises two hand-maintained lists.AGENTS.mdstates the opposite convention twice (lib/hreflang.ts,lib/urls.ts: one owner, "so the two cannot disagree"). Deriving retires the failure instead of paying it again on the next upstream group.Trade-off this accepts: with
Pick, a new upstream group no longer forces a compile error — it is simply not offered until someone adds it to the select.satisfies WmWebTranslationsSelect<true>still errors on a renamed group. If you would rather keep the hard stop on additions, say so and I will go back to the explicit list.The submission example named a route that does not exist.
server/api-routes.tsregisters the live-preview populate path and two related-content paths, and nothing else, so/api/user-submissions404s on this origin. The CMS grantsuser-submissionscreate to thewemeditate-web-clientkey alone, which carries noPUBLIC__prefix and must not reach a browser./api/form-submissionswas wrong the same way, so the flaw is inherited, but the line was rewritten here. The example now posts to a route this app owns and namesserver/api-routes.tsas its home. Nothing registers that route yet — no page in this repo suppliesonSubmit, so nothing is broken today, and wiring a real submission route is its own ticket.Dismissed findings:
videotoNON_GROUP_KEYSinscripts/sync-translations.mjs— rejected. That set names document metadata (id,_status, …), not groups the site skips. Adding a real group there conflates the two.@examplewith a pointer to README.md — rejected. It is the component's API doc; removing a working example to avoid duplication costs the reader more than the duplication does.sync-translations.mjsfilter byWEB_TRANSLATIONS_SELECT— not taken. The script is plainnodewith no TypeScript loader, so it cannot import the constant, and adding one widens a types chore into tooling. The rule now names the mirror as the exception instead.Detail
Verification against the ticket's checklist
git diff --stat server/payload-types.ts→ 576 insertions, 575 deletions. The ticket predicted 558/557 against07e3e40; SahajCloudmainhas moved since.raw.githubusercontent.com/sydevs/SahajCloud/refs/heads/main/src/payload-types.tsafter every later commit.grep -nE "'(event-submissions|user-messages|form-submissions)'"→ nothing. The four dead types (Registration,EventSubmission,UserMessage,FormSubmission) are gone.\bregistrations:grep does not return nothing, and should not:collectionsJoins.events.registrations: 'user-submissions'is the join field onEvent, pointing at the new collection. That criterion was written against the old shape.grep -rn "form-submissions" components/→ nothing.Why the example body changed shape.
UserSubmissionrequirestype('contact' | 'subscribe' | 'registration' | 'proposal') and carries answers undersubmissionData.FormBuilderSubmissionalready suppliesformandsubmissionData, so the example spreads it and addstype.Pre-existing mismatch, not fixed here:
FormBuilderSubmission.formisstringwhileUserSubmission.formisnumber | Form, andsubmissionData[].valueisstring | boolean | numberhere vsstringin the CMS. No page in this repo suppliesonSubmit, so nothing exercises either.What the snapshot mirror costs.
scripts/sync-translations.mjs:107keeps every response key outsideNON_GROUP_KEYS, so the nextpnpm sync:translationswrites the 41video.*keys intolib/translations.en.json. They are dead weight and nothing more:EN_TRANSLATIONSis cast toWebTranslations, which derives from the select, so no unfetched group becomes addressable throughuseT().Not run, deliberately:
pnpm sync:translations. It fetches the whole global with noselect, so it would pull those keys in and turn a types chore into an i18n change. Wiring the player touseTis the ticket's open question.Security review: ran (the diff matches
^server/). No findings. The live-preview populate allowlist (COLLECTION_BY_ID_CONFIG) is a hand-written literal of three slugs and is not derived from the generatedConfig, souser-submissionsand its PII fields stay unreachable.getWebTranslationssends a byte-identical request.Closes #116
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_017298GTLqXj1XHr2bvWv7bc