Download follow-ups from #4: atomic final-name claim (S29) + small cleanups #5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Carried out of the #4 review trail — the approving review (
b1c13f5) left one follow-up and four nits, none blocking. Original write-up: #4 (comment)S29 — the final name has the same race the temp name lost
In
SchemaViewModel.downloadToAppDownloads(pre-Q path):Two transfers can genuinely run at once — two pages on the back stack, each with its own ViewModel and its own guard. If both resolve the same
finalName, neitherexists()at check time, both compute the same candidate, and the secondrenameTosilently replaces the first — exactly whatuniqueNameexists to prevent. Check and claim are two steps; the filesystem is the shared thing between them.Pre-existing (a per-ViewModel guard never bound cross-page downloads), not introduced by #4.
Fix:
minSdkis 26, soFiles.move(temp.toPath(), target.toPath())withoutREPLACE_EXISTINGthrowsFileAlreadyExistsExceptionatomically. Retry with the nextuniqueNamecandidate on that exception — the loop becomes a claim instead of a poll.Nits
runActionandsubmitFormwrap their POST inrunCatchingwithout rethrowingCancellationException;probe()andopenActionboth rethrow. Harmless (token guard catches it), but the rule has two exceptions left.downloadJobis the only job field without the self-nullinginvokeOnCompletionthatsubmitJob/actionJobhave. Functionally fine; odd one out.sweepOrphanPartsKDoc overclaims: Q+ "deletes its own pending row on failure" only for failures it sees — process death leaves a pendingIS_PENDINGrow this code never deletes (platform expires it after ~7 days). Doc fix..parts/sweep's reach forever. Only affects machines that ran those commits; decide whether a one-time root sweep of.{name}.{random}.part-shaped files is worth it or leave it.