Skip to content

Exec round (#53) - #63

Merged
VidurShah merged 3 commits into
mainfrom
vidur/exec-round
Nov 30, 2026
Merged

VidurShah merged 3 commits into
mainfrom
vidur/exec-round

Conversation

@VidurShah

Copy link
Copy Markdown
Collaborator

Ticket

Closes #53

Stacked PR. Based on vidur/review-applications (#62).

What changed

API (superuser only)

  • GET /semesters/:id/recruiting/preview?step=exec: { emails: [{ kind, label, recipientCount }], blockers, warnings, alreadyDone }. step=all comes in WP9.
    • exec_rejection → exec applications with status not_selected.
    • invite → selected applicants whose member has no login.
  • POST /semesters/:id/recruiting/exec-done (📝 recruiting.exec_round_done), in one transaction:
    1. Locks the semester row (FOR UPDATE) and returns 409 if exec_round_done_at is already set. Pressing twice, or two superusers at once, can't double-send.
    2. Returns 409 if any exec application is still Applied/Interviewed.
    3. Makes sure every invitee has a member record, sets invited_at, sets exec_round_done_at/_by, writes one email_sends row per kind, and writes the audit entry with counts.
    4. After commit: sends exec_rejection emails, then creates each invitee's passwordless login and sends the invite email (the WP1 7-day set-password link). Failures are counted in the response (failed) and never undo the round.
  • Exec decisions are locked afterwards: PUT /submissions/:id/status already returns 409 once exec_round_done_at is set (WP5).
  • Shared email/batch.ts: recordEmailSend() and sendToAll() (loads the template once). Recruiting done reuses them.

Web: an Actions section on /recruitment with Exec round done… (superusers only, until it's pressed). It opens ConfirmStepModal, which lists every email kind and its count, shows blockers and warnings, and keeps Confirm disabled until the preview loads and nothing blocks it. Accept all and Recruiting done will reuse the modal.

Decisions to check

  • Undecided applications block Exec round done. TDD 2.3 says it "emails the candidates who weren't selected" but doesn't cover candidates nobody decided on. Treating them as rejections would email people no one rejected, so the preview names them and the button stays disabled until each is Selected or Not selected.
  • Selected without an exec position is only a warning. Positions are assigned separately by a superuser (TDD 3.2), so the round doesn't require them. The preview names who's missing one.
  • invite covers "selected and no login". A selected candidate who already has an account (e.g. a returning member) gets nothing from the tool; TDD says selected execs are told directly.

How to verify

  1. bun run test:all. API exec-round.test.ts: superuser-only, blocked while undecided, preview counts equal the emails actually sent, the invite carries a set-password link, email_sends + audit + exec_round_done_by written, second press is 409 with no new sends, decisions locked afterwards. Web stage-actions.test.ts: hidden for non-superusers, Confirm disabled until the preview loads, stays disabled on blockers, posts and shows the result.
  2. Manually: decide every exec application, press Exec round done… on /recruitment, and check the console email driver output matches the counts.

Screenshots

To follow with the demo seed (WP10).

Checklist

  • CI passes locally (format, lint, typecheck, tests, build)
  • TDD updated if behavior changed: see "Decisions to check"; nothing marked ‼️
  • No secrets or real member data in the diff

@VidurShah VidurShah mentioned this pull request Nov 30, 2026
3 tasks done
@VidurShah
VidurShah force-pushed the vidur/review-applications branch from aff65e4 to 2361eea Compare November 30, 2026 21:36
@VidurShah

Copy link
Copy Markdown
Collaborator Author

Updated:

  • Fix: failed emails are retryable. Migration 0010 adds email_sends.failed_recipients (a TDD 3.1 addition; invites keep the login so a resend gets a fresh link). New GET /semesters/:id/recruiting/sends and POST /semesters/:id/recruiting/resend (superuser, audited email.resend). A Recruiting emails card on the overview shows failures with a Resend failed button.
  • Exec round done is now also blocked while a Not selected candidate still holds an exec position.
  • The confirmation modal uses the shadcn Dialog.

@VidurShah
VidurShah force-pushed the vidur/review-applications branch from 2361eea to 6ce66fa Compare November 30, 2026 21:46
- GET /semesters/:id/recruiting/preview?step=exec lists the exec
  rejections and invites that would go out, plus blockers (undecided
  applications, already done) and warnings (selected without a position).
- POST /semesters/:id/recruiting/exec-done (superuser) locks the semester
  row, refuses if already done or undecided, links members, sets
  exec_round_done_at/by, records email_sends and an audit entry, then
  sends exec_rejection emails and invites after commit.
- Overview gains an Actions section with a confirmation modal that lists
  every email kind and its count; Confirm stays disabled until the
  preview loads and nothing blocks it.
…em (#53)

- email_sends.failed_recipients (migration 0010) stores the emails the
  provider rejected; invites keep the login so a resend gets a fresh link.
- Exec round done saves its failures; GET /semesters/:id/recruiting/sends
  lists sends with failure counts and POST /semesters/:id/recruiting/resend
  retries them without redoing anything (audited as email.resend).
- Exec round done is blocked while a Not selected candidate still holds
  an exec position.
…led emails (#53)

- ConfirmStepModal uses the shadcn Dialog, Alert and Button; the Actions
  buttons use Button.
- A Recruiting emails card on the overview (superusers) lists sends with
  failures and a Resend failed button.
@VidurShah
VidurShah changed the base branch from vidur/review-applications to main November 30, 2026 21:48
@VidurShah
VidurShah merged commit f6e1b27 into main Nov 30, 2026
1 check passed
@VidurShah
VidurShah deleted the vidur/exec-round branch November 30, 2026 21:48
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.

Exec round

1 participant