Skip to content

test: cover the pin, ABS match state, staggered refresh and remap paths merged since v1.42.1 - #3303

Merged
vavallee merged 2 commits into
mainfrom
test/coverage-pin-abs-refresh
Oct 16, 2026
Merged

vavallee merged 2 commits into
mainfrom
test/coverage-pin-abs-refresh

Conversation

@vavallee

@vavallee vavallee commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

What

Test only. No source files are touched. This closes the biggest patch coverage gaps codecov reported on the work merged since v1.42.1 (#3283 download client pin, #3296 ABS skip rematch, #3275 staggered author refresh, #3276 path remap assistant, #3281 content check, #3285 title relevance). Every test asserts an outcome (routing, refusal, redaction, boundary, write guard), not just that a line ran.

Coverage measured with go test -cover, before to after

Package totals: db 87.5 to 88.0, scheduler 91.4 to 92.4, abs 88.0 to 88.1, downloader 92.2 to 93.2, importer 87.8 to 88.0, indexer 95.0 to 95.0 (unchanged), models 87.6 to 90.5, api 86.3 to 86.4.

Per file statement coverage (from the coverprofiles; local numbers run higher than codecov's patch view because the older tests already exercise some of these lines):

File Before After
db/download_client_pin.go 56.2% 95.8%
db/abs_series_match.go 83.3% 100%
db/abs_imports.go (ListSeriesByItem was 0%) 90.2% 92.7%
db/author_metadata_refresh.go 79.6% 85.7%
db/download_clients.go 94.9% 95.6%
scheduler/scheduler.go 90.6% 91.2%
scheduler/metadata_refresh.go 89.9% 94.2%
abs/import_series_match_state.go 83.0% 97.9%
downloader/pathcheck.go 84.4% 98.7%
importer/content_check.go 93.0% 97.1%
importer/content_title.go 95.7% 100%
models/indexer.go 0% 100%
api/queue.go 90.5% 91.6%
api/indexers.go 87.8% 88.6%

What is covered

  • Pin: refusal reasons (missing, disabled, wrong protocol), no substitute client, role based redaction of the client name, delete refused with every pinned indexer named in order, scheduler pinnedClient/checkPin routing, quiet skip for an indexer already refused in a sweep, failure record dedupe per indexer and per reason, pending row gate (error keeps the row, corrupt row skipped, other media type ignored), clientForGrab fallbacks and storage faults, validateDownloadClientPin matrix (unchanged pin to a disabled client keeps saving, type change under a pin is checked), 500 without storage detail.
  • ABS match state: miss expiry at the exact boundary, unknown outcome re-matches, unreadable state re-matches, Full run ignores state, bootstrap adoption rules, series provenance scoping by source, library, item and entity type.
  • Staggered refresh: non-positive limit, strict cutoff, a stamp equal to now is not a future stamp, legacy text layouts, tie break by id, stamp leaves updated_at alone, batch size bounds, cooldown and trip memory boundaries, author unmonitored mid pass uses no slot, edit during the provider call wins, sparse answers do not clobber a stored profile.
  • Remap and path checks: nil client, folder created on first grab, file where a folder is expected, client remap beats global remap, warning text variants.
  • Content check and relevance: compilation shapes, "best of" needs the author's surname, creator script handling, alias lookup, series suffix and volume stems, subtitle and trailing number helpers.

Left out

About 1,880 added lines in 10 test files, still above the 1,500 target. The indexer relevance test file was dropped after review, so trailing_title.go and primary_title.go gain nothing from this PR.

Not covered: web/src/pages/settings/ClientsTab.tsx and web/src/api/downloadclients.ts (frontend, lowest priority), remap_assist.go (the two uncovered lines look unreachable through pathmap), the recordPinnedFailure history write error path, ListByBookAndMediaType error in pending, GetByID reload error in the refresh loop, and the Delete backstop that re-checks pins after a foreign key failure (needs a concurrent write between two statements).

Mutation checks

26 mutants applied by me, restored each time. One equivalent survivor: dropping the *indexerID != 0 guard in clientForGrab (id 0 never exists). The review found a real hole, clientForGrab dropping the release protocol; a new subtest now kills it. Mutants on the surname length rule and on the indexer relevance code no longer have a test, by review decision. Source is unchanged in this PR.

Not asserted on purpose

Two behaviours the task flagged as known leaks are not pinned by a test: a scheduler pending row whose indexer was deleted and recreated with a pin routes to the default client, and a supplied unpinned indexer id on a shared host is trusted at face value.

stripSeriesSuffix("Mary, Mary, Book Eleven") returns "Mary" because the regex reads "Mary," as a series name. Ambiguous by design, so not asserted.

No changelog fragment (test only).

🤖 Generated with Claude Code

https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9

…hs merged since v1.42.1

Test-only. Closes the largest patch coverage gaps on #3283, #3296, #3275,
#3276, #3281 and #3285 with assertions on outcomes: pin resolution and its
refusal messages, delete refusal, scheduler pin skipping and the failure
record dedupe, pending row gating, ABS series match state expiry and
bootstrap adoption, staggered refresh boundaries and write guards, path
visibility warnings, and the content check and title relevance helpers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9
Signed-off-by: vavallee <vavallee@protonmail.com>
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

… assertions

Adds a clientForGrab subtest where the release protocol disagrees with the
pinned client, in both directions. Removes the unknown indexer id fallback
row, the Torznab case row and the two letter surname row, and deletes the
low value indexer relevance test file and three content helper subtests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9
Signed-off-by: vavallee <vavallee@protonmail.com>
@vavallee
vavallee merged commit 558d744 into main Oct 16, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant