Repository navigation
fix(audiobooks): return all authors/series for non-paginated ABS requests - #317
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]>
…ests
Real ABS returns the FULL author list when the client sends no
limit/page — the official app and other clients fetch it once and
scroll locally. Silo applied a default limit (50 authors, 25 series)
to the non-paginated form, so the bare {authors} response silently
truncated to the first page with no total to signal more, capping the
Authors/Series screens at the first N entries.
Non-paginated requests now use limit=0 (return all, the existing ABS
contract in the store layer); explicitly paginated requests are
unchanged.
Co-Authored-By: Claude Fable 5 <[email protected]>
|
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 (1)
📝 WalkthroughWalkthrough
ChangesPagination guardrails for library lists
Access log query redaction
Author photo lookup
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 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: 56707a20f6
ℹ️ 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".
| // cap) — clients like the official app fetch the whole list once and | ||
| // scroll it locally, so a server-side default limit silently truncates | ||
| // the Authors page. limit=0 means "return all". | ||
| limit, page := readPagedQuery(r, 0) |
There was a problem hiding this comment.
Treat limit-only author requests as unpaginated
When a client sends /api/libraries/{id}/authors?limit=100 without page (the handler below returns the bare non-paginated {authors: ...} shape unless both params are present), this call still passes limit=100 to ListLibraryAuthors. That response is truncated but carries no total/paging envelope, so clients cannot discover authors beyond the cap; match the pagination predicate when deciding whether to pass a limit.
Useful? React with 👍 / 👎.
A truly unbounded return-all crashes non-paginating mobile clients at silo scale: a 250k-book library carries ~98k authors (15.5MB JSON) and ~32k series (each row embeds up to four minified book objects). Real ABS never sees libraries this size, so its return-all contract has no survival story for them. Clamp the return-all form to 10k authors / 2k series and log a Warn when a non-paginated request is truncated, so the cutoff is deliberate and observable instead of a silent first-page mystery. Explicitly paginated clients still page through the full set via the paged envelope's total. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Follow-up pushed: verified on a large dev audiobook library that true return-all (15.5MB) crashes a non-paginating client, so the return-all form is now clamped to 10k authors / 2k series with a Warn log on truncation. Paginated clients still reach the full set via the paged envelope. |
Path-only debug lines can't distinguish paginated from non-paginated list requests, which blocked diagnosing a client crash on /authors. Log the query string with credential params redacted, plus the user-agent to tell concurrent clients apart. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/audiobooks/abs/libraries_handler.go (1)
345-458: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd test coverage for the new guardrail behavior.
The PR notes
go test ./internal/audiobooks/...passed, but the diff doesn't appear to add tests for the new clamp/warning logic itself — e.g., non-paginated request exceedingmaxUnpaginatedAuthors/maxUnpaginatedSeriesgets clamped, the warning fires only on the intended path, and thepage-without-limitedge case discussed above. These are exactly the kind of behaviors that regress silently.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/audiobooks/abs/libraries_handler.go` around lines 345 - 458, Add test coverage for the new guardrail logic in handleLibraryAuthors and handleLibrarySeries. Create cases that verify non-paginated requests are clamped to maxUnpaginatedAuthors/maxUnpaginatedSeries, that the truncation warning is emitted only when total exceeds the returned slice and page is absent, and that the page-without-limit path behaves as intended. Use the existing handler methods and the readPagedQuery/accessFilterFromRequest/ListLibraryAuthors/ListLibrarySeries flow so the tests lock in the new behavior and prevent silent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/audiobooks/abs/libraries_handler.go`:
- Around line 345-458: Add test coverage for the new guardrail logic in
handleLibraryAuthors and handleLibrarySeries. Create cases that verify
non-paginated requests are clamped to
maxUnpaginatedAuthors/maxUnpaginatedSeries, that the truncation warning is
emitted only when total exceeds the returned slice and page is absent, and that
the page-without-limit path behaves as intended. Use the existing handler
methods and the
readPagedQuery/accessFilterFromRequest/ListLibraryAuthors/ListLibrarySeries flow
so the tests lock in the new behavior and prevent silent regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9c8ad08c-4895-457d-b0cb-236a4a76d8ce
📒 Files selected for processing (1)
internal/audiobooks/abs/libraries_handler.go
…the corrected GetAuthorByID query
…ests (#317) * 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]> * fix(audiobooks): return all authors/series for non-paginated ABS requests Real ABS returns the FULL author list when the client sends no limit/page — the official app and other clients fetch it once and scroll locally. Silo applied a default limit (50 authors, 25 series) to the non-paginated form, so the bare {authors} response silently truncated to the first page with no total to signal more, capping the Authors/Series screens at the first N entries. Non-paginated requests now use limit=0 (return all, the existing ABS contract in the store layer); explicitly paginated requests are unchanged. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(audiobooks): clamp non-paginated authors/series to a guardrail cap A truly unbounded return-all crashes non-paginating mobile clients at silo scale: a 250k-book library carries ~98k authors (15.5MB JSON) and ~32k series (each row embeds up to four minified book objects). Real ABS never sees libraries this size, so its return-all contract has no survival story for them. Clamp the return-all form to 10k authors / 2k series and log a Warn when a non-paginated request is truncated, so the cutoff is deliberate and observable instead of a silent first-page mystery. Explicitly paginated clients still page through the full set via the paged envelope's total. Co-Authored-By: Claude Fable 5 <[email protected]> * feat(audiobooks): log sanitized query + user-agent in ABS access log Path-only debug lines can't distinguish paginated from non-paginated list requests, which blocked diagnosing a client crash on /authors. Log the query string with credential params redacted, plus the user-agent to tell concurrent clients apart. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
Problem
The ABS Authors page in client apps only shows the first ~50 authors and won't scroll further. Clients fetch
GET /api/libraries/{id}/authorswith nolimit/page(real ABS returns the complete list for that form and clients scroll it locally), but Silo applied a default limit of 50 (25 for/series) to the non-paginated form — a bare{authors:[...]}truncated to the first page, with nototalfield to signal more exist.Fix
Non-paginated
/authorsand/seriesrequests now uselimit=0("return all" — the contract the store layer already implements). Explicitly paginated requests are unchanged, as are the capped filter-data/search author buckets.Response-size note: this returns the full author set (~100k objects on a large library) exactly as real ABS does; the MV-backed query serves it in one indexed read.
Verification
go build/go test ./internal/audiobooks/...pass.Disclosure
Implemented with Claude Code (AI-assisted).
🤖 Generated with Claude Code
Summary by CodeRabbit