What this release is
Pure CI / test-infrastructure work. Zero user-visible change. Same image otherwise.
Two long-documented CI flakes finally root-caused and fixed. Future PRs ship through CI without the intermittent retries.
Pull image
docker pull ghcr.io/new-usemame/calibre-web-nextgen:v4.0.52
Or use :latest.
Technical detail (developer-focused)
test_cwa_db flake (3 tests)
CWA_DB.__init__ was hardcoding /config/cwa.db regardless of the CWA_DB_PATH env var that the test fixture was already setting. Every parallel pytest-xdist worker opened the same shared file. Under contention this surfaced as sqlite3.OperationalError: database is locked and intermittent wrong-timestamp readbacks.
Fixed by reading CWA_DB_PATH with /config/ as the default (production behavior unchanged), plus os.makedirs(..., exist_ok=True) defense-in-depth before sqlite3 connect.
test_generate_checksums flake (3 tests)
scripts/generate_book_checksums.py imported cps.progress_syncing.* at module-top, forcing the full cps/__init__.py boot (Flask + SQLAlchemy + plugins) on every subprocess invocation — 30+s under CI worker contention, tripping the test's 30s timeout.
Fixed by moving heavy imports inside generate_checksums() and adding a lightweight _check_koreader_sync_enabled_lightweight() helper that reads cwa_settings via direct sqlite3 (no cps boot). Disabled-path subprocess: 1.5s+ → 0.039s.
What this unblocks
Future PRs no longer need --admin overrides for "pre-existing flake" reasons. Phase 3 of the cover-normalization feature (currently being implemented) can ship through normal CI cleanly.