fix: advance batch offset past unmigratable logs in auditlogmigratejson - #838
Open
Sanjays2402 wants to merge 1 commit into
Open
fix: advance batch offset past unmigratable logs in auditlogmigratejson#838Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
Log entries whose changes_text is not valid JSON are reported as errors but stay in the get_logs() queryset. Every batch re-fetched the same unconvertible entries from the top of the queryset, so once a batch was filled with them the migration made no further progress and the entries behind them were never migrated. The batch window now advances by the number of entries that failed conversion, and the queryset is explicitly ordered by primary key so the offset is stable across batches. Adds a regression test that places an unmigratable entry ahead of a migratable one and asserts the latter is still migrated.
2ykwang
self-requested a review
July 25, 2026 08:52
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #838 +/- ##
=======================================
Coverage 96.33% 96.34%
=======================================
Files 35 35
Lines 1256 1259 +3
=======================================
+ Hits 1210 1213 +3
Misses 46 46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #667
Log entries whose
changes_textis not valid JSON are reported as errors but stay in theget_logs()queryset, and each batch re-fetched the same entries from the top of that queryset. Once a batch filled up with unconvertible entries the migration stopped making progress, so everything behind them was never migrated (the symptom in the issue: repeated runs report a large remaining count).The batch window now advances by the number of entries that failed conversion, and the queryset is ordered by primary key so that offset is stable across batches.
The new
test_using_django_batched_skips_unmigratable_logsputs an unmigratable entry ahead of a migratable one; it fails onmaster(AssertionError: unexpectedly None) and passes with the fix.