Skip to content

feat(desktop): live shelf ingest progress and failed-book removal - #6

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/user-experience-and-testing-aae9
Draft

cursor[bot] wants to merge 2 commits into
mainfrom
cursor/user-experience-and-testing-aae9

Conversation

@cursor

@cursor cursor Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

Summary

This PR addresses the biggest first-run UX gap on the library shelf: after uploading a book, Phase A ingest can take minutes but the apps were not wired to the backend's live progress channel.

Primary improvement: live ingest feedback on the shelf

  • Added LibraryEventStream in @kinora/core to subscribe to GET /api/books/events (SSE ingest_progress)
  • Desktop library patches the React Query cache in real time as ingest stages advance
  • Book covers show a live progress bar and stage label during import
  • Opening a non-ready book is blocked with a clear gate message
  • Upload errors from the API envelope are surfaced in a dismissible banner
  • Poll fallback every 5s while any book is still importing (catches the final ready flip if SSE drops)

New open-source demo book

  • Added assets/books/build_little_red_cap_pdf.py — Little Red Riding Hood (Brothers Grimm, public domain)
  • make demo-pdf now builds both Frog-King and Little Red Riding Hood PDFs

Second improvement (from user testing)

Testing surfaced that the failed-import gate toast told users to "remove the book" but provided no way to do it.

  • Added DELETE /api/books/{id} (owner-only, cascades child rows)
  • Failed book covers now show a Remove button on the shelf

Verification

make install && make demo-pdf
pnpm install && pnpm --filter @kinora/core test
pnpm --filter @kinora/desktop typecheck
make stack-up && make seed-demo   # or seed_e2e for fast pre-ingested shelf
make app-desktop-dev

Manual walkthrough (local stack):

  1. Log in → library shows ingest progress on uploading books
  2. Click a failed/importing book → blocked with toast; failed books can be removed
  3. Open a ready book → reading room loads PDF + cinema pane

Backend impact

  • New route: DELETE /api/books/{book_id} (204)
  • BookRepo.delete() helper
  • Test: test_delete_book_removes_from_shelf
Open in Web View Automation 

Summary by cubic

Adds live ingest progress to the desktop shelf and lets users remove failed imports. Also adds a second public‑domain demo book for testing.

  • New Features
    • @kinora/core: LibraryEventStream subscribes to GET /api/books/events (SSE ingest_progress) and patches React Query caches.
    • Desktop shelf UI: progress bar + stage label on covers; blocks non‑ready books with a clear gate message; shows upload errors in a dismissible banner.
    • Poll fallback every 5s while any book is importing to catch the final ready flip if SSE drops.
    • Failed imports: new Remove button on covers; backend DELETE /api/books/{id} (owner‑only) removes the book and cascades child rows.
    • New demo PDF: Little Red Riding Hood; make demo-pdf now builds both demos.
    • Tests for SSE parsing, shelf helpers, and DELETE /api/books/{id}.

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

Review in cubic

cursoragent and others added 2 commits June 23, 2026 20:09
Wire GET /api/books/events into the desktop library with a shared
LibraryEventStream in @kinora/core. Book covers now show a live progress
bar and stage label during Phase A ingest, block opening until ready,
and surface upload errors from the API envelope.

Also add Little Red Riding Hood as a second public-domain demo PDF.

Co-authored-by: Rishabh Bansal <rishabhcli@users.noreply.github.com>
Add DELETE /api/books/{id} so readers can dismiss a failed import
after the gate toast tells them to. Failed book covers now show a
Remove button that clears the book from the library.

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