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
@@ -683,6 +683,18 @@ analytics는 제품 presentation이 소유한다.
| network/429/모든 5xx | `UNAVAILABLE` | bounded retry/backoff |
| complete 응답 유실·진행 중 | `UNAVAILABLE`(`UPLOAD_COMPLETE`, retryable) | 같은 파일로 `upload()` 재호출, 또는 `abort()`가 resourceId와 함께 `ALREADY_COMPLETED` 반환(4.3) |
`ResumableUploadPort.upload()` 실패의 `recovery`는 호출자가 할 행동 하나를
가리킨다(`resumable-upload.ts` port 주석, `resumable-upload-runtime.ts`
`toUploadAction`). 이 다섯 값 밖의 값은 `upload()`에서 나오지 않는다.
| recovery | 호출자 행동 |
| --- | --- |
| `RESUME` | 같은 파일·key로 `upload()`를 다시 부른다. `retryable:true`면 자동 재시도해도 된다. capability 재발급이 필요한 실패도 여기로 온다 |
| `RECONCILE` | `upload()`를 다시 부른다. 서버 상태를 먼저 읽는다(예: 다른 문맥이 checkpoint를 먼저 씀) |
| `RESTART` | `abort()` 뒤 `upload()`로 새 session을 연다. abort가 남아 있음(operation `UPLOAD_ABORT`), 읽을 수 없는 checkpoint 행, 서버 part가 파일과 다름 |
| `RESELECT` | 파일을 다시 고르거나, 다른 파일이면 새 key를 쓴다 |
| `NONE` | 이 요청으로 할 행동이 없다. 잘못된 입력, 상한·정책·권한 거절, 호출자 자신의 abort, 다시 불러도 같은 답이 오는 서버 응답(정책보다 긴 session 등) |
관측성에는 operation, safe outcome, byte/part/candidate bucket, retry bucket과
failure code만 기록한다. capability ID, URL, query, asset/resource/session ID,
file name, digest, raw ETag, receipt와 backend message는 log/diagnostics/telemetry에