Skip to content

fix(metadata): stop rendering Audible's not-found stub as a book - #43

Merged
nexalapp merged 1 commit into
canaryfrom
fix/audible-stub-unknown-title
Sep 1, 2026
Merged

fix(metadata): stop rendering Audible's not-found stub as a book#43
nexalapp merged 1 commit into
canaryfrom
fix/audible-stub-unknown-title

Conversation

@nexalapp

@nexalapp nexalapp commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Looking a book up by ASIN showed "Unknown Title" for anything Audible has no product for.

Cause

Audible's catalogue API answers 200 with a stub rather than 404 for an unknown ASIN:

{"product":{"asin":"B0DFKPXBWQ","asset_details":[],"is_vvab":false},
 "response_groups":["always-returned"]}

AudibleProductMapper.MapProductToBookResponse required only an ASIN, so it mapped that stub into a "book" with every other field empty. The API returned it as a 200 and the UI rendered result.title || 'Unknown Title'.

MetadataController already turns a null result into a 404, and useSearch already has a "No audiobook was found with ASIN …" message for it. Neither ever fired, because the result was never null.

Fix

Require a non-blank title in the mapper. A real Audible product always has one, so its absence is the signal that nothing came back. All three call sites — single lookup, batch lookup and product search — only checked Asin, so fixing the one choke point fixes them all.

The same mapper feeds the monitored-series catalogue via GetBooksMetadataByAsinsAsync, so a stub in a series' relationships array would have added a titleless phantom book to the library. This closes that too.

It also logs a warning when a document maps to nothing. The stub is indistinguishable from Audible declining to answer properly for a particular host, so if every lookup logs this, the ASINs are fine and the catalog API is the problem — which is worth being able to see from the logs.

Verified against the running API

Before:

GET /api/v1/metadata/B0DFKPXBWQ?region=us
200 {"metadata":{"asin":"B0DFKPXBWQ","authors":[],"narrators":[],"genres":[],"series":[],"region":"us"}}

After:

GET /api/v1/metadata/B0DFKPXBWQ?region=us   ->  404 No metadata found for ASIN: B0DFKPXBWQ
GET /api/v1/metadata/B08G9PRS1K?region=us   ->  200 {"metadata":{"asin":"B08G9PRS1K","title":"Project Hail Mary",…}}

Testing

AudibleProductMapperStubTests covers the stub captured verbatim from the live API, blank and whitespace titles, the unchanged missing-ASIN guard, a non-object document, and a real product mapping through untouched.

  • dotnet format clean; the Metadata, Search, Monitoring, Catalog and architecture suites show the same 46 failures as canary, compared by stashing and re-running rather than assumed.
  • Frontend untouched: 739 tests and vue-tsc pass.

Scope note

If ASIN lookups are failing for every ASIN on a particular deployment, this change turns "Unknown Title" into an honest "not found" and puts a warning in the log, but the underlying cause would be that host's access to api.audible.com — worth checking with a direct curl from that machine.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YCsUgtQ6zHRVnRAnWjjryc

Looking a book up by ASIN showed "Unknown Title" for anything Audible has
no product for. Audible answers 200 with a stub rather than 404 —
{"asin":…,"asset_details":[],"is_vvab":false} under an "always-returned"
response group — and the mapper accepted it because it required only an
ASIN. That produced a book with every other field empty, which the
lookup UI rendered as "Unknown Title".

MetadataController already turns a null result into a 404, and the UI
already has a "No audiobook was found with ASIN" message for it; neither
ever fired because the result was never null. Requiring a title in the
mapper makes both work as intended. A real product always carries one.

The same mapper feeds the monitored-series catalogue, so a stub in a
series' relationships array would have added a titleless phantom book to
the library. This closes that too.

Log a warning when a document maps to nothing, because the stub cannot be
told apart from Audible refusing to answer properly for a given host — if
every lookup logs this, the ASINs are fine and the catalog API is not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YCsUgtQ6zHRVnRAnWjjryc
@nexalapp nexalapp added the patch Version bump: patch (x.y.Z) label Sep 1, 2026
@nexalapp
nexalapp merged commit 1aa3168 into canary Sep 1, 2026
3 of 4 checks passed
@nexalapp
nexalapp deleted the fix/audible-stub-unknown-title branch September 1, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Version bump: patch (x.y.Z)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant