Remove Django comments (#1130) — phase 2: drop tables + notice types (merge after #1217 deploys) - #1218
Draft
rdhyee wants to merge 2 commits into
Draft
Remove Django comments (#1130) — phase 2: drop tables + notice types (merge after #1217 deploys)#1218rdhyee wants to merge 2 commits into
rdhyee wants to merge 2 commits into
Conversation
…ent tables Merge/deploy only AFTER the phase-1 code release (remove-comments-1130) is deployed and all Python processes restarted. See the migration header for the full rationale (queue-wedge scrub with restricted-unpickler label inspection + byte-scan fallback; ORM-cascade NoticeType/ContentType deletion; FK-ordered table drops). Codex R2 (MEDIUM) addressed: batch scrub now inspects the label slot of the queued five-tuples via a stubbed unpickler (no imports of the removed package, no reduce execution) instead of a raw byte scan; byte scan remains only as the conservative fallback for uninspectable pickles. Verified against synthetic fixtures incl. an unimportable embedded class and a label-in-prose false-positive case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DD8dp3nkAyH2KeZymEgW5W
rdhyee
force-pushed
the
comments-drop-migration-1130
branch
from
August 6, 2026 12:50
6b637e9 to
7e31c72
Compare
…go-1.6 era) Rehearsal on test surfaced 2 ContentType rows (app_label='comments', models comment/commentflag) with 6 attached permissions — leftovers from the original django.contrib.comments generation, sibling cruft to the django_comments rows already handled. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DD8dp3nkAyH2KeZymEgW5W
Member
Author
|
[CC] Rehearsed on test.unglue.it 2026-08-06 in the intended order (phase-1 deployed + restarted first, then this migration): 🤖 Posted by Claude Code on Raymond's behalf |
5 tasks
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.
Phase 2 of #1130: the destructive migration that finishes the comments removal — scrubs the notification queue, deletes the comment notice types and content types, and drops the
django_comments/django_comment_flagstables.⛔ Merge gate
Do not merge until phase 1 (#1217) is deployed to the target box and every Python process restarted (apache2, celeryd, celerybeat). That ordering — enforced by release sequencing rather than runbook discipline — is what makes this migration safe on every deploy path (
deploy.yml, the deploy guide §5 chained flow, or a fullsetup-*.ymlprovision). Prod additionally takes the standard pre-deploy RDS snapshot (the recovery path for the intentionally dropped data).What migration 0032 does, in order
core.0031) — catches any straggler batch created in phase 1's migrate→restart ingress window. Same restricted-unpickler label-slot inspection with byte-scan fallback; idempotent. This matters here because step 2 makes a missing NoticeType fatal tosend_all(): it tolerates missing users only, and any other exception escapes pastbatch.delete()into the outer bareexcept, permanently wedging the queue.NoticeTyperows via the ORM so deletion cascades toNoticeSetting/Notice/ObservedItem(RESTRICT FKs at the MySQL level; the collector deletes children first).django_commentsContentTyperows (cascades to theirauth_permissionrows).django_comment_flagsthendjango_comments(FK ordering).Verification
Scrub logic empirically tested against synthetic fixtures: comment batch embedding an unimportable class → scrubbed; non-comment batch with a comment label inside prose text (Codex R2's false-positive case) → kept; ordinary batch → kept; protocol-0 pickle → scrubbed.
Notes
django_migrationsrows for the removed app are inert (migrate --prunelater if desired)pip install -rnever uninstalls: thedjango-contrib-commentsdistribution stays inert in existing venvs until a rebuild🤖 Generated with Claude Code
https://claude.ai/code/session_01DD8dp3nkAyH2KeZymEgW5W