feat(android): UploadJobs — an upload from a phone survives the app being killed

MediaUploader.upload(jobs, key, …) seals once into an app-private job
directory and resumes with the same media id; a job already done gives its
grant again unless the relay says the file is gone. OS file locks keep one
upload per job. The live cross-check now kills a job after its first piece
and resumes it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-19 00:21:52 +02:00
parent f5125b8f66
commit b53dcd7813
5 changed files with 377 additions and 3 deletions

View File

@@ -10,7 +10,8 @@
* client, then runs the gated `MediaLiveTest` in android/ with
* `SHADE_MEDIA_LIVE_SPEC` set. That test opens the TS file from its link,
* seals and uploads a 40 MiB film in pieces and a photo in one PUT, puts the
* film again (the relay already has it) and deletes the photo. This script
* film again (the relay already has it), runs an upload job that is "killed"
* after its first piece and resumed, and deletes the photo. This script
* then opens the Kotlin film from its link with the TS reader and checks every
* byte, and that both faults were hit and recovered from.
*
@@ -105,10 +106,10 @@ try {
check((await fetch(out.photo.url, { method: 'HEAD' })).status === 404, 'the deleted photo is still served');
check(faults.lostAnswer === 1 && faults.refused === 1, `faults not hit: ${JSON.stringify(faults)}`);
const left = await new MediaClient(url, kotlinOwner).list();
check(left.items.length === 1, `Kotlin owner should have 1 file left, has ${left.items.length}`);
check(left.items.length === 2, `Kotlin owner should have 2 files left (film, re-shared video), has ${left.items.length}`);
console.log(
`LIVE OK — Kotlin read the TS file; Kotlin film ${(out.film.size / MiB).toFixed(1)} MiB in ${faults.pieces} piece requests ` +
`(${faults.starts} starts/resyncs, 1 lost answer, 1 refusal) read back by TS byte for byte; photo deleted`,
`(${faults.starts} starts/resyncs, 1 lost answer, 1 refusal) read back by TS byte for byte; upload job killed and resumed; photo deleted`,
);
} finally {
server.stop(true);