Skip to content

feat(clubs): members come in through their seat, a first official Round from the club, the youth path and leaving a club (LAUNCH-19.9 · LAUNCH-19.10 · LAUNCH-19.11 · LAUNCH-19.12) - #977

Open
2witstudios wants to merge 6 commits into
mainfrom
pu/club-first-round

Conversation

@2witstudios

@2witstudios 2witstudios commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Change

The rest of the organizer's first sitting after #974, the leaves LAUNCH-19.9 to LAUNCH-19.12 (point guard, Delivery 7293):

  • 19.9: members come in through their seat (built). Accepting a seat of a paid club lets a waiting member in through the gate's own transition and writer, under the same principal as the manager's admission, club:<organisation id>. A paid club admits an account; this is one concept (ADR 0974, extended by this PR's ADR). On an unpaid plan the seat is taken and the account keeps waiting. ISSUE-1580's "a club seat cannot let them in" copy goes. /beta now leads a new invitee on to their invitation.
  • 19.10: a first official Round from the club. On a paid plan, an admitted manager sees Hold a Round on Seats. For each ladder with funded holders it shows the official standing lobby that fits them (Youth for under-18, Open for adults) and a link to /play/room?lobby=<id>. The Room's create path rechecks the lobby in its transaction, and club staff may host Youth. Holders are named by username for the Room's Invite people dialog. No new command.
  • 19.11: the youth path on accept. The open invitation view carries the invitee's ladder, never an age (ADR 0151 §8). A Youth invitee is told the media release comes next. On accept they move to Settings › Media release, which asks a parent or guardian, or the club, now listed there. Playing in Youth needs no guardian. A guardian-addressed notification waits for counsel (ISSUE-1623).
  • 19.12: leaving a club. decideClubLeave frees the leaver's seat as a removal does, so its Premium ends at the end of the UTC day, and refuses the manager. The DB leaveCommand runs in the club order (holders' fences, then the club, then billing rows), rewrites the grants and ends the membership through Tab's writes (endSeatMembership). Route: POST /api/clubs/<id>/leave. /clubs offers "Leave " with its consequence, and Settings › Billing's seat panel links there.
  • Proof in the browser: club-journey.e2e.ts now also has a waiting student open the emailed link, accept the paid seat, and reach /lobby without /beta.
  • ADR 0977 (new): a club seat lets its member in, and a member may leave. ADR 0962's consequence, ADR 0974 and compliance.md follow.

PageSpace

Builder: ag-z3ps5fiu

Criteria

Criterion Code Test Evidence
LAUNCH-19.9: Given a club seat invitation to a waiting account on a paid plan, should admit the invitee through the gate on accept under the gate's claim rule and age floor, replacing the waits-for-beta-access copy packages/protocol/src/club-admission.ts (decideSeatAdmission), packages/db/src/club-admission.ts, packages/db/src/club-seat-commands.ts (answerCommand), apps/web/src/features/clubs/invitee-command.ts, apps/web/src/features/access/decision.ts (club area), apps/web/src/ui/beta/beta-waiting.tsx packages/protocol/src/club-admission.test.ts; apps/web/integration/club-seat-admission.integration.ts; apps/web/e2e/club-journey.e2e.ts (waiting student); decision-beta.test.ts; beta-waiting.test.tsx CI
LAUNCH-19.10: Given a club manager, should hold a first official Round from the club: open a Room in the official lobby that fits the members and invite seat holders by name apps/web/src/ui/clubs/hold-a-round.tsx, apps/web/src/ui/clubs/seats-page.tsx, apps/web/src/app/(shell)/clubs/[club]/seats/page.tsx apps/web/src/ui/clubs/seats-page.test.tsx ("a paid club holds a Round in the official lobby that fits each ladder") unit
LAUNCH-19.11: Given a minor invited to a club seat, should take the youth path whole: the media-release step on accept and the guardian's answer where a guardian must act packages/db/src/club-seat-reads.ts (youth), apps/web/src/features/clubs/views.ts, apps/web/src/ui/clubs/invitation-page.tsx, apps/web/src/app/(shell)/clubs/actions.ts (clubInvitationAction destination) apps/web/src/ui/clubs/invitation-page.test.tsx ("a Youth debater is told the media-release step comes next") unit. The guardian-addressed notification is ISSUE-1623 (counsel)
LAUNCH-19.12: Given a club seat holder, should be able to leave the club, ending the seat and the membership packages/protocol/src/club-seats.ts (decideClubLeave), packages/db/src/club-seat-commands.ts (leaveCommand), packages/db/src/tab/seat-membership.ts (endSeatMembership), apps/web/src/features/clubs/leave-command.ts, routes.ts (leave), apps/web/src/ui/clubs/leave-club-form.tsx packages/protocol/src/club-seats.test.ts; apps/web/src/ui/clubs/clubs-index-page.test.tsx; apps/web/integration/club-leave.integration.ts CI

