Skip to content

feat(events): cancellation and waitlist promotion #242

Closed

Description

@danielhe4rt

Parent

#237

What to build

Implement cancellation with deadline validation and automatic waitlist promotion (FIFO) when a confirmed participant cancels.

Action: CancelEnrollmentAction

  • Validates: enrollment status must be confirmed, waitlisted, or pending
  • Validates deadline: now() < event.starts_at - policy.cancellation_deadline_hours
  • Transitions enrollment to cancelled, sets cancelled_at timestamp
  • Records transition in audit trail (triggered_by=user, reason optional)
  • If the cancelled enrollment was confirmed AND there are waitlisted enrollments: trigger promotion

Action: PromoteFromWaitlistAction

  • Finds the oldest waitlisted enrollment (ordered by enrolled_at ASC, LIMIT 1)
  • Transitions it to confirmed, sets confirmed_at, clears waitlist_position
  • Records transition (triggered_by=system, reason="slot opened from cancellation")
  • Dispatches EnrollmentConfirmed domain event for the promoted enrollment
  • Recalculates waitlist_position for remaining waitlisted enrollments (optional optimization: just leave gaps)

App panel:

  • "Cancel" button visible on enrollment when:
    • Status is confirmed, waitlisted, or pending
    • Deadline has not passed
  • Shows "Cancellation deadline passed" message when deadline expired
  • Confirmation dialog before cancelling

Admin panel:

  • "Cancel Enrollment" action available on enrollment records (bypasses deadline — admin override)
  • Shows cancellation reason in transitions log

Edge cases:

  • Cancellation after deadline: rejected with 422 and message showing deadline
  • Cancellation of waitlisted: does NOT trigger promotion (no slot was freed)
  • Multiple cancellations in quick succession: each promotes the next in line

Acceptance criteria

  • Participant can cancel within deadline → status changes to cancelled
  • Cancellation after deadline is rejected with clear error message
  • Cancelling a confirmed enrollment promotes next waitlisted participant (FIFO)
  • Promoted participant gets confirmed status with proper transition record
  • EnrollmentConfirmed is dispatched for promoted enrollment
  • Cancelling a waitlisted enrollment does not trigger promotion
  • Admin can cancel any enrollment regardless of deadline
  • Transition audit trail records actor and reason for all cancellations
  • Feature tests: cancel within deadline, cancel after deadline, waitlist promotion, admin override
  • Pint passes

Blocked by

Activity

  1. added
    enhancement
    ready-for-agent
    type:feat
    mod:events
    and removed
    enhancement
    ready-for-agent
    on May 17, 2026
  2. changed the title [-]Events: Cancellation + Waitlist promotion[/-] [+]feat(events): cancellation and waitlist promotion[/+] on May 23, 2026
  3. added a commit that references this issue on Aug 15, 2026
    bd5cd67
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

    difficulty:mediummod:eventstype:feat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions