Skip to content

feat(events): a Registrations tab for the event's own manager - #1073

Merged
sydevs-bot merged 18 commits into
mainfrom
claude/feat-1069-registrations-tab
Nov 4, 2026
Merged

sydevs-bot merged 18 commits into
mainfrom
claude/feat-1069-registrations-tab

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • An event's own active manager, and an admin, can open /registrations on it: who signed up, with their answers, under Accepted / Pending / Withdrawn.
  • The tab carries a count of accepted registrations, and GET /api/events/:id/registrations/csv serves those rows as a file. Both go through the view's own gate.
  • The registrations join beside it was never readable by a manager, and is now admin-only.
  • Joined on the way: registrationAnswers stops showing userAgent, locale, path and subscribe to managers as questions the visitor answered — live in the notification email and the daily digest, not only here.

Change outline

Flow — three doors, one gate

readableEvent is the authority, and each entry point calls it before it reads a row. Nothing upstream can decide this: Root has already checked canAccessAdmin for the document route, and the question here is narrower than that.

+ readableEvent(req, docID)                              data.ts
+   findByID events, select { manager, schedule.firstDate_tz }, trash: true
+   no row → null
+   isManager(user) && manager === user.id  → the event    # `type: 'manager'`, so never `inactive`
+   isAdminManager(user)                    → the event
+   otherwise                               → null

  EventRegistrations({ initPageResult, searchParams })   EventRegistrations/index.tsx
+   parseRegistrationQuery(searchParams)                 # filter + page, via firstParam/pageParam
+   loadEventRegistrations(req, docID, query)
+     readableEvent → null → redirectRefused(req)        # the unauthorized view
+     find user-submissions                              # only after the gate passes
+       where: type=registration AND event=<id> AND status in statusesIn(filter)
+       select the row's own 6 columns, depth 0, limit 50
+       name    ← readSubmissionValue(submissionData, 'name')   # never a `users` row
+       answers ← registrationAnswers(submissionData)
+     + count() per filter, for the three tab counts
+   → <EventRegistrationsView data>                      # 'use client'

  RegistrationsPill({ req })                             RegistrationsPill.tsx
+   countAcceptedRegistrations(req, req.routeParams.id)  # a Pill is handed no docID
+     readableEvent → null → render nothing              # a refused visitor learns no count

  GET /api/events/:id/registrations/csv                  Events/endpoints/registrationsCsv.ts
+   requireActiveManager(req) → 403                      # not requireActiveClient: admin-panel only
+   acceptedRegistrationsCsv(req, id)
+     readableEvent → null → 403
+   → text/csv, escape_formulas, BOM

Contract — who may read an event's registrants

 events                         read: project-wide (sahaj-atlas)
                                update: region subtree OR manager == user
+  /registrations view          active manager == user, OR admin   # narrower than both
+  the tab's count pill         the same gate
+  the CSV endpoint             the same gate, behind requireActiveManager
-  registrations join           visible to every viewer, renders empty for a manager
+  registrations join           admin only (the field; its subquery still runs)

A region manager holds update on every event in their subtree and is still refused here, which is why the gate cannot read the collection's own access config. An inactive manager the event still names is refused too: isManager tests type === 'manager', and the admin shell admits them.

Behaviour — the three filters, and what counts as an answer

+ FILTER_OF: Record<UserSubmission['status'], RegistrationFilter>
+   accepted → accepted      # confirmed
+   pending  → pending       # screening or the confirmation email is still to run
+   rejected ┐
+   spam     ├ → withdrawn   # the row's own Status says which, with a one-line detail
+   failed   ┘               # "failed" is a confirmation that never sent, not a decline

Keyed by status, so a status added to the collection is a build error here, and none can appear under two filters.

buildRegistrationAnswers labels an unrecognised key by the key itself, so every reserved key reaching it became a question the visitor supposedly answered.

 registrationAnswers(submissionData)        src/collections/UserSubmissions/submissionData.ts
-  every pair → buildRegistrationAnswers
-    name: "Jane", locale: "fr", path: "/x", userAgent: "Mozilla/5.0 …", subscribe: "Yes"
-    referral: "A friend"
+  pairs less NON_ANSWER_KEYS → buildRegistrationAnswers
+    NON_ANSWER_KEYS = BASE_SUBMISSION_KEYS + TYPE_SUBMISSION_KEYS.registration
+                      less REGISTRATION_QUESTION_NAMES      # derived, never listed
+    referral: "A friend"                   # plus any legacy key the Atlas dump carried

Files

 src/components/admin/helpers/
+├── searchParams.ts     # firstParam / pageParam — was copied in 3 views
+├── useSetQuery.ts      # lifted out of AtlasManagerView
 └── requireAdminAccess.ts
+    # + redirectRefused: its redirect, without the canAccessAdmin test

 src/collections/Events/endpoints/
+└── registrationsCsv.ts

 src/collections/UserSubmissions/
 └── submissionData.ts
