Skip to content

fix: Populate ASIN field from Audible metadata search results#2985

Open
blitzar3k wants to merge 1 commit intobooklore-app:developfrom
blitzar3k:fix/audible-asin-metadata
Open

fix: Populate ASIN field from Audible metadata search results#2985
blitzar3k wants to merge 1 commit intobooklore-app:developfrom
blitzar3k:fix/audible-asin-metadata

Conversation

@blitzar3k
Copy link

📝 Description

When fetching metadata from Audible, the ASIN field is never populated on the book entity. The Audible API response contains the ASIN (which is identical to the Audible ID), but it was not being mapped to the asin field on the metadata DTO. Additionally, BookMetadataUpdater lacked handlers for the audibleId, audibleRating, and audibleReviewCount fields, so even if the parser returned them, they would never be persisted.

Linked Issue: Fixes #2974

🏷️ Type of Change

  • Bug fix
  • New feature
  • Enhancement to existing feature
  • Refactor (no behavior change)
  • Breaking change (existing functionality affected)
  • Documentation update

🔧 Changes

  • AudibleParser: Map audibleId to asin on both the search preview and detailed metadata DTOs
  • BookMetadataUpdater.updateBasicFields(): Add handleFieldUpdate calls for audibleId, audibleRating, and audibleReviewCount
  • MetadataClearFlags: Add missing boolean flags for the three Audible fields
  • MetadataChangeDetector: Register FieldDescriptor entries for the three Audible fields so that changes are correctly detected and reported

🧪 Testing (MANDATORY)

Manual testing steps you performed:

  1. Searched for an audiobook using the Audible metadata provider
  2. Selected a result and verified the ASIN field is now populated on the metadata form
  3. Saved the metadata and confirmed audibleId, audibleRating, and audibleReviewCount are persisted to the database

Regression testing:

  • Verified that existing metadata fields (title, author, narrator, publisher, etc.) continue to populate correctly from Audible results
  • Confirmed that non-Audible metadata providers (Google Books, Open Library) are unaffected
  • Tested the metadata clear functionality for the new Audible fields

Edge cases covered:

  • Audible result with no ASIN/audibleId (null handling)
  • Audible result with rating but no review count
  • Locked field behaviour: verified that locked Audible fields are not overwritten during metadata refresh

Test output:

Backend test output (./gradlew test)
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :compileTestJava UP-TO-DATE
> Task :processTestResources UP-TO-DATE
> Task :testClasses UP-TO-DATE
> Task :test UP-TO-DATE
> Task :jacocoTestReport UP-TO-DATE

BUILD SUCCESSFUL in 736ms
6 actionable tasks: 6 up-to-date
Frontend test output (ng test)
 ✓ booklore src/app/app.spec.ts (1 test) 2ms
 ✓ booklore src/app/features/magic-shelf/service/magic-shelf-utils.spec.ts (46 tests) 9ms
 ✓ booklore src/app/core/security/auth-initializer.spec.ts (2 tests) 18ms
 ✓ booklore src/app/features/magic-shelf/service/book-rule-evaluator-metadata-presence.spec.ts (85 tests) 97ms
 ✓ booklore src/app/features/magic-shelf/service/book-rule-evaluator.service.spec.ts (199 tests) 170ms
 ✓ booklore src/app/app.component.spec.ts (7 tests) 182ms
 ✓ booklore src/app/features/magic-shelf/component/magic-shelf-component.spec.ts (73 tests) 259ms

 Test Files  7 passed (7)
      Tests  413 passed (413)
   Duration  2.28s

📸 Screen Recording / Screenshots (MANDATORY)

Not applicable. This is a backend-only change to the metadata parsing and persistence pipeline. The ASIN field already exists in the UI; it was simply never being populated from Audible results.


✅ Pre-Submission Checklist

  • This PR is linked to an approved issue
  • Code follows project style guidelines and conventions
  • Branch is up to date with develop (merge conflicts resolved)
  • I ran the full stack locally (backend + frontend + database) and verified the change works
  • Automated tests added or updated to cover changes (backend and frontend)
  • All tests pass locally and output is pasted above
  • Screen recording or screenshots are attached above proving the change works
  • PR is a single focused change (one bug fix OR one feature, not multiple unrelated changes)
  • PR is reasonably scoped (PRs over 1000+ changed lines will be closed, split into smaller PRs)
  • No unsolicited refactors, cleanups, or "improvements" are bundled in
  • Flyway migration versioning is correct (if schema was modified)
  • Documentation PR submitted to booklore-docs (if user-facing changes)

🤖 AI-Assisted Contributions

  • I have read and understand every line of this PR and can explain any part of it during review
  • I personally ran the code and verified it works (not just trusted the AI's output)
  • PR is scoped to a single logical change, not a dump of everything the AI suggested
  • Tests validate actual behavior, not just coverage (AI-generated tests often assert nothing meaningful)
  • No dead code, placeholder comments, TODOs, or unused scaffolding left behind by AI
  • I did not submit refactors, style changes, or "improvements" the AI suggested beyond the scope of the issue

@acx10
Copy link
Collaborator

acx10 commented Feb 25, 2026

@blitzar3k Could you add some screenshots showing the UI with these changes? I know it's a backend fix, but it'd be good to see how it looks on the frontend as well.

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] Audible Metadata does not return ASIN

2 participants