Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jennifer-richards
Copy link
Member

@jennifer-richards jennifer-richards commented Aug 1, 2025

This moves all our JSONField model/form fields to Django's internal classes. These have been available since Django 3.3, and the jsonfield package has been deprecated as of version 3.2.0.

Fixes #9266

We can't actually remove the jsonfield dependency because several0001_* migrations refer to it. After we have merged this PR, we will need to plan another migration reset so we can drop those references. We may want to do this along with or shortly after the Django 5.x migration next year.

Before the migrations can succeed, we need to clean up three Submissions that have null characters in them. These are

>>> Submission.objects.filter(authors__icontains="u0000").values_list("pk", flat=True)
<QuerySet [21133, 21175, 21208]>

These seem to be real cancelled submissions, as the bad data was eventually fixed and the draft submitted successfully. Probably a fixup in the admin to remove the null characters is most appropriate. Testing locally, replacing the \u0000 strings with "(null)" in the authors fields for those drafts allows migrations to succeed. Note that doing this requires #9285 be merged first.

Edit: we can now modify the submissions, but I've also added a step to the migration to fix them automatically. This replaces them with \u2400, which has the virtue of being a single glyph that renders as ␀. This migration protects us against the very unlikely case that another record is created with a null character in it. I checked other places where JSONField is in use - I don't think the others depend on user-generated content in a way that benefits from more thoroughly guarding the migrations.

@jennifer-richards jennifer-richards marked this pull request as ready for review August 15, 2025 15:58
@codecov
Copy link

codecov bot commented Aug 15, 2025

Codecov Report

❌ Patch coverage is 93.18182% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.73%. Comparing base (f5df667) to head (6e6df70).
⚠️ Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
ietf/utils/db.py 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9284      +/-   ##
==========================================
- Coverage   88.74%   88.73%   -0.02%     
==========================================
  Files         320      320              
  Lines       41674    41784     +110     
==========================================
+ Hits        36984    37075      +91     
- Misses       4690     4709      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rjsparks rjsparks merged commit 0694863 into ietf-tools:main Aug 15, 2025
10 checks passed
@jennifer-richards jennifer-richards deleted the ditch-jsonfield-pkg branch August 15, 2025 22:23
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

migrate away from deprecated jsonfield package

2 participants