+    # + registrationAnswers, from src/jobs/DeliverSubmissions/deliverRegistration.ts
+    #   (3 callers, and it now sits beside the keys it filters on)

The view composes @payloadcms/ui's own primitives rather than wrapping them: the filters are Payload's document-tab markup (doc-tab, one pill-version-count each), so they read as the header's Edit / Versions row, and the pager is Pagination directly. Two earlier helpers — FilterTabs and PageControls — are gone with it: each wrapped one primitive behind a slot only the dashboard used, and Payload's own composed equivalents are bound to a collection list view.

Preview

  • Events list — open any event, then its Registrations tab for this view, or Registration for the join beside it
  • Admin home — the manager dashboard, whose URL-query handling this branch lifted a hook out of

Data: not seeded. previewUrl.seed is unset for this repo and this session has no PREVIEW_ADMIN_EMAIL, so I could not sign in to the preview to create anything. pnpm seed atlas is deliberately not the answer here: its dump is 2004 real registrants' names and addresses, which must not go into a preview.

To see rows, as the signed-in admin: create an event, then create a registration against it. The admin API accepts one directly — paste into the preview's own browser console on any admin page:

Create a registration on an event
await fetch('/api/user-submissions', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    type: 'registration',
    event: 1, // the event's id
    senderEmail: '[email protected]',
    submissionData: [
      { field: 'name', value: 'Ada Lovelace' },
      { field: 'referral', value: 'A friend' },
      { field: 'locale', value: 'en' },
      { field: 'userAgent', value: 'Mozilla/5.0 (preview)' },
      { field: 'subscribe', value: 'true' },
    ],
  }),
}).then((r) => r.json())

The locale, userAgent and subscribe pairs are there on purpose: before this PR they rendered in the Answers column, and in the manager's email. Add a second row with status: 'pending' and a third with status: 'spam' to see all three filters and their counts.

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — lint, format:check, typecheck, typecheck:tests, 236 unit files / 3054 tests
  • Targeted spec: ✓ atlas-manager.int — 17 passed
  • Security review: ✓ no findings. The branch now matches securityReview.triggerPattern through Events/endpoints/registrationsCsv.ts, so the branch-level sweep was run rather than skipped
  • Contract step: ✓ db:migrations:create --skip-empty wrote nothing — no schema change
  • Build: N/A (CI)

Every new assertion was watched failing first: the subscribe leak, the archived-event read, the status partition, the event scoping, the inactive manager, the pill's gate, the CSV's 403, and the gate itself.

Manual verification

  1. As an event's own manager, open /admin/collections/events/<id>/registrations: its registrants, Accepted first, Pending and Withdrawn behind their own filters, each tab carrying its count. The tab itself shows the accepted count beside its label.
  2. As another manager who oversees that event's region, open the same URL: redirected to the unauthorized view, and the tab shows no count. The tab is still visible to them first — a DocumentTabCondition is handed no document, so it cannot hide per event.
  3. As an admin, the same URL works, and the Registration tab still shows the join's drawer.
  4. The Answers column shows only the event's questions — no userAgent, locale or subscribe row.
  5. Under Withdrawn, each row's Status pill carries a one-line detail — "Confirmation email could not be sent" for failed, which is what a manager needs in order to read that row at all.
  6. Download accepted (CSV) returns a file of the accepted rows, one column per question anyone answered. As the region manager, the same URL answers 403.

Notes for reviewer

  • The gate is the security-relevant part, and the reviewer settled where it belongs: option A, the view decides, in this thread. managerSubmissionScope would not have reached every event's manager — it narrows a role grant, and atlas-manager is the only role granting user-submissions, while Events.manager accepts any manager.
  • Scope the ticket did not list, and why it is here: the answers leak and the trash: true read are in the exact code paths the ticket told me to reuse, and would have shipped in the new table too.
  • The registrations join's subquery still runs for every manager and its result is discarded — admin.condition hides a field, it does not stop a read. The ticket chose to keep the join for the admin's drawer, so this is an accepted cost, now stated at the field.
  • helpers/searchParams.ts is not req.searchParams restated. Root rebuilds the request URL by qs.stringify-ing Next's searchParams, which spells a repeated key page[0]=2&page[1]=9 — so req.searchParams.get('page') is null where firstParam is '2'. The module's own comment carries it.
  • The CSV endpoint has no OpenAPI entry and no requireActiveClient, because it serves the admin panel alone. Its docblock says so, as docs/rules/endpoints.md requires of an endpoint that skips the client guard.
  • escape_formulas on the export is load-bearing: every cell is text a visitor typed, and a spreadsheet runs one starting with =, +, - or @ as a formula. The integration spec pins it with =SUM(1,1).
  • Dismissed findings: a memoised Intl.DateTimeFormat cache (bounded by limit: 50 — a cache against an unmeasured harm is machinery this repo would rather not carry); running the gate and the rows under one Promise.all (a refused caller would then have read restricted rows); userManagesDocument for the gate (it answers the wider ancestor-inclusive question, which would silently widen the day events gain a parent chain); a shared registrationRowFrom (the digest keeps startingAt raw to group on, so one row shape would serve neither).
  • tests/PERF.md's file/test counts moved with the new spec; its timing figures are untouched, since the measurements this container gives are not the ones that file records.
