Repository navigation
fix(file-system): drop the retired desktop folder tables - #122447
Conversation
1285 removed FileSystemFolderInstructions and FileSystemFolderContextGeneration from Django state but kept their tables and their deferred foreign keys to posthog_team, posthog_user and posthog_filesystem. Django no longer cascades into them, so deleting a team, user or folder they reference fails at COMMIT. SafeDropTable drops both tables after canvas.0003 has copied their rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
😎 Merged successfully - details. |
🤖 CI report
|
|
|
Risk: No findings This PR adds one migration (posthog.1412) that drops the two retired desktop file-system tables left behind by migration 1285, using the existing SafeDropTable helper and depending on canvas.0003 so the row copy into the channel models runs first. I traced the ordering, the lock phase, and the dependency resolution and found no security issue: no attacker-controlled input, no auth surface, and the drop fails closed if the copy migration cannot run. Sentinel reviewed |
Problem
1285_drop_desktop_file_system.py(feat(canvas): build and securely deliver cloud artifacts #73874) removed two models from Django state but kept their tables and foreign keys.posthog_team,posthog_userandposthog_filesystemand areDEFERRABLE INITIALLY DEFERRED. Django no longer cascades into the tables, so the delete fails at COMMIT.Changes
1412dropsposthog_filesystemfolderinstructionsandposthog_filesystemfoldercontextgenerationwithSafeDropTable, the step the table retirement guide says is owed.canvas.0003_migrate_desktop_tree, which copies these rows into the channel models, so no database drops them before the copy.SafeDropTableskips a missing table.Note
SafeDropTablebriefly takes ACCESS EXCLUSIVE onposthog_team,posthog_userandposthog_filesystem, under a budget of half ofdeadlock_timeout. If it loses the race, the migration gives up andbin/migrateretries it, so live reads are never the deadlock victim (#100779).How did you test this code?
1412as a no-op.1412and succeed after it. A rerun of1412is a no-op.LOCK TABLE posthog_filesystem, posthog_team, posthog_user, <both tables> IN ACCESS EXCLUSIVE MODEunder a 500mslock_timeoutandstatement_timeout, thenDROP TABLE IF EXISTS.analyze_migration_risk: "Needs Review", properly staged;makemigrations --check: no changes.Test rationale: no new test.
SafeDropTablehas its own tests, and this migration only names tables.Release status
Docs update
None.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5
/django-migrations,/writing-pr-descriptions.LookupErrorincanvas.0003) and does not drop the tables.🤖 Generated with Claude Code