Drop coveragerecords and equivalentscoveragerecords tables (PP-4653)#3521
Drop coveragerecords and equivalentscoveragerecords tables (PP-4653)#3521dbernstein wants to merge 4 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>
Restore the resilience of the retired BibliographicCoverageProvider: catch and log exceptions from bibliographic.apply in _ensure_bibliographic_coverage so a database error or unexpected data shape during apply does not propagate out of update_licensepool. 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>
With the CoverageProvider machinery and the CoverageRecord / EquivalencyCoverageRecord models gone, BaseCoverageRecord had no remaining users except the workcoveragerecords-removal migration (01b1e464a9d1), which imported it only for the coverage_status enum values. Inline those values in that migration so it is self-contained, then drop the mixin. coverage.py now contains only the Timestamp model. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @dbernstein's task in 3m 55s —— View job Claude Code Review
SummaryThis is a clean, well-scoped "release 2" deletion. I verified there are no dangling references left behind: no DetailsMinor:
|
Greptile SummaryThis PR completes the second half of the CoverageProvider retirement by dropping the now-unused
Confidence Score: 5/5Safe to merge once the release containing PR #3520 has shipped; the PR itself contains no logic — only schema cleanup and the deletion of dormant models. Every changed file is a removal: dead model classes, orphaned ORM relationships, and their tests. The Alembic migration correctly sequences drops (indexes → tables → enum) and the downgrade recreates both tables with all FK constraints and partial indexes in the right order. No running code references the dropped objects, and a grep over the full src/ and tests/ tree confirms zero remaining imports of CoverageRecord, BaseCoverageRecord, or EquivalencyCoverageRecord. The older 01b1e464a9d1 migration is self-contained after inlining the enum values. The migration test validates the full round-trip. No files require special attention. Important Files Changed
|
27bf685 to
ac18fb5
Compare
Description
Stacked follow-up to #3520 ("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.It also removes the now-orphaned
BaseCoverageRecordmixin. Its only remaining user was theworkcoveragerecords-removal migration (01b1e464a9d1), which imported it solely for thecoverage_statusenum values; that migration is now self-contained (the enum values are inlined), so the mixin can go.coverage.pyis left containing only theTimestampmodel.Timestampand its separateservice_typeenum 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 (#3520) — 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), plus theTimestamptests. The01b1e464a9d1down-migration still recreatesworkcoveragerecordscorrectly with its inlined enum.Checklist
🤖 Generated with Claude Code