Home: stream arbitrarily large originals in multipart pieces
Native Home originals above the Worker streaming threshold previously used one presigned object PUT, leaving them subject to its single-request size limit. The Swift wire client now opts into bounded multipart pieces; completion streams them into an R2 multipart object and verifies the original size and SHA-256 before committing it.
- Preserve participant checks, derived-image ordering, rate policy and existing clients' presigned protocol. Admission and byte-quota changes remain in #26409.
- Make part writes conditional, reject invalid bounds and changed etags, batch cleanup, renew an idle lease only as pieces or assembly make progress, and abort interrupted assembly on slot expiry. Existing presigned compatibility tests stay intact.
- Support the same protocol in the self-hosted filesystem bucket, with streaming writes, assembly and downloads; deletion-safe listing cursors keep expiry cleanup complete.
- This PR covers the Swift wire client, API Worker and self-hosted server. The Rust cloud proxy remains on its existing transport; it needs a separate file/stream upload API before it can remove whole-file buffering.
Relevant standing order from the audit:
“No attachment size cap ("arbitrarily large files of any type"). ... Remove them (stream large files instead of reading them whole), invert the test, and add a lint that rejects MAX_*BYTES in attachment and upload paths.”
Validation:
- Focused checks passed at 676324936bda49447f8e347b20d0d6ed8e4fe077: 24 attachment API tests, all 11 self-hosted tests, and API/server typechecks.
- Native WireHomeSourceTests: all 13 passed, including ordered multipart upload, in fleet step
35c4a3068013dcaa7722b420at dda6701fe6f28320ef41d90380f3d2324cc57e35. Its CmuxHomeCore treee72e4608939d313ec62ca0d1e350426663826e5cis identical at the final head. - Full API check at dda6701fe6f28320ef41d90380f3d2324cc57e35 passed, along with all 11 self-hosted tests and both typechecks. Final attachment/typecheck check at 8788b3c6cd05e97732d7a772ac05d1432a47532c passed all 25 tests and the API typecheck; the final delta adds idle-lease renewal and its regression.
Each streaming loop ends on EOF, bounds failure or cancellation; file handles/readers close on exit and expiry aborts incomplete assembly.
HOLD: exact-head independent review is pending.
Agent session: agent session