Repository navigation
fix(audiobooks): improve poster enrichment throughput - #94
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Warning Review limit reached
More reviews will be available in 41 minutes and 24 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis pull request introduces four coordinated audiobook enhancements: configurable enrichment sweep sizing via environment variables, unified audiobook poster URL presigning across catalog and GraphQL services, audiobook-specific library scanning routes, and default enablement of the Audiobookshelf compatibility listener via database configuration and SQL migrations. ChangesAudiobook Features and Configuration
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/audiobooks/enrichment_test.go (1)
66-94: 💤 Low valueConsider adding a test case for worker capping in NewEnricher context.
The existing tests provide good coverage, but there's a small gap: no test demonstrates that
NewEnricheractually caps workers whenSILO_AUDIOBOOK_ENRICH_WORKERSexceedsSILO_AUDIOBOOK_ENRICH_BATCH_SIZE. For example:func TestNewEnricherCapsWorkersToConfiguredBatchSize(t *testing.T) { t.Setenv("SILO_AUDIOBOOK_ENRICH_BATCH_SIZE", "50") t.Setenv("SILO_AUDIOBOOK_ENRICH_WORKERS", "100") e := NewEnricher(nil, nil, nil, nil, nil, nil) if e.workers != 50 { t.Fatalf("workers = %d, want 50 (capped to batchSize)", e.workers) } }This would verify the integration of both helpers in
NewEnricherwhen capping applies.🤖 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/enrichment_test.go` around lines 66 - 94, Add a new unit test that verifies NewEnricher caps the workers to the configured batch size: set environment variables "SILO_AUDIOBOOK_ENRICH_BATCH_SIZE" to a smaller value (e.g., "50") and "SILO_AUDIOBOOK_ENRICH_WORKERS" to a larger value (e.g., "100"), call NewEnricher(nil, nil, nil, nil, nil, nil), and assert that the returned enricher's e.workers equals the batch size (e.batchSize) rather than the larger env value; this ensures NewEnricher correctly integrates audiobookEnrichBatchSize/audiobookEnrichWorkers capping logic.
🤖 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.
Inline comments:
In `@internal/scanner/scanner.go`:
- Around line 250-255: The code currently passes filepath.Clean(subtreePath)
(cleanSubtree) directly into ScanAudiobookFolder which can be "." for empty or
relative inputs and thus expand scope incorrectly; add a guard in the
ScanAudiobookFolder call sites (e.g., where cleanSubtree is computed and passed
to ScanAudiobookFolder and the analogous use around ScanAudiobookFolder at the
later location) that validates cleanSubtree is non-empty, not ".", and is an
absolute or appropriately rooted path (or otherwise reject leading ".."),
returning an error instead of calling ScanAudiobookFolder when the scope root is
invalid; keep the validation next to the cleanSubtree computation and reuse the
same check for both occurrences.
---
Nitpick comments:
In `@internal/audiobooks/enrichment_test.go`:
- Around line 66-94: Add a new unit test that verifies NewEnricher caps the
workers to the configured batch size: set environment variables
"SILO_AUDIOBOOK_ENRICH_BATCH_SIZE" to a smaller value (e.g., "50") and
"SILO_AUDIOBOOK_ENRICH_WORKERS" to a larger value (e.g., "100"), call
NewEnricher(nil, nil, nil, nil, nil, nil), and assert that the returned
enricher's e.workers equals the batch size (e.batchSize) rather than the larger
env value; this ensures NewEnricher correctly integrates
audiobookEnrichBatchSize/audiobookEnrichWorkers capping logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 508a5630-5fa1-4d68-8f72-4e225d24627b
📒 Files selected for processing (12)
internal/audiobooks/enrichment.gointernal/audiobooks/enrichment_test.gointernal/audiobooks/service.gointernal/audiobooks/service_test.gointernal/catalog/detail.gointernal/catalog/detail_audiobook_test.gointernal/config/db_loader.gointernal/config/db_loader_test.gointernal/scanner/audiobook_test.gointernal/scanner/scanner.gomigrations/sql/20260607161414_add_audiobookshelf_compat_enabled.sqlmigrations/sql/20260608183000_enable_audiobookshelf_compat_default.sql
* fix(audiobooks): improve poster enrichment throughput * fix(audiobooks): enable ABS compat by default * chore(audiobooks): remove stale feature flag setting * fix(audiobooks): validate scoped scan roots --------- Co-authored-by: rxwatcher <[email protected]>
* fix(audiobooks): improve poster enrichment throughput * fix(audiobooks): enable ABS compat by default * chore(audiobooks): remove stale feature flag setting * fix(audiobooks): validate scoped scan roots --------- Co-authored-by: rxwatcher <[email protected]>
Summary
ScanSubtreeandScanFilecalls through the audiobook scanner instead of the generic video pathaudiobooks.enabledsettingVerification
go test ./internal/config ./internal/scanner ./internal/catalog ./internal/audiobooks/...Notes
The ABS compatibility setting now defaults to
true, matching Docker deployments that publish:13378. Operators can still turn it off from Admin Settings -> Compatibility Proxies -> Audiobookshelf.Summary by CodeRabbit
New Features
Bug Fixes
Tests