Repository navigation
feat(api)!: unified intake, phase 1 — the user-submissions schema - #754
Conversation
…phase 1) Phase 1 of #695, per #723: the form-builder plugin's submissions collection is renamed `user-submissions` and given the typed columns every public write needs, beside the three collections it will eventually replace. Nothing is deleted here — `registrations`, `user-messages` and `event-submissions` keep working until Phase 3. - `formSubmissionOverrides.slug` + a `fields` override adds `type`, `uuid`, `status`, `senderEmail`, `user`, `client`, `subject`, `screeningResult`, `activityLog`, `event`, `startingAt`, `unsubscribedAt`, `eventFeedback`, `followUpSentAt` and `proposed`. `submissionData` keeps only the flat free-form remainder, since it is client-writable as one blob and nothing queryable, unique, relational or system-gated can be protected inside it. - `prepareUserSubmission` (beforeValidate) enforces per-type allowed keys and lengths on that blob, issues the `uuid`, composes `subject`, upserts the sender into `users`, and stamps provenance from the authenticated key. - The plugin's unconditional `form` requirement becomes per-type: required for `contact` and `subscribe`, refused for the two that name an `event`. The plugin's own existence check is composed with, not replaced. - Forms gain `actionType` with conditional `recipient` / `client`, save-time validation of the authored field list, and lose `emails` — a structural disable of the plugin's pre-screening `sendEmail`, not a suppression. - Every `type: 'json'` column declares a `jsonSchema`, `logField`'s included. Its entries stay open (`additionalProperties: true`) because machine data is each writer's own; `LogDisplayCells` declares the matching index signature. - `user-submissions` joins RESTRICTED_COLLECTIONS and leaves the wemeditate-web project. Clients get create-only; a manager's read is narrowed per row to contact rows addressed to them plus proposals. - The `registrations: ['update']` client grant, its uuid-scoped access branch and `restrictClientRegistrationUpdate` are removed. The vote's only writer is the CMS-hosted feedback page, which writes with `overrideAccess` — that grant was an open write path nothing used. - `Users` shows one `submissions` join in place of `registrations` and `submittedEvents`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP
…form actions
Four spec files, plus the two the change re-points.
Each caught a defect while being written, which is the reason for the shape
they take:
- `user-submissions-access.int.spec.ts` reads rows back through
`overrideAccess: false` rather than asserting grants, and found that the
form-builder plugin's own `access` block outranks the whole RBAC layer
(`accessPlugin` composes `{ ...rbac, ...collection.access }`). Its
`read: !!user` would have granted every API client read of every stranger's
message, with `RESTRICTED_COLLECTIONS` looking like it applied. The plugin's
`access` is now cleared for this collection.
- `user-submissions-create.int.spec.ts` found the Turnstile stub succeeding for
any argument, so the "no token" case passed for the wrong reason; found the
offending key missing from a `ValidationError`'s message, which is the one
thing the acceptance criterion asks for; and found the plugin's `sendEmail`
throwing once per form-less submission.
- `forms-action-type.int.spec.ts` pins the save-time rules and that `emails` is
absent from the sanitized config.
- `submission-data.spec.ts` holds the per-type key matrix in the unit lane, and
the URL-scan exemption that keeps a crash report from reading as spam.
The access, form-action and submission-data specs were each re-run with the
rule they cover disabled, and each went red.
`event-feedback.int.spec.ts` is re-pointed at the real writer: the feedback
page's server action, which votes with `overrideAccess`. Its client-vote block
becomes the assertion that no client write path exists.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP
Two corrections found reviewing the branch against `src/collections/AGENTS.md`. `proposed` reaches `user-submissions` from a public POST and is a patch of real Events fields, so Phase 3's accept path would apply it to an Event with a manager's authority behind it — a submitter setting `verificationStage` mints a verified listing, and `registrationNotificationEmail` forwards registrants' answers to an inbox of their choosing. `validateProposal` is `event-submissions`' own gate and derives its allowlist from the live Events config, so it is reused rather than re-derived. It moves to a shared home in Phase 3, when that collection is deleted. `activityLog`'s schema now declares no `required` keys. Payload runs a JSON validator on every save of the document, including one that never touches the column — and this column predates the `logField` factory: it was Registrations' `reminderLog`, whose entries were reminders with no `cells`. A `required` list would have made any row holding one permanently unsaveable, which no test here could see because no test holds a pre-#626 row. Type checks on the properties that are present still apply. The verification spec's hand-built log fixture is rebuilt with the real entry builders either way: the entries it spelled out omitted `type` and `cells`, which nothing that writes the column omits, so the crash it simulates was a state the app cannot reach. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP
…ules The new refusal codes, the URL-scan exemption, and the create-only grant are things an integrator observes, so they belong beside the Turnstile contract rather than only in the code that raises them. Also corrects a cross-reference in EventSubmissions to the Users join that replaced `submittedEvents`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP
Nine findings from a security pass and a code-quality pass over the branch. Five would have shipped a defect; each now has a test that fails without the fix. - **An unrecognised `type` crashed the public POST with a 500.** This hook runs before Payload validates the select's options, so the cast reached `TYPE_SUBMISSION_KEYS[type]` and spread `undefined`. Checked now, with the same 400 the neighbouring refusals use. - **`type` was never reconciled with the form's `actionType`**, and `enforceSubscribeReach` keys on `type` — so a restricted client could post against another client's subscribe form while calling the row a `contact`, and the reach check never ran. The form is the authority; a disagreement is refused rather than silently corrected. - **`activityLog` was client-writable.** `logField`'s docblock promised it was never writable through the API and stated that nowhere the server reads, which did not matter while the column sat on collections no client could write. The admin renders it as system-written history. Denied to clients — deliberately not a flat `update: () => false`, because the admin verify action writes that log with `overrideAccess: false` so the manager's own permissions gate it, and a blanket deny silently dropped the record of who verified a listing. - **`validateFormAction` merged with `??`.** Payload normalises a cleared relationship to `null` and hands the hook data already merged with the stored document, so clearing a subscribe form's client read as the old client and passed the one rule the hook exists for. It now reads the merged value, and judges a save only when it changes the field list, the action or the client — which is also what stops a legacy form, back-filled to `contact` and lacking a message field, becoming unsaveable on an unrelated edit. - **`subject` echoed the title of any event id a client named**, drafts and trashed rows included, routing around the published-only narrowing a client's own reads get. Three test cases could not fail for their own rule: a form fixture that also broke a second rule, a `?? []` join assertion that could not tell "filtered to nothing" from "never populated", and an "admins read everything" case reading with `overrideAccess: true`. All three assert the property they name now. Also: the entry cap short-circuits instead of emitting one message per row; `activityLog` gained `maxItems`; a `.catch(() => null)` that turned a transient database error into a 400 blaming the integrator is gone; the dead `urlScanFields: ['subject']` entry is removed with a note saying why field access had already emptied it; and the docs' claim that both new refusals are 400 is corrected — `subscribe_target_forbidden` is 403. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP
|
🚅 Deployed to the SahajCloud-pr-754 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
|
CI is red on one smoke spec. Ruled out. No changed file touches Images, the upload path, the storage adapter or sharp. Lint, typecheck, unit and integration all passed in the same run. Of the eight e2e specs the image upload is the only write, and the rest passed or skipped. The absent migration is not it either: the preview boots, and an images write reads no drifted table. What remains. Reproducing needs the deployed preview and its Cloudflare Images credentials, which a routine lacks. Two candidates:
Read the Railway deploy log for the stack. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Correcting the comment above: the missing migration is the cause. It was ruled out wrongly. Sentry caught the stack from the smoke run — environment Payload checks document locks on every authenticated write, and that join carries one column per collection. The PR body's "this fails on deploy, not on CI" is the same mistake. The smoke lane runs against the preview, which migrates on boot. No fix-ci pass can turn this green. The next step is the attended one you already wrote: 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
CI is still red after 3 fix attempts (failing: Lint, Test & Smoke). I have stopped retrying. A comment or a push from you starts me again. 🤖 sydevs dispatcher |
|
This draft has had no CI activity for hours and no session holds it. Comment or push to wake me. 🤖 sydevs dispatcher |
|
@sydevs-bot CI is failing and needs to be fixed |
…submissions-schema
|
CI is red for one reason: this PR still has no migration. The Railway preview runs this branch's code against a database that never got its schema. Pushed e2f7c8d: I need one attended run from you: It stops on I did not answer it blind: 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`screening.ts` held one const with one consumer and an alias with none, so it goes the way `proposal.ts` went in b4c2d8f. `SUBMISSION_VERDICTS` now sits beside `screeningResultField` in `fields.ts`, which builds the schema's enum from it, and the module's one substantive paragraph — why the machine verdict lives in this column and never in `status` — moves onto that field. `SubmissionVerdict` is deleted rather than re-derived. Nothing imported it, and the list already generates `SubmissionScreeningResult['verdict']`; an exported alias would be the second definition `src/types/AGENTS.md` says to delete, not to point somewhere else. A Phase 2 consumer reads the generated type directly. `pnpm generate:types` leaves `payload-types.ts` byte-identical, which is the evidence no shape moved. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XpWhgSLpDEgsryNu4btTJt
|
Three threads answered. One commit, pushed to 3b17fca. Adopted and resolved
Open, for you
There is no Lean gate green (2045 tests), three integration specs green (44). 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
One thread answered. Nothing pushed — the branch stands at 3b17fca. Open, for you
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`UserSubmissions/types.ts` is gone. Its two exported aliases were the re-export chain `src/types/AGENTS.md` prohibits: `SubmissionType` and `SubmissionStatus` already spelled `UserSubmission['type']` and `['status']`, and exporting them gave each shape a second home for every consumer to reach through. Each consumer now names the generated union at its own call site — `submissionData.ts` twice, `fields.ts` once, `prepareUserSubmission.ts` three times — so no file imports a type from another module that is only forwarding one. With `submissionData.ts` off the module entirely, the pure-module objection that kept `types.ts` alive last round is gone: it takes `@/payload-types`, which is types only, and pulls no `zod` or `logField` into the unit lane. The runtime halves move to `fields.ts`, beside the selects they build — the same fold `proposal.ts` and `screening.ts` got. `SUBMISSION_STATUSES` and `STATUS_LABELS` stop being exported: only `statusField` reads them. No shape moves. `pnpm generate:types` leaves `src/payload-types.ts` byte-identical. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Nrgkhg12CwBzFcYKtRbmnu
|
One thread answered. One commit, pushed to fd278c3. Adopted and resolved
Still open, for you
Lean gate green (2045 tests), three integration specs green (44). 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
user-submissions— the one intake for contact, subscribe, registration and proposal — beside the three collections it will replace in Phase 3. Nothing is deleted here.actionTypewith save-time validation, and lose the plugin'semailsfield — the pre-screeningsendEmailpath is now structurally unreachable.Changes
src/plugins/formBuilder/— the plugin's one configuration, shared with the test harness. It also does three things the plugin options cannot: clears the plugin's ownaccessblock, removes itssendEmailhook, and reusesvalidateProposalas the gate onproposed. Each is explained where it happens.src/collections/UserSubmissions/— the field list, the per-typebeforeValidate, thesubmissionDatabound, and the two JSON columns, declared withjsonFieldand Zod (refactor(fields): declare a JSON column with one jsonField helper #756). Two files:fields.tsandsubmissionData.ts, plus the hook.src/collections/Users/— gains thesubmissionsjoin. It does not loseregistrationsorsubmittedEvents: nothing writesuser-submissionsuntil Phase 2, so all three sit side by side and the two legacy ones go in Phase 3.src/plugins/access/—RESTRICTED_COLLECTIONS, the role changes, and the per-row manager scope. Theregistrations: ['update']grant, its uuid-scoped branch andrestrictClientRegistrationUpdateare removed.src/fields/logField.ts— the activity-log column now goes throughjsonFieldtoo, with its shape in Zod.src/migrations/20260914_172100_user_submissions.*andsrc/migrations/20260914_175014.*pluspatches/[email protected]— the migration, the snapshot resync, and the patch that made generating them possible.src/migrations/AGENTS.mdrecords all three.package.json— the whole Payload family pins3.86.0, for the patch-key reason below.Preview
GET /api/formsthere is the one to check: it 500'd on the missingforms.action_typebefore the migration landed.Migration
Two files, both included.
src/migrations/20260914_172100_user_submissions.{ts,json}(the schema change) andsrc/migrations/20260914_175014.{ts,json}(a snapshot resync, no DDL), both generated attended by @Ardnived in 2d51e48 and fe3fbba.20260914_172100_user_submissionsrenames rather than rebuilds, so existingform_submissionsrows survive:form_submissions→user_submissions, itssubmission_datachild table, andpayload_locked_documents_rels.form_submissions_id. Then the intake columns,forms.action_type/recipient_id/client_id, and the drop offorms_emails+forms_emails_locales.user_submissions.form_idlosesNOT NULL, as this body asked for. Validator: 4 pass, 0 fail.Generating it first needed
patches/[email protected](b001669):applyPgSnapshotsDiffhandspreparePgAlterColumnsthe raw pre-rename snapshot, so a renamed table with altered columns — every collection rename — is looked up under its new name and crashes. Unfixed upstream through 0.31.10, and@payloadcms/db-postgrespins 0.31.7 exactly, so the Payload family drops its carets to keep the patch matching. All ten packages, not two (1a0a690): Payload does not support a mixed-version family, so pinningpayloadalone left onepnpm updateable to put@payloadcms/[email protected]beside it. No version moves — only the ninespecifier:lines change in the lockfile, andpnpm install --frozen-lockfileaccepts it.The snapshot chain is healed.
20260914_175014.jsonwas generated on the merged tree, so it carries bothuser_submissionsandmain's 20260909–20260913 schema, and it is the highest-timestamp snapshot.pnpm db:migrations:create <probe> --skip-emptynow writes no files, which is the proof that snapshot and config agree exactly. Re-run after the latestmainmerge, and again after the round-2 review: still no files.⚠ Its
.tshalf had to be emptied (d4cafc5). It was generated against the stale predecessor, so all 142 of its statements re-emitted DDL that nine earlier migrations already apply — every statement checked against the rest of the chain, none of them new. Replaying it aborts the boot migration on its first statement (CREATE TYPE "enum_wm_app_config_available_locales"already exists), and theDROP COLUMNs below it would take the translation columns with them. That is #566, the out-of-order snapshot trap. Nothing rolls back: the migration fails on statement one, so it commits no schema and leaves nopayload_migrationsrow. The snapshot is kept, the DDL is gone, and the file's docblock names the nine migrations that already ship it.No translation reseed is needed. The drops that prompted that concern lived in the emptied
up(), and each was a re-emission of a dropmainhad already made. No live column loses data.⚠ CI cannot see this class of defect.
push: !isProductioninsrc/payload.config.tsmeans dev and every test lane sync the schema with Drizzle push and never replay the migration chain. Only a Railway boot runsprodMigrations, so the preview deploy is the check that matters for this folder.Test results
tscoversrc/,tscovertests/, unit lane (2045 tests, 143 files)user-submissions-access,user-submissions-create,forms-action-type— 3 files / 44 tests, all green. Earlier rounds also ranevent-verification,atlas-seo,role-based-access,event-submissions,event-registrationpnpm generate:typesleavessrc/payload-types.tsbyte-identical at fd278c3, which is the evidence this round moved no shapedb:migrations:create --skip-emptyexits 0 and writes no files — before and after the latestmainmerge, and after the round-2 review. Not re-run this round: no field's shape changedManual verification
20260914_175014no longer aborts it./admin: author a contact form with a recipient and a subscribe form with a client. Confirm a subscribe form with no email field refuses to save, and that the Forms edit view shows no emails feature.curl -X POST $URL/api/user-submissionsas an atlas client for each of the four types, with and withoutx-turnstile-token, and from a disallowed Origin.actionType: 'contact', and the save-time rule then applies to it. It is deliberately scoped to saves that change the field list, the action or the client, so a rename should pass even on a legacy form that lacks a message field — that scoping is what stops such a row becoming unsaveable, and it is worth confirming against real data.activityLog.logFieldnow declares a schema, so that column is validated on every save of those documents. The schema is deliberately all-optional for this reason, but production rows are the one thing no test here reads./admin. Three joins now show: Submissions (empty until Phase 2), Registrations, and Submitted Events.Notes for reviewer
Four judgement calls worth checking, each a deviation from #695's written plan or a decision it did not cover:
sendEmailhook is removed, not merely starved. feat(api)!: unify public intakes on the form-submissions pipeline #695 said strippingemailswould make it take its "nothing to send" branch. It does not get that far: it spreadsdata.submissionDataand loadsdata.form, both optional here, so it threw and logged an error on every registration and proposal. Nothing is swallowed — no email can be authored, so there is provably none to send.accessblock is cleared foruser-submissions.accessPlugincomposes{ ...rbac, ...collection.access }, so the plugin's own block outranked the role table, the manager scope andRESTRICTED_COLLECTIONStogether — including an anonymous, captcha-free create. This was pre-existing onform-submissionsand would have carried over silently.validateProposalis reused rather than re-derived, which meansuser-submissionsimports fromEventSubmissions/. It moves to a shared home in Phase 3 when that collection is deleted; duplicating the gate now would leave two definitions to reconcile.seeds/lib/tagManager.tsneeded a cast. Adding a requiredactionTypetoformsbroke it:payload.createwith aCollectionSlug-typed variable demands the required fields of every collection at once, andformswas the union member that{ title }happened to satisfy. The helper has no callers.Two scope limits stated rather than hidden: the
submissionDatabounds are create-time only (no client holds update; a manager editing a row is trusted, not checked), andproposedvalues are unbounded beyond a 60-key cap — the same shapeevent-submissionshas today.What Ardnived's review changed (round 4)
One thread, one commit. Nothing behavioural — the collection's runtime is untouched.
types.tsis gone (fd278c3). Round 3 left this open because folding the module would make the puresubmissionData.tsimportfields.ts. The review's answer removed that objection rather than arguing with it: adapt each consumer to name the generated union itself, instead of routing it through a module that only forwards it.submissionData.tswritesUserSubmission['type']twice,fields.tsonce,prepareUserSubmission.tsthree times, and each imports@/payload-types, which is types only — so nozodorlogFieldreaches the unit lane.src/types/AGENTS.mdalready states: a derived alias stays local and is never re-exported.SubmissionTypeandSubmissionStatuswere exported aliases forUserSubmission['type']and['status'], which is the re-export chain the rule names — deleted, not repointed.fields.ts, beside the selects they build — the same foldproposal.ts(b4c2d8f) andscreening.ts(3b17fca) got.SUBMISSION_STATUSESandSTATUS_LABELSstop being exported at all:statusFieldis their only reader.pnpm generate:typesleavessrc/payload-types.tsbyte-identical, which is the evidence no shape moved.What Ardnived's review changed (round 3)
Three threads, one commit. Nothing behavioural — the collection's runtime is untouched.
screening.tsis folded away (3b17fca), the wayproposal.tswent in b4c2d8f. It held one const with one consumer and an alias with none.SUBMISSION_VERDICTSnow sits infields.tsbesidescreeningResultField, which builds the schema's enum from it, and the module's one substantive paragraph — why the machine verdict lives in that column and never instatus— moves onto the field.SubmissionVerdictis deleted, not re-derived: the list already generatesSubmissionScreeningResult['verdict'], so an exported alias is the second definitionsrc/types/AGENTS.mdsays to delete rather than repoint. A Phase 2 reader takes the generated type directly.types.tsstays, and that thread is left open. ⚠ Superseded in round 4 above — the file is gone. What this round left standing was the objection that folding it would make the puresubmissionData.tsimportfields.ts; the review answered it by pointing each consumer at@/payload-typesdirectly.submissionData.ts's checks stay hand-written, and that thread is left open. Measured rather than argued this time: on zod 4.3.5,z.array(T).max(3)parses all 50,000 elements before the length check refuses, so a naive port loses the deliberate short-circuit atsubmissionData.ts:121— the one that stops a 100k-entry array being walked on a public endpoint. A faithful port keeps today's loop inside asuperRefine, because the allowed keys come from the liveformsdocument per request, the cap is per key, and each message names the offending key as contract.There is no
UserSubmissions.tsto move anything into:formsPluginassembles the collection fromuserSubmissionFields, sofields.tsis that file here.What Ardnived's review changed (round 2)
Six threads, five commits. One behavioural change; the rest are how a shape is declared.
subscribe_target_forbidden403, theUNRESTRICTED_SUBSCRIBE_ROLESexemption, its integration case and the row indocs/rules/api-clients.mdgo with it. Thetype/actionTypereconciliation stays: it kept this check reachable, but every per-type rule keys ontypeindependently.jsonFieldand Zod (4dec4cc), the pattern refactor(fields): declare a JSON column with one jsonField helper #756 established after this branch was cut.screeningResultis az.strictObject,proposeda boundedz.looseObject, both inline at their fields.screening.tskeptSUBMISSION_VERDICTSand carried no schema. ⚠ That file is gone as of round 3 above, and the "a leaf an admin component may import" reasoning went with it — it had no such importer.logFielddoes the same (c75de38). It was building its own{ uri, fileMatch, schema }wrapper and exporting anACTIVITY_LOG_SCHEMA_URI— exactly the constant refactor(fields): declare a JSON column with one jsonField helper #756 deleted everywhere else. Nothing imported it. The shape is unchanged: every key optional, the entry open, cap 500, because Payload validates this column on every save of the document.SubmissionTypeandSubmissionStatusderive from@/payload-types(9ec9ac3) instead of(typeof ARRAY)[number]. The const arrays stay —fields.tsbuilds the selects from them — so deriving the types back closes the loop, and a new option without a label is now a compile error. ⚠ Round 4 finished this: the two aliases are deleted, and each consumer names the generated union itself.blockTypesis inlined (a64d2f8) at its one call site. That thread is resolved.prepareUserSubmission's checks stay hand-written, and that thread is resolved. The columns moved to Zod; what remains is not shape validation — see the measurement in round 3 above.pnpm generate:typesregeneratessrc/payload-types.tsbyte-identically across all three schema conversions, which is the evidence that no shape moved.What the adversarial review changed
Five findings, five commits. Nothing behavioural beyond the first.
Userskept its two legacy joins (9d57d11). The newsubmissionsjoin replacedregistrationsandsubmittedEvents, but nothing writesuser-submissionsthis phase —registerForEventstill createsregistrations,event-submissionsstill takes proposals. So the replacement showed nothing while the two it replaced were the admin's only window onto a registrant's history, against a ticket saying this phase changes no old behaviour. All three now sit side by side.3.86.0(1a0a690) — see the Migration section above.sendEmailstory (0a744e7). It was told three times and one telling was wrong:Forms/fields.tsand the firstformBuilderdocblock both said strippingemailsdisables the hook. It does not — the hook throws before it readsemails. The detailed docblock also sat onformBuilderwhile describingformsPlugin. It moves ontoformsPluginand is now the one statement; the other two point at it.subject's docblock says what it is composed from (b4f2130). It claimed "not client-writable: it is derived". The column is denied to clients, butcomposeSubjectjoins the sender's ownsubjectpair into it, so unreviewed text does reach the admin list title. Bounded (URL-scanned, capped, truncated to 300) rather than trusted — wording, not a hole.proposal.tsfolded intofields.ts(b4c2d8f): 38 lines for one constant with one consumer. ⚠ The reply on that thread saidUserMessagesimportsscreening.ts's schema; it does not —UserMessages/screening.tsis its own file.UserSubmissions/screening.tsturned out to have one consumer too, and folded in round 3.What the merge with
mainresolvedThree conflicts in the first merge, all additive on both sides:
pnpm-workspace.yaml—main'sundici: '^7.29.1'override and this branch'spatchedDependenciesblock both kept.src/migrations/index.ts—main's seven migrations (20260909–20260913) kept ahead of this branch's20260914_172100_user_submissions, which stays last by timestamp.src/payload-types.ts— generated, so both sides' interfaces were kept and the file was then regenerated withpnpm generate:types.The second merge (#781, #784 — atlas translations) was clean and added no migration. So was the third (#785, #786).
What the earlier reviews changed
An adversarial security pass and a code-quality pass both ran over the branch. Nine findings held up and were fixed; each has a test.
Would have shipped a defect:
typestring crashed the public POST with a 500 — the hook runs before Payload validates the select's options, so the cast reachedTYPE_SUBMISSION_KEYS[type]and spreadundefined. Now a 400 naming the value.typewas never reconciled with the form'sactionType, so a row could be judged by the rules of a type its form does not accept. Closed now. (It also kept the since-removed subscribe reach check reachable — see round 2 above.)activityLogwas client-writable.logField's docblock claimed it was "never writable through the API" and said so nowhere the server reads. The admin renders it as system-written history, so a forged delivery record would have read as fact. Now denied to clients — deliberately not a flatupdate: () => false, because the admin verify action writes that log withoverrideAccess: falseon purpose, and a blanket deny silently dropped the record of who verified a listing. That regression is what the narrower rule is for;event-verification.int.spec.tscaught it.validateFormActionmerged with??, which reads an explicitly cleared relationship as the old value — so clearing a subscribe form's client passed the one rule the hook exists for.Test quality:
?? []join assertion that could not tell "filtered to nothing" from "never populated"; an "admins read everything" case that read withoverrideAccess: true). All three now assert the property they name.Bounds and accuracy: the entry cap now short-circuits instead of emitting one message per row;
activityLoggainedmaxItems; a.catch(() => null)that turned a transient database error into a 400 blaming the integrator is gone; the deadurlScanFields: ['subject']entry is removed with a note saying why; and the docs' claim that both new refusals are 400 is corrected. (subscribe_target_forbiddenwas 403, and is since removed — see round 2 above.)Reported and deliberately not changed:
proposed's unbounded values (parity withevent-submissions, noted above);URL_EXEMPT_KEYSbeing wider than the crash-report case strictly needs (pinned as a constraint on Phase 2's templates in a comment, since nothing renders those pairs today).Detail
Why
submissionDatais not in the write-guard'surlScanFields. A path there is walked bystringLeaves, which flattens the whole[{field, value}]array — and that array now carries the crash-report context (error,hostUrl,path) thatuser-messagesexempted on purpose, because a bug report names the page it happened on. Listing it would refuse every issue report the Atlas widget sends. The pairs are scanned byprepareUserSubmissioninstead, which can tell one key from another, and raises the sameurls_not_allowedfailure.Why the allowed-key check is a hook and not a
jsonSchema.submissionDatais the plugin's array field, not a JSON column, so Ajv never sees it. It also has to be per-type: a contact row's legitimate keys are whatever its form's author named, read from the liveformsdocument.Why the refusal is an
APIError. AValidationError's top-level message is composed from field paths ("The following field is invalid: submissionData") and the per-error text is buried, so the offending key — the thing the acceptance criterion asks for — never reaches the body an integrator reads.FormskeepsValidationError, because there the admin UI surfaces the per-field message.Why
clientis notrequiredon a subscribe form. The rule is per-action, andrequired: trueis a column-levelNOT NULLthat would demand one of every contact form too, on a table that already has rows. It lives invalidateFormAction.Every rule added here was re-run with itself disabled, and each went red: the access matrix (3 cases), the form-action rules (2 + the
??merge), the submission-data matrix (2).Closes #723
🤖 Generated with Claude Code
https://claude.ai/code/session_01XpWhgSLpDEgsryNu4btTJt