Skip to content

feat(apps): live shelf import progress, bundled Red Riding Hood, remove failed books - #8

Draft
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/user-experience-and-testing-52e8
Draft

cursor[bot] wants to merge 4 commits into
mainfrom
cursor/user-experience-and-testing-52e8

Conversation

@cursor

@cursor cursor Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

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:

  • LibraryEventsClient in @kinora/core — SSE client with reconnect + cache patching helpers
  • useLibraryEvents hook 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/books fails
  • 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 art
  • make demo-pdf builds both Frog-King and Red Riding Hood PDFs
  • make seed-library uploads 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; with test placeholder, books reach failed quickly — the new UX surfaces that state clearly and lets users clean up.
  • Keep KINORA_LIVE_VIDEO=false unless intentionally testing live video spend.
Open in Web View Automation 

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: LibraryEventsClient in @kinora/core plus useLibraryEvents hooks (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-pdf builds both Frog‑King and Red Riding Hood; seed_library.py and make seed-library upload both idempotently.
  • Bug Fixes

    • SSE auth: reconnect library events when the JWT becomes available to prevent silent 401s.

Written for commit f3e8e78. Summary will update on new commits.

Review in cubic

cursoragent and others added 4 commits June 23, 2026 22:06
- Add LibraryEventsClient in @kinora/core for /api/books/events SSE
- Wire desktop and mobile shelves with live progress + polling fallback
- Block opening books until ready; show upload errors on desktop
- Add Little Red Riding Hood public-domain book + seed-library script

Co-authored-by: Rishabh Bansal <rishabhcli@users.noreply.github.com>
Co-authored-by: Rishabh Bansal <rishabhcli@users.noreply.github.com>
- Add DELETE /api/books/{id} with ownership check and progress cleanup
- Show remove affordance on failed book covers (desktop + mobile)
- Add API test for shelf deletion

Co-authored-by: Rishabh Bansal <rishabhcli@users.noreply.github.com>
Co-authored-by: Rishabh Bansal <rishabhcli@users.noreply.github.com>
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