Skip to content

fix: enable MOBI and AZW vectorization on mobile - #690

Open
cha1latte wants to merge 11 commits into
codedogQBY:mainfrom
cha1latte:fix/mobi-vectorization
Open

fix: enable MOBI and AZW vectorization on mobile#690
cha1latte wants to merge 11 commits into
codedogQBY:mainfrom
cha1latte:fix/mobi-vectorization

Conversation

@cha1latte

@cha1latte cha1latte commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

What changed

  • enables manual and automatic vectorization for DRM-free MOBI, AZW, and AZW3 books on mobile
  • replaces duplicated format allowlists with one capability owner and preserves stored format/filename context through the WebView reader
  • rejects protected PalmDOC/MOBI records before extraction; no decryption or DRM bypass is added
  • distinguishes protected, malformed, unsupported, and unknown extraction failures with localized messages
  • adds real queued/active cancellation through extraction, embedding, and persistence, with cleanup before any terminal success/cancel state
  • makes vectorization completion database-first on mobile and desktop so persistence failures cannot produce a false Indexed state
  • isolates concurrent reader extraction sessions so one book can never receive another book's chapters

Root cause

ReadAny's bundled Foliate parser already understands DRM-free MOBI/KF8, but the mobile vectorization entry points only allowed EPUB/PDF/TXT/UMD and lost the book-format hint when files arrived as generic binary data. The existing lifecycle also needed stricter failure, persistence, and cancellation boundaries before these formats could be enabled safely.

Real-book proof

The regression suite includes official Project Gutenberg ebook 11 fixtures for MOBI v6 and KF8/AZW3. Their source URLs, sizes, SHA-256 values, retrieval date, and public-domain/license context are recorded beside the fixtures. Tests run the real Foliate parser/decompressor, assert ordered Alice text, and prove a synthetic nonzero-encryption header is rejected without decryption.

Validation

  • TZ=UTC pnpm --filter @readany/core test ? 600 passed
  • TZ=UTC pnpm --filter @readany/app-expo test ? 100 passed
  • pnpm --filter @readany/app-expo exec tsc --noEmit
  • pnpm --filter @readany/app-expo build:reader ? deterministic generated output
  • pnpm --filter app build
  • targeted Biome ? 45 changed files clean; documented pre-existing warnings/format noise excluded in four legacy/vendor files
  • git diff --check upstream/main...HEAD
  • independent final review ? no Critical, Important, or Minor findings

Scope and limitations

  • DRM-free MOBI, AZW, and AZW3 only
  • KFX and protected Kindle books remain unsupported
  • embedding providers, chunk sizes, ranking, retrieval, and search behavior are unchanged

Manual acceptance still pending

The implementation and automated real-book coverage are ready for maintainer review. A live Android acceptance pass remains pending for real MOBI/AZW3 import, manual and automatic vectorization, grounded answers, protected-file messaging, queued/active cancellation, and absence of partial searchable residue after cancellation.

@cha1latte
cha1latte marked this pull request as ready for review August 17, 2026 15:12
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