Detail

Why the tab has no condition. The ticket proposed one hiding it from non-managers users, but admin.user is managers, so every admin-panel visitor already satisfies it and the condition would be vacuous. DocumentTabCondition is handed no document either, so a per-event condition is not expressible — which is why the view refuses rather than the tab hiding. The count pill is the part that can decide per event, and it renders nothing for a refused visitor.

Why the gate re-reads the event instead of using the doc prop. Payload already loads the document for this route and passes it to the view, but as a draft: true read. A region manager holds update on every event in their subtree, so gating on that value would let a draft-only reassignment of manager hand someone the registrants of an event they do not run, with nothing published.

Why answersFrom moved. It lived in src/jobs/DeliverSubmissions/deliverRegistration.ts and was already imported from a second job folder, which src/AGENTS.md prohibits; this view would have been a third consumer, outside src/jobs/ entirely. Beside readSubmissionValue it also sits next to the key declarations the exclusion is now derived from, which is what made the subscribe case fixable without a fourth list.

The timezone null. startingAt_tz and schedule.firstDate_tz are both generated non-nullable and both left null by Postgres on a draft, where validation is skipped — so a || b yields null, and formatDate's default parameter covers only undefined. The three call sites spell || 'UTC', which is what the other nine sites in the repo already do, eventDetails.ts itself included.

senderEmail is virtual: 'user.email' since #630, so it resolves through the users join rather than off a column — which is why depth: 0 with senderEmail selected is the right shape, and the same one both notification jobs use. The name is still read off submissionData, never from that row.

Closes #1069

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjX4qSoyst3EVF2Wkrr

Registration rows are admin-only, so the `registrations` join renders empty
for every manager and a program manager's only view of their own signups was
the digest email. This adds a document view on `events` at `/registrations`
that the event's named manager, and an admin, can open.

A collection edit view sits behind `Root`'s own `canAccessAdmin` redirect —
`isCustomAdminView` reads the root `views` map alone — so the view's own gate
is the narrower one: admin, or `event.manager === user.id`. A region manager
holds `update` on the row through its subtree and is still refused, which is
why the gate cannot read the collection's own access config.

`answersFrom` moves to the collection that owns `submissionData`, beside
`readSubmissionValue`: it had two consumers in two different job folders
already, and this is a third outside `src/jobs/` entirely.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXeWziyUPFizPTu17e
`answersFrom` handed `buildRegistrationAnswers` every `submissionData` pair,
and that function labels an unconfigured key by the key itself — so the manager
notification and the daily digest both rendered `userAgent: Mozilla/5.0 …`,
`locale`, `path` and the registrant's own `name` as things the visitor had been
asked. `BASE_SUBMISSION_KEYS` is already the list of what a client writes about
itself, so the fix drops those and nothing else; the mailing-list opt-in and
any legacy question key still come through.

`formatDate` defaulted its timezone, which covers `undefined` and not `null` —
and both columns a caller reads it from (`startingAt_tz`,
`schedule.firstDate_tz`) are generated as non-nullable and left null by
Postgres. An event with no schedule timezone therefore threw `RangeError:
Invalid time zone specified: null` out of `Intl`, mid-send, inside the digest
job. The two parameter types that were lying about it say `| null` now.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXeWziyUPFizPTu17e
One case per acceptance criterion, driving the view's loader directly: the
event's own manager, a region manager who holds `update` on the same row and
is still refused, a stranger, an admin, and a document id that resolves to no
event. Nested in the atlas-manager suite so it shares the one test environment
that file may create, and declared last so its fixtures cannot reach the
dashboard cases above.

The registrant's name is asserted against a renamed `users` row, so the case
fails if the page ever reads the join instead of the submission's own pair.

`admin.condition` on the `registrations` join spells its sibling parameter
`_siblingData`: it reads none, and `admin-condition-fields.spec.ts` refuses a
condition that takes `siblingData` without reading one.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXeWziyUPFizPTu17e
The earlier commit on this branch excluded `BASE_SUBMISSION_KEYS` by hand, and
that is an exclusion list where the question is an inclusion one: `subscribe`
is a declared registration key too, so the manager email, the digest and the
new table still rendered an answer row labelled `subscribe` → "Yes". Deriving
the set from `BASE_SUBMISSION_KEYS` plus `TYPE_SUBMISSION_KEYS.registration`,
less the configured question names, excludes a reserved key the day it is
declared rather than the day someone remembers the list. What survives is a
configured question or a legacy key the Atlas dump carried, which is the only
thing `buildRegistrationAnswers`' extras branch is for.

`registrationAnswers` replaces the `buildRegistrationAnswers(answersFrom(x))`
pairing at all three call sites, so no caller re-derives which map feeds the
labeller — the one thing that could reopen this.

