Repository navigation
feat(audiobooks): emit non-null imagePath for photo-bearing ABS authors - #316
Conversation
GetAuthorByID selected poster_path from the people table, but the
person-image column is photo_path, so every GET /api/authors/{id}
request failed with SQLSTATE 42703 and a 500. Since photo_path is
NOT NULL DEFAULT '', the nullable scan is also dropped.
Co-Authored-By: Claude Fable 5 <[email protected]>
Author responses always emitted imagePath: null, so ABS clients never
fetched /api/authors/{id}/image even though it works and ~7% of
audiobook authors have a people.photo_path. Real ABS puts a server-local
filesystem path in imagePath and clients treat any non-null value as the
cue to fetch the image endpoint, so a synthetic ABS-shaped path is
emitted whenever the person has a photo.
The detail path reads the flag from Author.PosterPath. The list path
carries a new AuthorSummary.HasPhoto: the MV query LEFT JOINs people at
read time (photo presence stays current instead of stale until the next
REFRESH) and the live fallback selects photo_path alongside its existing
people join.
Co-Authored-By: Claude Fable 5 <[email protected]>
…e corrected GetAuthorByID query
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a ChangesAuthor photo flag propagation
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant LibrariesHandler
participant AuthorSeriesHandler
participant MediaStore
Client->>LibrariesHandler: request library authors
LibrariesHandler->>MediaStore: ListLibraryAuthors
MediaStore-->>LibrariesHandler: AuthorSummary with HasPhoto
LibrariesHandler->>AuthorSeriesHandler: authorObjectABS(a.HasPhoto)
AuthorSeriesHandler-->>Client: author JSON with conditional imagePath
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b37dcd4a11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // The MV carries no photo column; join people at read time so photo | ||
| // presence is always current instead of stale until the next REFRESH. | ||
| dataSQL := `SELECT c.person_id, c.name, c.num_books, c.added_at, | ||
| COALESCE(p.photo_path, '') <> '' |
There was a problem hiding this comment.
Treat '-' as a missing author photo
When people.photo_path is the "-" sentinel, this predicate marks the author as photo-bearing and the ABS list emits a non-null imagePath; the detail path has the same issue because GetAuthorByID copies raw photo_path and authorToABS checks only != "". The repo treats "-" as no photo elsewhere (internal/api/handlers/people.go:357, internal/catalog/person_repo.go:319), so ABS clients will be prompted to fetch /api/authors/{id}/image for authors with no real image and get a broken/404 image. Please exclude "-" in the has-photo checks.
Useful? React with 👍 / 👎.
…rs (#316) * fix(audiobooks): select photo_path in ABS author detail query GetAuthorByID selected poster_path from the people table, but the person-image column is photo_path, so every GET /api/authors/{id} request failed with SQLSTATE 42703 and a 500. Since photo_path is NOT NULL DEFAULT '', the nullable scan is also dropped. Co-Authored-By: Claude Fable 5 <[email protected]> * feat(audiobooks): emit non-null imagePath for photo-bearing ABS authors Author responses always emitted imagePath: null, so ABS clients never fetched /api/authors/{id}/image even though it works and ~7% of audiobook authors have a people.photo_path. Real ABS puts a server-local filesystem path in imagePath and clients treat any non-null value as the cue to fetch the image endpoint, so a synthetic ABS-shaped path is emitted whenever the person has a photo. The detail path reads the flag from Author.PosterPath. The list path carries a new AuthorSummary.HasPhoto: the MV query LEFT JOINs people at read time (photo presence stays current instead of stale until the next REFRESH) and the live fallback selects photo_path alongside its existing people join. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
Problem
ABS-compat author responses always emitted
"imagePath": null(list and detail alike), even thoughGET /api/authors/{id}/imageworks and a meaningful share of audiobook authors have apeople.photo_path. ABS clients treat a non-nullimagePathas the cue to fetch the author image endpoint — with it hardcoded to null, no client ever showed an author photo.Fix
Emit a non-null
imagePathwhenever the person has a photo. Real ABS stores a server-local filesystem path there and clients never dereference it directly (they call/api/authors/{id}/image), so a synthetic ABS-shaped path (/metadata/authors/{id}.jpg) is emitted as the flag.authorToABS): flag comes fromAuthor.PosterPath, which the store already loads.handleLibraryAuthors): newAuthorSummary.HasPhoto. The MV pathLEFT JOINspeopleat read time — theabs_audiobook_author_countsMV carries no photo column, and a read-time join keeps photo presence current instead of stale until the next REFRESH. The live fallback selectsphoto_path <> ''off its existingpeoplejoin (allowed underGROUP BY p.idby PK functional dependency).The filter-data and search author buckets don't emit
imagePathtoday and are unchanged.Includes the commit from #315 (
GetAuthorByIDcolumn fix) — the detail path depends on it; this PR reduces to one commit once #315 merges.Verification
go build/go vet/go test ./internal/audiobooks/...pass; handler tests now assert non-nullimagePathfor photo-bearing authors (detail + list) and null for authors without.imagePathfor photo-bearing authors, which ABS clients follow withGET /api/authors/{id}/image(already verified to 302 to the stored photo).Disclosure
Implemented with Claude Code (AI-assisted).
🤖 Generated with Claude Code
Summary by CodeRabbit