Repository navigation
feat(forms): render contact & subscribe forms via unified intake - #112
Conversation
`pnpm types:cms` against SahajCloud main after #695 Phase 3 (#801): `registrations`, `user-messages` and `form-submissions` are gone, replaced by `user-submissions` with a `type` discriminator, and `forms` gains `actionType` plus its conditional `recipient` / `client`. The same sync brought a new `video` translations tab. `WebTranslations` makes every group required, so the read has to select it or the cast in `getWebTranslations` stops compiling. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
`lib/cms-forms.ts` turns a `forms` document into the render config and the create body for `POST /api/user-submissions`. Both shapes are fixed from opposite ends, so the translation is pure and tested on its own. Three choices worth stating: - The plugin's percentage `width` is bucketed into Tailwind classes. Tailwind scans source, so an interpolated `w-[NN%]` produces no class at all. - `country` and `state` render as text inputs. Their option lists live in the plugin and are not mirrored here; rendering nothing would drop a required field and fail the submission at the collection. - The email answer is lifted to the `senderEmail` column and its pair dropped, so the address screening and delivery read cannot disagree with a copy in the blob. FormBuilder gains a `captcha` slot and `submitDisabled`, both provider- agnostic, and its example no longer names the retired `/api/form-submissions` path. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
`POST /api/submissions` forwards one submission to the CMS's `POST /api/user-submissions`. The browser cannot make that call itself: the create is authenticated with `SAHAJCLOUD_API_KEY`, and SahajCloud answers a wildcard CORS origin with no credentials — the same pairing the live-preview populate proxy already works around. Three properties the tests pin, because the route attaches our API key: - The body is re-validated (`submissionSchema`) before the CMS is called, and `type` is narrowed to the two form-backed intakes. - Exactly one browser header crosses over, the captcha token. Forwarding `Origin` or `Referer` would put this site's host through the client's `allowedDomains` allowlist, which a server-to-server call is exempt from. - A refusal forwards the intake's `errors[].data.code` and never its message, which is English written for a log. A CMS fault reads as 502, never as the browser's bad request. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
A `forms` relationship node is the one reference in rich text that is content rather than a link: the editor embedded it to be filled in, and it has no page of its own. `CmsForm` composes FormBuilder, the Turnstile widget and the submit call; the RichText `relationship` converter renders it and leaves every other collection to the route mapper. `Turnstile` renders **explicitly**, not through Cloudflare's automatic document scan. Vike swaps the page under `<main>` on a client-side navigation and that scan runs once per document load, so an auto-rendered widget would appear on a full load and never again. ⚠ `PAGE_POPULATE` gains a narrow `forms` select, and it is not about payload size. A collection absent from `populate` comes back fully populated, and a form's `recipient` is a relationship to `managers` — so without this entry a manager's record is serialized into the page's hydration payload. A refusal shows one message whatever its code. The intake distinguishes a failed captcha from a disposable address, but this site has one CMS-owned string for a failed send and a translation key cannot be invented here, so the code decides only whether to re-challenge. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
`server/AGENTS.md` covered reads only, which left the four load-bearing facts about a public submission — why the browser cannot make the call, the captcha header, the `errors[].data.code` envelope, and that `select` gates reads alone — stated nowhere. The FormBuilder README's `/api/form-submissions` example predates both auth and the captcha, and its `getFormById` pointer names a function that does not exist. Both now point at what is real. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
The /simplify pass found two defects and several cleanups. **Every page was paying for the form.** `RichText` renders on every route, so importing `CmsForm` statically put `react-hook-form` and the resolver (~38 kB minified) into the eager client chunk of every entry — the lean embed routes included — and into the Worker bundle, for a component almost no page contains. `CmsForm/index.tsx` is now a `ClientOnly` + `React.lazy` barrel, the repo's documented pattern. Measured after: `dist/server` carries only the wrapper, and react-hook-form sits in a 40 kB chunk no entry imports statically. Nothing is lost by not server-rendering a form that submits through `fetch`; the fallback still renders its heading. **An authored width rendered nothing.** The percentage was bucketed into three Tailwind classes emitted from `lib/`, which `layouts/tailwind.css` does not `@source` — so `sm:w-2/3` existed nowhere in the repo and the other two worked only by inheriting CSS from unrelated files. And the field container was `flex flex-col`, so no width could have paired two fields anyway. Fields now sit in a 12-column grid, single-column below `sm`, and the span classes are written out one per column in a scanned file. `FormBuilderField.width` is the percentage the editor authored, not a class name. Also from the pass: - `EmbeddedForm` replaces `Form` at every consumer, tied to `EMBEDDED_FORM_SELECT` through `EmbeddedFormSelect`, so the select and its renderer cannot drift. The old `as unknown as Form` asserted columns the select does not return. - One Lexical text walker in `lib/lexical-text.ts`, with the separator as an argument — `getNodeText` was a second copy of it. - `CmsFormSpec` collapses into `cmsFormConfig` plus a `submissionBody` that derives what it needs, removing a non-null assertion at every call site. - `siteKey` is a prop defaulting to the env var, as `LocationSearch` does, so the story can show the captcha with Cloudflare's test key. - `path` comes from `pageContext.urlPathname`, beside the locale, instead of `window.location`. - The refusal `code` is no longer parsed by the form. Whether the captcha token was spent depends on where upstream refused, so re-challenging on every refusal is the only rule that cannot be wrong. The route still forwards the code, and `SubmissionResult` now types its responses. - Turnstile's existing-script branch is gone: unreachable, and its live path would have hung the promise forever. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
Findings from the review pass, the first one a break rather than a nit. **A quoted form id would have refused every authored field.** SahajCloud resolves the relationship with `relationId()`, which answers `null` for a string — so `form: "12"` is accepted, the intake cannot load the form, and the authored-field allow-list comes back empty: every field the editor named is then refused as unknown while the base context keys still pass. It also skips the `actionType`-versus-`type` guard and blanks the admin subject. `submissionBody` now sends the form's own numeric id and `submissionSchema` refuses a string, so this cannot ship again. The rest: - A repeated `submissionData` key is a 400 at the collection, so an author who names a field `locale` or `path` had a form nobody could submit. The author's answer wins; the context pair is skipped. - `path` goes through `normalizeContentPath`, so the home page reports `/` rather than `+onBeforeRoute`'s `/index` spelling. - A thrown `fetch` now re-challenges like any other failure. It could have reached the CMS and spent the token, so leaving the token in place let the retry send a spent one. - Turnstile no longer caches a rejected script load. One blocked request would have left every later form in the visit captcha-less and permanently unsubmittable, since Vike never reloads the document. - The challenge takes the page locale. Cloudflare's default follows the *browser's* language, so a Spanish page could serve an English challenge. - The route refuses an oversized body on its declared length, before reading it. - The unconfigured-captcha test stubs the env var instead of assuming it is unset — `.env.example` tells developers to set it. Filed sydevs/SahajCloud#808: the CMS reads `cf-connecting-ip` off its own request for Turnstile's `remoteip`, so a proxied submission presents this Worker's address rather than the visitor's. Recorded in `server/AGENTS.md` as the one thing needing an end-to-end test before anyone trusts it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
`forms.redirect.url` is a plain CMS text field with no upstream validation, and `FormBuilder` assigns it to `window.location.href` on a successful submission. That line was unreachable before this branch — FormBuilder had no call site with real data — so making the form live from page content also makes the sink live. An authored `javascript:` URL would run in this origin for every visitor who submits the form. `cmsFormConfig` now drops a redirect the browser must not be sent to, which leaves the form showing its confirmation message instead. The guard sits where the CMS value enters rather than at the sink, so there is one enforcement point; `FormBuilderConfig.redirect` states that a caller owns the scheme. `isSafeHttpUrl` moves from `server/error-utils.ts` to `lib/urls.ts`, which owns how a URL is spelled, and is re-exported so its existing importers do not change. It is too strict alone here: `/thank-you` is the redirect an editor is most likely to write and `new URL` cannot parse it. So `isSafeNavigationUrl` accepts a root-relative path as well — excluding `//host`, the one spelling that reads like a path and behaves like an absolute URL. Reaching the sink needs CMS write on `forms`, which no manager role grants, so this is defence in depth rather than an open door. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
The repo-wide `lib/urls.ts` convention listed the path and locale rules but not the scheme guard, which is what stops a configured `javascript:` value reaching an `href` — so the next person to plumb an external URL had nothing pointing them at it. FormBuilder's redirect section says the same at the one sink that navigates. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WCGod1mebic2xdXWUP8fgE
Deploying wemeditate-design with
|
| Latest commit: |
75180e4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4032d424.wm-design.pages.dev |
| Branch Preview URL: | https://claude-feat-78-forms-intake.wm-design.pages.dev |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 75180e4 | Commit Preview URL Branch Preview URL |
Sep 18 2026, 07:17 PM |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The PR is the size of its ticket. #78 asked for five things — render the embedded form, submit to the unified intake, add Turnstile, re-sync types, retire the dead example path — and all five are here with nothing smuggled in beside them. The two heaviest calls are right: every wire-contract decision in a pure lib/cms-forms.ts, and the ClientOnly + React.lazy barrel that keeps react-hook-form out of the Worker and out of every route's eager chunk.
The cross-repo contract holds. I checked the producer side rather than taking the body's word for it, and the numeric form id, the x-turnstile-token header and the locale/path scan exemption are all as claimed.
Nothing blocking. Six findings; the two worth reading are both "does this need to exist" — a redirect guard whose one special case protects nothing while a different spelling gets past it, and a submitDisabled prop that turns a blocked captcha script into a permanently dead submit button.
Findings
- should-fix
lib/urls.ts:54— the//exclusion blocks nothingisSafeHttpUrlalready allows, and/\evil.comnavigates off-site straight through it. - should-fix
FormBuilder.tsx:165—submitDisableddead-ends the form when Turnstile fails to load, to save a round trip on an already-failing submission. - consider
server/api-routes.ts:232— thecontent-lengthceiling is skipped by omitting the header. - consider
FormBuilder.tsx:181—@source inline("sm:col-span-{1..12}")replaces the twelve literals. - consider
server/error-utils.ts:104— one importer; repoint it and delete the shim. - consider
lib/cms-forms.ts:169— upstream matches the name field by the literal keyname, which is an authoring constraint nothing documents.
What was checked
- Ticket against diff: #78's five bullets and five acceptance criteria against
git diff origin/main...c8fc598— 35 files, ~1370 lines once regeneratedpayload-types.tsis set aside. - Read whole:
lib/cms-forms.ts,lib/lexical-text.ts,lib/urls.ts,server/api-routes.ts,server/validation.ts,server/cms-types.ts,Turnstile.tsx, bothCmsFormfiles, and theFormBuilder,RichText,cms-client,lexical-helpersand.env*diffs. - Consumer side, at SahajCloud
07e3e40:relationIddoes returnnullfor a string, so the numeric-id fix is load-bearing rather than cosmetic.writeGuardPluginrequiresx-turnstile-tokenon every client-originateduser-submissionscreate and screenssenderEmailfor disposable domains.URL_EXEMPT_KEYSholdslocaleandpath.allowedSubmissionKeysreads authored names off the live form, which is what makes the collision rule insubmissionBodynecessary. - Ran:
new URL('/\\evil.com', 'https://site.com')to confirm the bypass;git grep isSafeHttpUrlto count the shim's importers; checked@sourceusage inlayouts/tailwind.css. - Not checked: everything behind the two operational prerequisites. No Turnstile widget exists yet, so no real submission has been made, and SahajCloud#808's
remoteipquestion stays open — it is still the one thing that could refuse every proxied submission with nothing wrong in this diff.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
isSafeNavigationUrl carried two meanings at once. It excluded `//host` as if the rule were "stay on this site", while the http(s) arm permitted `https://host` — the same destination, spelled plainly. The exclusion bought nothing, and `/\host`, which browsers fold into `//host`, walked past it regardless. The rule is the scheme: an authored redirect may leave the site, but it may not be `javascript:` or `data:`. The branch and its test go. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
Turnstile reports a blocked or unreachable challenges.cloudflare.com by calling onToken(null), and its script-load catch does the same. With submitDisabled wired to `token == null`, CmsForm then held null forever: a greyed button, an empty widget container, and nothing telling the visitor why. Ad blockers and corporate proxies reach that state often. Submitting without a token already refuses with captcha_failed, shows forms.general.submit_error and remounts the widget. That path covers the case, so the prop and its one caller go. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
The branch read content-length, which a chunked or streamed POST simply omits: `Number(undefined ?? 0)` is 0, the check passes, and the next line reads the whole body regardless. It refused an honest large submission and not an unfriendly one. submissionSchema on the following line bounds what can get through — 40 pairs, 5000 characters each — and that is the bound the CMS enforces too. Bounding request size on a public route belongs in front of the Worker, where it cannot be skipped. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
Tailwind v4 has `@source inline()` for exactly the scanner problem the twelve literals worked around, and layouts/tailwind.css is already where this repo configures scanning. fieldSpanClass interpolates again. Confirmed against a real build: all twelve `.sm\:col-span-N` rules are in dist/client, emitted by the directive alone. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
Two importers found the function in server/error-utils before it moved, and a re-export kept them working. Repointing them at lib/urls, which owns the rule, leaves it one home. The tests move with it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
The email field is matched here by blockType, but prepareUserSubmission matches the name field by the literal key `name` — the plugin has no name block to match on instead. An author who calls it `fullName` gets a users row named off the address, written on first contact and reused after. Verified against SahajCloud main: upsertUserByEmail returns early on an existing row, so the name is never revisited. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
`//evil.example` moves from the refused list to the accepted one: isSafeNavigationUrl now gates the scheme, and an off-site redirect is an editor's to make. The oversized-body case drops its content-length header and exceeds submissionSchema's 40-pair bound instead, which is the bound that is still enforced. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RMWA5UmUx1tpsAZj6YbXjY
|
Six adversarial-review threads, all adopted, replied to and resolved. Nothing rebutted, nothing left open.
Gate green: lint, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
AGENTS.md told the next reader to keep `FormBuilder` out of the Worker, and the README told them to import it through the barrel. Both are now the opposite of the rule the PR ships. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WzXYaXtdds4VRxr9NjdFPF
|
Pushed at Adopted — server-rendered fields ( Measured after:
Gate: lint 0 errors, 🤖 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.
Ensure that there are no other remaining references to "CMS Form" - this labelling is quite unclear and unhelpful
The Ladle story was still named "CMS Form", after the component it named was folded into `FormBuilder`. It reads as a second organism that no longer exists. Renamed to "Form Builder", matching every other organism story. The same label sat in six more places — the story and component JSDoc, `types/vike.d.ts`, `.env.example`, the FormBuilder README heading and `docs/rules/zod-validation.md`. All of them mean the form a content editor authors, so they say that. Two stale pointers left by the same removal go with it: the README's redirect warning named `cmsFormConfig`, which is deleted and whose check `FormBuilder` now does itself, and the story JSDoc sent the reader to a FormBuilder story that is this one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DXKEK5KrejVKbgUxJJHwfp
|
Pushed at Adopted — the story name. It is "Form Builder" now, matching every other organism story. Swept the label out of the six other places it sat: the story and component JSDoc, Two stale pointers from the same removal went with it: the README's redirect warning named Gate: lint 0 errors, 🤖 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
|
Merged The FormBuilder docs. #117 rewrote JSDoc and README prose about the ⚠ The Gate green after the merge: lint 0 errors, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
formsnode embedded in page rich text now renders the form and submits it, where it used to render its title as plain text.user-submissionsintake through a same-origin proxy, with a Cloudflare Turnstile captcha — both net-new here.registrations/user-messages/form-submissionsare gone from this repo.Changes
components/organisms/FormBuilder/— the whole feature. It takes the authoredformsdocument itself and owns the captcha, the submit and the refusal handling. It server-renders:index.tsxre-exportsFormBuilder.tsx, which renders@marsidev/react-turnstilewithexecution: 'render'so the widget survives a client-side navigation.lib/submissions.ts— theuser-submissionscreate body, and where every wire-contract decision lives. Pure.server/api-routes.ts—POST /api/submissions, forwarding one create withSAHAJCLOUD_API_KEYand the captcha header.server/cms-client.ts—EMBEDDED_FORM_SELECTinPAGE_POPULATE, tied toEmbeddedFormso the select and its renderer cannot drift.layouts/tailwind.css—@source inline("sm:col-span-{1..12}"), so the runtime-built span class is emitted.Preview
The feature has no fixed route of its own, so the pages worth opening are any CMS page whose rich text embeds a form, plus the Ladle story
Organisms → Form Builder.Contract impact
pnpm types:cmsagainst SahajCloudmain, post-#801).registrations,user-messagesandevent-submissionsno longer exist in this repo's types; nothing referenced them.PUBLIC__TURNSTILE_SITE_KEY. Deliberately absent from.env.production— see Manual verification.@marsidev/react-turnstile1.6.1. It renders a plain container and touches the DOM only from effects, so it server-renders. It is in the Worker bundle and in every route's client chunk — see the SSR decision below.cf-connecting-ipoff its own request for Turnstile'sremoteip, so a proxied submission presents this Worker's address, not the visitor's. Cloudflare validatesremoteipagainst the address that solved the challenge, so this may refuse every proxied submission. Recorded inserver/AGENTS.md.name.prepareUserSubmissionmatches it on that literal key, not on a block type, andupsertUserByEmailwrites theusersrow once and never revisits it. A field calledfullNamenames the row off the email's local part, permanently. Documented in the FormBuilder README.Test results
pnpm lint(0 errors),tsc --noEmit,pnpm test:run— 682 passed, 72 filespnpm build.dist/serveris 2.63 MB raw and 564 kB gzipped, against Cloudflare's 3 MB gzipped Worker ceiling.react-hook-formand Turnstile are in it deliberately.Manual verification
Two operational prerequisites gate everything below, and neither is code. Until both are met, every submission is refused
captcha_failed— the CMS requires a token on every public write.TURNSTILE_SECRET_KEYis the matching half of that same pair. SetPUBLIC__TURNSTILE_SITE_KEYin.env.productionor the Cloudflare build variables.type: contactrow reaches the CMS and is delivered to the form's recipient.type: subscriberow reaches the configured provider (activityLogor the provider dashboard).remoteipquestion above (SahajCloud#808) on that first real submission — check the CMS logs forerrorCodeson a refusal. This is the one thing that could make the whole path fail with nothing wrong at either end.smbreakpoint and stack on a phone.messageblock containing a link, and confirm it renders as a link. It used to be flattened to plain text.<form>and its inputs are in the delivered HTML.Notes for reviewer
FormBuildertakes the CMS document directly. The parallelFormBuilderConfigtype had one producer and one consumer, andFormBuilderhad no caller butCmsForm, so the conversion layer only bridged two shapes of the same thing. See the review round below.RichTextrenders on every page, soreact-hook-formand@marsidev/react-turnstileare in the Worker (dist/server2.53 MB → 2.63 MB, 564 kB gzipped against a 3 MB ceiling) and in a 495 kB client chunk the route entries import statically, against a 42 kB lazy chunk before. The reviewer took SSR at that price.AGENTS.mdand the FormBuilder README now carry the decision, since both previously said the opposite.video: trueinWEB_TRANSLATIONS_SELECTis not a drive-by.WebTranslationsmakes every group required, so the new upstream tab has to be selected orgetWebTranslationsstops compiling. It is in its ownchore(types)commit. Nothing readsvideo.*yet, andlib/translations.en.jsonhas novideogroup —pnpm sync:translationsstill needs running by someone with the key (it is not run in CI). I checked that no existingmedia.*key moved upstream, so nothing regresses meanwhile.forms.general.submit_error, and a translation key cannot be invented here. Richer copy needs the keys added upstream first.countryandstaterender as text inputs — the plugin's option lists are neither mirrored here nor returned by the read. A typed answer still submits the pair the collection expects./simplifyand/code-review high;/security-reviewran becauseserver/**and.env*changed. One anomaly:/pr-review-toolkit:review-pris not installed in this environment, so/code-review highstood in for it, andcomment-rule-sync.mjscannot resolve its canonical path from a worktree (no rule copy was touched).Detail
The human review round.
3b99c91), confirmed before it was made.FormBuildernow takes theformsdocument.lib/cms-forms.tsbecomeslib/submissions.tsholding only the wire contract;cmsFormConfig,formFields,FormBuilderConfig,lib/lexical-text.tsand the wholeCmsForm/directory are gone, as are theonSubmit,schemaandcaptchaprops.getNodeTextreturns tolexical-helpers.ts, where the heading converter reads it, and amessageblock and the confirmation render throughRichTextinstead of being flattened — so an authored link or bold survives. Net −671 lines.7193bd9).@marsidev/react-turnstile1.6.1 replaces the hand-rolled explicit render: the module-scoped script-load promise, the widget-id ref and the cache-clearing rejection path are all the library's.execution: 'render'keeps the behaviour that mattered — a widget tied to the component's lifecycle rather than to Cloudflare's once-per-document scan, which a Vike client-side navigation never re-runs.1fa39b3). Once the library landed,components/molecules/Turnstile/mapped five props onto it and passed them through, for a single importer.FormBuilderrenders the library itself;execution: 'render'and the page-localelanguagekeep their reasoning at the call site, and thex-turnstile-tokencontract stays where it is owned, inlib/submissions.ts. Net −111 lines.ca28108,7766380). TheClientOnly+React.lazywrapper and its skeleton fallback are gone, soRichTextrenders the real form on the server. Measured after:dist/server2.63 MB raw / 564 kB gzipped, and a 495 kB (161 kB gzipped) client chunk thatpages_slug_,entry-client-routingand both_embedroutes import statically. Neither library touches the DOM while rendering.RichText.test.tsxnow asserts the<form>and its inputs are in the server output, so putting the component back behindClientOnlyfails a test rather than passing quietly.77d4e38). The Ladle story kept the name of the organism that was folded intoFormBuilder, so it read as a second component. It is "Form Builder" now, like every other organism story. The same label sat in the story and component JSDoc,types/vike.d.ts,.env.example, the README heading anddocs/rules/zod-validation.md; all say "authored form". Two stale pointers from the same removal went too: the README's redirect warning named the deletedcmsFormConfig, and the story JSDoc pointed at a FormBuilder story that is itself.new URL(url)plus a scheme comparison, so a library would wrap the same platform parser;validator.isURLmatches by regex, which is weaker for scheme allowlisting and far larger.The adversarial review round (six threads, all adopted).
isSafeNavigationUrlcarried two meanings at once (1e7c174). It excluded//hostas if the rule were "stay on this site", while the http(s) arm permittedhttps://host— the same destination, plainly spelled. The exclusion bought nothing, and/\host, which browsers fold into//host, walked past it anyway. The rule is now the scheme alone: an authored redirect may leave the site, but it may not bejavascript:ordata:.submitDisabledcould dead-end the form (29489fd). Turnstile reports a blockedchallenges.cloudflare.comby callingonToken(null), so the button greyed out permanently with nothing saying why. The refusal path already covers the case, so the prop is gone.6b75e11). A chunked POST carries nocontent-length,Number(undefined ?? 0)is0, and the body was read regardless. It refused honest large submissions and not unfriendly ones.submissionSchema's 40-pair bound is what stays.b0a2454).@source inline("sm:col-span-{1..12}")is Tailwind v4's answer to exactly this scanner problem, and scanner configuration belongs in the CSS. Confirmed against a real build: all twelve.sm\:col-span-Nrules reachdist/client.isSafeHttpUrlre-export shim is gone (8154521). Its two importers now read fromlib/urls, which owns the rule, and the tests moved with it.eaec47a) — see Contract impact. Verified against SahajCloudmain.What the earlier review passes caught, since the commits are where the reasoning lives:
relationId(), which answersnullfor a string, leaving the intake unable to load the form and so with an empty authored-field allow-list. Base context keys would still pass, which is what would have made it look like it worked.lib/, whichlayouts/tailwind.cssdoes not@source, sosm:w-2/3existed nowhere in the repo — and the container wasflex flex-col, so no width could have paired two fields anyway.redirect.urlreacheswindow.location.href. That line was unreachable before this branch, so making the form live makes the sink live.isSafeNavigationUrlgates it at the CMS boundary.submissionDatakey is a 400 upstream, so an author naming a fieldlocaleorpathhad a form nobody could submit.Rejected suggestions. Branching the form on the refusal
code— whether the token was spent depends on where upstream refused, so re-challenging always is the only rule that cannot be wrong. Sharing thesatisfies EmbeddedFormfixtures — they differ in what each test needs, and per-file Lexical fixtures are the existing house style.Closes #78
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_01WzXYaXtdds4VRxr9NjdFPF