feat: search loop scoring integration & tiered cooldowns#79
Closed
menottim wants to merge 3 commits intofeat/search-scoringfrom
Closed
feat: search loop scoring integration & tiered cooldowns#79menottim wants to merge 3 commits intofeat/search-scoringfrom
menottim wants to merge 3 commits intofeat/search-scoringfrom
Conversation
Implement cooldown.py with adaptive and flat cooldown modes for search items. Adaptive mode uses content age to determine base cooldown (6h for <24h old, up to 7d for >1yr old) with exponential backoff on consecutive failures, capped at 14 days. Flat mode uses a fixed configurable period. Includes 29 unit tests covering all tiers, backoff, cap, and edge cases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Refactor _search_paginated_records to use intelligent search ordering: 1. Fetch ALL pages into a flat list via new _fetch_all_records helper 2. Batch-load LibraryItem data from DB via _load_library_items 3. Score each item using compute_score() from the scoring engine 4. Sort by score descending (highest priority items first) 5. Filter out excluded and cooldown items 6. Truncate to queue.max_items_per_run 7. Search remaining items, updating LibraryItem.search_attempts Replace in-memory cooldown dict with DB-backed tiered cooldowns from the cooldown service. Search log entries now include score, score_reason, item_id, and series_id for better observability. Update existing tests to work with the new flow (ExclusionService mock, library item loading, queue config attributes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
items_evaluated = total records from API (before filtering) items_searched = items that passed scoring/filtering and were searched Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e4b29cd to
5f00065
Compare
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.
Summary
New files
src/splintarr/services/cooldown.py— tiered cooldown enginetests/unit/test_cooldown.py— 29 testsTest plan
🤖 Generated with Claude Code