From 20a5b084fd4c33f20075542192c5e0b9d4e655c2 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 4 Nov 2026 22:34:35 +0900 Subject: [PATCH] =?UTF-8?q?fix(http):=20Fileserver=20422=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EA=B1=B0=EC=A0=88=EC=9D=80=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EA=B1=B0=EC=A0=88=EB=A1=9C,=20=ED=82=A4=20=EC=9E=AC=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=20=EB=B6=88=EC=9D=BC=EC=B9=98=EB=8A=94=20=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=20=ED=91=9C=EB=8C=80=EB=A1=9C=20=EC=9D=BD=EB=8A=94?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제 fix/r1103-transfer의 Fileserver 업로드 client는 실패 kind를 공유 Envelope 판정(envelopeFailureReading)에서 받고 413·415만 VALIDATION_REJECTED로 바꾼다. fix/r1103-http(1103/08-05)는 필드 목록 없는 422를 UNKNOWN_CLIENT_FAILURE로 읽게 했다. 두 브랜치를 합치자 Fileserver의 422(digest·서명·검사기 거절, 예: MALWARE_DETECTED)가 입력 거절이 아니게 되어 통합 테스트 2건이 실패한다. 고른 방법 - Fileserver 계약에서 422는 파일 자체의 거절이다(백엔드 docs/fileserver/http-contract.md 상태 표). 사용자가 파일을 바꿔야 하는 413·415와 같이 VALIDATION_REJECTED로 둔다. - 422 IDEMPOTENT_REQUEST_MISMATCH(같은 키, 다른 본문)는 파일 문제가 아니므로 08-05의 공통 판정(UNKNOWN_CLIENT_FAILURE)을 따른다. 테스트 기대값도 그렇게 바꿨다. - 버린 대안: 공통 판정을 422 전체 입력 거절로 되돌리기. 08-05가 고친 결함(같은 키 불일치를 입력 오류로 보임)이 다시 생긴다. 위험·한계 - 422 code 목록을 파일 거절로 고정하지 않고 "불일치가 아니면 파일 거절"로 본다. 백엔드가 파일 업로드에 다른 뜻의 422를 더하면 다시 본다. 검증 - test:integration 189건(fileserver-upload 48건 포함), check:types, lint 통과. Refs: docs/reviews/2026-11-03-maturity-review/01-adapters-browser-transfer.md 01-01, 08-presentation.md 08-05 --- src/adapters/http/fileserver-upload.ts | 13 +++++++++---- tests/integration/fileserver-upload.test.ts | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/adapters/http/fileserver-upload.ts b/src/adapters/http/fileserver-upload.ts index b9171dfb..47646e07 100644 --- a/src/adapters/http/fileserver-upload.ts +++ b/src/adapters/http/fileserver-upload.ts @@ -643,10 +643,15 @@ function envelopeFailure( const waitRefused = retryAfterMs !== null && retryAfterMs > settings.maxRetryAfterMs; const reading = envelopeFailureReading(status, error); - // A file the server refuses by size or type is the user's to replace, as - // the same refusal before sending is (`readMultipartBody`). - const kind: FailureKind = - status === 413 || status === 415 ? "VALIDATION_REJECTED" : reading.kind; + // A file the server refuses by size, type, digest, signature or scan is the + // user's to replace, as the same refusal before sending is + // (`readMultipartBody`). A 422 for a reused key with another body is not + // about the file and reads as the shared table reads it (2026-11-03 08-05). + const fileRefused = + status === 413 || + status === 415 || + (status === 422 && error.code !== "IDEMPOTENT_REQUEST_MISMATCH"); + const kind: FailureKind = fileRefused ? "VALIDATION_REJECTED" : reading.kind; const created = createFailure(kind, FILESERVER_UPLOAD_OPERATION_ID, 0, { code: reading.code, httpStatus: status, diff --git a/tests/integration/fileserver-upload.test.ts b/tests/integration/fileserver-upload.test.ts index 0d8d8904..ec5bd27b 100644 --- a/tests/integration/fileserver-upload.test.ts +++ b/tests/integration/fileserver-upload.test.ts @@ -317,7 +317,7 @@ describe("Fileserver multipart upload — Envelope failures", () => { { status: 413, code: "QUOTA_EXCEEDED", category: "CONFLICT", retryable: false, kind: "VALIDATION_REJECTED", effect: "NOT_APPLIED", clientRetryable: false }, { status: 415, code: "UNSUPPORTED_MEDIA_TYPE", category: "VALIDATION", retryable: false, kind: "VALIDATION_REJECTED", effect: "NOT_APPLIED", clientRetryable: false }, { status: 422, code: "MALWARE_DETECTED", category: "DATA_INTEGRITY", retryable: false, kind: "VALIDATION_REJECTED", effect: "NOT_APPLIED", clientRetryable: false }, - { status: 422, code: "IDEMPOTENT_REQUEST_MISMATCH", category: "VALIDATION", retryable: false, kind: "VALIDATION_REJECTED", effect: "NOT_APPLIED", clientRetryable: false }, + { status: 422, code: "IDEMPOTENT_REQUEST_MISMATCH", category: "VALIDATION", retryable: false, kind: "UNKNOWN_CLIENT_FAILURE", effect: "NOT_APPLIED", clientRetryable: false }, { status: 500, code: "PARTIAL_WRITE", category: "TRANSIENT_DEPENDENCY", retryable: false, kind: "SERVER_FAILURE", effect: "NOT_APPLIED", clientRetryable: false }, { status: 500, code: "AMBIGUOUS_COMPLETION", category: "DATA_INTEGRITY", retryable: false, details: { ambiguous: true, reconciliationRequired: true }, kind: "SERVER_FAILURE", effect: "MAYBE_APPLIED", clientRetryable: false }, { status: 500, code: "INTERNAL_ERROR", category: "INTERNAL", retryable: false, kind: "SERVER_FAILURE", effect: "MAYBE_APPLIED", clientRetryable: false },