Loading…
Reference in a new issue
No description provided.
Delete branch "mcp/downloads-coherent-experience"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Unified Downloads program branch for #19, #20, #21, #22 and #29.
Implementation order: #19 → #22 → #29 → #20 → #21 → integration hardening.
This PR is the single review surface for the coherent Downloads implementation. It is not ready to merge until:
Do not merge yet.
077041ad2d2df7ee5104Independent Test & Acceptance review — canonical findings
Reviewed exact HEAD
90c188bba30ca6b4a2c4a2ebc0cd1f07be5f5c73againstmain@f9f7feba8e7bb499c6001bf0cc19a38357b7494a.Merge base is the same main SHA; branch is 91 ahead / 0 behind and Forgejo reports mergeable.
BLOCKER — DownloadsViewModel does not compile once verification reaches Kotlin compilation
app/src/main/kotlin/com/example/shelfplayer/feature/downloads/DownloadsViewModel.ktuiStatecallscopy.toRow(..., storageState = storageState(...))around line 197.OfflineBook.toRowaround line 303 accepts onlybook,execution, andpartialBytes.DownloadRowalso never assigns the computed storage state, so it would retain the defaultUnknown.Repair: add the storage-state argument to the projection and assign it to
DownloadRow.storageState, then add/retain a test proving Available/Unavailable/Unknown reaches the row.BLOCKER — removing a last-claim copy while its removable owner is absent can orphan bytes and erase durable reachability
data/downloads/src/main/kotlin/com/example/shelfplayer/data/downloads/BookDownloader.kt::removearound lines 176-192 andDownloadStorage.deleteItem.Current order:
storage.deleteItem(...);DownloadStorage.deleteItemonly enumerates currently reachable roots. If the physical owner is an absent removable card, its directory is not reachable, so no bytes on that card are deleted; the code can then forget the manifest anyway. When the card returns, the physical bytes are orphaned and BookWave has lost the durable owner/manifest that made them manageable.This violates #20's preservation rule and the destructive-ordering safety requirement in #21. Repair must not erase manifest/claims until byte deletion is known to have succeeded for the actual physical owner. Known-Unavailable should not perform destructive removal as though the owner were reachable.
MAJOR — mid-transfer card removal is persisted as download failure
data/downloads/src/main/kotlin/com/example/shelfplayer/data/downloads/FileDownloader.kt::download+BookDownloader.download.The owner-pinned path is good:
partFor(..., storageVolumeUuid)returns null rather than silently falling back to internal. However that producesAppError.Storage("The download storage is currently unavailable.");BookDownloader.downloadthen unconditionally callsrepository.markFailed(...). Transfer failures after the card disappears likewise record a Failed file before the book is marked Failed.That contradicts #20's core invariant: a known unavailable removable owner must remain Unavailable, not Failed/Missing/Corrupt. Repair needs a distinct storage-unavailable execution outcome that preserves durable file/book state and can resume/reverify when the owner returns.
Add deterministic coverage for card removal before opening the next file and during an active transfer; current tests prove “do not redirect to internal” but not “do not persist Failed”.
#21 product decision remains unresolved
Issue #21 still contains only the owner-decision request: A1 vs A2 and B1 vs B2. No newer owner choice exists. Therefore this PR cannot claim full #21 completion. This is not itself a code defect, but the existing device-wide Remove/pin semantics remain misleading until the product decision is made and implemented.
CI — exact HEAD run #1553
Standard / balanced / build APK=false on exact reviewed HEAD failed in Quick KtLint before verifyDebug:
:app:ktlintMainSourceSetCheckBookDownloadWorker.kt, signature formatting inDownloadNotificationFactory.kt, and when/indent formatting inDownloadsScreen.kt(plus additional findings)Historical exact-head run #1535 also failed KtLint. No CI was restarted during this review.
What is already structurally sound
dataSyncforeground-service type and permission are declared; WorkManager is 2.11.2 and targetSdk is 36.storageVolumeUuid; migration test starts from exported v20 and verifies manifest/files/claim survival.Platform note
The foreground-worker setup is valid, but Android 16 applies JobScheduler runtime quotas to long-running WorkManager workers even while WorkManager uses a foreground service. This is a real operational risk for very long audiobook transfers, not a reason by itself to require a scheduler rewrite in this PR. Device acceptance should include long/background transfers and interruption/retry behavior.
Physical acceptance still required after repairs
Real removable-card acceptance remains mandatory: download to card, offline playback, remove card, launch, verify Storage unavailable without durable failure/destruction, perform a new download with internal fallback disclosure, reinsert card, reverify/reuse old copy without redownload, and confirm the removable preference remains selected. Also exercise simultaneous downloads/notifications and process restart.
Verdict
PR #94 ACCEPTANCE BLOCKED — REPAIRS REQUIREDRepair the two blockers, the mid-transfer unavailable-state defect, all KtLint findings, and rerun exact-head Standard so verifyDebug/tests/Detekt/Lint actually execute. After that, #21 still needs an explicit owner decision before the PR can claim full #21 completion, followed by the required physical removable-storage acceptance.