Repository navigation
Release 1.162.6 - #3851
Merged
Merged
Release 1.162.6#3851
Conversation
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…when generating certificates (#3848)
OpenAPI ChangesShow/hide changesUnexpected changes? Ensure your branch is up-to-date with |
| user=user, program=node.required_program, is_revoked=False | ||
| ).exists() | ||
|
|
||
| return _has_earned_program_cert(user, node.program) |
Contributor
There was a problem hiding this comment.
Bug: The recursive call to _has_earned_program_cert incorrectly uses node.program instead of node.required_program, causing an infinite loop and a crash when checking programs with sub-program requirements.
Severity: HIGH
Suggested Fix
Change the recursive call from _has_earned_program_cert(user, node.program) to _has_earned_program_cert(user, node.required_program). This ensures the function correctly recurses into the required sub-program instead of calling itself with the same arguments.
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/api.py#L1282
Potential issue: In the function `_has_earned_program_cert`, a recursive call is made
using `node.program` which refers to the parent program already in the call stack. This
should instead use `node.required_program` to check the sub-program. This mistake leads
to an infinite recursion loop, ultimately causing a `RecursionError` crash. This bug is
triggered when the function is called for a program that has a sub-program requirement
and the parent program itself does not have a verified enrollment mode.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
James Kachel
annagav
cp-at-mit