fix(http): Fileserver 422 파일 거절은 입력 거절로, 키 재사용 불일치는 공통 표대로 읽는다
문제 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
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user