Repository navigation
refactor(client-runtime): share the Effect attachment upload registry with web - #37743
Merged
juliusmarminge merged 4 commits intoNov 16, 2026
Conversation
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.
Mobile and web each had their own attachment upload queue, with the same concepts: a job per attachment, a few uploads at a time per environment, cancel, retry, and a send that waits on the running upload. Web's 700-line queue ran all of it on zustand, promises, a pump,
settledpromises andcancelled/abortflags. This moves the Effect registry from #37682 intoclient-runtimeand runs both clients on it.Shared in
client-runtimestate/attachment-uploads(createAttachmentUploadRegistry): anRcMapof upload fibers keyed by a caller-supplied key, with per-environment concurrency, explicitholds plus asyncfor a set of requests, joining (upload),currentto await an upload without holding it, and optional statuses.Effect.tryPromisecalls, whose signal aborts the native upload or XHR on interruption.runAttachmentUploadCycleandverifyPersistedAttachmentUploadare Effects. Interrupting the cycle aborts the transfer and deletes the fresh mint, even when the interruption lands while minting. That replacesonMintedcancel and theaborthandoff. A failure still returns the minted id so the caller decides between retry and release.Mobile's composer worker creates the registry directly with its key, environment and concurrency, and
uploadComposerAttachmentis an Effect over the shared cycle. Its failures use the sharedAttachmentUploadError.Web keeps its upload policy and public API: previous uploads across environment switches, release deletes, retry on reconnect, expiry checks, draft stamping, and its zustand states. Each upload is now a registry hold running an Effect, which replaces the job map, pump,
settledpromises and cancel flags. Uploads start inside the holder's call, as web's queue did.Verification
client-runtime. Web's 20 queue tests, its other queue users, and theuseQueuedRunEditbrowser test pass unchanged. That includes "does not let stalled uploads block another environment", which covers per-environment concurrency.vp run check:changedpasses (typecheck across all 41 dependent packages). Stacked on #37725.Done by Claude Opus 5.5 in Claude Code via T3 Code.
🤖 Generated with Claude Code