It also drops the `string | null` timezone widening. `formatDate`'s default is
right, and the repo already resolves this at the call site in nine places,
`eventDetails.ts` itself among them — so the three callers that could produce a
null now spell `|| 'UTC'` like every other, and the module stops being the one
that accepts a zone no other accepts.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXeWziyUPFizPTu17e
The `/simplify` pass found the asymmetry: this branch lifted the URL writer
(`useSetQuery`) out of the manager dashboard and then duplicated the reader
beside it, along with the tab-button row and its accessibility contract.

`firstParam` / `pageParam` replace three copies of "Next hands a repeated key
over as an array, take the first" — the dashboard's, the sign-in view's and
this branch's. `FilterTabs` owns the convention that a selected tab is
`subtle` rather than `tab` and carries `aria-pressed` plus an `aria-controls`
naming the region it filters, which had two definitions a fix to either would
have drifted.

In the new view: the payload carries the filter alone, since the table pages
off `PaginatedDocs` and never read the query's page; the two tables keyed by
the same union became one; and the page size is a local in the loader that
consumes it. The join's condition stops forwarding two arguments
`adminOnlyCondition` ignores, and says what it does and does not do — it hides
the field, and the subquery still runs.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXeWziyUPFizPTu17e
`admin-ui.md` said an event's registrations are read through its join, which
`user-submissions` being restricted has never made true for a manager. It now
says which half each surface owns, and carries the opposite of the #1030 rule:
a `path` under a collection's `views.edit` is not what `isCustomAdminView`
reads, so `Root` does gate it — what such a view owes is whatever is narrower
than admin access, plus the two routes that reach it with no document.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXeWziyUPFizPTu17e
…cline

Three findings from the review pass, all in the new tab:

An archived class is a trashed row, and Payload hides one from every read that
does not ask for it — so the gate read its own manager's event as absent and
answered the unauthorized redirect. `trash: true`, and an integration case that
fails without it.

`failed` is in `INACTIVE_STATUSES` because the confirmation never sent, not
because anyone withdrew. The filter's copy said the rows there were declined or
refused, which for that status tells a manager the opposite of what happened.

The empty notice now turns on `totalDocs` rather than this page's rows: a page
past the end has none, so it claimed the event had no registrants at all and
hid the pager that gets you back.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXeWziyUPFizPTu17e
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1073 November 2, 2026 22:44 Destroyed
@railway-app

railway-app Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1073 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Nov 4, 2026 at 6:57 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 question for the reviewer, one per thread.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot

sydevs-bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 18:53Z address-review · attempt 1 · session · done
  • 18:53Z address-review · attempt 1 · session
  • 18:11Z resolve-conflicts · attempt 1 · session · done
  • 18:11Z resolve-conflicts · attempt 1 · session
  • 21:46Z resolve-conflicts · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 2, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 2, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The shape matches the ticket: the gate is the loader, the tab is a document view, and the ticket's reuse targets are reused rather than rebuilt.

The joined work earns its place. Deriving NON_ANSWER_KEYS from the two key declarations beats the hand-listed exclusion it replaces, and the leak it fixes is in the path the ticket said to reuse.

Two of the three new helpers do not. searchParams.ts re-solves what req.searchParams already answers, and the pager — the one piece both views still duplicate — stayed outside the folder this diff built for exactly that. Neither holds the PR.

Findings

  • should-fix — helpers/searchParams.ts:12: duplicates req.searchParams.get(), which Payload hands all three callers.
  • should-fix — EventRegistrationsView.tsx:39: the Withdrawn legend renders only when the filter is empty, so a Failed row reaches a manager unexplained.
  • consider — EventRegistrationsView.tsx:120: the pager is duplicated verbatim between the two views this diff just gave a shared owner.

What was checked

  • #1069's four criteria against atlas-manager.int.spec.ts: one case each, plus the archived event and docID: 'create'.
  • Read whole on the branch: the four EventRegistrations/ modules, the four helpers/, active.ts, questions.ts, submissionData.ts, AtlasManagerView.tsx.
  • Ladder: req.searchParams is the one named answer; FilterTabs and useSetQuery have two consumers each.
  • NON_ANSWER_KEYS resolves to name, locale, path, hostUrl, userAgent, error, subscribe — no question name collides. INACTIVE_STATUSES is rejected, spam, failed, and the two Wheres partition it.
  • No contractSync source is touched. Preview answers 200, but with no PREVIEW_ADMIN_EMAIL the tab was not opened.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 2, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 2, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 2, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 2, 2026
The review asked whether `helpers/searchParams.ts` duplicates
`req.searchParams.get()`, which Payload hands all three callers. It does
not: `Root` builds the request URL from this same `searchParams` object
with `qs.stringify`, and that writes a repeated key as `page[0]=2&page[1]=9`
— so `req.searchParams.get('page')` answers null precisely where
`firstParam` takes the first value.

Record the constraint at the module, so the next reader does not re-derive
it from @payloadcms/next.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVDVHWCcHkdUvg6iLh
The sentence naming all three reasons a registration is withdrawn lived in
`CenteredNotice`, which renders only when nothing matches the filter — so a
manager read it exactly when there was nothing to explain, and a `Failed`
row, whose confirmation never sent, reached them unexplained.

