Repository navigation
Conversation
An interrupted download's partial is a MediaStore item with IS_PENDING=1. Collection-wide MediaStore matches leave pending items out unless the caller opts in, so every slot delete (permanent failure, Remove, revoke cleanup, a fresh restart's pre-clean) and every profile/server purge deleted nothing, and each attempt left a hidden `.pending-…` file that the OS only expires after about a week. - Path deletes opt in to pending items (QUERY_ARG_MATCH_PENDING on Android 11+, setIncludePending on Android 10). - The worker's stop handler used to rely on that delete missing the partial: a Wi-Fi or other system stop now keeps the partial for the retry and only an app cancel deletes it. - Cancelling waiting work from the item detail screen deletes the kept bytes along with the row.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Preserving partial bytes after a system stop changes the mobile Downloads row’s progress during retry from restarting at zero to resuming at the retained amount ( Suggested fix: No diff; replace the “no user-visible change” evidence line with captures covering the listed devices and flow. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
Evidence is published at https://evidence.siloserver.org/r/silo-android/pr-674/. On the retry progress point: on main a system stop already resumed from the partial, because the delete could not see pending items, so the retry behaviour does not change; this branch keeps that while making deletes work. The visible difference is the failed row's size (119.5 MB before, 0 B after) and the freed storage, shown on the phone where the low-storage run happened. |
|
This PR is superseded: #675 merged its commit in 338f5e0 on main. That squash includes "fix(downloads): delete pending MediaStore partials with their slot". Main already has everything this branch changes: the pending-inclusive folder deletes in No issues are linked, so closing it closes nothing else. Thanks for the work, @Rhainland. Posted by Claude Code (claude-opus-5-5) on behalf of the maintainer. |
Problem
Related issue: N/A
Validation tasks: unblocks #329 C2, C3
A download that does not finish leaves its partial file in shared storage. When a download fails (for example the phone runs out of space), or the user removes one that is still downloading, the app's delete finds nothing to remove: the partial is a MediaStore item still marked pending, and the slot delete's folder query skips pending items unless it opts in. MediaProvider logs "Deleted 0 … items" for each attempt. On a test phone, three interrupted downloads of one 181 MB movie left 236 MB of hidden
.pending-*files inMovies/Silo/…. Android only expires pending items after about a week, so a user who is already short of space silently loses more.This change deletes a slot's pending partials together with the slot.
Approach
MediaStorePublicDownloadStoreroutes its folder deletes (the slot delete, the slot pre-clean before a new download, and the profile/server purges) through one helper that includes pending items:QUERY_ARG_MATCH_PENDING = MATCH_INCLUDEon Android 11+,setIncludePendingon Android 10. Deletes stay limited to this app's items in that slot's folder. Every caller already stops or waits for the slot's worker first.Validation
./scripts/test-check-build-supply-chain.sh,./scripts/check-build-supply-chain.sh: pass../gradlew testDebugUnitTest: 908 tests, 1 failure,ReflowStyleTest > line height flows from settings, which also fails on main (confirmed on main at 5e19a58). New tests: a fake MediaStore that hides pending rows unless the caller opts in shows a slot delete removing its pending partials and leaving a sibling slot's files alone; a stop-reason table decides when the partial is kept.assembleDebugfor both apps: pass..pending-*files from earlier runs along with the finished file.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/pr-674/
Risks
Deletes now remove pending items in a slot's folder. They stay limited to this app's items and to that one slot, and run only after the slot's worker has stopped.
Merge this before #675; that pull request contains this one's commit.
Checklist
AI Disclosure