Skip to content

feat(matching): track detected books without a companion - #130

Open
serabi wants to merge 3 commits into
devfrom
feat/track-solo-reading-activity
Open

feat(matching): track detected books without a companion#130
serabi wants to merge 3 commits into
devfrom
feat/track-solo-reading-activity

Conversation

@serabi

@serabi serabi commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Problem

Two issues with the Currently Reading inbox:

  1. Cutesy, misleading copy. The dashboard banner said "Currently Reading books need companions" — which describes PageKeeper's internal pairing model, not what the user needs to know (books detected in progress that aren't tracked yet). Worse, the nav item and the dashboard's tracked-books section were both called "Currently Reading" while pointing at different things.
  2. Ebook-only reads dead-ended. The inbox only offered "Review match / Find companion" or "Dismiss". Review match exists solely to confirm an opposite-format companion (_post_pairing_review has no other path), so a book you'll only ever read as an ebook hit a wall: pair an audiobook you don't have, dismiss it (untracked), or hunt through Add Book yourself — even though import_ebook_only and import_audio_only already existed in the intake module.

Changes

  • Rename to Reading Activity — nav item and page title for /suggestions, removing the collision with the dashboard's Currently Reading section. Empty-state and dismiss-confirm copy updated to match.
  • Honest banner — "Untracked books in progress" with an "Open Reading Activity" button.
  • New track_solo intake action (matching_bp.py:_post_track_solo) routes by detection source:
    • ABS → import_audio_only (live title/duration/author lookup)
    • KoSync hash → import_ebook_only(kosync_doc_id=...)
    • Grimmory ebook / Storyteller → import_ebook_only
    • Grimmory audiobook-only detections keep the companion flow (no solo path exists yet)
  • import_ebook_only accepts kosync_doc_id — hash-detected Kobo docs have no filename to compute one from.
  • Escape hatch on review page — "Track as {format} only" replaces the dead-end "No opposite-format companions were found" text; also offered alongside live companion choices.
  • Card-level shortcut — pairing cards get a format-aware "Track as {format}" button between Review match and Dismiss.
  • Identity quirk handled — after solo tracking, the detected row is resolved by its true identity explicitly: Grimmory detections keyed {instance}:{id}:{fileId} don't match the {instance}:{filename} key import_ebook_only resolves internally, so cards would otherwise linger.

Testing

  • New track_solo tests covering all four sources plus resolved-detection, unsupported-format, and missing-detection rejections
  • Updated assertions in navigation shell, pairings inbox, and dashboard error tests for the renamed copy

1360 passed, 2 skipped (pre-existing). ruff check clean.

Note

Add solo-track flow for detected books without a companion and rename 'Currently Reading' to 'Reading Activity'

  • Adds _post_track_solo handler in matching_bp.py so users can track a single detected format without pairing — supports ABS audio-only imports, and ebook-only imports from KoSync, Storyteller, and Grimmory (when ebook_filename exists)
  • Extends BookIntakeService.import_ebook_only in book_intake_service.py to accept kosync_doc_id directly; when present, saves via save_book_with_kosync_ownership and returns 409 on KoSyncOwnershipConflict instead of falling back to save_book
  • Adds solo_track_supported flag to the match page context, disabled for Grimmory audiobooks; adds solo-track buttons in match.html and suggestions.html
  • Rebrands "Currently Reading" to "Reading Activity" across the navbar, dashboard, and suggestions page in navbar.html, index.html, and suggestions.html
  • Behavioral Change: import_ebook_only no longer calls ensure_kosync_document unconditionally; when kosync_doc_id is present the save is atomic with ownership and may return 409 on conflict, whereas storyteller-only imports still use plain save_book

Macroscope summarized 6f5da49.

serabi added 2 commits August 23, 2026 13:41
Reading Activity inbox (renamed from Currently Reading) forced every
detected book through companion pairing, dead-ending ebook-only reads.

- Rename nav/page to Reading Activity; dashboard banner now says
  'Untracked books in progress'
- Add track_solo intake action: ABS detections import audio-only,
  KoSync/Grimmory-ebook/Storyteller import ebook-only
- Extend import_ebook_only with kosync_doc_id for hash-detected docs
- Resolve detected rows by true identity after solo tracking
- Solo-track buttons on pairing cards and review page
@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). label Aug 23, 2026
Comment thread src/services/book_intake_service.py
Comment thread templates/match.html
…orted solo option

Addresses macroscopeapp review findings:

- High: import_ebook_only inserted a Book without claiming the KoSync
  document, so concurrent requests could create duplicate books sharing
  one hash. Hashed paths now use save_book_with_kosync_ownership and
  return 409 when another request owns the document.
- Medium: the review page rendered 'Track as audiobook only' for
  Grimmory audiobook detections that _post_track_solo always rejects.
  The block is now gated on solo_track_supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant