feat: refresh a book's metadata from providers on the edit page #89

Merged
jfro merged 1 commit from feat/refresh-metadata into main 2026-10-25 22:40:24 +00:00
Owner

Closes #79

The edit page gets Refresh from providers (disabled, with a tooltip, when the book has no ISBN). It opens GET /books/:id/refresh, which compares what's saved with what each provider has for the book's ISBN, and lets you pick per field.

  • BookLookup.lookup_all_by_isbn/2 asks every configured provider in parallel (Task.async_stream, 15s timeout, on_timeout: :kill_task), normalizes each answer like lookup_by_isbn/1, and skips unconfigured providers. A provider that raises or times out comes back as an error instead of failing the page. Each lookup logs provider, ISBN, outcome and duration.
  • The page shows one row per field where some provider differs: Current (selected by default) plus each provider's value, as radios, and a Use all button per provider column. Providers that didn't answer are listed above the table (e.g. "Google Books (HTTP 429)").
  • Apply selected posts book[...] to the existing PUT /books/:id, so validation is unchanged. Only offered fields are sent.
  • Offered: title, subtitle, author, publisher, publication date, pages, genre, series, series number, language, original title, description.
  • Never offered: ISBN-10/13, UPC, ASIN (a provider may answer for another edition), cover, and ebook OPF metadata (rating, tags, custom metadata).

Left out to keep it small: cover refresh, title+author refresh for books without an ISBN, background refresh.

Tests: book_lookup_all_test.exs (order, unconfigured skipped, raise and timeout isolated), book_refresh_test.exs (edit link and disabled state, only differing fields shown, identifiers never offered, apply updates only picked fields, nothing-differs message) and refresh_value/1 doctests. mix precommit green. Browser check at desktop and phone width against live providers: Open Library answered, Google (no-key quota) and LoC reported in the banner; Use all + Apply saved the picked publisher.

Note: books added from the ISBN/title lookup tabs only keep title/author/ISBN/language/cover, so this is also the way to fill in their publisher, pages, description, etc.

Closes #79 The edit page gets **Refresh from providers** (disabled, with a tooltip, when the book has no ISBN). It opens `GET /books/:id/refresh`, which compares what's saved with what each provider has for the book's ISBN, and lets you pick per field. - `BookLookup.lookup_all_by_isbn/2` asks every configured provider in parallel (`Task.async_stream`, 15s timeout, `on_timeout: :kill_task`), normalizes each answer like `lookup_by_isbn/1`, and skips unconfigured providers. A provider that raises or times out comes back as an error instead of failing the page. Each lookup logs provider, ISBN, outcome and duration. - The page shows one row per field where some provider differs: Current (selected by default) plus each provider's value, as radios, and a **Use all** button per provider column. Providers that didn't answer are listed above the table (e.g. "Google Books (HTTP 429)"). - **Apply selected** posts `book[...]` to the existing `PUT /books/:id`, so validation is unchanged. Only offered fields are sent. - Offered: title, subtitle, author, publisher, publication date, pages, genre, series, series number, language, original title, description. - **Never offered:** ISBN-10/13, UPC, ASIN (a provider may answer for another edition), cover, and ebook OPF metadata (rating, tags, custom metadata). Left out to keep it small: cover refresh, title+author refresh for books without an ISBN, background refresh. Tests: `book_lookup_all_test.exs` (order, unconfigured skipped, raise and timeout isolated), `book_refresh_test.exs` (edit link and disabled state, only differing fields shown, identifiers never offered, apply updates only picked fields, nothing-differs message) and `refresh_value/1` doctests. `mix precommit` green. Browser check at desktop and phone width against live providers: Open Library answered, Google (no-key quota) and LoC reported in the banner; Use all + Apply saved the picked publisher. Note: books added from the ISBN/title lookup tabs only keep title/author/ISBN/language/cover, so this is also the way to fill in their publisher, pages, description, etc.
jfro added this to the v0.9.0 milestone 2026-10-25 21:15:40 +00:00
feat: refresh a book's metadata from providers on the edit page
All checks were successful
CI / test (pull_request) Successful in 56s
ab056fad03
A Refresh from providers button on the edit page (disabled without an
ISBN) opens a comparison page: every configured provider is asked for
the ISBN in parallel (BookLookup.lookup_all_by_isbn/2), and each field
where a provider differs gets a row with the current value and each
provider's, picked by radio, plus a Use all button per provider. The
picks post to the existing update action.

ISBNs, UPC, ASIN, cover and ebook metadata are never offered.

Closes #79
jfro merged commit 8485b43d96 into main 2026-10-25 22:40:24 +00:00
jfro deleted branch feat/refresh-metadata 2026-10-25 22:40:24 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/fuzzy_catalog!89
No description provided.