Conversation
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
OpenAPI ChangesShow/hide ## Changes for v0.yaml:Unexpected changes? Ensure your branch is up-to-date with |
| if failed_certificates: | ||
| # We indicate IDs, but errors should also be logged to sentry from within create_verifiable_credential | ||
| level = messages.WARNING | ||
| message = f"Successfully requested verifiable credential backfill for {len(certificates)} {self.model._meta.model_name} certificates, but encountered errors for certificates with IDs: {[cert.id for cert in failed_certificates]}" # noqa: SLF001 |
There was a problem hiding this comment.
Bug: The admin message for credential backfill incorrectly reports the total certificate count as successful, even when some certificates fail processing.
Severity: LOW
Suggested Fix
Update the message string to calculate the number of successful operations correctly. Instead of using len(certificates), use len(certificates) - len(failed_certificates) to reflect the actual number of successfully processed certificates when failures are present.
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/admin.py#L59
Potential issue: In the `populate_verifiable_credentials_for_certificate` admin action,
when some certificates fail the backfill process, the resulting message is misleading.
The message reports that `len(certificates)` certificates were successfully processed,
which is the total number of certificates attempted. However, it also lists the
certificates that failed. This creates a contradiction and misinforms the admin user
about the actual number of successful operations. The correct count of successful
backfills should be the total count minus the number of failures.
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.
annagav
James Kachel
Dan Subak
renovate[bot]
pre-commit-ci[bot]