It now sits above the list for both filters, inside the live region so a
filter switch announces it. The empty notice keeps its icon and title.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVDVHWCcHkdUvg6iLh
The pager was `AtlasManagerView` verbatim in `EventRegistrationsView` —
the same seven props, the same `?? undefined` mapping, and a `.pageControls`
rule in each CSS module — while the diff that built `admin/helpers/` moved
the filter row and the query readers into it and left this behind.

`PageControls` takes the `PaginatedDocs` and a page callback, with `PerPage`
as an optional slot, and owns both rules a caller was restating: the
nullable-neighbour mapping `Pagination` refuses, and offering a page size
only once the list outgrows the smallest one. `Pagination` already renders
nothing on a single page, so the dashboard's unconditional wrapper and the
Registrations view's `totalPages > 1` were two spellings of one rule; the
component returns null instead, which keeps an empty row out of its
parent's gap.

The dashboard's pager gains `margin-top` from the shared rule. Nothing in
`@payloadcms/ui` spaces a `.paginator`, so it sat flush against the table.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVDVHWCcHkdUvg6iLh
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1073 November 2, 2026 23:21 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three critic threads settled, and origin/main merged in clean.

Adopted

Rebutted

Open

Gate: ✓ lint, format, typecheck ×2, 3004 unit tests, atlas-manager.int (14).

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 2, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 2, 2026
#630 made `senderEmail` a `virtual: 'user.email'` field on main while this
branch was open. The loader's two comments still claimed the opposite —
that the column is authoritative and the `users` join is the derived copy
`prepareUserSubmission` seeds — which would invite the next reader to drop
the relationship the value now resolves through.

The query itself is already right: `depth: 0` with `senderEmail` in the
`select` is the shape both notification jobs use on main, where Payload
resolves the relationship-path virtual in the query. Only the prose was
inverted, so this is comment-only.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXhiETAYtCznnsP6oT
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1073 November 4, 2026 18:27 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main. One conflict: importMap.js is generated, and both sides added an entry at the same line — this branch's EventRegistrations, main's BlockUserButton. Kept both. pnpm generate:importmap then found no new imports to write, so the merged file is what the config requires.

One semantic drift the merge could not see: #630 made senderEmail a virtual: 'user.email' field. The loader's two comments still claimed the column was authoritative and the users join the derived copy — the reading main itself corrected in SendSessionReminders. Fixed in a second commit, comment-only: the query already used the right shape (depth: 0 with senderEmail selected, which Payload resolves through the join).

Gate green on the merged tree: lint, format, both typechecks, 236 unit files / 3058 tests. Integration: atlas-manager, registration-digests, session-reminders, user-submissions-create, user-submissions-access, block-user — 92 passed.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 4, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 4, 2026
…ab' into claude/feat-1069-registrations-tab

# Conflicts:
#	src/app/(payload)/admin/importMap.js
#	src/components/admin/EventRegistrations/data.ts
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1073 November 4, 2026 18:53 Destroyed
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 4, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 4, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Your answer is built already — your own two commits are it. Nothing to push.

Answered

  • The access-layer question → A, resolved. readableEvent is the gate, and isManager tests type === 'manager', so an inactive manager the event names is refused. The pill and the CSV route both call it before any read.

Verified on ce07225

  • Lean gate: lint, format, both typechecks, 236 files / 3054 tests.
  • atlas-manager.int: 17 passed — the inactive manager, the pill's gate, the CSV's 403.
  • Security review run, not skipped: the branch matches securityReview.triggerPattern through the new endpoint, which the body denied. No findings.

Written

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 4, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 4, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 4, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit b40c6e6 Nov 4, 2026
45 of 47 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-1069-registrations-tab branch November 4, 2026 23:24
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 4, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 4, 2026
Six conflicts, three kinds.

Four were the same measurement — the unit-lane file and test counts in
AGENTS.md, tests/AGENTS.md, tests/PERF.md and docs/rules/testing-reqs.md.
Both sides had re-counted, so neither number is right on the merged tree:
re-measured here as 239 files / 3079 tests, which perf-figures-pinned now
confirms. testing-reqs.md takes main's shape, which moved the counts off the
dated measurement sentence onto the "Locally" bullet.

Events.ts was an import list, and both imports are used. One unconflicted
line of main's needed a word with it: its comment said no manager role reads
`user-submissions`, which this branch makes false — a derived role reads
`contact` and `proposal` rows, never a `registration` row, so the join that
comment explains still renders empty for every manager.

atlas-manager.int.spec.ts needed both sides. main's `env` hoist and its whole
Registrations-tab block are kept; the fixtures are this branch's. `stranger`
held `atlas-manager`, which no longer exists, so it is now a manager listed
on a region of its own — the same Atlas authority, still not reaching the tab
event's region, which is what those refusals are about. `admin` and the
inactive manager go through testData.authUser for the same reason.

