Isolate per-file extraction failures in canvas and edX content syncs - #3752
Closed
mbertrand wants to merge 12 commits into
Closed
Isolate per-file extraction failures in canvas and edX content syncs#3752mbertrand wants to merge 12 commits into
mbertrand wants to merge 12 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d archives empty Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
load_content_files no-ops for non-course resources, so the randomized factory type made the test order-dependent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
OpenAPI ChangesNo changes detected Unexpected changes? Ensure your branch is up-to-date with |
content_files_loaded_actions fires search indexing gated by randomized resource fields; when the draw enables it, the eager task hits the nonexistent test opensearch and the resulting Retry is swallowed by process_course_archive's bare except, leaving the checksum unstamped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What are the relevant tickets?
Closes #3750
Description (What does it do?)
One PDF that crashes the OCR converter currently aborts an entire canvas course sync before any contentfiles load — course
33842-7.06is stuck at 0 contentfiles on production because a single answer-key PDF crashes opendataloader (RasterFormatException). The same per-file loop (process_olx_path) serves edX archive ingestion and canvas tutor problem files, so any extractor exception kills those syncs the same way.This branch makes a failing file cost exactly that one file:
load_content_files' staleness/unpublish pass (canvas and edX), and the tutor problem orphan delete. Files that fail are simply absent this run — no empty placeholder rows.run.checksum, so a deterministic crash isn't re-downloaded and re-OCR'd weekly (failed files retry when the archive next changes, or via--overwrite). A total failure does not stamp, so the course retries next sync instead of looking legitimately empty. Same on edX: an all-failed archive is no longer mistaken for an empty one.No new database queries — the exclusions chain onto existing lazy querysets, and with no failures the generated SQL is identical to main.
How can this be tested?
Use the course from the issue — its current archive contains the PDF that crashes the converter, so it exercises the real failure path. With env pointed at the canvas course bucket (
CANVAS_COURSE_BUCKET_NAMEetc.) and OCR enabled:main, run./manage.py backpopulate_canvas_courses --canvas-ids 33842and watch it die on7.06_Fall2025_Exam1_answers.pdf(FileNotFoundErrorfor the converter output JSON) with the course left at 0 contentfiles.OCR extraction failed ... falling back to tikawarning for the answer-key PDF(s), the course going from 0 to ~158 contentfiles (the fallback text may be sparse), andrun.checksumset.--overwrite— it should logChecksums match ... skipping loadinstead of re-downloading and re-extracting.39194from the same incident) and sync it — no existing contentfiles should be deleted or flipped topublished=Falsebecause of extraction failures.