Skip to content

chore(sc-46275): drop the UserExperimentSettings table (phase 4) - #3574

Closed
dcschreiber wants to merge 2 commits into
chore/sc-46274/phase-3-remove-experiments-frameworkfrom
chore/sc-46275/phase-4-drop-userexperimentsettings-table
Closed

chore(sc-46275): drop the UserExperimentSettings table (phase 4)#3574
dcschreiber wants to merge 2 commits into
chore/sc-46274/phase-3-remove-experiments-frameworkfrom
chore/sc-46275/phase-4-drop-userexperimentsettings-table

Conversation

@dcschreiber

Copy link
Copy Markdown
Contributor

(Claude writing on Daniel's behalf)

Phase 4 of sc-46240 — sub-task sc-46275. The deploy after Phase 3.

Stacked on #3573 (Phase 3), which is itself stacked on #3572. Rebase onto master as each lands.

  • reader/migrations/0002 deletes the model and its table; reader/models.py is now empty.
  • scripts/migrations/archive_user_experiment_settings.py dumps the rows to CSV first — reversing a DeleteModel recreates the schema, not the data. It reads the table with raw SQL rather than the model this PR deletes, so it must be run before the deploy applies the migration.
  • The Phase 2 flip scripts are removed: the forward migration sourced its cohorts from this table and can no longer run, and its rollback window closed in Phase 3. What they did survives in the Mongo archive collection they wrote (library_assistant_migration_archive).

Deploy-day order

  1. Run python scripts/migrations/archive_user_experiment_settings.py against production and keep the CSV.
  2. Deploy (the migration applies).

🤖 Generated with Claude Code

@gitvelocity-reviewer

gitvelocity-reviewer Bot commented Aug 3, 2026

Copy link
Copy Markdown

📊 Code Quality Score: 14/100

Base Score 34 × ESF 0.4 = 13.6, rounded to 14

Category Score Factors
🔭 Scope 7/20 4 files across migrations, models, and scripts; single subsystem (reader app); removes a model and associated operational scripts; no new public APIs or external integrations
🏗️ Architecture 6/20 Removes a model from the system (architectural cleanup); no new patterns or dependencies introduced; the delete+recreate migration pair adds minor migration graph complexity
⚙️ Implementation 5/20 Migration boilerplate is straightforward Django; archive script uses intentional raw SQL to avoid model dependency; deleted scripts had moderate complexity (batch writes, MongoDB, idempotency) that is now gone
⚠️ Risk 9/20 Database table drop with data loss risk if archive script not run first; 0002+0003 migration pair creates acknowledged technical debt and migration state complexity; no automated enforcement of operational sequencing; acknowledged TODO to squash before merge
✅ Quality 6/15 Excellent inline documentation in migrations and archive script; no tests for archive script or migrations; acknowledged pre-merge TODO embedded in production migration code; missing DJANGO_SETTINGS_MODULE guidance in usage docs
🔒 Perf / Security 1/5 No notable performance or security considerations; raw SQL uses parameterized-style query with no user input; LEFT JOIN handles orphaned rows correctly

Was this score accurate? 👍 Yes · 👎 No

How this was scored →

Scored by GitVelocity · How are scores calculated?

@dcschreiber
dcschreiber force-pushed the chore/sc-46274/phase-3-remove-experiments-framework branch from c6dfbe0 to 1e9c92d Compare August 3, 2026 10:29
@dcschreiber
dcschreiber force-pushed the chore/sc-46275/phase-4-drop-userexperimentsettings-table branch from 62ff5cd to 0fa1202 Compare August 3, 2026 10:29
@dcschreiber
dcschreiber marked this pull request as draft August 3, 2026 10:36
Nothing has read the experiments whitelist since the framework was removed a deploy
ago. reader/migrations/0002 deletes the model and its table; reader/models.py is now
empty.

Reversing a DeleteModel recreates the schema, not the rows, so
scripts/migrations/archive_user_experiment_settings.py dumps them to CSV first — it
reads the table with raw SQL rather than the model this commit deletes, and must run
before the deploy applies the migration.

The Phase 2 flip scripts go too: the forward migration sourced its cohorts from this
table and can no longer run, and its rollback window closed when the legacy fallback
was removed. What they did is preserved in the Mongo archive collection they wrote.
@dcschreiber
dcschreiber force-pushed the chore/sc-46274/phase-3-remove-experiments-framework branch from 1e9c92d to 70b7852 Compare August 3, 2026 10:38
@dcschreiber
dcschreiber force-pushed the chore/sc-46275/phase-4-drop-userexperimentsettings-table branch from 0fa1202 to 4d94a38 Compare August 3, 2026 10:38
CI applied this branch's 0002 DeleteModel to the shared cauldron Postgres
(sandbox web pods run migrate on boot) and to the shared pytest database
(--reuse-db). Recreating the table through a follow-up migration lets the
same CI machinery repair both databases on its next run. Squash 0002+0003
into one fresh-named delete migration before this branch merges.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dcschreiber
dcschreiber marked this pull request as ready for review August 3, 2026 11:40
@dcschreiber
dcschreiber marked this pull request as draft August 3, 2026 12:43
@dcschreiber

Copy link
Copy Markdown
Contributor Author

(Claude writing on Daniel's behalf) Closed: with the experiments framework staying in the codebase (see #3579), the model — and therefore its table — stays. Phase 4 is now a script run that archives and deletes the rows and unsets profiles.experiments (scripts/migrations/wipe_experiments_data.py, shipped in #3579). No schema change.

@dcschreiber dcschreiber closed this Aug 4, 2026
@dcschreiber
dcschreiber deleted the chore/sc-46275/phase-4-drop-userexperimentsettings-table branch August 4, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant