Skip to content

feat(registrations): a tidier Registrations tab, and one registration per person - #1092

Merged
Ardnived merged 3 commits into
mainfrom
feat/registrations-view-dedupe
Nov 7, 2026
Merged

Ardnived merged 3 commits into
mainfrom
feat/registrations-view-dedupe

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

What changes

Registrations tab

  • A filter with no rows is hidden, unless the URL already selected it. The whole filter row is hidden when Accepted is the only filter with rows — the tab's own pill already carries that count.
  • The CSV button reads Download (CSV) and shows only under Accepted, since the file holds accepted registrants only.
  • An event with no registrations at all shows a "No registrations yet" notice instead of the table. It lists the open items from the event's Recommendations panel with a Review recommendations link to the Edit tab, or says why the listing isn't checked (e.g. unpublished), or that it already follows every recommendation. The report is read only on this branch, because it costs a full document read.

Repeat registrations (mergeRepeatRegistration)

  • A client signup from an address (normalized) that already holds a registration for the same event updates that row — name, session, answers — instead of creating a second one. It goes back to pending with its screening verdict cleared, so the new answers are screened and a fresh confirmation is sent.
  • The row keeps its id, createdAt, activity log and uuid. The uuid keys the registrant's calendar entry, so the new confirmation moves it rather than adding a duplicate. An activity-log entry records the update.
  • How: the create runs to completion, so every public-write check still applies (captcha, link scan, gateRegistration, the submissionData allow-list). The new row is then folded into the existing one and deleted, in the same transaction. The hook runs first in afterChange, so the response and every later hook (opt-in spawn, fullness sync, screening queue) act on the surviving row. The response keeps the client-access shape; only id, uuid and the timestamps are swapped.
  • Merged into: accepted, pending, failed. Never into spam or rejected. A manager's own write and an import are left alone.
  • gateRegistration no longer refuses event_full to a registrant updating the seat they already hold.

No contract change for the widget: it still gets 201 { doc: { id, uuid } }, now naming the existing row.

Known follow-ups (not in this PR)

  • The manager's immediate notification fires again on an update, worded as a new registration.
  • A repeat signup with the mailing-list box ticked spawns another subscribe row.
  • SahajAtlasWeb/src/config/query-client.ts comments that a re-sent registration is a duplicate signup — no longer true.

Testing

  • Lean gate (check.sh): lint, format, typecheck ×2, unit lane — passed.
  • New user-submissions-repeat-registration.int.spec.ts (6 cases), plus atlas-manager (new empty-state case), user-submissions-registration-gate, registrations-fullness, user-submissions-create — all pass locally.
  • Checked by hand on a local dev server: empty state with and without open recommendations, Accepted-only (no filters), Accepted + Withdrawn, and the CSV button per filter.

🤖 Generated with Claude Code

Ardnived and others added 2 commits November 6, 2026 16:39
…pty one

A filter with no rows is left out, unless the URL already chose it, and the
whole filter row is left out when Accepted is all that remains — the tab's own
pill already carries that count. The CSV button reads "Download (CSV)" and
shows under Accepted alone, since the file holds the accepted rows only.

An event with no registrations at all replaces the tab with a notice that
points the manager at the listing: the open items of its Recommendations
panel and a link to review them, or why the listing is not checked, or that
it already follows every recommendation. The report is the virtual
`qualityReport` read off the draft with no `select`, and only on that branch,
because it costs a full document read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d row

A client registration from an address that already holds a registration for
the same event now updates that row: the registrant's name, session and
answers, back to `pending` with no screening verdict, so the new answers are
screened and a fresh confirmation goes out. The row keeps its `id`,
`createdAt`, activity log and `uuid` — the last keys the calendar entry, so
the re-sent confirmation moves it rather than adding one.

`mergeRepeatRegistration` runs first in `afterChange`. The create runs to
completion so every public-write refusal still applies, then is folded into
the existing row and deleted inside the same transaction; the response and
every later hook see the surviving row. Spam-flagged and rejected rows are
never merged into, and a manager's own write or an import is left alone.

`gateRegistration` no longer refuses `event_full` to a registrant updating the
seat they already hold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app

railway-app Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

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

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

@Ardnived

Ardnived commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@sydevs-bot review

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 6, 2026
@sydevs-bot

sydevs-bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 23:53Z address-review · attempt 1 · session · done
  • 23:53Z address-review · attempt 1 · session
  • 23:43Z review-pr · attempt 1 · session · done
  • 23:43Z review-pr · attempt 1 · session

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

@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 6, 2026
… hook

`lifecycle/repeatRegistration.ts` held one query for two callers in the same
folder, so it moves into `mergeRepeatRegistration.ts`, which owns the rule,
and the gate imports it from there. The hook takes the registrant's values
from the create's own `data` rather than re-reading the row it just wrote,
and drops the `subject`, which cannot change for the same event.

