Return 404 for out-of-range integer ids in ValuesViewset
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Viewsets with integer primary keys return a 500 (OverflowError) for ids outside SQLite's 64-bit integer range. ValuesViewset.serialize_object and DRF's get_object_or_404 catch ValueError and TypeError, but OverflowError is neither. ValuesViewset should return a 404 for these ids, so every integer-id viewset gets the fix.
Complexity: Low Target branch: develop
Context
Requests that return 500 on develop at fe298f5449 (minimum role in brackets):
GET /api/exams/exam/99999999999999999999/(coach). AlsoPATCH.exam.py#L581.GET /api/logger/generatecsvlogrequest/99999999999999999999/(facility admin).
serialize_object is at kolibri/core/api.py#L327-L336.
The Change
- A
ValuesViewsetdetail request with an integer id outside the 64-bit signed integer range should return 404.
Acceptance Criteria
- [ ] Each request under Context returns 404.
- [ ]
DELETEwith the same ids returns 404. - [ ] Integer ids inside the range behave as before.
- [ ] Tests cover retrieve, update and destroy.
AI usage
I had Claude Code sweep Kolibri's API code for unvalidated request input and reproduce each 500 with a test. I chose the fix and the split into sub-issues. Claude Code drafted the issue to the pattern of #15838.
/assign
Hi! I've read the contributing guidelines, including the part about generative AI. I'd like to work on this one. Plan: return 404 when a ValuesViewset detail request gets an integer id outside the 64-bit range, with tests for retrieve, update and destroy.
Hi! 👋
Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.
We really appreciate your willingness to help. 😊
Are you preparing for Google Summer of Code? See our GSoC guidelines.