Skip to content

dpub-meta: live Open Library smoke test (gated)#25

Merged
roelvangils merged 1 commit into
mainfrom
test/openlibrary-smoke
May 5, 2026
Merged

dpub-meta: live Open Library smoke test (gated)#25
roelvangils merged 1 commit into
mainfrom
test/openlibrary-smoke

Conversation

@roelvangils
Copy link
Copy Markdown
Member

Summary

Closes the saved question 7 from earlier: does the `--auto-cover` success path actually work end-to-end against a real, well-indexed book? Yes — verified by adding three gated tests in `crates/dpub-meta/tests/openlibrary.rs`.

What's tested

  1. ISBN path — `identifier="9780141439518"` (Pride and Prejudice). Asserts a real JPEG > 1 KiB comes back.
  2. Title + author fallback — same book, no identifier, forces the `search.json?title=...&author=...` route. Asserts the same outcome.
  3. Quiet miss — gibberish title + author returns `Ok(None)`, not an error.

Gating

All three tests are gated behind `DPUB_TEST_OPENLIBRARY=1`. Skipped silently otherwise so CI doesn't depend on Open Library uptime, and so contributors without internet aren't blocked. Matches the existing `DPUB_TEST_*` pattern (`DPUB_TEST_BOOK`, `DPUB_TEST_OPUS`, `DPUB_TEST_WHISPER_MODEL`).

Live verification

Ran with the env var set — ISBN path returned a 35 KiB JPEG (Pride and Prejudice by Jane Austen, cover_i=14348537); title+author path resolved to the same record; gibberish correctly returned None. All passed in 3.4 s.

README

Added one row to the local-development table explaining the env var.

Three tests in `crates/dpub-meta/tests/openlibrary.rs`:

  1. ISBN-shaped identifier path: known-good lookup
     (Pride and Prejudice, ISBN 9780141439518) returns a real
     JPEG > 1 KiB.
  2. Title + author fallback path (no identifier given):
     same book, same outcome via the search.json route.
  3. Gibberish title + author returns Ok(None) (the
     intentionally-quiet miss path).

All three are gated behind `DPUB_TEST_OPENLIBRARY=1` so CI and
contributors without that env var skip silently. We don't want
the test suite to fail because Open Library was briefly
slow or someone is offline.

Verified against the live API: ISBN path returned a 35 KiB JPEG
("Pride and Prejudice" by Jane Austen, cover_i=14348537);
title+author path resolved to the same record; gibberish
correctly returned None.

README's local-development table gains a row advertising the
env var.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@roelvangils roelvangils merged commit 3fdc2f0 into main May 5, 2026
@roelvangils roelvangils deleted the test/openlibrary-smoke branch May 5, 2026 23:01
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