Skip to content

fix: return 404 for missing rating event#799

Merged
OSEH-svg merged 1 commit into
Agora-Events:mainfrom
nanookclaw:fix/rating-missing-event-404
Jun 1, 2026
Merged

fix: return 404 for missing rating event#799
OSEH-svg merged 1 commit into
Agora-Events:mainfrom
nanookclaw:fix/rating-missing-event-404

Conversation

@nanookclaw
Copy link
Copy Markdown

Fixes #571.

This updates the event rating handler so a request for a missing path event ID returns the existing AppError::NotFound response instead of falling through to database-error behavior.

The handler now verifies the path event_id after the ticket lookup and before the ticket/event ownership check. That keeps the existing ordering for invalid ratings and missing tickets, while preserving the 403 response when a real event is rated with a ticket from another event.

The aggregate update also uses fetch_optional and maps a no-row result to NotFound, so the transaction has the same behavior if the event row disappears before the UPDATE ... RETURNING * completes.

Verification:

  • git diff --check

I also tried cargo fmt --check, cargo check --lib, and focused cargo test --lib ... commands. They currently fail before this change is checked because of unrelated existing compile/format issues in routes/mod.rs, EventSocialProofResponse Redis deserialization, and an existing SearchParams test initializer.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

@nanookclaw is attempting to deploy a commit to the oseh-svg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@OSEH-svg OSEH-svg merged commit 4e5f2bb into Agora-Events:main Jun 1, 2026
1 check failed
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.

Return 404 instead of 500 when an event rating references a non-existent event

2 participants