fix(browser-transfer): map each upload() failure recovery to one caller action (01-05)

ABORT_PENDING and a checkpoint CAS race returned the same failure, and some
recoveries (REISSUE_CAPABILITY, RESTART for a replayed create) named actions
the caller cannot take or that repeat the failure. The port now documents a
five-value recovery table and upload() returns only those values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-25 22:22:27 +09:00
co-authored by Claude Opus 5.5
parent 5a6665a61f
commit 426b6b8eec
7 changed files with 269 additions and 25 deletions
@@ -101,6 +101,25 @@ export type UploadAbortOutcome = Readonly<{
}>;
export interface ResumableUploadPort {
/**
* 01-05. A failure's `recovery` names exactly one caller action:
*
* | recovery | caller action |
* | ----------- | ---------------------------------------------------------- |
* | `RESUME` | Call `upload()` again with the same file and key. With |
* | | `retryable: true` it may be retried automatically. |
* | `RECONCILE` | Call `upload()` again; it reads the server state first. |
* | `RESTART` | Call `abort()`, then `upload()` for a fresh session: an |
* | | abort is pending (operation `UPLOAD_ABORT`), the stored |
* | | row is unreadable, or the server's parts disagree with the |
* | | file. |
* | `RESELECT` | Select the file again, or use a new key for another file. |
* | `NONE` | No action on this request: invalid input, a limit, a |
* | | policy or permission refusal, the caller's own abort, or |
* | | a server answer that a new call would only replay. |
*
* No other recovery value is returned from `upload()`.
*/
upload(
request: ResumableUploadRequest,
): Promise<BrowserDataResult<QuarantinedUpload>>;