Repository navigation
test: raise coverage for covers, abs, calibre and opds - #3034
Conversation
Test only change. Adds *_coverage_test.go files using httptest servers, scripted transports, temp dirs and the in memory DB. covers 66.2% -> 87.3% abs 71.3% -> 87.4% calibre 76.7% -> 88.9% opds 78.8% -> 99.6% Covers HTTP error decoding, malformed JSON, retry and backoff cut short by context cancellation, size caps, SSRF refusals for the ABS base URL, per user scoping in every OPDS feed, and rollback, pull delivery and plugin client error paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9 Signed-off-by: vavallee <vavallee@protonmail.com>
Raise the cancelled backoff bounds from 100ms to 2s so a loaded CI runner cannot trip them, and pin the normalized alias match to the "normalized_alias" tier the matcher actually returns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9 Signed-off-by: vavallee <vavallee@protonmail.com>
There was a problem hiding this comment.
Test-only PR (+5569 / 0). No production code touched, all additions are *_coverage_test.go files. Notes below.
OPDS user scoping (highest-priority area) — the new tests in internal/opds/builder_coverage_test.go cover the properties that matter most:
- Every feed type (authors, author, series list, series, recent, book) is exercised for a scoped user, an admin (user 0), and the legacy owner-0 rows.
- Cross-user entity access correctly returns
ErrNotFoundrather than an empty feed — this is the right behaviour; an empty feed would leak existence. TestBuildSeries_SkipsBooksThatFailToLoad(line 5583): whenGetByIDreturns a store error, the series is surfaced asErrNotFoundfor the requesting user. That conflates a real storage failure with "no accessible books", which could silently hide transient DB errors. This is testing existing production behaviour, not new code, so not a blocker — but worth a glance to confirm theBuildSeriesimplementation intentionally swallows that error.
ABS client / SSRF test (TestValidateBaseURLSecure, line 82): link-local IPv4 (169.254.169.254) and IPv6 (fe80::1) are both refused. Good.
Test infra — db.OpenMemory() throughout, httptest.NewServer for all remote APIs, t.TempDir() for file tests, SQLite trigger injection (covImpEnv.failOn) for narrow write-failure paths. All correct patterns.
ScanNotifier DB-close behaviour (TestScanNotifier_Lifecycle, line 517): a settings read failure after database.Close() is expected to silently act as "unconfigured" rather than return an error. The test is documenting existing behaviour; fine as-is.
No new dependencies, no production code changes.
— 🤖 Bindery triage bot (automated). Reply to correct me; a human will see it.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Test only. No production code changes, so no changelog fragment.
What the new
*_coverage_test.gofiles exercise:All remote APIs are httptest servers or scripted transports; files live in temp dirs; DB tests use
db.OpenMemory.Test plan
gofmt -lcleango veton the four packagesgolangci-lintv2.11.4 on the four packages: 0 issuesgo test -count=1 -coveron the four packages: passgo test -race -count=1on the four packages: passNo production bugs surfaced.
🤖 Generated with Claude Code
https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9