Nothing semantic: #1073's code names no Atlas role.

Gate: lean gate green (239 files / 3079 tests, 140 s). atlas-manager and
role-based-access integration specs: 109 tests passed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYG97mnkGLAnzjV8dk
Ardnived pushed a commit that referenced this pull request Nov 5, 2026
Six conflicts, three kinds.

Four were the same measurement — the unit-lane file and test counts in
AGENTS.md, tests/AGENTS.md, tests/PERF.md and docs/rules/testing-reqs.md.
Both sides had re-counted, so neither number is right on the merged tree:
re-measured here as 239 files / 3079 tests, which perf-figures-pinned now
confirms. testing-reqs.md takes main's shape, which moved the counts off the
dated measurement sentence onto the "Locally" bullet.

Events.ts was an import list, and both imports are used. One unconflicted
line of main's needed a word with it: its comment said no manager role reads
`user-submissions`, which this branch makes false — a derived role reads
`contact` and `proposal` rows, never a `registration` row, so the join that
comment explains still renders empty for every manager.

atlas-manager.int.spec.ts needed both sides. main's `env` hoist and its whole
Registrations-tab block are kept; the fixtures are this branch's. `stranger`
held `atlas-manager`, which no longer exists, so it is now a manager listed
on a region of its own — the same Atlas authority, still not reaching the tab
event's region, which is what those refusals are about. `admin` and the
inactive manager go through testData.authUser for the same reason.

Nothing semantic: #1073's code names no Atlas role.

