You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes permanently blocked exports caused by SubmissionSupplement records with content={} (created by get_or_create when the subsequent revise_data call crashed). Two targeted changes unblock the path: the export guard now skips empty supplements when checking for un-migrated data, and the management command stamps those empty supplements with _version (instead of silently skipping them) so they are no longer flagged on future runs.
Confidence Score: 5/5
Safe to merge — both changes are minimal, well-scoped, and handle the edge case correctly without introducing new failure paths.
No P0 or P1 issues found. The export guard exclusion is semantically correct (empty supplements have nothing to migrate), and the management command stamping with SCHEMA_VERSIONS[0] is consistent with how the rest of the command treats fully-migrated records. The stranded_qs loop safely handles newly-stamped empty supplements because only the _version key is present and it is already explicitly skipped in the inner loop.
No files require special attention.
Sequence Diagram
sequenceDiagram
participant User
participant ExportTask
participant DB as SubmissionSupplement
participant MgmtCmd as mgmt cmd
User->>ExportTask: trigger export
ExportTask->>DB: check for un-migrated supplements
alt non-empty supplements without stamp exist
DB-->>ExportTask: blocked
ExportTask-->>User: SupplementMigrationInProgress
else only empty or stamped supplements
DB-->>ExportTask: clear
ExportTask->>ExportTask: stream_with_supplements
ExportTask-->>User: export succeeds
end
note over MgmtCmd: Run separately to repair DB
MgmtCmd->>DB: fetch un-stamped supplements
loop each supplement
alt empty content
MgmtCmd->>MgmtCmd: stamp with latest schema version
else has data
MgmtCmd->>MgmtCmd: migrate and stamp
end
end
MgmtCmd->>DB: bulk update stamped records
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
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.
📣 Summary
Exports were permanently blocked for some projects due to incomplete NLP supplement records that the migration command could not fix.
👀 Preview steps
QuestionAdvancedFeaturerecords and aSubmissionSupplementwithcontent={}(simulates a crashedrevise_data)SupplementMigrationInProgress; running the management command skips the supplement and does not fix it_version