Drop coveragerecords and equivalentscoveragerecords tables (PP-4653)#3504
Drop coveragerecords and equivalentscoveragerecords tables (PP-4653)#3504dbernstein wants to merge 2 commits into
Conversation
Apply Overdrive bibliographic metadata directly instead of routing it through the CoverageProvider machinery, then delete the now-dead machinery. Nothing read the coverage rows: the only live caller of ensure_coverage was OverdriveAPI.update_licensepool (force=True, return value ignored), and the admin refresh_metadata endpoint was wired with no provider. The Celery apply task and the Bibliotheca updater already skipped coverage-record writes, so Overdrive was the last writer. - Rewrite OverdriveAPI.update_licensepool to fetch + apply metadata and make the work presentation-ready via a new _ensure_bibliographic_coverage helper, replacing OverdriveBibliographicCoverageProvider.ensure_coverage. - Stop writing coverage records: drop create_coverage_record from BibliographicData.apply and its call sites. - Delete core/coverage.py, the Overdrive and Bibliotheca coverage providers, the coverage-provider runner scripts, Identifier.missing_coverage_from, and the Explain script's coverage block. - Neutralize the now-dead admin refresh_metadata endpoint. - Leave the CoverageRecord model and coveragerecords table in place (dormant) for one release; the drop migration follows in a stacked PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow-up to "Retire the CoverageProvider machinery": now that no running code reads or writes the coverage tables, remove the CoverageRecord and EquivalencyCoverageRecord models, their relationships, and the tables themselves along with the shared coverage_status enum. - Remove CoverageRecord and EquivalencyCoverageRecord from sqlalchemy/model/coverage.py and the Identifier/DataSource/Collection coverage_records relationships. - Add a migration dropping coveragerecords and equivalentscoveragerecords and the now-orphaned coverage_status enum; the downgrade recreates them. - Keep the Timestamp model, its service_type enum, and the BaseCoverageRecord mixin (still referenced by the workcoveragerecords-removal migration). - Remove the obsolete CoverageRecord tests and the db.coverage_record fixture. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Greptile SummaryThis is the "Release 2" cleanup of the CoverageProvider retirement: it drops the
Confidence Score: 4/5Safe to merge once the release containing #3503 has shipped; the draft guard in the PR description is the only merge blocker. The change is a well-scoped cleanup: dead tables are dropped in the correct release slot per the N-1 convention, all code references to the removed models have been cleaned up, and the migration round-trips correctly. The only finding is a stale one-liner docstring on BaseCoverageRecord that still mentions the now-deleted CoverageRecord class. src/palace/manager/sqlalchemy/model/coverage.py — stale docstring on BaseCoverageRecord; all other files look clean. Important Files Changed
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3504 +/- ##
==========================================
+ Coverage 93.48% 93.56% +0.07%
==========================================
Files 511 508 -3
Lines 46570 45808 -762
Branches 6339 6221 -118
==========================================
- Hits 43538 42860 -678
+ Misses 1968 1913 -55
+ Partials 1064 1035 -29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Stacked follow-up to #3503 ("Retire the CoverageProvider machinery"). Now that no running code reads or writes the coverage tables, this PR removes the
CoverageRecordand (already-dormant)EquivalencyCoverageRecordmodels, thecoverage_recordsrelationships onIdentifier/DataSource/Collection, and drops thecoveragerecordsandequivalentscoveragerecordstables along with their sharedcoverage_statusenum.Timestamp, its separateservice_typeenum, and theBaseCoverageRecordmixin (still imported by theworkcoveragerecords-removal migration forstatus_enum) are retained.Motivation and Context
JIRA (PP-4653)
This is the "release 2" half of the CoverageProvider retirement. Per the online-migration / N-1 rule, the tables could not be dropped in the same release that stopped using them (#3503) — N-1 app servers still wrote to them during a rolling deploy.
How Has This Been Tested?
mypyandruffpass on all changed files.upgradedrops both tables and thecoverage_statusenum (leavingtimestamps/service_typeintact);downgraderecreates both tables with identical indexes, constraints, and foreign keys; a secondupgradedrops them again.tests/migration/suite passes undertox -e py312-docker(incl. pytest-alembic single-head / up-down-consistency / model-matches-DDL checks and a new drop test), along with theTimestamp, collection-deletion, identifier, and data-layerapplytests.Checklist
🤖 Generated with Claude Code