create_single_event_occurrence and create_recurrence_rule return 500 for an unknown event_id #66

Open
opened 2026-10-03 19:44:43 +00:00 by jalenluorion · 0 comments
Member

What's wrong
Both are site-admin, "testing purposes" routes.

  • POST /api/events/create_single_event_occurrence: ZoneInfo(event.event_timezone) (L421) and event.last_updated_at (L423) run before if not event (L426), so an unknown event_id raises AttributeError, so 500 instead of 404.
  • POST /api/events/create_recurrence_rule: never checks the event (L368) and passes None to populate_event_occurrences(), so 500.

How to reproduce
As a site admin (bearer(**SITE_ADMIN)):

POST /api/events/create_single_event_occurrence
{"event_id": 999999, "org_id": 1, "category_id": 1, "title": "t",
 "start_datetime": "2026-11-01T10:00:00-05:00", "end_datetime": "2026-11-01T11:00:00-05:00", "recurrence": "ONETIME"}
POST /api/events/create_recurrence_rule
{"event_id": 999999, "frequency": "WEEKLY", "interval": 1, "start_datetime": "2026-11-01T10:00:00-05:00"}

Both return 500.

Expected
404 {"error": "Event not found"}, checked before the event is used.

Where to look

  • api/app/api/events.py create_recurrence_rules() L347-386 and create_single_event_occurrence() L390-458.
  • Line numbers are from main at 2c5f2e9.

Done when

  • both return 404 for an unknown event
  • tests in api/tests/api/test_error_responses.py
**What's wrong** Both are site-admin, "testing purposes" routes. - `POST /api/events/create_single_event_occurrence`: `ZoneInfo(event.event_timezone)` (L421) and `event.last_updated_at` (L423) run before `if not event` (L426), so an unknown `event_id` raises AttributeError, so 500 instead of 404. - `POST /api/events/create_recurrence_rule`: never checks the event (L368) and passes None to `populate_event_occurrences()`, so 500. **How to reproduce** As a site admin (`bearer(**SITE_ADMIN)`): ``` POST /api/events/create_single_event_occurrence {"event_id": 999999, "org_id": 1, "category_id": 1, "title": "t", "start_datetime": "2026-11-01T10:00:00-05:00", "end_datetime": "2026-11-01T11:00:00-05:00", "recurrence": "ONETIME"} POST /api/events/create_recurrence_rule {"event_id": 999999, "frequency": "WEEKLY", "interval": 1, "start_datetime": "2026-11-01T10:00:00-05:00"} ``` Both return 500. **Expected** 404 `{"error": "Event not found"}`, checked before the event is used. **Where to look** - `api/app/api/events.py` `create_recurrence_rules()` L347-386 and `create_single_event_occurrence()` L390-458. - Line numbers are from main at 2c5f2e9. **Done when** - [ ] both return 404 for an unknown event - [ ] tests in `api/tests/api/test_error_responses.py`
jalenluorion added this to the Phase 2 milestone 2026-10-03 19:44:43 +00:00
jalenluorion added this to the CMUCal project 2026-10-03 19:45:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ScottyLabs/cal#66
No description provided.