Events Registration
Current Shape
The events subsystem covers event series generation, event runtime capacity, guest import, registration, waitlist promotion, attendance, and undo paths inside the events worker (workers/events/src/routes/event-series.ts:27-220, workers/events/src/event-runtime.ts:173-400, workers/events/src/routes/events.ts:1091-1298).
RRULE Series
The RRULE parser currently supports FREQ, COUNT, INTERVAL, UNTIL, BYDAY, and BYMONTHDAY, with frequency validation limited to daily, weekly, and monthly recurrence (workers/events/src/routes/event-series.ts:27-86).
Occurrence generation handles daily intervals, weekly weekday selection, monthly month-day selection, count limits, and until limits (workers/events/src/routes/event-series.ts:88-187).
Series create input includes recurrence, date/time, capacity, waitlist, pricing, visibility, and lifecycle fields, while series update input can target all, future, or none generated events (workers/events/src/routes/event-series.ts:189-220).
Capacity Model
The runtime computes registration status from active registrations, confirmed registrations, waitlisted registrations, extra attendees, active holds, ticket capacity, ticket hold-back, registration open/close windows, event status, waitlist capacity, and event capacity (workers/events/src/event-runtime.ts:141-270).
Ticket availability includes ticket-specific capacity, remaining seats, held seats, sold-out state, registration count, and hold-back values (workers/events/src/event-runtime.ts:40-69).
Registration preview rejects missing customers, duplicate active registrations, invalid ticket types, sold-out tickets, closed registration windows, full events, and exhausted waitlists before a write is attempted (workers/events/src/registration-core.ts:66-174).
TOCTOU Protection
Registration creation inserts the registration, re-reads active confirmed capacity, and downgrades or deletes the new row if the confirmed count now exceeds event capacity (workers/events/src/registration-core.ts:176-268).
When the post-insert capacity check detects a race and waitlist space remains, the registration is moved to waitlisted; when no waitlist space remains, the registration is deleted and EVENT_FULL is returned (workers/events/src/registration-core.ts:239-268).
Confirmed paid registrations create order and payment-intent records after the capacity-protected registration write succeeds (workers/events/src/registration-core.ts:273-320).
Registration Lifecycle
Event check-in codes are generated from event and customer IDs, which creates deterministic short codes for registration lookup flows (workers/events/src/event-runtime.ts:90-92).
Event check-in windows are local-date aware and reject check-in before the event date or after the event date with explicit CHECK_IN_TOO_EARLY and CHECK_IN_TOO_LATE codes (workers/events/src/check-in-window.ts:31-62).
Admin bulk attendance de-duplicates registration IDs, only processes confirmed registrations, skips already checked-in rows, avoids changing no-show records to attended, stamps attendance fields, upserts service sessions, dispatches calendar sync, and fires event campaign triggers (workers/events/src/routes/events.ts:1780-1975).
Admin check-in by registration ID verifies confirmed status, prevents duplicate check-in, validates the check-in window, updates attendance, upserts the event session, dispatches calendar sync, and triggers the checked-in campaign (workers/events/src/routes/events.ts:1977-2067).
Check-in by code follows the same confirmed-status and check-in-window path after resolving the code to a registration (workers/events/src/routes/events.ts:2069-2120).
Waitlist Promotion
Waitlist promotion selects the oldest waitlisted registration, re-checks computed event state and ticket availability, promotes to confirmed when capacity exists, creates paid-order artifacts when needed, upserts the event session, and emits calendar sync (workers/events/src/event-runtime.ts:297-400).
Undoing a guest import cancels invitees and registrations created by the import, cancels related event sessions, and promotes the next waitlisted registration when a cancelled registration consumed confirmed capacity (workers/events/src/routes/events.ts:2344-2413).
Event cancellation marks active registrations cancelled and cancels related service sessions and calendar sync records (workers/events/src/event-lifecycle.ts:20-50).
Guest Import
Guest import parses imported rows, de-duplicates existing invitees and registrations, supports invite-only mode, supports immediate registration mode, creates customers when needed, calls the same registration core used by ordinary registration, and returns summary counts (workers/events/src/routes/events.ts:1091-1298).
The import undo route is scoped by import ID and records cancellation metadata on invitees, registrations, and service sessions before promotion logic runs (workers/events/src/routes/events.ts:2344-2413).
Corrections From Frozen HTML
The frozen page's RRULE discussion is still directionally correct, but the current parser is specifically daily, weekly, and monthly; yearly recurrence is not implemented in the cited parser (workers/events/src/routes/event-series.ts:27-86).
The frozen page under-described current lifecycle behavior because the worker now includes bulk attendance, registration-ID check-in, check-in-code flow, guest import, and import undo paths (workers/events/src/routes/events.ts:1091-1298, workers/events/src/routes/events.ts:1780-2120, workers/events/src/routes/events.ts:2344-2413).
last verified: 2026-04-24, commit 14f3b190db8817399dcd30e1dc4e1ae7674bbf8a