Add management command for auditing missing sources#5711
Add management command for auditing missing sources#5711bjester merged 3 commits intolearningequality:hotfixesfrom
Conversation
rtibblesbot
left a comment
There was a problem hiding this comment.
Audit command for missing import sources on public channels, with CTE support added to the Channel model. Code is clean and well-structured.
CI: linting and frontend builds pass; Python unit tests still pending. The "Update community pull requests spreadsheet" failure is an unrelated admin workflow.
- suggestion: Command name vs. current behavior mismatch (inline)
- suggestion: Duplicate CTE construction (inline)
- nitpick:
.gitignoreadditions are unrelated to the PR scope but harmless
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
Reviewed the pull request diff checking for:
- Correctness: bugs, edge cases, undocumented behavior, resource leaks, hardcoded values
- Design: unnecessary complexity, naming, readability, comment accuracy, redundant state
- Architecture: duplicated concerns, minimal interfaces, composition over inheritance
- Testing: behavior-based assertions, mocks only at hard boundaries, accurate coverage
- Completeness: missing dependencies, unupdated usages, i18n, accessibility, security
- Principles: DRY (same reason to change), SRP, Rule of Three (no premature abstraction)
- Checked CI status and linked issue acceptance criteria
- For UI changes: inspected screenshots for layout, visual completeness, and consistency
contentcuration/contentcuration/management/commands/fix_missing_import_sources.py
Show resolved
Hide resolved
contentcuration/contentcuration/management/commands/fix_missing_import_sources.py
Show resolved
Hide resolved
|
|
||
|
|
||
| class ChannelModelQuerySet(models.QuerySet): | ||
| class ChannelModelQuerySet(CTEQuerySet): |
There was a problem hiding this comment.
praise: Good approach — inheriting from CTEQuerySet instead of models.QuerySet keeps the custom create/update_or_create methods intact while adding CTE support. The ChannelModelManager via from_queryset is the correct Django pattern for this.
rtibbles
left a comment
There was a problem hiding this comment.
I ran it locally and got this:
INFO:contentcuration.management.commands.fix_missing_import_sources:=== Iterating over private destination channels. ===
INFO:contentcuration.management.commands.fix_missing_import_sources:=== Done iterating over private destination channels. ===
INFO:contentcuration.management.commands.fix_missing_import_sources:Found 0 nodes across 0 channels.
INFO:contentcuration.management.commands.fix_missing_import_sources:Finished in 0.015901565551757812
Which seems accurate :)
Further testing we can do live.
Summary
References
#5683
Reviewer guidance
fix_missing_import_sources.csvin your CWDLLMs