Skip to content

Cached opens skip the parsing pass; copies counted once; stray posts not sent as backups - #591

Merged
xbmc4lyfe merged 4 commits into
mainfrom
grouping-leftovers
Nov 17, 2026
Merged

xbmc4lyfe merged 4 commits into
mainfrom
grouping-leftovers

Conversation

@xbmc4lyfe

@xbmc4lyfe xbmc4lyfe commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The last open items of the grouping design. A repeat open of a cached search now skips the whole metadata pass, a release's copies are counted once, and a backup that is another post under the release's name is not sent. Size clusters for named releases are left out: the build thread measured them and par2 makes 10-15% gaps between copies normal.

Measured on the Kodi box (standalone, lowest priority, while a film played; the add-on install was not touched), 23 searches from the corpus fixture. After each first open the run stores what the add-on's NFO step stores: one failed read and two audio answers for the top three releases. CPU time summed over the 23 searches:

Main 21204cb This branch Change
Cached open right after new NFO answers 21.9 s 25.7 s 17% more, once: the pass runs and the entry is rewritten
Every later cached open 20.5 s 16.2 s 21% less, about 0.2 s per open
First open 89.0 s 88.0 s no real change (parsing is 79%)
Picker rows; cached open lists what the first did 6,534; 23 of 23 6,534; 23 of 23 same lists

A first review run (empty NFO store) showed 22% and hid that a failed NFO read changed the stamp; the second commit fixes that (see Changes).

flowchart TD
    R[Cached search read] --> Q{Stored from one whole pass,<br>and nothing new known of<br>its releases' NFO or MediaInfo?}
    Q -->|yes| M[Rows marked as this run's pass]
    Q -->|no| P[Metadata pass over the rows]
    M --> L[Requested item, filters, ranking, picker]
    P --> L
    classDef new fill:#1E1E2E,stroke:#34D399,color:#34D399
    class M new
Loading

Changes

  • filter.attached_record / filter.resume_attached, cache: a cache entry records the list's release-name keys and nfo_audio.stamp_for(keys), a fingerprint of what the NFO store knows of those releases (persistent across runs, unlike known_version). A read marks the rows as one pass while the fingerprint matches.
  • release_index.ReleaseIndex.copies_in / copies_of: copy count once per grouping; the picker row shows the count the ranking used (before, the picker counted again in another order and could differ by one).
  • Review fixes (second commit): stamp_for hashes only what apply_known puts on a row, so a failed or empty NFO read keeps the skip; an entry whose pass went stale is passed again and rewritten by keep_parsed; listed sizes count once per distinct posting in hand (after the duplicate check), and a backup with no listed size is never a stray.
  • FleetDedup.stray_from_pick (nzbget_resolver_dupes): a backup whose files are not the pick's, 1.35 times off the pick's size, with a listed size off the median of the distinct postings in hand while the pick's is not, is not sent; needs three listed sizes. On 1,428 real backup/pick pairs it skipped 32: a payload posted under six names, broken partial posts and mislabelled episodes. New strings 30787/30788.
  • Docs: NZBGet backend page (new rule, Mermaid chart of the backup checks), search pipeline caching section, CHANGELOG.

Testing

  • just test passes (5,223)
  • just lint passes
  • Timed on the Kodi box outside Kodi (no install change)
  • Updated CHANGELOG.md and docs-site/; the chart renders on the built docs page
  • New tests/test_grouping_leftovers.py (22, including a read-back-equals-fresh-pass check over all 23 corpus searches): cache round trip skips the pass, an NFO answer for a listed release redoes it, an answer for another release does not, damaged records, copy count once, stray rules and the dialog count. Corpus numbers in tests/test_grouping_corpus.py unchanged.

🤖 Generated with Claude Code

…not sent as backups

- A cache entry records that its parses came from one whole metadata pass,
  with the release-name keys of the list and a fingerprint of what the NFO
  store knows of them (nfo_audio.stamp_for). Reading it back marks the rows
  as a pass of this run while that fingerprint holds, so every later
  attach_metadata returns at once.
- A release's copy count is counted once per grouping (ReleaseIndex.copies_in)
  and the picker row shows the count the ranking used
  (release_index.copies_of).
- At NZB fetch, a backup whose files are not the pick's, 1.35 times off its
  size, with a listed size off the release's median while the pick's is not,
  is not sent (FleetDedup.stray_from_pick). Counted as "post that is not this
  release" in the dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T01:10:16.802957Z
We couldn’t complete this review. Comment @codex review to try again.
4e2f16b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-code-quality

github-code-quality Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Python

Python / code-coverage/pytest

main 21204cb grouping-leftovers cb5ac88 +/-
92% 92% 0%
View coverage of the 9 most impacted files.
File main 21204cb grouping-leftovers cb5ac88 +/-
repo/plugin.vid...solver_dupes.py 91% 90% -1%
repo/plugin.vid..._diagnostics.py 91% 91% 0%
repo/plugin.vid..._fleet_dedup.py 96% 96% 0%
repo/plugin.vid...elease_index.py 98% 98% 0%
repo/plugin.vid...ib/nfo_audio.py 96% 96% 0%
repo/plugin.vid...s/lib/filter.py 96% 96% 0%
repo/plugin.vid...sults_dialog.py 98% 98% 0%
repo/plugin.vid...get_progress.py 100% 100% 0%
repo/plugin.vid...es/lib/cache.py 91% 92% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 17, 2026 01:37 UTC

…r posting

Review findings on #591:
- nfo_audio.stamp_for hashes only what apply_known puts on a row (audio,
  channels, exact, sure, video of answers that tell something). A failed or
  empty NFO read, stored after every first open, no longer stops the skip.
- A cache entry read back whose pass no longer stands is passed again and
  rewritten by keep_parsed, so the open after it skips the pass.
- stray_from_pick: listed sizes count once per distinct posting in hand
  (after the duplicate check), so a second listing of the pick's own NZB
  cannot make an incomplete pick look typical; a backup with no listed size
  is never a stray.
- Tests: failed read keeps the skip, a stale entry is stored again, a read
  back list equals a fresh pass on all 23 corpus searches, incomplete pick,
  no listed size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xbmc4lyfe and others added 2 commits November 16, 2026 19:34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…FO answer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xbmc4lyfe
xbmc4lyfe merged commit b70e1a7 into main Nov 17, 2026
11 of 12 checks passed
@xbmc4lyfe
xbmc4lyfe deleted the grouping-leftovers branch November 17, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants