Repository navigation
Keep the judge's verdicts, a protection's past, and the plays of removed media - #240
Merged
Merged
Conversation
…ved media Verdicts lived only in the 30-day verdict cache, so the Wrap-Up in December could not say what the judge thought in spring. Every verdict of a deletion scan now lands in judge_verdicts, one row per title and change of verdict; the same verdict again only counts. Lifting a protection deleted its row and re-judging overwrote it. protection_history keeps what it was (lifted, changed, downscaled); the live protected_media table is unchanged for its readers. The orphan cleanup deleted every play of a title that left Plex. It now sets orphaned_at. Every ORM read hides marked rows (database/orphaned); the Wrap-Up, the taste snapshots and the sync's duplicate check read them, and a title back in Plex gets its plays back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KECJpoVqo39hQKxkrxUjrc
Owner
Author
|
Generated by Claude Code |
This was referenced Oct 25, 2026
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.
What & why
The year's Wrap-Up is written in December, but three kinds of data it needs were being thrown away before then. This PR keeps all three. It covers the three open items from
docs/WRAPUP_V2_BLUEPRINT.mdthat need no Plex server.1. Judge verdicts (
judge_verdicts,services/judge_record.py)verdict:cache, so by December the spring's verdicts were gone.judge_verdicts. A row holds:last_atand countsscans, so nightly scans that reuse cached verdicts add no rows.2. Protection history (
protection_history)protection_historyfirst, with a kind:lifted, with who lifted it;changedby the judge;downscaled.lifted_atcolumn onprotected_mediabecause that table has about fifteen readers, and each would need a new filter. One missed filter would mean a lifted protection still shields a title.3. Plays of removed media (
watch_history.orphaned_at,database/orphaned.py)orphaned_at.do_orm_executehook addsorphaned_at IS NULLto every ORM SELECT onwatch_history. History, taste and recommendations therefore look as they did after a delete, without touching their roughly 50 queries.orphaned.include(db)). Without that, the sync would import a hidden play a second time.archived/would_archive/returned, and the settings UI text says what happens.FACTS_VERSIONis unchanged: a Wrap-Up reads no other rows than before, it just stops losing them.Checks
python tests/run_all.pyis green (254/254 suites)Behaviour changes come with a test that would have caught the old behaviour.
tests/test_judge_record.pyhas 21 checks:tests/test_plex_history_safety.pynow checks that the hidden plays are still in the table, that a second run hides nothing more, and that a title back in Plex gets its plays back.No personal data, tokens or hardcoded local paths in the diff
Based on current
mainGenerated by Claude Code