Skip to content

refactor: extract cross-source Paper merge into service/_merge.py - #26

Merged
Burton-David merged 1 commit into
mainfrom
refactor/extract-merge
May 31, 2026
Merged

refactor: extract cross-source Paper merge into service/_merge.py#26
Burton-David merged 1 commit into
mainfrom
refactor/extract-merge

Conversation

@Burton-David

Copy link
Copy Markdown
Owner

What

LibraryService imported _merge_records directly from service/search.py — one service reaching into another service's private symbol for what is really shared infrastructure (cross-source Paper enrichment). The ROADMAP flagged this under "Code organization."

Move the field-by-field merge into service/_merge.py as merge_records, along with its _pick_* / _merge_metadata helpers and the _ID_PREFIX_RANK id-preference table (all used only by the merge). Both SearchService (in-search dedup) and LibraryService (ingest-time enrichment) now import it from the shared module.

No behavior change — the merge logic is byte-for-byte the same, just relocated and renamed (dropping the leading underscore now that it's a module's intended API rather than a private symbol).

Test plan

  • ruff check src tests — clean (verified no unused imports left behind in search.py)
  • mypy src — clean
  • pytest -q --strict-markers — 524 passed, 14 skipped; test_search_service.py (merge/dedup) and test_library_service.py (enrichment) cover the moved code

`LibraryService` imported `_merge_records` straight out of `service/search.py`
— a service reaching into another service's private symbol for shared infra.
Move the field-by-field merge (and its _pick_* / _merge_metadata helpers and
the id-preference table) into `service/_merge.py` as the public
`merge_records`, which both SearchService (in-search dedup) and LibraryService
(ingest enrichment) import. No behavior change — the search/library service
tests cover the merge paths.
@Burton-David
Burton-David merged commit bb83492 into main May 31, 2026
1 check passed
@Burton-David
Burton-David deleted the refactor/extract-merge branch May 31, 2026 15:40
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