The gate waives `event_full` outright for a sender updating a seat they
hold, instead of re-running the whole gate with one seat fewer: it is the
gate's last check, and an update never adds a seat.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧐 Adversarial review

The repeat-registration half is right, and its ⚠ comments earn their place: Payload cannot turn a create into an update, so folding inside its transaction is the only shape available. Unsettled: the merge is keyed on an address nobody verified, which turns a forged signup from a nuisance into an overwrite of someone else's registration. That exposure is new, and the body does not name it.

The tab half is three changes under one title. The filter and CSV tidy-up is plainly in scope. The empty-state recommendations listing is a feature of its own, and the most machinery here for the least stated need.

No contract moved, and admin-ui.md and COVERAGE.md both follow.

Findings

  • blocker — a stranger can overwrite a registration, keyed on an unverified email · mergeRepeatRegistration.ts:56
  • should-fix — a newer failed row withholds the full-event relief from an active registrant · gateRegistration.ts:101
  • consider — seven new pieces for a notice the Edit tab already serves · data.ts:253

What was checked

Read whole on the branch: the two new files, gateRegistration, data.ts, EventRegistrationsView, lifecycle/review, fields.ts, and the siblings the merge runs ahead of — guardStatusTransition, queueScreening, syncFullness, spawnSubscribeFromRegistration.

Clean: reviewMove returns none on a client req, so the nested accepted→pending write passes the status guard; queueScreening names the surviving row; update-then-delete leaves fullness right inside the transaction; userField closes only create and update, so relationId(doc.user) resolves for a client. Ladder: lifecycle/ and CenteredNotice existed already, and buildPanelModel is reused, not re-derived. uuid keys only the ICS uid — #723 removed its access branch. Preview deployed, not opened.

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


Generated by Claude Code

// the client `select` requirement, which is meant for the client's own reads.
const trusted = asTrustedReq(req)

const existing = await findRepeatRegistration({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The match is an unverified email, so a stranger holds the write. Anyone with a client key — the widget ships one to every host page — can POST a registration naming another person's address and overwrite their row: answers and session replaced, status back to pending, verdict cleared, a fresh confirmation mailed to them. No versions here and no old values in the log entry, so nothing restores them. Turnstile bounds volume, not a targeted overwrite. What bounds this?

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


Generated by Claude Code

eventId,
sender: { email: data.senderEmail },
})
if (existing && isActiveRegistration(existing)) rejection = gate(registrationCount - 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

findRepeatRegistration returns the newest row among accepted, pending and failed. A failed row newer than an accepted one fails isActiveRegistration, so the relief is withheld from a registrant who does hold a seat and a full event refuses them. The helper's own doc says legacy duplicates exist, so this is live data. Filter the lookup by activeRegistrationWhere (src/lib/registrations/active.ts), or sort actives first.

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


Generated by Claude Code

* ⚠ **No `select`.** The report is computed from the document it is read
* with, so a narrowed read would report every unselected field as missing.
*/
async function listingRecommendations(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seven new pieces serve this one notice: ListingRecommendations, this function, editUrl, recommendations, NoRegistrationsYet, a .recommendations class, and a second unselected document read — reaching into EventQualityPanel/model and lib/eventQuality from an unrelated view. The Recommendations panel already says all of it one click away, and the notice already links there. Is the listing worth the pieces, or would the notice and its button do the job?

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


Generated by Claude Code

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1092 November 6, 2026 23:52 Destroyed
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 6, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 6, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 6, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 6, 2026
@Ardnived
Ardnived merged commit 1ed0b39 into main Nov 7, 2026
14 of 15 checks passed
@Ardnived
Ardnived deleted the feat/registrations-view-dedupe branch November 7, 2026 00:09
@sydevs-bot sydevs-bot moved this from Working to Done in SYDevelopers Technical Roadmap Nov 7, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor

Merged at af5e627 while this run was building, so no thread got a commit. The security sweep then found two more holes, both now on main:

  • registrationLimit is bypassable. ?select[id]=true on the create empties the doc the merge keys on, while gateRegistration has already waived event_full from data.
  • A merge takes the row. It writes the caller's client onto it, so one org's key re-attributes another's registrant and re-mails them.

Both fixes, and the threads below, are on claude/fix-repeat-registration-seat. Filed as #1093 (Critical).

🤖 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 7, 2026
Ardnived added a commit that referenced this pull request Nov 7, 2026
Resolves the Registrations view onto FilterTabs and QueryPager, keeping
#1092's hidden empty filters and accepted-only CSV; FilterTabs renders no
tab row when it is given none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1092 — af5e6272 Deployed Nov 6, 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.

2 participants