Skip to content

Release 0.141.1#3374

Merged
odlbot merged 3 commits intoreleasefrom
release-candidate
Mar 11, 2026
Merged

Release 0.141.1#3374
odlbot merged 3 commits intoreleasefrom
release-candidate

Conversation

@odlbot
Copy link
Copy Markdown
Contributor

@odlbot odlbot commented Mar 11, 2026

Nathan Levesque

@github-actions
Copy link
Copy Markdown

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:
4 changes: 0 error, 0 warning, 4 info
info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API POST /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API DELETE /api/v3/enrollments/{id}/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v3/enrollments/{id}/
		endpoint added



## Changes for v1.yaml:
4 changes: 0 error, 0 warning, 4 info
info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API POST /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API DELETE /api/v3/enrollments/{id}/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API GET /api/v3/enrollments/{id}/
		endpoint added



## Changes for v2.yaml:
4 changes: 0 error, 0 warning, 4 info
info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API POST /api/v3/enrollments/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API DELETE /api/v3/enrollments/{id}/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v2.yaml	
	in API GET /api/v3/enrollments/{id}/
		endpoint added



Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Comment on lines +67 to +70
user = self.context["user"]
run_id = validated_data["run_id"]
run = models.CourseRun.objects.filter(id=run_id).first()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The create method in CourseRunEnrollmentSerializer accesses validated_data["run_id"], but the serializer doesn't declare a run_id field, which will cause a KeyError on enrollment creation.
Severity: CRITICAL

Suggested Fix

Add run_id = serializers.IntegerField(write_only=True) to the CourseRunEnrollmentSerializer class definition and include "run_id" in the Meta.fields list. This will align the v3 serializer with the behavior of the v1 and v2 versions.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: courses/serializers/v3/courses.py#L67-L70

Potential issue: The `create` method in the v3 `CourseRunEnrollmentSerializer` accesses
`validated_data["run_id"]` to create a new enrollment. However, the serializer itself
does not declare a `run_id` field, nor is it included in the `Meta.fields` list. When a
POST request is made to the `/api/v3/enrollments/` endpoint, the Django Rest Framework
will not include `run_id` in the `validated_data` dictionary because it's not a defined
field. This will cause the `create` method to fail with a `KeyError` for every
enrollment creation attempt, breaking this core functionality.

Did we get this right? 👍 / 👎 to inform future reviews.

@odlbot odlbot merged commit 29cf34c into release Mar 11, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants