Skip to content

fix: return 404 for deleted activity in activity_retrieve endpoint - #2037

Merged
divbzero merged 1 commit into
developfrom
fix-test
Apr 10, 2026
Merged

fix: return 404 for deleted activity in activity_retrieve endpoint#2037
divbzero merged 1 commit into
developfrom
fix-test

Conversation

@sricharan-varanasi

Copy link
Copy Markdown
Contributor

Changes

  • Added null check after ActivitiesCRUD.get_by_id() - raises ActivityDoeNotExist (404) when activity is not found
  • Updated test assertion to expect HTTP 404 instead of != 200

Why

Previously, fetching a deleted activity without a version would cause a NullPointerError or undefined behavior downstream (attempting schema.applet_id on None). Now it returns a proper 404.

Notes

  • ActivityDoeNotExist already existed in apps/activities/errors.py
  • Only affects the unversioned code path in activity_retrieve (the versioned path was already safe)

- Add null check after ActivitiesCRUD.get_by_id() to raise ActivityDoeNotExist
- Update test assertion to expect HTTP 404 instead of generic != 200

@divbzero divbzero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sricharan-varanasi The fix looks good and works on my machine. Thank you!

@divbzero
divbzero merged commit d2072f8 into develop Apr 10, 2026
3 checks passed
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.

2 participants