Validation

At 73cf195:

  • Focused bun test (protocol club-admission and club-seats, web clubs, beta, access, member-boundary): pass.
  • Non-incremental tsgo for protocol (both tsconfigs), db and web; eslint and prettier on changed files; bun scripts/check-boundaries.ts; regenerated bun log:routes and nets/route-table.ts: all clean.
  • NOT RUN locally (machine budget): the integration tests (club-seat-admission, club-leave) and the billing browser run. CI is their first run.

Changed test assertions

  • decision-beta.test.ts: /clubs/invitations was participant, and a waiting account was sent to /beta. It is now the club area, and the waiting account is allowed.
  • seats-page.test.tsx: the invite section's sentence changed from "A club seat does not let them in" to "accepting the seat lets them in".
  • beta-waiting.test.tsx: the ISSUE-1580 notice test is replaced by "an account that signed up from a club invitation is led on to it".

Operational impact

No configuration change. New route: POST /api/clubs/<id>/leave, behind club-seats. No migration: the access-event principal club:<id> already exists (#974).

Architecture

The protocol module club-manager-admission is renamed club-admission: a paid club admits an account, whether its manager or a seat holder. The DB shares readClubAdmissionAccount and admitThroughGate. The ADR comes with this PR.

Compliance & telemetry

  • Compliance page: no new data class. A member aged 13 to 17 admitted by a paid seat is under the gate's own age floor, as a member invitation is (ADR 0962 §4).
  • Log events: none added.
  • Consent: none.

🤖 Generated with Claude Code

… (LAUNCH-19.9)

The seat accept, already under the invitee's account fence then the club,
now admits a waiting invitee through the gate's own transition and writer
under club:<id> when the club plan gives access and the gate's claim rule
(with its age floor) allows; on an unpaid plan the seat is taken and the
account still waits. decideSeatAdmission sits beside the manager's rule in
@daisy/protocol/club-admission (renamed from club-manager-admission: one
concept, a paid club admits an account); db shares readClubAdmissionAccount
and admitThroughGate. /clubs is now the 'club' access area, invitations
included, and the invitation routes admit waiting accounts. ISSUE-1580's
'a seat cannot let them in' copy goes; /beta leads a new invitee on to the
invitation instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb8a2450-baea-4b11-a9d2-f8dbdb328943
Commits

Reviewing files that changed from the base of the PR and between 532e0d6 and 73cf195.

Files ignored due to path filters: 1

  • packages/logger/src/app-routes.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 51

  • apps/web/e2e/club-journey.e2e.ts
  • apps/web/integration/club-leave.integration.ts
  • apps/web/integration/club-manager-admission.integration.ts
  • apps/web/integration/club-seat-admission.integration.ts
  • apps/web/nets/route-table.json
  • apps/web/src/app/(bare)/beta/page.tsx
  • apps/web/src/app/(shell)/clubs/[club]/seats/page.tsx
  • apps/web/src/app/(shell)/clubs/actions.ts
  • apps/web/src/app/(shell)/clubs/invitations/[invitation]/page.tsx
  • apps/web/src/app/(shell)/clubs/page.tsx
  • apps/web/src/app/api/clubs/[club]/leave/route.ts
  • apps/web/src/features/access/decision-beta.test.ts
  • apps/web/src/features/access/decision.ts
  • apps/web/src/features/access/guarded-pages.test.ts
  • apps/web/src/features/clubs/composition.ts
  • apps/web/src/features/clubs/invitation-email.ts
  • apps/web/src/features/clubs/invitation-path.test.ts
  • apps/web/src/features/clubs/invitation-resend.ts
  • apps/web/src/features/clubs/invitee-command.ts
  • apps/web/src/features/clubs/leave-command.ts
  • apps/web/src/features/clubs/routes.test.ts
  • apps/web/src/features/clubs/routes.ts
  • apps/web/src/features/clubs/views.ts
  • apps/web/src/server/operation-names.ts
  • apps/web/src/ui/beta/beta-waiting.test.tsx
  • apps/web/src/ui/beta/beta-waiting.tsx
  • apps/web/src/ui/billing/settings-page.tsx
  • apps/web/src/ui/clubs/club-copy.ts
  • apps/web/src/ui/clubs/clubs-index-page.test.tsx
  • apps/web/src/ui/clubs/clubs-index-page.tsx
  • apps/web/src/ui/clubs/hold-a-round.tsx
  • apps/web/src/ui/clubs/invitation-page.test.tsx
  • apps/web/src/ui/clubs/invitation-page.tsx
  • apps/web/src/ui/clubs/leave-club-form.tsx
  • apps/web/src/ui/clubs/seats-page.test.tsx
  • apps/web/src/ui/clubs/seats-page.tsx
  • docs/decisions/0962-member-invitations.md
  • docs/decisions/0974-a-paid-club-admits-its-manager.md
  • docs/decisions/0977-a-club-seat-lets-its-member-in.md
  • docs/operations/compliance.md
  • packages/db/src/club-admission.ts
  • packages/db/src/club-manager-admission.ts
  • packages/db/src/club-seat-commands.ts
  • packages/db/src/club-seat-reads.ts
  • packages/db/src/tab/seat-membership.ts
  • packages/protocol/package.json
  • packages/protocol/src/club-admission.test.ts
  • packages/protocol/src/club-admission.ts
  • packages/protocol/src/club-manager-admission.ts
  • packages/protocol/src/club-seats.test.ts
  • packages/protocol/src/club-seats.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T22:44:24.127548Z 1e34e1b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

2witstudios and others added 5 commits November 30, 2026 16:47
… the end of the UTC day, membership ended (LAUNCH-19.12)

decideClubLeave (@daisy/protocol/club-seats) frees the leaver's seat as a
removal does and refuses the manager (manager-cannot-leave). The db
leaveCommand runs in the club order (holders' fences, club, billing rows),
rewrites the grants and ends the membership through Tab's writes
(endSeatMembership beside activateSeatMembership: membership ended, the
member's organisation grants revoked, user version bumped). POST
/api/clubs/<id>/leave; /clubs offers Leave <club> with its consequence, and
Settings › Billing's seat panel leads there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… official lobby that fits each ladder, its holders named for the Room's invite (LAUNCH-19.10)

Seats gains Hold a Round on a paid plan, to an admitted manager: for each
ladder with funded holders, the official standing lobby that fits it
(defaultStandingLobby: Youth for under-18, Open for adults) and a link to
/play/room?lobby=<id>, whose create path rechecks the lobby (club staff may
host Youth). Holders are named by username for the Room's Invite people.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se comes next and is taken to it (LAUNCH-19.11)

The open invitation view carries the invitee's ladder (youth, never an age:
ADR 0151 §8). A Youth invitee reads that a parent or guardian can sign the
media release, or the club confirm one it holds, and on accept moves on to
Settings › Media release, which asks either (the club now listed there).
Playing in Youth needs no guardian; a guardian-addressed notification waits
for counsel (ISSUE-1623).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e; 0962, 0974 and compliance follow (LAUNCH-19.9 · LAUNCH-19.10 · LAUNCH-19.11 · LAUNCH-19.12)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eat and is let in by it (LAUNCH-19.9)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@2witstudios

2witstudios commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner Author

Review: feat(clubs): members come in through their seat, a first official Round from the club, the youth path and leaving a club (LAUNCH-19.9 · LAUNCH-19.10 · LAUNCH-19.11 · LAUNCH-19.12) at 73cf195

Reviewer: ag-pm5yh0t7 · Builder: ag-z3ps5fiu

Checks

  • bun test packages/protocol/src/club-admission.test.ts packages/protocol/src/club-seats.test.ts (local, at head): PASS, 13 tests
  • bun test src/ui/clubs src/features/clubs src/features/access/decision-beta.test.ts src/ui/beta in apps/web (local, at head): PASS, 53 tests
  • Typecheck, lint, knip, full unit: NOT RUN locally (machine budget). CI quick-check / Quick check is still pending at this SHA.
  • Integration (club-seat-admission, club-leave): NOT RUN locally (needs services). CI only; pending.
  • Browser (club-journey.e2e.ts, Playwright suite and isolated native browser jobs): pending in CI.
  • CI that finished at this SHA: Admin E2E PASS, Advisory reports PASS, Dependency vulnerability audit PASS, Migration journal collision guard PASS.

Findings

  • major · packages/protocol/src/club-admission.ts:72 · CONFIRMED by code trace (not executed). One paid seat can admit any number of waiting accounts through the gate. decideSeatAdmission has no count. A removal (decideClubSeating remove, packages/protocol/src/club-seats.ts:298) frees the seat at once and does not touch the gate state. Scenario: a club pays for 1 seat. The manager invites A, A accepts, and A is approved under club:<id>. The manager removes A, invites B, B accepts, and B is approved. Repeat for C, D and so on: each admission costs nothing more than the one seat already paid for. Member invitations bound the same gate with a fixed allowance that counts accepted invitations (ADR 0962 §3, DEC-559: 5). ADR 0977 says "paying for seats is the signal" but neither bounds nor mentions recycling. OWASP A01/A04 · Correct looks like: one of two things. (a) Bound admissions per club as a named value beside the decision: for example, club:<id> admissions at most the paid seat count, counted from account_access_events under the fence and passed to decideSeatAdmission as a fact. (b) Record unbounded recycling as an accepted consequence in ADR 0977 and put the question to the point guard on Delivery. Either way, the gate's capacity is then a decision, not a side effect.
  • minor · packages/db/src/tab/seat-membership.ts:86 · CONFIRMED. endSeatMembership re-spells Tab's pure endMembership decision (apps/web/src/features/tab/commands/organization.ts:354) as db code: the active-membership guard, which organisation grants to revoke, the revoke shape and the version bumps. It matches the precedent of activateSeatMembership, and its writes match Tab's today. But "ending a membership" now has two homes that can drift: a write Tab later adds to end-membership would not reach a leaving seat holder. · Correct looks like: the writes come from one Tab-owned pure function that both Tab's command and the seat leave call. If that refactor is out of this slice, file it as an issue together with activateSeatMembership.
  • minor · apps/web/src/app/(shell)/clubs/actions.ts:195 · CONFIRMED. The core of 19.11, "taken to the media release on accept" (/settings#media-release for a Youth invitee, /settings/billing otherwise), has no test. invitation-page.test.tsx:91 checks only the sentence before accept, and no test covers clubInvitationAction's destination. · Correct looks like: pull the destination into a small pure function (answer, youth → path) with a unit test, or assert the Youth redirect in an existing journey.
  • nit · packages/db/src/club-seat-commands.ts:634 · The answerCommand JSDoc ("Addressed invitee facts and their atomic seat/mail/membership/grant application.") now sits above leaveCommand's JSDoc, so leaveCommand has two doc blocks and answerCommand (:716) has none. · Move it back above answerCommand.

Criteria

  • LAUNCH-19.9 — Given a club seat invitation to a waiting account on a paid plan, should admit the invitee through the gate on accept (age floor and claim rule), replacing the "waits for beta access" copy · PASS · packages/protocol/src/club-admission.ts:72, apps/web/src/features/clubs/invitee-command.ts:44, packages/db/src/club-seat-commands.ts:790, apps/web/src/features/access/decision.ts:54, apps/web/src/ui/beta/beta-waiting.tsx:196, apps/web/src/ui/clubs/seats-page.tsx:413 · packages/protocol/src/club-admission.test.ts:79, apps/web/integration/club-seat-admission.integration.ts:16 and :58 (CI pending), apps/web/e2e/club-journey.e2e.ts:166 (CI pending), apps/web/src/ui/beta/beta-waiting.test.tsx:68. The plan's principal club-seat-invitation:<id> became club:<id>, a recorded design change (ADR 0977 §1, no migration). Bounding admissions is the major finding above.
  • LAUNCH-19.10 — Given a club manager, should hold a first official Round from the club: open a Room in the official lobby that fits the members and invite seat holders by name · PASS (as designed in the plan's second-PR section: holders are listed by username for the Room's own Invite people dialog, with no new command) · apps/web/src/ui/clubs/hold-a-round.tsx:24, apps/web/src/ui/clubs/seats-page.tsx:394, apps/web/src/app/(shell)/clubs/[club]/seats/page.tsx:49 · apps/web/src/ui/clubs/seats-page.test.tsx:221
  • LAUNCH-19.11 — Given a minor invited to a seat, should take the youth path whole: the media-release step on accept and the guardian's answer where a guardian must act · PASS within D4 (the guardian-addressed notification is ISSUE-1623, counsel) · packages/db/src/club-seat-reads.ts:293, apps/web/src/ui/clubs/invitation-page.tsx:72, apps/web/src/app/(shell)/clubs/actions.ts:195 · apps/web/src/ui/clubs/invitation-page.test.tsx:91. The redirect is untested (minor above).
  • LAUNCH-19.12 — Given a seat holder, should be able to leave the club (ending the seat and membership) · PASS · packages/protocol/src/club-seats.ts:268, packages/db/src/club-seat-commands.ts:642, packages/db/src/tab/seat-membership.ts:86, apps/web/src/features/clubs/leave-command.ts:11, apps/web/src/features/clubs/routes.ts:359, apps/web/src/ui/clubs/leave-club-form.tsx:13 · packages/protocol/src/club-seats.test.ts:359, apps/web/integration/club-leave.integration.ts:6 (CI pending), apps/web/src/ui/clubs/clubs-index-page.test.tsx:80. The route is /api/clubs/<id>/leave rather than the plan's /seat/leave, and the form is on /clubs with Billing linking to it. ADR 0977 §6 records both.

OWASP Top 10 (runtime change)

  • A01 Broken access control: reviewed. Leave acts only on the subject's own seat (subject.userId, club id validated, holders fenced). Answering still needs the invited verified address (invitedAs). admitsWaiting is set only on the invitation read and answer. Leave needs an admitted account. Seat recycling is the major above.
  • A02 Cryptographic failures: N/A. No secrets, tokens or hashes touched.
  • A03 Injection: reviewed. Parameterised sql templates, the grant scope through listedWord, and the lobby href through encodeURIComponent.
  • A04 Insecure design: the unbounded gate admission through a recycled seat (major above).
  • A05 Security misconfiguration: reviewed. The new route goes through processRoute, is rate limited (clubs:leave, 10/60 s) and is behind club-seats. No configuration change.
  • A06 Vulnerable components: N/A. No dependency change; the audit job passes.
  • A07 Identification and authentication failures: reviewed. Member boundary unchanged. A waiting account reaches only the club area, whose routes decide, and a restricted account never passes.
  • A08 Software and data integrity: reviewed. Admission is written in the accept transaction after the account fence, in the club order. Leave keeps the same lifecycle invariants as answer.
  • A09 Logging and monitoring: reviewed. Every admission is an account_access_events row under club:<id>. New operation name clubs.leave. No new log fields.
  • A10 SSRF: N/A. No outbound request.

Privacy & telemetry

The invitation view adds youth: boolean, the viewer's own ladder and never an age (ADR 0151 §8). Hold a Round shows the manager their holders' ladder, which Seats already shows. The access event reuses the existing principal shape and class, and compliance.md records the admission and the leave. No new log field, analytics event, error-report field or client tracking. Nothing personal reaches a log.

Verdict

0 blocker / 1 major / 2 minor / 1 nit — CHANGES REQUESTED

@2witstudios 2witstudios left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Inline threads for the /review at 73cf195 (summary comment: #977 (comment)).

* rule, with its age floor, decides who may come in. Accepting still takes
* the seat when this skips; the account then waits as before.
*/
export function decideSeatAdmission(input: {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

major (CONFIRMED by code trace): one paid seat can admit any number of waiting accounts through the gate. Remove a holder (decideClubSeating remove frees the seat at once and leaves the gate as it is), invite the next person, they accept and are admitted, and so on. ADR 0962 §3 bounds member invitations at 5, counting accepted ones. Either bound club:<id> admissions (for example, at most the paid seat count, counted under the fence and passed in as a fact), or record unbounded recycling as an accepted consequence in ADR 0977 and ask the point guard.

* A membership that is not active is left as it is. The caller holds the
* club row lock and its scope, and has refused the owner.
*/
export async function endSeatMembership(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

minor: this re-spells Tab's pure endMembership (apps/web/src/features/tab/commands/organization.ts:354) in db: the active guard, which grants to revoke, the revoke shape and the bumps. The writes match today, but ending a membership now has two homes that can drift. Have one Tab-owned pure function produce these writes for both, or file it together with activateSeatMembership.

return moveOn(incoming, answer === 'accept' ? '/settings/billing' : '/');
// A Youth debater goes on to the media release (LAUNCH-19.11); the bound
// flag only chooses between two pages that check their own access.
return moveOn(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

minor: no test covers 19.11's "taken to the media release on accept" destination. Pull the destination into a small pure function (answer, youth → path) with a unit test, or assert the Youth redirect in a journey.

@@ -606,6 +632,87 @@ export function createClubSeats(input: {
},

/** Addressed invitee facts and their atomic seat/mail/membership/grant application. */

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

nit: this is answerCommand's JSDoc. It now sits above leaveCommand's own doc block, so answerCommand (:716) has none. Move it back.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant