Skip to content

feat(metadata): multi-provider abstraction (LoC, DNB, K10plus, Open Library)#128

Merged
phildenhoff merged 2 commits into
mainfrom
cdl-7-marc21-national-library-metadata-provider
Jun 14, 2026
Merged

feat(metadata): multi-provider abstraction (LoC, DNB, K10plus, Open Library)#128
phildenhoff merged 2 commits into
mainfrom
cdl-7-marc21-national-library-metadata-provider

Conversation

@phildenhoff

Copy link
Copy Markdown
Member

Summary

Makes Hardcover one metadata source among several. With no Hardcover key configured, ISBN lookup still works via the keyless library providers.

Live providers: Library of Congress, Deutsche Nationalbibliothek, K10plus (SRU/MARC21), Open Library (JSON), and Hardcover (GraphQL). All five lookups verified end-to-end against the real endpoints.

Backend (src-tauri/src/metadata/)

  • Unified BookMetadata model + three provider-agnostic Tauri commands behind enum dispatch (Tauri/specta-safe; provider crosses as a string).
  • Config-driven SRU endpoint registry — adding a MARC21 library is a data row, not code (that's how K10plus was added).
  • quick-xml MARCXML parser: author inversion ("Last, First" → display order, corporate names left alone), 6xx subjects, 008/041 language, entity decoding (&), and ISBN-match verification.
  • Open Library JSON client; Hardcover moved in with unchanged behaviour.
  • ISBN 10↔13 equivalence lives here as the single authority.

Frontend

  • Capability-driven provider registry + a streaming aggregator that dedupes by ISBN to one whole record (cover backfill is the only borrowed field) and pins the file's ISBN match.
  • One unified MetadataSearchModal with source provenance and a designed cover-less placeholder.
  • Provider-agnostic hooks for the Edit and Add-Book flows; a "Metadata sources" settings pane; library subjects offered as opt-in tag-suggestion chips.
  • Language is parsed but applied later (CDL-2).

Settings migration

Flat hardcoverApiKey/hardcoverAutoLookup → a provider block. Versioned: v0→v1 folds the Hardcover key in; v1→v2 adds K10plus. Keyless libraries default on; existing Hardcover keys preserved.

Also fixes

  • Edit Book showing a stale cover after a lookup — cache-bust the single-book cover URL by mtime (list paths stay stat-free at scale).
  • Settings panel content shifting sideways when a scrollbar appears.
  • Provider-row switch alignment; Add Book modal label truncation.
  • "Matches ISBN" picker badge contrast in light and dark.

Testing

  • Rust: MARCXML mapping for LoC/DNB/K10plus, ISBN equivalence, entity decoding, cover cache-bust — all green.
  • Frontend: aggregator dedup/pin/cover-backfill, settings migration — 166 tests green.
  • format:check, bun lint (web + clippy), tsc all clean.
  • Verified live: all five providers return correct data; settings migration applied; picker streams merged results with provenance; subject chips add to tags.

Note: British Library was considered but is excluded — its SRU/Z39.50 endpoints remain offline after the 2023 cyberattack. It's a one-row add when they return.

Fixes CDL-7

🤖 Generated with Claude Code

…ibrary)

Make Hardcover one metadata source among several. With no Hardcover key
configured, ISBN lookup still works via the keyless library providers.

Backend (src-tauri/src/metadata/): a unified BookMetadata model and three
provider-agnostic Tauri commands behind enum dispatch. A config-driven SRU
endpoint registry powers Library of Congress, Deutsche Nationalbibliothek and
K10plus (MARC21/slim via a quick-xml parser: author inversion, 6xx subjects,
008/041 language, entity decoding, ISBN-match verification). Open Library is a
keyless JSON provider; Hardcover (GraphQL) moves in unchanged in behaviour.
ISBN 10<->13 equivalence lives here as the single authority.

Frontend: a capability-driven provider registry + a streaming aggregator that
dedupes by ISBN to one whole record (with cover backfill as the only borrowed
field) and pins the file's ISBN match. One unified MetadataSearchModal with
source provenance and a designed cover-less placeholder; provider-agnostic
hooks for the edit and import flows; a "Metadata sources" settings pane; and
library subjects offered as opt-in tag-suggestion chips. Language is parsed but
applied later (CDL-2).

Settings migrate from the flat hardcoverApiKey/hardcoverAutoLookup keys to a
provider block (v0->v1, then v1->v2 adds K10plus), with the keyless libraries
enabled by default and existing Hardcover keys preserved.

Also fixes:
- Edit Book showing a stale cover after a lookup: cache-bust the single-book
  cover URL by mtime (the list paths stay stat-free at scale).
- Settings panel content shifting sideways when a scrollbar appears.
- Provider-row switch alignment; Add Book modal label truncation.
- "Matches ISBN" picker badge contrast in light and dark.

Fixes CDL-7

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

CDL-7

…-library-metadata-provider

# Conflicts:
#	src/components/organisms/AddBook.tsx
@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 80.81%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

@phildenhoff phildenhoff merged commit c212a96 into main Jun 14, 2026
7 checks passed
@phildenhoff phildenhoff deleted the cdl-7-marc21-national-library-metadata-provider branch June 14, 2026 19:00
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