fix(proxy): meaningful audit data — strip suffixes + cache title-fast-path matches#15
Conversation
…title-fast-path matches
Two related bugs together made every classifier_audit row report
predicted=NONE / missed_dkaudio, masking real proxy verdicts:
1. /learn/imported's WHERE release_name=? lookup never matched because
Radarr's sceneName env var contains the proxy's appended .DKaudio +
.NFOxxx tags (e.g. "Mufasa…-RCDiVX-xpost.DKaudio.NFODV"). nfo_cache
stores the un-suffixed canonical name. Fix: strip_proxy_suffix()
helper applied to the lookup name (NOT to the audit row — original
sceneName is kept there for debugging).
2. Title-fast-path classifications in hunt_danish set found_hits[nid]
then 'continue' without calling cache_set, so even when the proxy
correctly classified a release via title regex or attr scan there
was no cache row for /learn to find. Fix: cache_set on each fast-
path branch with source='title' or source='attr' per spec
precedence (ffprobe > nfo > description > attr > title).
After this:
- Audit rows on already-classified releases show mismatch_type
'agreement' (proxy and ffprobe agreed) instead of always
'missed_dkaudio'.
- title-only fast paths now contribute to cross-search cache hits.
11 new tests (strip helper + lookup integration + 2 fast-path cache writes).
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 4 minutes and 26 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, 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 have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ 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 |
…tle-cache fix(proxy): meaningful audit data — strip suffixes + cache title-fast-path matches
Summary
Fixes two compounding bugs that made every
classifier_auditrow reportmismatch_type=missed_dkaudioregardless of what the proxy actually knew.The two bugs
1.
/learn/importedlookup never matched the cache:Radarr's
radarr_moviefile_scenenameenv var contains the title the proxy returned — INCLUDING the appended.DKaudio/.NFODVetc tags.nfo_cache.release_namestores the un-suffixed canonical title. SoWHERE release_name=?could not find existing classifications.2. Title-fast-path tags never wrote to cache:
In
hunt_danish, fast paths (AUDIO_DK_RE,is_native_dk_title, ATTR matches) setfound_hits[nid]thencontinuewithoutcache_set. Even when the proxy correctly classified a release via title alone, there was no cache row for/learn/importedto find.Fix
strip_proxy_suffix(release_name)helper (regex strips trailing.DKaudio|.DKOK + zero or more .NFOxxx)._handle_learn_importedstrips the lookup name beforeWHERE release_name=?and beforecache_set. The audit row keeps the original (suffixed) sceneName for debugging visibility.hunt_danishnow callscache_set(nid, tag, title, source=...)with the spec's source precedence:source="title"source="attr"After this
classifier_audit.mismatch_typewill show meaningful values (agreement,upgrade,missed_dkaudio,false_dkaudio,false_dkok) reflecting real proxy-vs-ffprobe accuracyTests
11 new across 3 test files:
tests/test_strip_proxy_suffix.py(8 tests on the helper)tests/test_learn_endpoint.py(+1 integration: suffixed POST finds un-suffixed cache row →agreement)tests/test_title_path_caches.py(+2: title and attr fast-paths write to cache)216 tests pass (205 baseline + 11 new).
Verified live
Pre-seed cache with
('test123', '.DKaudio', 'TestAudit.2026.NORDiC-FOO', source='title'). POST{release_name: "TestAudit.2026.NORDiC-FOO.DKaudio.NFODV", audio_languages: ["dan", ...]}. Response:🤖 Generated with Claude Code