Repository navigation
feat(api)!: unified intake, phase 3 — cutover, and delete the three old collections - #801
Conversation
Phase 3 deletes `event-submissions`, and the Accept/Reject buttons, the diff UI and the merge-into-Events lifecycle had never moved with it — so deleting the collection would have deleted proposal review along with it. The lifecycle, the two virtual projections, `validateProposal` and the `/review` endpoint all move to `src/collections/UserSubmissions/`. The endpoint registers in the `formsPlugin` wrapper, because the collection is plugin-generated and that wrapper is the one merge this repo owns; it stays out of `CUSTOM_ENDPOINT_PATHS`, which is what would publish a manager-only action in the OpenAPI spec. Three things the port had to decide rather than copy: - `user-submissions` carries one five-state vocabulary, so the six-state one collapses: accept → `accepted`, reject → `rejected`, reopen → `pending`. Created-vs-updated is an `activityLog` entry and a `outcome` field on the response, not a sixth status. `reviewedBy`/`reviewedAt` are dropped for the same log — two fewer columns for the same record. - The open set is `pending` **and** `failed`. `failed` means the decision path was fine and the review email did not send, so a manager who reaches the row anyway must still be able to act; porting the old set verbatim would have refused them. - Every entry point gates on `type === 'proposal'`. One table holds four intakes now, so without it a registration row would reach `newEventDefaults` with no `proposed` and mint an empty listing. Refs #796 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
`POST /api/user-submissions` with `type: registration` was accepted
unconditionally: the eligibility gates, the capacity count and the
confirm/deny vote hooks all still hung off the `registrations` collection.
They move here, so the unified create enforces what
`POST /api/events/{id}/register` does and the Atlas widget keeps its
machine-readable refusals at `errors[].data.code`.
`gateRegistration` is a **`beforeValidate`**, not a `beforeChange`. Payload
runs every `beforeValidate` ahead of every `beforeChange`, and
`prepareUserSubmission` is one — so a `beforeChange` gate could not run
ahead of it. It gates **client-originated creates only**: a manager
recording a registration on a full event by hand is a deliberate act, and
`req.context.skipRegistrationGate` is the server-side escape a historical
import needs (#799).
One `countActiveRegistrations` helper replaces the `where` re-derived at
four sites, so a `spam`, `rejected` or `failed` row frees its seat
everywhere at once.
Two decisions the ticket left open:
- **It sums the old collection too.** `POST /api/events/{id}/register`
still writes `registrations` rows until #800, and the widget still posts
there until sydevs/SahajAtlasWeb#195. Counting only the new table would
make `registrationsFull` read 0 for every event registered through the
live path — a limit silently ceasing to be enforced. The legacy count,
and the two thin bridge hooks that keep the flag in step with it, are
marked for deletion with the collection.
- **`Events.registrations` gains `where: { type: { equals: 'registration' } }`.**
One table holds four intakes and three can name an event, so without it
the tab would list the event's proposals and spawned subscribe rows. The
bare type, not `activeRegistrationWhere` — a manager needs to see the row
they flagged `spam`.
Refs #797
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
Generated, not hand-written. Three nullable columns plus their FKs and indexes — `manager_id`, `region_id`, `region_hint` — which is exactly what the ported review path reads (#796). The re-pointed `Events.registrations` join produces no DDL: a join field is virtual. Refs #796 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
The three `describe` blocks that exercised the review path — the two virtual projections, reopen, and `applyReview` — move with the code they cover, plus the one `proposed patch validation` case that also called `applyReview`. What stays in the event-submissions spec is the old intake: the write guard, screening, proposal validation, titles and access. Three assertions changed meaning rather than target, because the semantics did: - An accept asserts `status: 'accepted'` **and** `outcome`, since one status now serves four intakes and created-vs-updated lives in `outcome`. - "Attributed to the reviewer" is the last `activityLog` entry of `type: 'review'` carrying `managerId` — `reviewedBy`/`reviewedAt` are gone. - Reopen no longer "clears the review stamp": an append-only log has nothing to clear, so the case asserts the row is genuinely open again and that the reopening is recorded as its own entry. The idempotence case then asserts the log still holds exactly one review entry, so "already decided" is provably a no-op rather than vacuously green. Adds the case the port itself did not owe: a `failed` row is still actionable. That status has no `event-submissions` equivalent, so nothing would have caught the open set being ported verbatim. Refs #796 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
Both hooks now run on all four intakes, and the vote check is not enough to stand alone: on a **create** `previousDoc` is undefined, so `null === undefined` is false and a row that never carried a vote passes it. On the old single-purpose collection that only ever meant a registration. Here it would fire on every proposal and every spawned subscribe row naming an event, paying for two counts and an Events write per create. Refs #797 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
…missions Everything that reads a registration *after* it is created still read the `registrations` collection: the feedback and unsubscribe pages, the session reminder sweep, the post-event follow-up sweep, and the manager digest. All six call-site groups now read `user-submissions where type = registration`. **Both signed-token kinds are bumped, not just their claim renamed.** Each carried a bare `registrations` row id, and the same integer addresses an unrelated row in the new table. `verifyFeedbackToken` casts without checking the claim, so a rename alone would have sent `undefined` into `findByID` rather than refusing; a new kind refuses at the signature. The unsubscribe token has no expiry at all, so nothing about the old shape ages out on its own. **⚠ `dueWhere` in the follow-up sweep gains `activeRegistrationWhere`, and that is correctness, not tuning.** Nothing else in that `where` is a type filter — `startingAt` is registration-shaped by an admin `condition`, never by the column — so pointed at the unified table unchanged it would have swept contact, subscribe and proposal rows and mailed their senders a feedback ask. Name, address, language and answers come off the row's own columns and `submissionData` pairs, as `deliverRegistration` already does. The `users` join was the derived copy: `prepareUserSubmission` seeds that row *from* these. `loadUsers.ts` goes with its last caller. The missing-address guard stays — `senderEmail` is deliberately optional, so an anonymous submission is skipped and warned, never mailed. Refs #798 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
Every fixture that stood in for a registration was a `registrations` row with a `users` join, a `locale` column and a `questions` blob. It is now a `user-submissions` row whose address is `senderEmail` and whose name, language and answers are `submissionData` pairs — the shape the jobs now read, and the one `prepareUserSubmission` seeds the `users` row *from*. Three cases the criteria asked for and nothing covered: - **The follow-up sweep skips a non-registration row with a past `startingAt`.** The fixture is a `subscribe` row carrying an `event` and no form — the one shape `needsForm` exempts — with a registration on the same event as the control proving the sweep ran at all. Verified by removing `activeRegistrationWhere` from `dueWhere` and watching it go red: `scanned: 2, sent: 2`, the subscriber's address in the recipients. Restored: `scanned: 2, sent: 1`. - **The reminder sweep skips a `spam`-flagged row**, again against an active sibling on the same event. - **The unsubscribe page action**, which had no spec at all: it stamps `unsubscribedAt` on the row, and the sweep then skips it. It lives in the reminders suite because that suite owns the sweep the assertion depends on, and `createTestEnvironment()` may be called only once per file. Refs #798 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
…ive votes
**A published client key could read any Event out of a create response.**
`previewEvent` and `proposedChanges` are `virtual` fields with an `afterRead`
hook, and Payload runs field `afterRead` hooks on the response of a
**create** with no `findMany` argument — so their own list-read guard never
fired there, and `admin.hidden` is not `hidden`, so nothing stripped the
value either. `loadTargetEvent` reads the named event with
`overrideAccess: true, draft: true, trash: true`, and `mergeProposal`
returns the whole document. `eventField` has no `filterOptions` and
Payload's relationship validator checks the id's shape only, so a POST of
`{ type: 'proposal', event: <any id> }` read that event straight back —
past the published-only access filter, which applies on `read` alone, past
the trash filter, past project visibility, and past the client `select`
requirement.
The mechanism is not new; `event-submissions` carried identical fields. The
blast radius is: they now sit on the collection `wemeditate-web-client` also
holds `create` on, and the hooks fire for all four types. `read` is denied
to clients rather than the hooks being gated on `type`, because one rule
then closes every intake at once.
Second fix, same file family: `countVotes` filtered on the bare `type`
predicate while every other consumer of that row set uses
`activeRegistrationWhere`. A registration flagged `spam` after its follow-up
token was minted freed its seat but kept its vote — and five denials past
the Wilson bound unpublish the listing.
Three existing create cases moved to a published event: since #797 a client
registration naming an event it cannot read is refused 404, and those
fixtures had always used Payload's default draft. The subject-echo case
moves to a `proposal` for the same reason — a registration no longer reaches
`titleOf` at all, and a case that cannot reach the code it names is not
covering it.
Refs #796, #797
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
- `docs/rules/access.md` — the locale-bearing admin fetch is now `SubmissionReview/urls.ts` → `/api/user-submissions/:id/review`. - `docs/rules/admin-ui.md` — the live-preview-by-postMessage example is `UserSubmissions.previewEvent`, and clients hold create-only on `user-submissions`. - `docs/architecture.md` — the registration gate runs on the unified intake too, and `registrationsFull` counts both tables until the register endpoint goes. - `src/collections/AGENTS.md` — the `formsPlugin` wrapper now also registers the review surface, and every collection-wide admin slot there serves four intakes, so each owes a `type` branch. - `tests/COVERAGE.md` — the three new suites. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbAa7XEfgnkNdNgWSnej9n
|
🚅 Deployed to the SahajCloud-pr-801 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 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
#796 → #797 → #798 are sequentially dependent and the intermediate state is coherent, so three tickets in one PR holds. Each open question is answered with the option its ticket recommended. The PR's own rule — one table, four intakes, so every moved hook branches on type — reaches four hooks; both should-fix findings are where it does not.
Findings
- should-fix — both review projections run on all four intakes ·
UserSubmissions/fields.ts:432 - should-fix — a live-preview panel opens on every contact, subscribe and registration row ·
formBuilder/index.ts:177 - consider —
skipRegistrationGateis unreachable ·hooks/gateRegistration.ts:39 - consider —
Event['registrations'].docsretypes toUserSubmission[]·Events/Events.ts:520
What was checked
All three tickets, then the diff file by file bar the migration snapshot. Clean: down drops what up adds, and registerForEvent writes only registrations, so seats cannot double-count. Neither consumer reads Event['registrations'].
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`computePreviewEvent` and `computeProposedChanges` guarded only on `findMany`, so every single-document read of a contact, subscribe or registration row paid for both: an `events` findByID whenever the row named one, plus a diff over the whole Events `flattenedFields` against an empty proposal. `SendPostEventFollowUps` reads each due row singly and the feedback page reads twice per vote, so this was on a hot path rather than an admin one. `admin.condition` hides the fields; it does not stop the hooks. Every other hook moved onto the unified table already opens with a `type` guard — these two were the exception. The new case fails against the unguarded hooks with `expected [] to be null`: the diff had run and returned nothing. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013wu7znVUBgKHudEYxkdVit
…ing it `livePreviewUrl` never returns a falsy URL — Payload would persist that as the editor's "live preview off" preference for the whole collection — so `path: null` lands on the explanation page rather than closing the panel. The comment here claimed the other three intakes got no panel at all, and `openByDefault: true` then opened one on arrival showing `no-path`, whose copy tells the reader to go and fill in a slug. A `not-reviewable` reason says what is actually true. `openByDefault` goes rather than gains a branch: the option is collection-wide and takes no function, so the only way to keep it for the reviewer is to greet every contact, subscribe and registration row with that page. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013wu7znVUBgKHudEYxkdVit
`skipRegistrationGate` sat one line below the check that already returns for every caller that is not an API client, and a Local API import — the case its docblock named — never carries `req.user.collection === 'clients'`. The only caller was the spec, which built a synthetic req impersonating a client to reach it. #799 is unwritten, so this was a knob for a caller that does not exist. The spec case now creates the row the way an importer will, so it covers the exemption that is really there. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013wu7znVUBgKHudEYxkdVit
The slot warning covered the components and the preview URL. Two things it did not: a field hook behind a conditional field still runs on all four types, and an admin option taking a value rather than a function cannot branch at all. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013wu7znVUBgKHudEYxkdVit
|
Adopted all four adversarial findings — three in code, one in the body.
Five new integration cases, each watched failing against the defect first. Lean gate green, and both touched integration specs green. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
@sydevs-bot Why is this ticket still a draft? |
|
Still a draft because CI has not finished. The dispatcher owns the draft flag, and it reaches that step only after CI is green. The order it works through, on head
A session never touches the draft flag itself. Flip it by hand if you want it ready sooner — the dispatcher carries on from there. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`openByDefault` was dropped in 61c5a78 because it is collection-wide and takes a value rather than a function: on a table holding four intakes it would greet a contact, subscribe or registration row with the `not-reviewable` page. That left the reviewer opening the panel by hand on the one row where the preview is real. A field branches where the option cannot. `previewTargetField` already carries `autoOpen`, and a false `admin.condition` returns in `addFieldStatePromise` before Payload attaches the custom component to form state, so `PreviewTarget` never mounts for the other three types. The target declares `autoOpen` alone. With neither `path` nor `params`, `composeTargetUrl` returns null and the panel keeps the URL `livePreview.url` already resolved per type — the two cannot disagree about where a proposal previews. No column and no import-map entry: a `ui` field stores nothing, and `PreviewTarget` was already registered by Meditations. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q5qrN8WKRSc65QPbqhgZKa
|
Three threads answered on Adopted — Rebutted, left open for you — Nothing asked. Say the word on either placement and I will move it. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
"kept only because #809 was comment-only" reads only to someone who saw that diff, which `docs/rules/code-comments.md` bans. "Unwired since #801" and "#811 decides whether this goes" carry the substance to a fresh reader. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011JrquZ3M6mxws5KZXJkBbq
) * fix(docs): resolve the conflict block in the access rule `docs/rules/access.md` carried a raw, unresolved conflict block from #787. Markdown is the one place a marker is silent: the same lines in a `.ts` file are a syntax error both `pnpm lint` and `pnpm typecheck` reject, and in `.json`, `.mts` or `.yml` they break a parser. Here they rendered as ordinary text, and no lint covers `docs/`, so the block survived four merges. #801 and #803 each edited prose inside it without seeing it. The file is a `docs/rules/` rule, so it loads into every agent session that reads `src/plugins/access/` — both halves at once, contradicting each other. Neither half was wholly current, so the resolution is a mix. The client-grant paragraph takes the `origin/main` text: both `wemeditate-web` and `sahaj-atlas` may create `user-submissions`, create only. `config/roles.ts:95,122` grants exactly that and nothing else. The `HEAD` text named `wemeditate-web` alone and cited form submissions, a collection #801 deleted. The warning paragraph takes the `HEAD` text, which differs from its twin only in the final clause. "with no live-preview credential at all" is correct; "with no preview secret" names the shared secret #788 deleted. A legitimate draft read now carries a minted Ed25519 token, and `previewSecret.ts` says so in the file: the header name outlived the value it used to carry. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * test(docs): fail when a conflict marker lands anywhere tracked Nothing in the repo grepped for conflict markers, which is why the block in `docs/rules/access.md` survived four merges. A unit spec closes that, and runs in both places that matter: `pnpm test:unit` is the lean gate's fast lane, and `pnpm test` runs it in CI. It is a unit spec rather than a line in `.claude/skills/pr-prep/check.sh` deliberately. `.claude/` is a Claude Code Protected Path, so an unattended run cannot write there — the write is prompted rather than refused, and the session stalls until its lease expires. The scan shells to `git grep`, for scope and for cost. Tracked files are what can land on `main`, and git scans them in ~40ms where reading 76MB of tracked bytes into JS would cost more than the rest of the lane. Two traps are handled in the spec. The patterns are built by concatenation, so the file cannot match itself. And a second test greps a scratch block through the same pattern and the same command, because a pattern typo, a `git grep` that cannot see the tree, and an exit code read the wrong way all produce the same green as a clean tree does. Proven by reintroducing a marker in a tracked file and watching the lane go red. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * refactor(tests): simplify the conflict-marker guard per /simplify pass The three marker tokens are now named constants the pattern and the fixture both build from, so the second test visibly shares the definition it is there to prove. `grep` closed over the one pattern it was ever called with, its two-valued argv fragment became a `noIndex` flag, and the `maxBuffer` knob went — nothing it guarded was reachable. The temp directory the non-vacuity test writes is now removed in `onTestFinished`. Every lane run had been leaving one behind. Cut the docstring roughly in half. One claim in it was also false: reading the tracked tree into JS measures ~130ms against a 27s lane, not "more than the rest of the unit lane". A checkable number that is wrong by two orders of magnitude costs more than it buys, so the comparison is gone rather than restated. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * fix(tests): close two ways the conflict guard could go quiet Both found by an adversarial review pass and reproduced before fixing. `-I` skipped whatever git calls binary, and that includes a plain text file marked `-diff` in `.gitattributes`. A scratch repo with `*.lock -diff` and a real conflict block in `deps.lock` exited 1 with no output, so the guard went green with the block committed. Without `-I` the same tree reports `Binary file deps.lock matches`, which is a non-empty row and fails the assertion. A guard should name a media file loudly rather than miss a real block quietly, and the tree has no binary match today. The fixture also proved only the pattern, not the scan. `--no-index` bypasses index enumeration, the pathspec and `.gitattributes` — every structural way the tracked scan can come back empty — so a sparse checkout, or the `-diff` case above, left both tests green. It is now a real repository with the file really tracked, which exercises the same path the tree test takes and lets the `noIndex` branch go. `grep.column` is pinned off. A contributor who sets it globally got `sample.md:1:1:…` and failed the exact-array assertion on a clean tree. A spawn that never ran reported "exited null". It now says git may not be on PATH. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * fix(tests): cut the guard docstring narration The header retold #787 in six lines that the ticket, the PR body and the commit already carry. What a reader cannot re-derive is the concatenation rule and the tracked-files scope, so those stay and the story goes. The #787/#810 breadcrumb stays too — docs/rules/code-comments.md keeps those whatever else is cut. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Summary
registrations,user-messagesandevent-submissionsare gone, with their jobs, their tables andPOST /api/events/{id}/register; every caller readsuser-submissions.type: registrationrows, so a seeded database has the shape a live one now has.This is all five children of #725 in one PR, in dependency order: #796 → #797 → #798 → #799 → #800, one commit per behaviour.
Changes
src/collections/UserSubmissions/{lifecycle,endpoints,hooks}/— the review path, the registration gate, and the vote hooks, moved and re-pointed.src/lib/registrations/fullness.ts— onecountActiveRegistrations, now a single count overuser-submissions.src/jobs/RegistrationNotifications/— all three jobs read the row's own columns andsubmissionDatapairs.seeds/atlas/import.ts—importRegistrationscreatesuser-submissionsrows keyed on the dump'suuid.src/migrations/20260916_144804_drop_legacy_intake_collections.ts— the three tables, five enums and threepayload_locked_documents_relscolumns.DEPLOYMENT.md,permissions.ts,payload.config.ts,formBuilder/index.ts,deliverProposal.ts,SubmissionActions.tsx— the deleted collections' names, off live code and docs (01c22e1).src/collections/UserSubmissions/fields.ts—proposalPreviewTargetFieldopens the Live Preview panel on aproposalrow and on no other intake (415e004).Preview
type: registrationEmail previews
None generated. The
src/emails/changes are a type import and a rename.UserMessageEmailnow declares theUserMessageContextit renders, instead of importing it from a deleted collection's generated type.EventSubmissionReviewEmailis nowSubmissionReviewEmail: it serves the proposal review job, not a collection that no longer exists. No template output changes.Contract impact
Breaking, and it ships with sydevs/WeMeditateWeb#78 and sydevs/SahajAtlasWeb#195 —
pnpm types:cmsreadsmain, so both consumers sync after this merges.Registration,UserMessageandEventSubmissionleavesrc/payload-types.ts, andPOST /api/events/{id}/registerreturns 404.src/collections/Events/endpoints/responseTypes.tsstays at its path — SahajAtlasWeb'stypes:cmscurls that exact raw URL withcurl -fsSL, so a move takes the whole chain down. It keepsEventRegistrationErrorCode, which the create gate still emits;EventRegistrationResponseis gone with the endpoint that returned it.EventRegistrationErrornow describes Payload's envelope, where the code sits aterrors[].data.code— sydevs/SahajAtlasWeb#171 reads both positions.Event['registrations'].docsretypes fromRegistration[]toUserSubmission[], so thetypes:cmssync is a breaking type change rather than an additive one. Neither consumer reads that field, so nothing downstream has to move.Migration
src/migrations/20260916_144804_drop_legacy_intake_collections.tsregistrations,user_messages,event_submissions, their five enums, and the threepayload_locked_documents_relscolumns with their FKs and indexes. It also deletespayload_jobs/payload_jobs_logrows naming the three removed task slugs.downrecreates every object. The deleted job rows and the three tables' contents are not restored, which is the intended hard cutover: there are no live deployments and no production data in them.Test results
pnpm lint && pnpm typecheck && pnpm typecheck:tests && pnpm test:unit— 2119 unit tests pass, re-run on415e00401c22e1, 1311 tests across 80 files — this phase deletes collections, so a stale reference anywhere surfaces there. On415e004, the threeuser-submissionsint specs (create, access, review lifecycle), 58 testsgenerate:typesandgenerate:importmapboth produce no diff on415e004— auifield adds no column, andPreviewTargetwas already registered by Meditationspayload_jobsrow seeded for each removed slug. It succeeds, the unrelatedscreenSubmissionrow survives, and none of the dropped objects remainManual verification
errors[].data.code.user-submissionsrow → event tallies updated → redirect with the post-vote param.curl -X POST $URL/api/events/1/registerreturns 404, and/api/docsshows no path for any of the three deleted collections.pnpm seed atlas, then filter/admin/collections/user-submissionsbytype: registration: rows carry an event, astartingAt, a linked user and the question pairs. Re-run it and the count is unchanged. Mailpit shows no new mail./admin/collections/users: one Submissions join, no join error on boot.proposalrow: the Live Preview panel is already open. Open a contact, subscribe or registration row: it is not, and nothing shows thenot-reviewablepage unless you open the panel yourself.Notes for reviewer
The Live Preview panel now opens itself on a proposal (
415e004, review thread).admin.openByDefaultis collection-wide and takes a value rather than a function, so on a table holding four intakes it would greet the other three with thenot-reviewablepage — which is why it was absent. A field branches where the option cannot:proposalPreviewTargetFieldis apreviewTargetField({ autoOpen: true })carryingadmin.conditionontype === 'proposal', and a false condition returns inaddFieldStatePromisebefore Payload attaches the custom component to form state, soPreviewTargetnever mounts elsewhere. It declaresautoOpenalone, socomposeTargetUrlreturns null and the panel keeps the URLlivePreview.urlalready resolved per type.Two placement questions, answered rather than moved.
src/lib/registrations/fullness.tshas two owners — Events'syncFullnessand UserSubmissions'syncFullnessplusgateRegistration— sosrc/AGENTS.mdrule 4 keeps it insrc/lib, and colocating it would force the cross-owner internal import that rule prohibits.feedbackLinks.tsis not imported by UserSubmissions at all: its consumers areSendPostEventFollowUpsand the two/registrations/feedbackroute files. ThebuildWebPathpattern is colocated because the collection itself consumes it (Events.tsreadsbuildEventWebPathfor bothpublicUrlFieldsandlivePreview.url), which is the part that does not hold here. Both threads are left open for you to settle.What still carries a deleted collection's name, after
01c22e1. Two things, both deliberate.src/migrations/20260812_032435_add_event_submissionsand itsindex.tsentry: an applied migration is immutable, and renaming one breaks every database that recorded it. And past-tense comments that say why the surviving code is shaped as it is —statuses.tson the open setevent-submissionshad no equivalent for,localizedRoles.tson the?locale=allover-grant,writeGuard/policies.tson howproposedwas scanned. Those are the reason a reader does not re-derive a decision. Everything else that named one of the three is gone.Two leftovers this PR does not take, both behaviour rather than naming. Say if you want either in here.
deliverProposalstill routes a brand-new-event proposal to the system contact. That was forced — Phase 1'suser-submissionshad no region column. It is not any more: the row carriesregionandregionHint, and screening resolves the first from the second, sofindManagerForRegionis reachable. The docblock records the constraint as closed with a TODO rather than a limit that no longer applies. It changes who receives an email, so it wants its own spec.proposalDetailsrenders proposed keys raw in the review email. The reason it did not uselabelForPathwas a cross-collection import into code this branch deletes;labelForPathis now a normal import away. It changes email copy, so it is the same kind of decision.Four open questions the tickets left, and what I chose. Each is a data decision, not a code one, so say if you want a different answer.
mailingListSubscribedAt. Exactly one source row has one. Recording the consent means a realsubscriberow, which screens and then delivers to a live provider — so the importer warns with the uuid and the date instead, and a person decides.66c7c86reached the same conclusion from the other side and deleted the unreachableskipRegistrationGateknob.Users.submittedEvents. Kept. It answers which proposals became listings —events.submitteris still written when one is accepted — which a join over submissions cannot.One contract loss, stated rather than hidden. The four registration refusal codes were documented on the register endpoint's OpenAPI path. The create that replaces it is the auto-generated
POST /api/user-submissions, which isx-internalbecause the collection is in no project, so the codes are no longer in/api/docs. They stay inresponseTypes.ts, which is the channel the widget actually syncs. Publishing them would mean puttinguser-submissionsin a project, which also opens reads.Five
src/lib/modules lost their second consumer when the old jobs went, solib-boundary.spec.tsnow lists them underKNOWN_SINGLE_CONSUMER:antiSpam/mxRecords,eventTitle/autoTitle,mapbox/geocoder,notifications/sendSubmissionReview,users/upsertUserByEmail. Each is general-purpose rather than one owner's private helper, so where each belongs now is a move worth deciding on its own, not a justification to write into this PR.The security review found nothing, and raised one data question. The migration drops the three tables with no backfill, so on a database that holds live rows this is irreversible on the next boot —
down()restores the tables empty. #725 states the premise it rests on: no live deployments and no production data in these tables. Worth confirming before merge, since it is the one thing this PR cannot undo.Two sessions worked this branch at once. Four commits (
30e578d..8ecbfc1) arrived on the remote while #799 and #800 were being written here, and this branch is rebased onto them. The one overlap is the gate escape above, where both reached the same answer; nothing else was touched twice.Process:
/simplifyand the six-lenspr-review-toolkitpass did not run — the toolkit is not installed in this session, and the branch is deletion-heavy.comment-lintreports one finding onsrc/fields/jsonField.ts:35, which predates this review round and reads as a false positive on field-shape prose. The security review did run, and is the note above.Detail
Two hand edits to the generated migration, both required.
payload_jobscleanup. Postgres cannot drop an enum value, so drizzle setstask_slugtotext, recreates the type without the three removed slugs, and casts back — and that cast fails on any row still holding one. Reproduced on a seeded database before adding the DELETEs.DROP CONSTRAINTfor eachpayload_locked_documents_relsforeign key is removed.DROP TABLE ... CASCADEabove has already taken them, so the statement errors as missing — the first apply failed on exactly that. The columns are still dropped, which is the part CASCADE does not do.The seed importer's natural key moves from
legacyIdtouuid, becauseuser-submissionshas nolegacyIdcolumn and the dump already carries a uuid per row. The preload, the pagination plan and the seed route's count verification move with it. That count is taken underactiveRegistrationWhererather than whole-collection: contact, subscribe and proposal rows share the table, and an unfiltered count would pass on those alone.Seeding at
acceptedis what keeps a seed run silent.enqueueSubmissionScreeningreturns early for a row that is notpending, andDeliverSubmissionsrefuses one, so neither queue is entered.spawnSubscribeFromRegistrationkeys on thesubscribeopt-in pair, which the importer never writes.tests/unit/atlas-registrations-data.spec.tsis new, and pins the 2034-row dump against the contract the collection now enforces: every mapped row insidecheckSubmissionData's key allow-list and length bounds, the name pair present, nosubscribepair, and blanks dropped. Proven to fail: emitting one disallowed key turns three of its four cases red.tests/unit/submission-preview-target.spec.tsis new, and pins the auto-open branch: the target is declared once, it carriesautoOpenwith neitherpathnorparams, and its condition is true forproposaland false for the other three and for a row with no type yet. Proven to fail both ways — dropping the condition turns 5 of its 7 cases red, and adding apathturns the repoint case red.RESTRICTED_COLLECTIONSshrinks tousersanduser-submissions— the other two entries named collections that no longer exist. No surviving collection changes tier:user-submissionsis still restricted, still in no project, and clients still hold create and nothing else on it.tests/unit/openapi-custom-endpoints.spec.tsis edited, not cut. It pins the register path and both its schemas as absent now, so a spec that re-advertised a 404 would fail, and it keeps the "ALLOW_POST_FORis necessary but not sufficient" case onuser-submissions.Closes #796
Closes #797
Closes #798
Closes #799
Closes #800
Closes #725
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_015xYUfQYxhoN3Y8YadtBHcc