Skip to content

feat(events): registration gating, fullness + ics for atlas redesign #577

Closed

Description

@Ardnived

Summary

The Sahaj Atlas event display & registration surfaces are being redesigned (spec: Sahaj Atlas — Event Display & Registration Surfaces Redesign, Anton, 2026-07-14 v2). The widget gains a computed registration-state machine — Open / Registration closed (started course) / Ended / Full — derived per event from the structured schedule. This is the CMS companion ticket; the widget side is covered by two Atlas companion issues on sydevs/SahajAtlasWeb — linked in a follow-up comment once created.

Items 1 + 2 are what the widget's new registration-state machine depends on. Today POST /api/events/:id/register accepts any registration for a published event, so the widget's derived "Registration closed"/"Full" states are cosmetic until the server enforces them (item 1) — and the widget can't know an event is full at read time because registrations aren't client-readable (item 2). Items 4 + 6 remain here: translation-system shaping (extends sydevs/SahajAtlasWeb#28) and pinning down the finished-event read contract.

Items 3 and 5 have been superseded. Both presupposed a registrant-facing confirmation email that does not exist in main. They are now owned by #582 (branded confirmation email + calendar invite) and #588 + #589 (manager notifications, digests, and session reminders), which cover the whole registrant-facing email surface rather than two fragments of it. Their sections below are retained as pointers.

1. Server-side registration gating

src/collections/Events/endpoints/registerForEvent.ts currently checks only that the event is published + project-visible (the overrideAccess: false find → 404) — no timing or capacity checks. Reject:

  • (a) Courses whose first session has passed — derivable from the structured schedule (src/fields/scheduleFields.ts): recurrenceType set + endingType (count/until) set = limited-run course; registration binds to the full run and closes at the first occurrence (schedule.firstDate, tz-aware). Recurring classes (no endingType) never close.
  • (b) Ended events — a one-off past its date/end time; a course/limited run fully finished. The ExpireEvents stage machine already encodes "schedule ran out" (shouldFinish, src/jobs/ExpireEvents/stageMachine.ts) — reuse that derivation rather than re-implementing it. (Finished events get unpublished by the job and then 404 via the access filter anyway; this check covers the window between the last occurrence and the job run.)
  • (c) Full events — registration count ≥ registrationLimit (Events.ts:280; blank = unlimited; the field only applies to registrationMode: 'sahaj-atlas').
  • Suggested while here: also reject registrationMode: 'external' events (Events.ts:265) — the native endpoint shouldn't accept registrations the host manages elsewhere.

Return structured, machine-readable errors so the widget can map each rejection to its UI state — e.g. extend the existing { errors: [{ message }] } shape with a stable code per case (registration_closed / event_ended / event_full — naming and HTTP status are this repo's call; type the shape in endpoints/responseTypes.ts). Preserve the existing published/visible 404 behavior unchanged.

Acceptance criteria

  • Registering for a started course, an ended event, or a full event is rejected with a distinct machine-readable code (not a generic 4xx message)
  • Registering for an open event is unchanged (201 + EventRegistrationResponse)
  • Unpublished/invisible events still 404 exactly as today
  • Int specs cover each rejection + the boundary case (a recurring class with no endingType never closes)

2. Fullness signal readable by atlas clients

The widget's new "Full" state mirrors "Ended" (no Register button, "This event is full", contact-the-host escape hatch) and needs to know at read time that an event is full — but registrations aren't client-readable. Add a derived/virtual field — e.g. registrationsFull: boolean; exact shape is this repo's call, but a boolean avoids leaking counts to the public widget — selectable by the sahaj-atlas-client role on:

  • normal event reads (GET /api/events/:id and list reads), and
  • the /api/events/geojson feed (src/collections/Events/endpoints/geojson.ts)

Semantics: true only when registrationMode: 'sahaj-atlas', registrationLimit is set, and count ≥ limit; false/absent otherwise. Perf note: don't introduce a per-event registration COUNT on the feed (cf. the N+1 sweeps #546/#559/#560) — a single grouped count for the batch, or a denormalized counter maintained on registration create, both work; implementation's call.

The widget degrades gracefully until this ships (absent field = never full), so this isn't a hard blocker for the Atlas issues — but the "Full" UI state is inert without it.

Acceptance criteria

  • sahaj-atlas-client can select the fullness signal on by-id reads and on the geojson feed
  • Signal flips when the registration count reaches registrationLimit; never true for blank limits or registrationMode: 'external'
  • Raw registration counts are not exposed to clients
  • Feed emission stays O(1) queries, not O(events)

3. ICS attachment on the registration confirmation email — superseded by #582

Superseded — do not implement here. The finding that prompted this item stands: no
registrant-facing email exists in current main
(registerForEvent.ts sends nothing,
Registrations has no hooks, src/emails/ has only verification/auth templates). That
turned out to be too big to carry as a sub-item — the confirmation email needs client-service
branding, localization, join-link delivery, and the ICS work below, plus attachment support
in both email adapters.

All of it now lives in #582 — feat(emails): branded registrant confirmation email with calendar invite, including this item's full ICS correctness bar (TZID from the schedule
timezone, a verified RRULE, EXDATEs from exclusions, COUNT/UNTIL bounds for
limited-run courses, and Google/Apple import verification).

The Atlas widget's own in-panel "Add to calendar" export remains separate and unaffected.

4. Translation-system shaping (extends sydevs/SahajAtlasWeb#28)

Framed as an extension of the existing plan to source Atlas translations from the CMS (sydevs/SahajAtlasWeb#28) — not a competing system. The Atlas repo is adding the redesign's new strings to its in-repo locale JSON for now; this item only shapes the eventual CMS-side system (src/fields/translationsField.ts + src/globals/SahajAtlasTranslations/):

  • (a) Per-string charBudget metadata — the leaf schema already carries non-JSON-Schema extensions (e.g. screenshot), so budgets slot in the same way. Add a CMS admin validation warning when a translation exceeds its budget, and include budgets in translator exports. The spec defines budgets per key (e.g. status chips 14 chars, action labels 12 chars × 2 lines).
  • (b) Plural-form support — verify a sessions_count-style key works across active locales: Russian/Ukrainian/Czech need _few/_many beyond _one/_other, and the current leaf types (string | richText) have no plural concept.

Acceptance criteria

  • charBudget is representable in translationsSchema.json and surfaced in the admin with an over-budget warning
  • Budgets are included in translator exports
  • Plural-key handling for locales with >2 plural forms is decided and documented

Overlap note: #582 introduces the first server-side translation resolver and an
emails group in translationsSchema.json. The charBudget and plural work here should
build on that seam rather than introduce a second one.

5. Verify the online joining-info delivery flow — resolved; superseded by #582

Verification done — the answer is that no delivery path exists. The redesign removes
onlineUrl from the widget entirely and the form promises "The link to this class will be
emailed to you", but nothing in main sends it: registerForEvent.ts creates the
registration and returns 201 without sending any email. Online registrants receive the join
link nowhere.

onlineUrl delivery for online events is therefore folded into #582 (confirmation
email, join link as both CTA and selectable plain text) and #589 (the T-1 session
reminder repeats it). Both are built on the redesigned registration semantics — courses
register to the full run; recurring classes carry startingAt.

6. Document the finished-event read contract

The Atlas widget implements an "Ended" terminal panel for direct links and needs the read contract pinned down either way. From src/jobs/ExpireEvents/ExpireEvents.ts, marking an event finished appears to also unpublish it ("terminal, unpublished, no email") — which would make GET /api/events/:id a 404 for API-key clients. Decide/confirm and document:

  • Stated contract: does an auto-finished event remain readable by sahaj-atlas-client (→ widget renders "Ended") or become a 404 (→ the widget's not-found fallback carries the "See nearby events" affordance)? Either answer works for the widget — it will handle both — but the contract must be pinned and documented.
  • Note the pre-job window in that documentation: an event past its last occurrence but not yet processed by ExpireEvents is still published/readable — the widget derives "Ended" client-side there, and item 1(b) closes the corresponding registration hole.

References

Activity

  1. Ardnived commented on Jul 14, 2026

    @Ardnived
    ContributorAuthor

    Atlas companion issues, as promised in the body: the frontend redesign is sydevs/SahajAtlasWeb#52 (its registration-state machine depends on items 1–2 here; its join-link removal depends on items 3+5), and the analytics ticket is sydevs/SahajAtlasWeb#51.

  2. Ardnived commented on Jul 22, 2026

    @Ardnived
    ContributorAuthor

    Superseded. #577 bundled six items; here's where each landed:

    Closing in favour of #599 + #598.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions