v1.1.0-beta.011 - feat: implement comprehensive debug logging and expand test suite coverage
This commit introduces deep, granular debug tracing throughout the application's background services, scrapers, and network boundaries, while establishing a robust suite of integration and API endpoint tests to lock them in. It provides full diagnostic visibility into automated decision-making processes when the Debug log level is enabled and addresses critical cross-platform/hoisting test runner constraints.
π€ Automation & Cron (automation.ts, cron.ts)
- Traced generated search queries and raw results from GetComics and Prowlarr.
- Added exposure for Prowlarr release scoring calculations and filtering exclusions.
- Logged exact string-matching and ratio comparisons for active torrents.
- Tracked stalled download retries and batch progress syncs.
π Trophies (trophy-evaluator.ts)
- Added logging for user stats (reads, requests, unique publishers) prior to evaluation.
- Traced pass/fail conditions for individual achievements during background checks.
- Added success logs for awarded trophies.
π‘οΈ Security & Middleware (middleware.ts)
- Traced unauthorized API rejections and access blocks.
- Logged unauthenticated and role-based frontend UI redirects.
π₯ Download Clients (download-clients.ts)
- Logged outbound payloads and category assignments sent to external clients (qBit, SABnzbd).
- Traced raw queue/history polling numbers and category filtering results.
π« Notifications (notifications.ts, mailer.ts)
- Added trace logs for outbound push payloads (Pushover, Telegram, Apprise).
- Logged SMTP connection attempts, skipped sends, and recipient resolutions.
πΈοΈ Hosters / Scrapers (hosters/)
- Added HTML parsing and URL extraction traces for Mediafire, Rootz, Vikingfile, and Terabox.
- Logged API limits, MD5 extractions, and HEAD request statuses for Anna's Archive and Pixeldrain.
- Added decryption failure traces for Mega.
- Traced Hoster Engine routing to verify premium account usage.
βοΈ Background Jobs & DB (queue.ts, db-init.ts)
- Logged table-by-table progress during automated database backups.
- Traced Metadata Sync targets, Watched Folder extraction attempts, and Discover Sync filtering.
- Tracked Metron and ComicVine Oracle matches during Series Monitor execution.
- Added JSON payload tracing for legacy database migrations on server startup.
π Importer (importer.ts)
- Logged Manga detection evaluations and target library selection.
- Traced the exact string replacement variables for Folder and File naming patterns before disk movement.
π¦ Utilities (rate-limit.ts, metadata-writer.ts)
- Added tracking for failed API rate-limit attempts and IP lockouts.
- Traced local disk export paths for Komga-compatible series.json files.
β¨ New Test Additions
- tests/lib/db-init.test.ts: Validates legacy configuration parsing and structural JSON schema migrations on startup.
- tests/lib/notifications.test.ts: Ensures robust notification routing to third-party push networks (Pushover, Telegram, Apprise).
- tests/api/import-anilist.test.ts: Tests external AniList GraphQL fetching, fuzzy title translation, and automatic request queue injection.
- tests/api/import-cbl.test.ts: Protects raw XML processing pipelines for uploaded ComicRack reading lists.
- tests/api/api-keys.test.ts: Assures secure SHA-256 API key generation, key hashing storage rules, and token revocation endpoints.
- tests/api/reader-image.test.ts: End-to-end testing for on-the-fly zip page extraction, Sharp WebP formatting pipelines, and background cache checking.
- tests/api/diagnostics.test.ts: Verifies administrative diagnostic actions and strictly enforces path traversal protection blocks.
- tests/api/rename.test.ts: Exercises bulk library re-pattern formatting and physical directory disk moves.
π Debug Tracing Assertions
- tests/security/rate-limit.test.ts: Asserted Logger.log output on user lockout states.
- tests/lib/cron.test.ts: Added missing mocks.log definitions and tested fuzzy string-matching calculation outputs.
- tests/lib/hosters.test.ts: Wired up logging checks inside the core switchboard Hoster Engine.
π οΈ Environment & Hoisting Stabilizations
- Fixed reference errors by embedding shared mock session objects directly inside vi.hoisted() blocks to accommodate early mock evaluation.
- Solved Vitest environment hangs on multipart forms in import-csv.test.ts and import-cbl.test.ts by replacing raw web Request FormData arrays with lightweight mock payload objects.
- Stabilized file system checks in reader-image.test.ts by converting .mockReturnValueOnce() chains into persistent path-evaluation rules to prevent test pollution from background intervals.
- Hardened rename.test.ts by adding an intelligent path lookup override to prevent fs.existsSync from masking target overwrite conflicts.
- Implemented path.normalize on disk move assertions to ensure multi-platform backslash/forward-slash testing compatibility between Windows, Linux, and macOS.