Fix advanced-search ASIN lookup returning "Unknown Title" (#525)#735
Open
Paelsmoessan wants to merge 1 commit into
Open
Fix advanced-search ASIN lookup returning "Unknown Title" (#525)#735Paelsmoessan wants to merge 1 commit into
Paelsmoessan wants to merge 1 commit into
Conversation
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>
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.
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.TryExecuteAsinSearchAsyncreturned whateverConvertMetadataToSearchResultAsyncproduced, guarded only byif (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 (IntelligentSearchAsyncthenAsinSearchHandler, 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"), returnnullso 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: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