feat(apps): live shelf import progress, bundled Red Riding Hood, remove failed books
Draft
CU
5mo ago+1166+1166+0123456789012345678901234567890123456789-23-23-01234567890123456789
Summary
This PR delivers three user-facing improvements discovered from a full walkthrough of the Kinora desktop app:
1. Live import progress on the shelf (large UX improvement)
The backend already exposed GET /api/books/events (SSE ingest_progress) and book progress/stage fields, but neither desktop nor mobile subscribed. This wires the existing infrastructure end-to-end:
LibraryEventsClientin@kinora/core— SSE client with reconnect + cache patching helpersuseLibraryEventshook on both shelves — live progress updates + 4s polling fallback while any book is importing- Progress bars + stage labels on
BookCover/BookCard(e.g. "Analyze · 45%") - Gate opening until
status === ready(failed/importing books cannot be opened) - Upload error banner on desktop when
POST /api/booksfails - SSE auth fix — reconnect library events when the JWT token becomes available (fixes silent 401s on
/api/books/events)
2. New public-domain book: Little Red Riding Hood
assets/books/build_little_red_riding_hood_pdf.py— 5-page Grimm tale with text layer + vector artmake demo-pdfbuilds both Frog-King and Red Riding Hood PDFsmake seed-libraryuploads both bundled books via the live API (idempotent — skips titles already on shelf)
3. Remove failed imports from shelf (second improvement from testing feedback)
Walkthrough showed failed imports cluttering the shelf with no recourse. Added:
DELETE /api/books/{book_id}— ownership-checked removal with progress key cleanup- Remove button on failed book covers (desktop ✕, mobile "Remove" pill)
- API test:
test_delete_book_removes_from_shelf
Verification
make install && make demo-pdf
make stack-up && make seed-library # needs valid DASHSCOPE_API_KEY for ingest to reach ready
make app-install && make app-desktop-dev
pnpm --filter @kinora/core test
KINORA_TEST_DATABASE_URL=postgresql+asyncpg://kinora:kinora@localhost:5432/kinora \
KINORA_TEST_REDIS_URL=redis://localhost:6379/0 \
KINORA_TEST_S3_ENDPOINT_URL=http://localhost:9000 \
backend/.venv/bin/pytest backend/tests/test_api_books.py::test_delete_book_removes_from_shelf -q
make app-typecheck # desktop + core pass; mobile has pre-existing ReadingScreen type error
Manual walkthrough (desktop @ :5173, demo@kinora.local / demo-password-123):
- Login → shelf shows import status chips
- Failed books show remove affordance and cannot be opened
- Upload shows importing state; progress bar visible when SSE + ingest are healthy
Notes
- Ingest still requires a valid
DASHSCOPE_API_KEY; withtestplaceholder, books reachfailedquickly — the new UX surfaces that state clearly and lets users clean up. - Keep
KINORA_LIVE_VIDEO=falseunless intentionally testing live video spend.


Summary by cubic
Show live import progress on the shelf across desktop and mobile, with progress bars and stage labels; books only open when ready, and failed imports can be removed. Also bundles Little Red Riding Hood and adds a script to seed both demo books.
-
New Features
- Live shelf progress via SSE:
LibraryEventsClientin@kinora/coreplususeLibraryEventshooks (desktop + mobile) with a 4s polling fallback. - Shelf UI: progress bars and stage chips; disable open until
status=ready; desktop shows an upload error banner on failed POSTs. - Remove failed imports:
DELETE /api/books/{book_id}with ownership and progress cleanup; remove affordance on failed covers (desktop ✕, mobile “Remove”). - New bundled book: Little Red Riding Hood (PDF builder + asset);
make demo-pdfbuilds both Frog‑King and Red Riding Hood;seed_library.pyandmake seed-libraryupload both idempotently.
- Live shelf progress via SSE:
-
Bug Fixes
- SSE auth: reconnect library events when the JWT becomes available to prevent silent 401s.