Skip to content

Fix advanced-search ASIN lookup returning "Unknown Title" (#525)#735

Open
Paelsmoessan wants to merge 1 commit into
Listenarrs:canaryfrom
Paelsmoessan:fix/525-asin-title-guard
Open

Fix advanced-search ASIN lookup returning "Unknown Title" (#525)#735
Paelsmoessan wants to merge 1 commit into
Listenarrs:canaryfrom
Paelsmoessan:fix/525-asin-title-guard

Conversation

@Paelsmoessan

Copy link
Copy Markdown

Problem

Advanced search by ASIN can return a result with the literal title "Unknown Title" (blank cover, "Unknown Author") when Audible has no title for that ASIN. This happens with delisted / old-edition ASINs, or via Library Import reading an ASIN from file tags with no user-typed title. These titleless ghost results can then be added to the library.

Root cause

StructuredSearchWorkflow.TryExecuteAsinSearchAsync returned whatever ConvertMetadataToSearchResultAsync produced, guarded only by if (md != null), with no title validation. That converter falls back to the literal "Unknown Title" when the metadata title is empty, and this inlined path short-circuits before the validated unified search path (IntelligentSearchAsync then AsinSearchHandler, which already rejects titleless results) can run.

Fix

Add a title guard mirroring AsinSearchHandler's existing check: when the built result has no usable title (empty, "Unknown Title", or "Amazon.com"), return null so the flow falls through to the validated unified path instead of surfacing a titleless result. Valid ASINs with a real title are unaffected.

Tests

Adds SearchControllerAsinTitleGuardTests:

  • titleless ASIN metadata falls through to unified search (no ghost result)
  • valid-title ASIN is handled inline and does not fall through

Also verified manually: advanced ASIN search on a delisted/titleless ASIN now returns a clean "No results" instead of an "Unknown Title" card, and normal ASIN search is unchanged.

Scope

Scoped to the advanced-search ASIN path. The analogous series shortcut (TryExecuteSeriesSearchAsync) shares the pattern but is left out of scope here.

Closes #525.

🤖 Generated with Claude Code

The inlined ASIN lookup in StructuredSearchWorkflow.TryExecuteAsinSearchAsync
returned whatever ConvertMetadataToSearchResultAsync produced, including its
literal "Unknown Title" fallback, when an ASIN was searched with no title
(e.g. Library Import reading the ASIN from file tags). It also short-circuited
before the validated unified search path could run.

Add a title guard mirroring AsinSearchHandler: when the built result has no
usable title (empty / "Unknown Title" / "Amazon.com"), return null so the
flow falls through to IntelligentSearchAsync -> AsinSearchHandler instead of
surfacing a titleless result. Valid ASINs (real title) are unaffected.

Adds regression tests covering both the titleless fall-through and the
valid-title no-fall-through cases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Paelsmoessan Paelsmoessan requested a review from a team July 5, 2026 19:24
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.

[Bug] Duplicate ASIN lookup in SearchController bypasses AsinSearchHandler and returns "Unknown Title" results

1 participant