Repository navigation
Description
Reconciled with sydevs/SahajCloud#695 on 2026-09-06, settled against shipped source on
2026-09-16. That issue deletesevent-submissionsand folds event proposals into one
user-submissionscollection astype: 'proposal'. Two consequences for this ticket: the preview
route now targets a different collection slug, and the submit-payload half moved to #195
(see §2). Phase 3 merged assydevs/SahajCloud#801, so the three points #695 left open are now
answered below from that source.
Why
SahajCloud reshapes event proposals so a manager reviews one as a proposal to judge rather than a
form to edit: one Events-shaped patch, a diff of what would change, and a live preview of the
resulting event.
Since sydevs/SahajCloud#695, a proposal is no longer its own collection. It is a row on
user-submissions with type: 'proposal', carrying event (nullable for a new-event proposal) and
proposed (a nested Events diff). The cutover is hard — event-submissions stops existing, and this
repo releases together with #695's Phase 3.
What is left on this repo is the preview route. The submit payload is #195's work now.
1. Preview route — render from postMessage, not a fetch
The admin's live-preview iframe will load:
{ATLAS_URL}/preview?collection=user-submissions&id=<id>&locale=<code>&live-preview=<Ed25519 token>
Composed in SahajCloud's src/plugins/formBuilder/index.ts, and only for data.type === 'proposal'
— the other intake types resolve to the explanation page instead. The credential is the #208 token,
verified against a committed public key; SAHAJCLOUD_PREVIEW_SECRET is retired.
Unlike collection=events, this route must not fetch the document by id. Two reasons, and #695
hardened the second one:
- A new-event proposal has no Event id to fetch.
user-submissionsjoinsRESTRICTED_COLLECTIONS, and #695 grants API clients create only, full
stop — no update or read of any kind. A fetch is not a 403 risk, it is a certain 403. The preview
secret cannot help: it unlocks drafts for collections a client can already read, and a client can
read none of these.
Instead the event data arrives via Payload's own live-preview channel. The admin posts the full
document form state into the iframe
(@payloadcms/ui/dist/elements/LivePreview/Window/index.js:52):
const values = reduceFieldsToValues(formState, true)
const message = { type: 'payload-live-preview', collectionSlug, data: values }
iframeRef.current.contentWindow?.postMessage(message, url)The row carries a virtual previewEvent field holding the merged Event object (target event +
proposed, or newEventDefaults + proposed for a new event), so data.previewEvent is a
ready-to-render event. Subscribe with @payloadcms/live-preview's subscribe() (or useLivePreview
from @payloadcms/live-preview-react) and render from that.
previewEvent is confirmed on SahajCloud main (src/collections/UserSubmissions/fields.ts:443):
a virtual JSON field, admin.hidden so the value reaches form state without rendering on the page,
computed by computePreviewEvent (hooks/computeReviewFields.ts:93) for type: 'proposal' only.
No client-side merge is needed.
Notes:
- Show a skeleton until the first message arrives — there is no initial fetch to render from.
- Relationship hydration by id still works and is still needed:
previewEvent.regionand
previewEvent.imagescome through as ids, and both Regions and Images are readable by
sahaj-atlas-client. No access change required. - ⚠
src/config/live-preview/protocol.tsstill pins the old slug —
export type LivePreviewCollection = 'event-submissions', andreadLivePreviewParamsnulls
anything that is not that literal, so the/previewarm matches nothing the CMS sends. Nothing
breaks today, because the atlas has never rendered a proposal preview. Fixing it belongs here. - The existing
collection=eventsandcollection=regionspreview paths are unaffected.
2. Submit payload — owned by #195 now
Moved. #195 item 3 migrates the proposal call site to
POST /api/user-submissions with:
{ "type": "proposal", "event": 651, "proposed": { /* Events diff */ },
"senderEmail": "…", "submissionData": [ /* submitter name, note */ ] }submitterInfo does not survive — #695 deletes it with the collection, and the submitter's address
becomes the real senderEmail column while name and note become submissionData pairs.
regionHint does survive, as its own user-submissions column (see Open questions 2).
Turnstile stays in the x-turnstile-token header.
One detail #195 does not spell out, kept here as the contract reference: proposed is keyed by
real Events field names, and schedule is the real scheduleFields group — firstDate (UTC ISO)
plus firstDate_tz (IANA), then recurrenceType / interval / weekdays / endingType /
untilDate / endTime as applicable. The old { scheduleType: 'one-off' | 'weekly', startDate, startTime, endTime, weekdays, timezone } vocabulary is retired, and the CMS-side
mapSubmissionSchedule() translator is deleted, so whatever is sent is what gets stored. An unknown
key in proposed is refused with a 400 naming the key, validated at the collection against the live
Events config. Fold this paragraph into #195 when that ticket is implemented.
3. The message carries PII — read previewEvent and nothing else
Payload posts the whole document form state, not a curated payload. Under #695 that state carries
more than it used to: senderEmail (the submitter's real address, now a first-class column), the
submissionData pairs (name, note), the user relationship, uuid, screeningResult and
activityLog. SahajCloud has accepted that rather than drop live preview: it is a targeted
postMessage to our own origin, inside a logged-in manager's browser, and the alternative removes the
feature. The containment is therefore this route's job:
- Render only
data.previewEvent. Treat every other key on the message as absent. Nothing else in
the payload has a legitimate use here. - Never log the message — no
console.log(data), no error reporter breadcrumb, no analytics event
carrying it. A whole-payload log puts a submitter's email into Sentry. - Never persist it — no
localStorage/sessionStorage/ cache / service-worker write, and never
round-trip it to a server. - Check the origin before trusting a message, per
@payloadcms/live-preview's own
subscribe({ serverURL })handling. - If a skeleton or error state needs to say something about the source, say "submission" — don't
surface the submitter's name.
Worth a comment in the handler saying why, so a later refactor doesn't widen it back out to "just
render the whole message".
Scope
-
/previewhandlescollection=user-submissions, rendering from thepayload-live-preview
postMessage with a skeleton until the first message -
LivePreviewCollectioninsrc/config/live-preview/protocol.tsnamesuser-submissions - Confirm relationship hydration still resolves
region/imagesfrom the pushed ids - The handler reads only
previewEvent, verifies the message origin, and neither logs nor
persists the payload (see §3) - Confirm nothing still references
event-submissionsor the retired preview slug
Removed from scope, now #195's: the submit body, the scheduleFields emission, the field-name audit,
and the legacy-shape sweep.
Open questions — settled 2026-09-16 against SahajCloud main
- Does
previewEventsurvive? Yes.src/collections/UserSubmissions/fields.ts:443— a virtual
JSON field onuser-submissions,admin.hidden, computed bycomputePreviewEventfor
type: 'proposal'only. This route renders it; it does not mergeevent+proposeditself. - Where does
regionHintgo? It stays, as its own column.fields.ts:656keeps it a
system-access JSON field ({ country, state, anchorRegion }) conditioned on
type === 'proposal'— not asubmissionDatapair. It is load-bearing on the CMS side:
lifecycle/review.ts:159resolves a region from it, andjobs/DeliverSubmissions/deliverProposal.ts
routes a proposal to the nearest manager up that region. Removing it would cost a screening input,
so it is one moving part worth keeping. - Is #641 superseded? No. It merged, and #695 carries its elements into the unified
user-submissionsrather than dropping them.
Ship order
sydevs/SahajCloud#695 Phase 3 merged as sydevs/SahajCloud#801, which deleted event-submissions
and created the user-submissions slug this route reads, so the gate is lifted. #195 carries the
submit half. ⚠ Phase 3 shipped without its consumers: POST /api/user-messages and
POST /api/events/{id}/register are gone (404 in production) while this repo's main still calls
both in src/config/api/mutate.ts — #195's work, and more urgent than this ticket.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Sep 6, 2026
@sydevs-bot Update this ticket's description to reconcile these changes with the currently in-progress consolidation of EventSubmissions into FormSubmissions/UserSubmissions.
[-]Event submission preview + Events-shaped submit payload[/-][+]Event submission preview — render a user-submission proposal from postMessage[/+]sydevs-bot commentedon Sep 7, 2026
Reconciled against #695 and #195. Body rewritten, and §2 moves out.
{type:'proposal', event?, proposed, senderEmail, submissionData}. I kept only what feat(api): migrate widget intakes to unified form-submissions #195 omits:proposed'sscheduleFieldsvocabulary and the unknown-key 400.event-submissionsis deleted. A proposal is auser-submissionsrow,type: 'proposal'. The preview URL becomescollection=user-submissions.senderEmailis a real column now, besidesubmissionData,user,uuid,screeningResultandactivityLog.Three things #695 leaves open. I flagged them rather than assume:
previewEventis absent from #695's column table. Does the merged-event virtual field survive?regionHinthas no stated home. #695 only says it dies with the collection.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Sep 7, 2026
@sydevs-bot Here are answers to the open questions. Revise the issue description accordingly.
previewEventwill not survive. Merge on the client sideregionHintnecessary inSahajCloud? Review both sides of the equation. If it is, it belongs in submissionData. That's definitely wheresubmitterInfobelongs. I'd prefer to get rid ofregionHintjust to have one less moving part, but only if that doesn't create more complications or problems.SahajCloud#641has already been merged.SahajCloud#695does delete the collection, but it incorporates many of the elements of that collection into the new unified UserSubmissions14 remaining items
sydevs-bot commentedon Sep 16, 2026
Two of your three answers were overtaken by what Phase 3 shipped (
SahajCloud#801, merged after you wrote them). Checked against SahajCloudmain:previewEventsurvives.UserSubmissions/fields.ts:443— virtual JSON,admin.hidden, computed bycomputePreviewEventfortype: 'proposal'only, so it reaches form state and the iframe. No client-side merge needed.regionHintstays as its own column, not asubmissionDatapair (fields.ts:656).lifecycle/review.ts:159resolves the region from it, anddeliverProposal.tsroutes a proposal to the nearest manager up that region. Dropping it costs a screening input.submitterInfois gone, as you said.Body updated: the three questions are answered inline, the stale
&secret=URL is now the #208 token, and theLivePreviewCollectionslug mismatch is a scope line.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Sep 17, 2026
@sydevs-bot Answer: Why is this issue labeled as
awaitingif it has already been approved and the PR is already created? We should move to tracking work through the PR at this point, so this ticket should no longer be awaitingsydevs-bot commentedon Sep 17, 2026
You are right, and the label came back by itself. #212 already carries
awaiting— non-draft, reviewer requested — so the turn is on the PR.Two paths write
awaitingon an issue, and they disagree:session-endremoves it and sets Statusdonewhen an open PR closes the ticket (dispatcher/decide.mjs:374).sweep-awaitingre-adds it to any open, unlocked issue the bot spoke last on (decide.mjs:396). It never readsopenPrsClosingIt, whichgather.mjs:117puts on every issue snapshot.My 23:33Z comment made the bot the last speaker, so the next sweep pass re-labelled this ticket. Locking it for this run cleared it again, and the sweep will repeat that until the guard lands.
Filed as sydevs/claude-workflow#106 — one line in
sweep-awaiting. An answer run may not push, so it needs a verb there.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code