dpub-meta: live Open Library smoke test (gated)#25
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.