feat(reader): make KOReader plugin sync non-blocking and resumable

Lifecycle handlers previously blocked on network work, so closing or suspending a book stalled the
device on slow or offline links. Persist snapshots first and drain them through a lifecycle outbox
with connected-state gates and phase-aware retries, so the UI stays responsive and pending work
survives restarts.

Move persistence behind a state manager with atomic flushes, and chunk sweeps, bulk downloads, and
annotation exchange through a background queue with checkpoints and transfer policies, so large
libraries make progress incrementally instead of restarting from scratch after an interruption.

Server side, add bulk manifest and page stats endpoints with batched queries and catalog query
filtering so the plugin can reconcile many books per round trip rather than one request per book.
This commit is contained in:
neon
2026-07-28 02:06:50 +00:00
parent 3aff8f521b
commit edc2a2ccfc
93 changed files with 12600 additions and 1458 deletions
+37
View File
@@ -438,6 +438,43 @@ export const E2E_SUITES = Object.freeze({
...SHARED_DB_AND_HELPER_PATHS,
],
},
"koreader-bulk-manifest": {
id: "koreader-bulk-manifest",
name: "KOReader Bulk Manifest Scale",
timeout: 45,
lane: "full",
description: "KOReader bulk manifest pagination and index support at 25,000 books",
vitestTarget: "test/koreader-bulk-manifest.e2e-spec.ts",
junitOutput: `${TEST_RESULTS_DIR}/koreader-bulk-manifest-e2e-junit.xml`,
prepareDedicatedDatabase: true,
useDedicatedDatabase: true,
changedPaths: [
"server/src/modules/koreader/**",
"server/src/modules/opds/opds-book.service.ts",
"server/src/db/schema/books.ts",
"server/test/koreader-bulk-manifest.e2e-spec.ts",
"server/test/e2e/reader-state-isolation/**",
...SHARED_DB_AND_HELPER_PATHS,
],
},
"koreader-page-stats": {
id: "koreader-page-stats",
name: "KOReader Page Stats Derivation",
timeout: 45,
lane: "full",
description: "KOReader incremental page-stat derivation suite",
vitestTarget: "test/koreader-page-stats.e2e-spec.ts",
junitOutput: `${TEST_RESULTS_DIR}/koreader-page-stats-e2e-junit.xml`,
prepareDedicatedDatabase: true,
useDedicatedDatabase: true,
changedPaths: [
"server/src/modules/koreader/**",
"server/src/common/utils/reading-daily-stats.utils.ts",
"server/test/koreader-page-stats.e2e-spec.ts",
"server/test/e2e/reader-state-isolation/**",
...SHARED_DB_AND_HELPER_PATHS,
],
},
"koreader-file-naming": {
id: "koreader-file-naming",
name: "KOReader File Naming",