Coverage for src/local_deep_research/research_library/extraction_catalog.py: 100%
5 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-22 21:20 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-22 21:20 +0000
1"""Catalog identifiers for arXiv HTML-extracted text provenance.
3``LibraryDocument.extraction_method`` and ``.extraction_source``
4(``database/models/library.py``) are plain unconstrained strings, not
5SQLAlchemy ``Enum`` columns, so adding a new catalog value never changes
6the schema Alembic ships -- see the docstring on ``ExtractionMethod`` /
7``ExtractionSource`` in that file.
9The ``"html_extraction"`` / ``"arxiv_html"`` values ``DownloadService``
10persists for an HTML-extracted arXiv download (see
11``_arxiv_text_provenance`` in
12``research_library/services/download_service.py``) are defined here,
13outside ``database/models/``, rather than as new members on the
14pre-existing enums in ``library.py``. That keeps every file under
15``database/models/`` byte-identical to the merge base, which two tests
16enforce:
18* ``test_migration_chain_integrity.py::test_every_file_behind_the_alembic_metadata_is_unchanged_since_the_fork``
19* ``test_upgrade_from_pre_migration_install.py::test_pr_changes_no_orm_model``
21Both treat any edit to a file backing ``Base.metadata`` (or anything
22under ``database/models/``) as presumed schema drift, regardless of
23whether the specific edit actually changes a column -- so a value that
24does not need to live there should not.
25"""
27import enum
30class ExtractionMethodExtra(str, enum.Enum):
31 """Extraction-method catalog values added after the merge base."""
33 HTML_EXTRACTION = "html_extraction"
36class ExtractionSourceExtra(str, enum.Enum):
37 """Extraction-source catalog values added after the merge base."""
39 ARXIV_HTML = "arxiv_html"