Drop customlist_sharedlibraries (PP-4773) - #3695
Conversation
|
Claude finished @jonathangreen's task in 3m 59s —— View job Code review
SummaryThe drop is clean and the release-2 mechanics check out: no reference to DetailsMinor:
|
Greptile SummaryThe PR removes the legacy custom-list sharing association table after sharing state moved to
Confidence Score: 4/5The PR is not yet safe to merge because rollback can expose shared lists to libraries that lacked the corresponding historical association. The downgrade still reconstructs every shared list’s legacy rows using an unconditional cross join, although the preceding migration discarded which individual libraries were historically authorized. Files Needing Attention: alembic/versions/20260901_5b1f4f3c7979_drop_customlist_sharedlibraries.py
|
| Filename | Overview |
|---|---|
| alembic/versions/20260901_5b1f4f3c7979_drop_customlist_sharedlibraries.py | Drops the obsolete table on upgrade, but its downgrade still broadens historical per-library sharing when reconstructing associations. |
| src/palace/manager/sqlalchemy/model/customlist.py | Removes the obsolete association-table definition from SQLAlchemy metadata consistently with the upgrade migration. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Current schema] -->|upgrade| B[Drop customlist_sharedlibraries]
B --> C[Sharing represented by customlists.shared_locally]
C -->|downgrade| D[Recreate legacy association table]
D --> E[Populate associations for every non-owning library]
Reviews (2): Last reviewed commit: "Drop customlist_sharedlibraries" | Re-trigger Greptile
| FROM customlists c CROSS JOIN libraries l | ||
| WHERE c.shared_locally AND c.library_id IS DISTINCT FROM l.id | ||
| """ | ||
| ) |
There was a problem hiding this comment.
Downgrade broadens list sharing
When a shared list was historically restricted because one or more libraries failed the former per-library validation, this cross join recreates associations for every non-owning library, causing the downgraded application to expose the list or a thin or empty lane to libraries that were previously excluded.
Knowledge Base Used:
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. |
There was a problem hiding this comment.
The generated Alembic revision-identifiers comment remains in the committed migration, adding template noise contrary to the repository’s migration convention.
| # revision identifiers, used by Alembic. |
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Sharing state moved to customlists.shared_locally in the previous release, which left this table unused but still in Base.metadata so that the release before it kept working while that migration ran online. Both of those releases are now behind us, so the table can go. The downgrade recreates and repopulates the table rather than leaving it out: the preceding revision's upgrade reads it, so alembic's up/down consistency test walks back through a schema where it has to exist. Do not merge until a release containing the previous PR has shipped. Until then the backwards compatibility check on this branch is expected to fail, because it tests against the last published release, which still reads the table.
4868609 to
ef8bd5f
Compare
Description
Drops the
customlist_sharedlibrariestable and removes itsTabledefinition from the model.Do not merge until a release containing #3694 (the first PR in this stack) has shipped. Until then the
Backwards compatibility teston this branch is expected to fail: it tests against the last published release, which still reads the table.The drop deliberately does not re-run the previous PR's backfill. That release stopped writing to the table entirely, including when a list is unshared, so any list unshared since then still has its rows; repeating the backfill would silently re-share every one of them. The deploy-window race it would otherwise catch is minutes long and self-correcting.
The
downgraderecreates and repopulates the table rather than leaving it out. The preceding revision'supgradereads it, so pytest-alembic'stest_up_down_consistencywalks back through a schema where it has to exist.Motivation and Context
PP-4773, release 2 of the online-migration split described in CLAUDE.md. Sharing state moved to
customlists.shared_locallyin the previous release, which left the table unused but still inBase.metadataso the release before it kept working while that migration ran.How Has This Been Tested?
tox -e py312-docker -- tests/migration— 19 passed, including up/down consistency across the drop and recreate.tox -e py312-docker -- tests/manager/sqlalchemy tests/manager/api/admin— 1128 passed.mypyclean../docker/ci/test_backwards_compatibility.sh 149127422run locally with this branch as the current side, proving the previous PR genuinely stopped using the table. CI cannot check this until PR 1 has been released, which is why it was verified locally first.Checklist