Gate: lean gate green (239 files / 3079 tests, 140 s). atlas-manager and
role-based-access integration specs: 109 tests passed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYG97mnkGLAnzjV8dk
Ardnived added a commit that referenced this pull request Nov 5, 2026
Reverts the restore. An Atlas manager reads their event's registrants on
the Registrations view (#1073), and a contact's sender address arrives in
its delivery mail; both read with `overrideAccess`, so neither needs the
Registrants collection.

The cost is deliberate and now pinned: a manager's read of a submission
carries no `senderEmail`, since that is `virtual: 'user.email'` (#1060).
Main's contact-scope cases identify rows by form instead, and the
Registrant-block case asserts the manager can read no Registrant at all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived pushed a commit to sydevs/claude-workflow that referenced this pull request Nov 7, 2026
* feat(lib): decide how a session reaches a gated PR preview

`workflow/lib/preview-auth.mjs` turns a repo's own `previewUrl` block and a PR
number into the host, the sign-in request to send, the Access headers to attach
by env-var name, and one verdict both `finalize-pr` and `review-pr` read:
whether this repo seeds previews at all.

It decides and never fetches, like `railway.mjs` beside it — a routine cannot
reach an API from a script, so the session sends the request and this file holds
no credential. Each token variable is reported only as set or unset, and the
headers are shell references, so a plan can be logged.

The two token env-var names go in `loop-config.json` as `previewAccess`, beside
`railway.tokenEnvVar`: a name typed into a skill is a tuning change nobody can
review on its own. `ceilings` is untouched.

The route and the account are the producing repo's, carried in its `.auth`
block, so nothing here knows either and nothing here goes stale when they
change. The test fixture deliberately uses a `.invalid` host for the same
reason: a copy of another repo's config value is a second definition, in a
fixture as much as in a skill.

The failure this prevents: `review-pr` reads no repo config today, so without one
answer in one place each skill would re-derive "does this repo seed previews" on
every dispatch — 25 to 40 times a day — and the two are then free to disagree.

Refs #241

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* feat(finalize-pr): give previewUrl.auth a meaning

Step 7's *Every link opens on data* now asks the helper first, and signs in with
what it answers where a repo declares `previewUrl.auth`. The configuration table
gains the key beside `.pattern` and `.seed`.

The example Preview block stops naming a real host. The pair it used names
SahajCloud's Railway address, which sydevs/SahajCloud#1081 shuts — so the
example would have told the next reader to write a link that 403s, and a host
spelled in this skill is a copy of a config value either way.

The failure this prevents: a run that holds a preview-only Access token still
had nowhere to read the route, the account or the header names from, so it
would have written `Data: not seeded yet` beside a preview it could have filled.

⚠ No step assumes `previewUrl.seed` is set. SahajCloud's copy carries only
`.pattern` today, and the same hand-edit that adds `.auth` adds `.seed`; the
`Cannot seed` case still covers an unset one.

Refs #241

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* fix(review-pr): a red seed check outranks a line in the body

Two places let a change admit it has no data and pass anyway. Where a repo's own
CI goes red on a preview that exists and could not be filled, the red check is
the gate and a sentence cannot stand in for it.

⚠ **Conditional, never a removal.** That text is correct for the other four
repos, which have no seeding check and no gate — there the line is still the only
honest thing to write. Each edit decides from the helper's verdict, so neither
skill names a number, a label or a repo. `rule-delta.mjs` reports no dropped
rule.

The failure this prevents is the one the written rule has already accepted twice:
sydevs/SahajCloud#1073 shipped its Registrations page with `Data: not seeded` and
a console snippet to paste, and sydevs/SahajCloud#874 linked three pages nobody
saw anything on — filling that one by hand afterwards found three defects in a
minute.

The story goes behind one new `docs/why.md` anchor, beside the rule it extends.
Each edit still reads as an instruction with the citation removed.

Refs #241

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* docs(routine-setup): write down both preview Access tokens

They live in two different places, so the doc needs a row in each: the
`github-ci` pair as an org-level GitHub secret, read by SahajCloud CI's seed and
smoke steps, and the `claude-loop` pair as a Claude cloud-environment variable,
read only by `workflow/lib/preview-auth.mjs`.

The ⚠ on "There is no secret store" now says what a preview-only Access token
reaches — every preview of the gated repo, as a service identity whose every use
Cloudflare logs — and what it does not: anything on the live site, whose address
it cannot change.

The failure this prevents is a person setting up the loop with one Service Auth
policy on "any service token", which reads like the simpler choice and makes
switching one token off a deletion of both. Two named policies are what let the
loop's be switched off while CI keeps running, and the other way round.

Nothing here names a stopgap variable: sydevs/SahajCloud#1081 retires it, and
this doc never carried a row for it.

Refs #241

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* chore(plugin): 5.3.0 → 5.4.0

Every skill change in this PR reaches a cloud routine on its next run, and an
installed plugin on no run at all until this string moves:
`installed_plugins.json` records a `gitCommitSha` and never revisits it, and the
cache directory is named after `version`. A skill change without a bump is the
one failure this repo has already paid eight days of stale skills for.

`.claude-plugin/marketplace.json` still parses and still points at `./workflow`.

Refs #241

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* fix(why): the 874 anonymisation was a hand seed, and no code does it

That passage read as though the seed itself replaced coordinator identities with
`preview.invalid` addresses. It did not: `grep -rn 'preview\.invalid'` over
sydevs/SahajCloud returns zero hits, and nothing writes that address. The
anonymisation was done by hand, once, on one preview.

Left as it was, the passage stated the opposite of the parent goal's whole
premise — that the content system has nothing safe to fill a preview with, since
its only data scripts import real people's names and addresses. A reader who
trusted it would have concluded the problem was already solved.

What makes made-up preview data true in code is the committed fixture
sydevs/SahajCloud#1081 adds, and that is structural rather than tested: the
real-data files left that checkout in sydevs/SahajCloud#1079, so no CI run holds
a real name to leak. It remains no promise about a preview somebody filled by
hand.

Replaced in place, not appended.

Refs #241

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* fix(lib): refuse a plan that would leave the preview host or carry half a token

Four defects found reviewing the helper, each the kind a prose rule cannot
hold and a script can.

A sign-in route came from config and was concatenated onto the host with no
check, so `@evil.example/x` or a bare `.evil.example/x` moved the origin while
`finalize-pr` attached the Access service token to the request. The route is
joined, then the composed origin is compared against the host's; anything else
plans no sign-in. For the same reason `{pr}` now takes digits only — the slot
sits inside the hostname — and a pattern must be `https:`, since `http:` would
put the pair on the wire in cleartext and `file:` would read the disk.

`headers` was built from the variable NAMES, so an environment holding no
token still handed the session two headers that expand to empty. Cloudflare
logs a blank client id as a failed service-token attempt, and the run reads two
headers as a working credential. Both halves must now be set. SahajCloud's
`accessTokenHeaders` already answered this question the same way; two answers
were one too many. The pair also rides only with a gated request now: a repo
declaring no `.auth` has no Access in front of it, and a preview host a repo
has since moved is a name anyone may claim.

`seedsPreviews` was true for any truthy `auth`, `{}` included. That verdict
tells `review-pr` to raise a `should-fix` on every empty preview in a repo
where no run can sign in or seed — a finding no author can comply with. It now
reads a usable plan.

`accountsPage` is gone. The seed route accepts only an admin manager, so a run
that picked another account from that page could not then seed, and the field
widened what the credential was used for while adding nothing.

The suite caught none of this: 7 of 7 mutations survived it, the
"opens no connection" assertion grepped for `fetch(` alone and passed a module
importing `node:https`, and neither field-name override was exercised. It now
asserts the import list against an allowlist, and 11 mutations were watched
failing against it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* fix(skills): make the new preview rules executable, and drop three false claims

Review found the skill half stated things that are not true and asked for
things a run cannot do.

False, and a false sentence in a skill is in the next run's context: the
example's hosts did not "become unreachable the day #1081 shut Railway's
address" — that ticket is open, and the raw host redirects rather than going
dark. The reason the hosts are gone is timeless, so it is stated that way.
`finalize-pr` promised that a repo's seed check "will red this PR", but
SahajCloud's step reds only where a preview was discovered; with none, CI
warns. `why.md` claimed in the present tense a fixture that an unmerged PR
commits, and named the ticket rather than the PR.

Not executable: `review-pr` was told to call the helper but never where its
input lives — `previewUrl` is not in `loop-config.json`, which is the only
config that skill opens — nor that the path needs the `CLAUDE_PLUGIN_ROOT`
convention, which is why 52 sessions once lost a call each. It also never got
the Access headers, so on a gated repo every preview link answers with the
login screen and reads as empty: the critic would have filed its own missing
credential as a finding. And the new absolute collided with the carve-out two
lines above it, leaving a mid-build 404 ambiguous.

`finalize-pr` asked for a JSON subobject hand-spliced into a single-quoted
shell string while the file was right there, and named no check on the token
before sending. Both are `jq` and one clause. Hard rules still carried the
unconditional form of the rule this PR makes conditional, which is the section
a run under pressure re-reads, and step 7b restated the bullet instead of
pointing at it.

Two rules added rather than corrected. The token must never be printed —
`fix-ci` already says so for the analogous case, and the values reach the
shell even though the script never holds them. And data a preview already held
must never be quoted into a public body: somebody may have filled it by hand
from a real source. `rule-delta` reports that second one as a removal because
it absorbed the shorter "never seed real people's contact details", which it
contains.

The docs now carry the Access application steps, because a service token is
account-scoped and the promise that it "opens nothing on the live site" is kept
by a policy nobody was told to create — with a verification `curl` against the
live hostname expecting 403. The `CF_ACCESS_*` row moves to a repo secret:
`--visibility all` would hand one repo's previews to every workflow in five.
And both docs now say the feature is inert until a repo declares
`previewUrl.auth`, naming its keys, which nothing told the person who must
write that block.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ

* fix(review-pr): key the unreachable preview on a signIn, not empty headers

`headers: []` has two causes and the text read only one. `authPlan` empties
it whenever `signIn` is null, so every repo with no `previewUrl.auth` — all
four product repos today — matched the sentence, and so did a repo carrying
`seed` alone. The branch's own test at `workflow/lib/preview-auth.test.mjs:141`
is that case: `seedsPreviews: true`, `signIn: null`, `headers: []`.

Read as written, the rule recorded such a preview unreachable and raised
nothing, cancelling the `should-fix` the next sentence demands. The condition
is now a `signIn` present with either `access` half unset, which is the only
shape that means this environment cannot pass a gate, and empty `headers`
with no `signIn` is named as no gate rather than a missing token.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjW1KpxUngcdTDx7hQ1

* fix(finalize-pr): pin the unreachable preview to a signIn and name the field

Same misreading as review-pr:98, and unscoped here. `authPlan` returns
`headers: []` whenever `signIn` is null, so all four repos carrying no
`previewUrl.auth` matched this sentence on every preview. Read as written,
step 7 stopped checking data and wrote "unreachable" instead — the exact
failure the step exists to prevent.

The sentence now requires a `signIn`, and names the condition as
`access.clientId.set` / `.clientSecret.set` rather than leaving the run to
infer it from an empty list. Empty `headers` with no `signIn` is stated to
mean no gate, so the data check proceeds as before.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjW1KpxUngcdTDx7hQ1

* fix(preview): send the Access pair only to the plan's own host

The security review found a credential leak this PR introduced, and it is the
kind a prose rule cannot hold.

`review-pr` was told to "send each link with the plan's `access.headers`",
where each link is a `## Preview` link read out of the body under review. That
body is not ours. `dispatcher/decide.mjs` fires `review-pr` with `onDemand`
on a PR no member authored as soon as a `respondTo` login types the review
verb, and the skill is told to judge a ticketless PR against its own body. So
anyone able to open a PR could name their own host in a Preview section and
collect the Cloudflare Access service token from their logs — a token that
opens every PR preview of the gated repo.

The branch had already hardened the script against leaving the host: `routeOn`
joins the sign-in route and compares the composed origin. The prose then left
by a different door, because the module validated the one URL it built while
the skill attached the same headers to URLs it never saw.

`onHost` closes it where a rule can be evaluated, and `--on-host <link>`
answers `ON_HOST` or `OFF_HOST` for one link. Both skills now send the pair to
an `ON_HOST` link only, and an `OFF_HOST` link in a body is a `should-fix` of
its own: a body pointing where the repo publishes no preview is one a reviewer
cannot check. `review-pr` also gains the `Never print the token` rule its
`finalize-pr` counterpart already carried, since it publishes a public
What-was-checked section. `railway.mjs` allowlists an outside poster's host for
the same reason.

Four mutations of the check were watched failing the suite: the `https:` guard
dropped, `endsWith` for origin equality, hostname for origin, and always
allowing. A fifth, dropping the null-host guard, is behaviour-preserving — the
try/catch already answers false.

`budget.test.mjs` asserts every verdict word a skill names is one a script can
print, so each script now exports its own list and the test reads their union.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjW1KpxUngcdTDx7hQ1

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: sydevs-bot <[email protected]>

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1073 — ce072257 Deployed Nov 4, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

feat(events): a Registrations tab for the event's own manager

3 participants