Return 400 for malformed lesson, course session and attendance session writes
π Looking for an issue? Welcome! This issue is open for contribution. If this is the first time youβre requesting an issue, please:
- Read Contributing guidelines carefully. Pay extra attention to Using generative AI. Pull requests and comments that donβt follow the guidelines wonβt be answered.
- Confirm that youβve read the guidelines in your comment.
Overview
Lesson and course session updates return a 500 when the body isn't a JSON object, and creating an attendance session returns a 500 when the same learner appears twice. These should return a 400.
Complexity: Low Target branch: develop
Context
On develop at fe298f5449 (coach):
PATCH /api/lessons/lesson/<id>/with[1]raisesTypeError, and with"ab"raisesValueError, fromdict(data)in an overriddento_internal_value(lesson.py#L128).PATCH /api/courses/coursesession/<id>/with[1]raisesTypeErrorfromOrderedDict(data)(course_session.py#L173).POST /api/attendance/attendancesession/with twoattendance_recordsfor the same user raisesIntegrityError(attendance_session.py#L81).
The Change
- The lesson and course session serializers should reject a body that isn't a JSON object before converting it.
- The attendance session serializer should reject duplicate users in
attendance_records.
Acceptance Criteria
- [ ] Each request under Context returns 400 and saves nothing.
- [ ] Valid lesson, course session and attendance session updates behave as before.
- [ ] Tests cover each request under Context.
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.
Hi! π
This issue is available for contribution and supports self-assignment. Here's how to get started:
- Comment
/assignto assign yourself to this issue - You can have up to 2 issues assigned at a time across all community repos
- Dropping an issue has a 7-day cooldown before the slot opens up
- Link your pull request to this issue when you submit it
π Read the Contributing guidelines before starting.
Are you preparing for Google Summer of Code? See our GSoC guidelines.
hi, I wanna work on this assign it to me
Hi! π
Thanks for your interest! This issue supports self-assignment. Comment /assign to assign yourself.
Visit Contributing guidelines to learn about the contributing process. π
Are you preparing for Google Summer of Code? See our GSoC guidelines.
/assign
Hi! π
You've been assigned to this issue. Here's what to do next:
- Read the issue description carefully and make sure you understand the requirements
- Link your pull request to this issue when you submit it
- If you can no longer work on this, unassign yourself so others can pick it up
Good luck! π
Are you preparing for Google Summer of Code? See our GSoC guidelines.
/assign
Hi! π
Thanks so much for your interest! This issue is already assigned. 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.