Chunked JS surface — types, codegen spec, chunkPlan - #32
Merged
Conversation
This was referenced Aug 24, 2026
dmurphy5
marked this pull request as ready for review
August 25, 2026 17:24
dmurphy5
force-pushed
the
dylan/v9-4-chunked-spec
branch
from
August 25, 2026 17:36
c3aab42 to
6d72a23
Compare
dmurphy5
marked this pull request as draft
August 25, 2026 17:38
dmurphy5
force-pushed
the
dylan/v9-4-chunked-spec
branch
2 times, most recently
from
August 27, 2026 19:46
1ad28fb to
a41621c
Compare
dmurphy5
marked this pull request as ready for review
August 27, 2026 19:51
Per docs/design/chunked-uploads.md. ChunkedUploadOptions (consumer-authored parts, required expiresAt), accept rules replacing acceptStatus on all uploads, errorKind 'expired', removeUpload, and chunkPlan — the deterministic greedy split the consumer calls so the create POST's part count and the parts array derive from one result. startUpload becomes a discriminated union and validates chunked input before crossing the bridge; codegen gets a separate startChunkedUpload entry point because it cannot model the union. No native implementation yet — the stack is runtime-complete at its tip. Native entry points for startChunkedUpload/removeUpload are stubs that reject with E_NOT_IMPLEMENTED so this change compiles on both platforms on its own; the Android and iOS engine changes replace them. noUncheckedIndexedAccess is on: Diana type-checks this package's shipped .ts under its own stricter config, so the library catches those breaks first. Final review fixes: - validateChunkedOptions now requires the parts to tile the file from byte 0 (sorted ascending, no gaps or overlaps), and each part to carry a non-empty url and plain-object headers — all rejected before the bridge. - startUpload JSDoc scopes idempotency: identical parts reconcile at any time; differing parts are a recreate, rejected while the upload is running. - removeUpload JSDoc covers the raw-upload case (cancels, no terminal event). - Tests for gap/overlap/out-of-order/nonzero-first-start/empty-url/bad-headers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dmurphy5
force-pushed
the
dylan/v9-4-chunked-spec
branch
from
August 28, 2026 16:49
a41621c to
29ac8f7
Compare
elliottkember
approved these changes
Aug 31, 2026
This was referenced Sep 3, 2026
dmurphy5
added a commit
that referenced
this pull request
Sep 3, 2026
This PR moves the merged chunked-upload work onto master. It replaces #39, which conflicted. The stacked PRs #32–#35 were reviewed and merged, but their stack was rooted on `dylan/v9-3-configure`, so their four squash commits landed on that branch and not on master. This branch carries those same four commits, cherry-picked onto the current master. The tree at the tip is byte-identical to the merged stack. There are no new changes, and there are no conflicts: the branch is a fast-forward of master. - Chunked JS surface — types, codegen spec, chunkPlan (#32) - Android chunked-upload engine (#33) - iOS chunked-upload engine (#34) - Global cap, example app, docs, v9.0.0 (#35) Prefer "Rebase and merge", so the four commits keep their identities on master. After the merge, master is v9.0.0 and gets the `v9.0.0` tag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the TypeScript surface for chunked uploads. It contains no engine code.
The new API is
startUploadwithtype: 'chunked'. The options are:id— the upload id. The consumer supplies it. It is required.path— the file to send.parts— a list of parts. Each part has a URL, headers, and a byte range.accept— rules that say which HTTP responses are a success. Each rule is a status code and optional body text. These rules replaceacceptStatusin all upload types, so the library has one shape.expiresAt— the time when the library must stop the upload. It is required.The library validates the parts. The first part must start at byte 0. Each next part must start where the last part ends.
The PR adds two functions.
chunkPlanis a pure function: give it a file size, and it returns the byte ranges for the parts. A property test sweeps every size at a reduced scale.removeUploadreleases a stopped upload's file and records.Codegen cannot model the raw/chunked union. Thus the native side gets a separate
startChunkedUploadentry point. The publicstartUploadstays one function and routes onoptions.type.The native functions are stubs on both platforms. They return
E_NOT_IMPLEMENTED. Thus this PR compiles and passes CI alone. The engine PRs above this one replace the stubs.The PR also turns on
noUncheckedIndexedAccess. Diana type-checks the shipped.tsfiles with that setting, so the library must catch those breaks first.🤖 Generated with Claude Code