Conversation
MapMetadataResultToAudibleAsync falls back to the fields a MetadataSearchResult already carries when the Audible product lookup cannot be made. That result holds the series as a name only, with no identifier, and the fallback filled the series entry's asin with a copy of the name. Every client downstream treats that field as an identifier. The library import wizard reads it, keeps it because it is the right length, and posts it as a membership's seriesAsin, so a series name lands in the one column whose value is that it is not a name. Foundation, Bartimaeus and Peripheral are all ten characters and all real series. The author fallback three lines above already reports a null asin for exactly this reason. The series fallback now matches it. Co-Authored-By: Claude Fable 5.1 <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.
Fixes #979.
SearchResponseMapper.MapMetadataResultToAudibleAsyncfalls back to synthesizing an Audible-shaped result when the Audible product lookup returns nothing. In that fallback, the synthesized series entry puts the series name into itsasinfield, rather than leaving it null. The two non-fallback shapes elsewhere in the same file maps.Asinhonestly, so a caller cannot tell from the response which branch produced the result it got. This matters now because three separate consumers have started reading a series ASIN off search results into the database:AudiobookSeriesMembership.SeriesAsin, the library-import wizard's membership construction, andAudibleBookMetadata.seriesAsinas a legacy fallback identifier. A series name landing in the one field meant to be a stable identifier is worse than merely cosmetic.The fix is one line: emit
asin = (string?)nullin the fallback series entry instead of the series name, matching what the author fallback three lines above already does for the identical reason.Four tests in
SearchResponseMapperSeriesFallbackTests, driven through a metadata service that returns no Audible product so the fallback path is what's under test: the series entry reports no identifier, it still carries name and position, the author fallback beside it is asserted to share the same convention, and a result with no series emits an empty list. The first fails against current code withExpected: Null, Actual: String.Suite run against current canary (
upstream/canaryata630572e9, which this branch is built on): targeted filterSearchResponseMapperSeriesFallbackTests, 4 passed, 0 failed.Once this lands, the client-side shape check the library-import wizard currently uses as a guard (which #847 already tightened, but which is leaky by construction) can be removed rather than maintained. Scope is one line plus the test file; out of #847's scope, per that PR's own body.
Disclosure: drafted with Claude Code at my direction; I read the cited code at commit a630572 and reviewed this before posting.