Skip to content

ADFA-4893 — Books: homologate to the ZIM download contract - #474

Merged
luisguzman-adfa merged 4 commits into
mainfrom
fix/ADFA-4893-books-homologate
Aug 26, 2026
Merged

luisguzman-adfa merged 4 commits into
mainfrom
fix/ADFA-4893-books-homologate

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Brings Books up to the treatment ZIM got: visible auto-reconnect, one morphing control
(Pause⇄Resume⇄Retry) + always-Cancel, and an idempotent resume — so both content types
behave identically. One PR under the download-contract story; no new tickets.

dash-node (server)

  • Visible reconnect: the books runner reports retry state (ctx.reportRetry), so
    GET /books/jobs/:id carries retryAttempt/retryTotal → the app shows "Reconnecting…
    n of 5" (books' 6-try per-item budget = n of 5, same label as ZIM).
  • Idempotent resume: presentTitles() skips books already in the Calibre-Web library
    (by title) instead of re-downloading + re-uploading them — which duplicated entries and
    reset the percent to 0. Also makes a resume after process death safe (ADFA-4897).
  • Bump 1.2.7 (dev through the PR).

app (convergence)

  • Generalize the REST client so ZIM and Books share one download client.
  • Re-point BooksDownloadService: pause/resume, onPaused/onReconnecting, poll percent,
    server cancel (today local-only).
  • BooksDownloadsFragment: morphing control row + honest labels; move Finish/Run-in-
    background to SetupProgressActivity (as ZIM); index-row determinate bar.

Not in this PR

  • Schedule standardization (books keeps its per-item 6-try budget; label matches).
  • Kolibri (separate mechanism).

Verification

On dash-node ≥ 1.2.7: start a Books download, drop Wi-Fi mid-download → "Reconnecting…
n of 5"; Pause/Resume/Cancel/Retry behave like ZIM; a resume does not duplicate books.

…mpotent resume

Books now follows the ZIM/rootfs reconnect contract: the books runner reports its
retry state via ctx.reportRetry (onRetry + cleared per item), so the poll carries
retryAttempt/retryTotal and the app can show "Reconnecting… n of 5". And the runner
is idempotent on resume — presentTitles() skips books already in the Calibre-Web
library (by title) instead of re-downloading + re-uploading, which duplicated entries
and reset the percent; this also makes a resume after process death safe. Bump 1.2.7-dev.1.
…ntrols

Generalize RestContentClient to type-parametric (start(body)) and interpret the
poll by percent + retry state, not the phase name, so kiwix (downloading/indexing)
and books (processing) share one client. Re-point BooksDownloadService onto it:
pause/resume, onPaused/onReconnecting, poll percent, server cancel — dropping its
inline POST/poll and the app-side retry loop (the server owns reconnection now).
BooksDownloadsFragment gets the morphing Pause⇄Resume⇄Retry + Cancel row and the
"Reconnecting… n of N" / paused labels (per-item pill removed); Finish/Run-in-
background stay for the standalone Books flow. Books index row gets the item-count
bar. ZIM unchanged (no-arg client ctor).
…ks next drain)

ACTION_CANCEL stopped the download but left the item non-terminal (ACTIVE), so the
session couldn't be dismissed and PendingContent.anyUnfinished stayed true, blocking
the next drain — a canceled book/zim got stuck and re-selecting never downloaded.
Cancel now calls finishSession() (clears the list; hasSession→false) + publish, so the
screen clears and the next drain runs. client.cancel() already cancels the server job.
@luisguzman-adfa
luisguzman-adfa merged commit eeaa57d into main Aug 26, 2026
4 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the fix/ADFA-4893-books-homologate branch August 26, 2026 04:31
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