Skip to content

Release 0.139.4#3357

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

Release 0.139.4#3357
odlbot merged 3 commits intoreleasefrom
release-candidate

Conversation

@odlbot
Copy link
Copy Markdown
Contributor

@odlbot odlbot commented Mar 5, 2026

James Kachel

cp-at-mit

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:


## Changes for v1.yaml:


## Changes for v2.yaml:


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

@@ -280,23 +291,25 @@ def handle(self, *args, **kwargs): # pylint: disable=unused-argument # noqa: C
is_source_run=kwargs.get("source_course", False),
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 import_courserun command will crash with an unhandled Course.DoesNotExist exception if --use-specific-course is provided with a non-existent course ID.
Severity: MEDIUM

Suggested Fix

Wrap the call to import_courserun_from_edx within the import_courserun management command in a try...except Course.DoesNotExist block. In the except block, log a helpful error message indicating that the specified course was not found and continue to the next item in the loop.

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/management/commands/import_courserun.py#L291

Potential issue: When the `import_courserun` management command is run with the new
`--use-specific-course` argument, the `import_courserun_from_edx` function calls
`Course.objects.get()` with the provided readable ID. If this ID does not exist in the
database, a `Course.DoesNotExist` exception is raised. This exception is not handled in
either the API function or the calling management command, which will cause the command
to crash. Other parts of the same command include `try/except` blocks for similar
database lookups, indicating that error handling is the expected pattern and its absence
here is an oversight.

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

@odlbot odlbot merged commit d7ac15e into release Mar 5, 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.

3 participants