From 3d3d6527ef66b799965b537774b0cfd5147eec50 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 5 Nov 2026 01:35:37 +0900 Subject: [PATCH] =?UTF-8?q?fix(http):=20Fileserver=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20client=EA=B0=80=20browser-file-storage=20=ED=8F=AC?= =?UTF-8?q?=ED=8A=B8=EB=A5=BC=20import=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제 src/adapters/http/fileserver-upload.ts(1103/01-01)가 입력 타입으로 application/ports/browser-file-storage의 FileByteSource를 import한다. test:browser-file-storage-removal(FE-GATE-020)은 그 선택 런타임과 포트를 지우고 남은 코드가 import하지 않는지 본다. 그래서 "Removed browser file/storage runtime is still imported by: src/adapters/http/ fileserver-upload.ts"로 항상 실패한다(리뷰 조치 X2 #7). 고른 방법 - client 안에 같은 모양의 FileserverByteSource(byteLength, stream이 Result를 낸다)를 두고 배럴로 낸다. client가 쓰는 것은 이 셋뿐이다. 제품은 FileContentPort.openSource가 준 FileByteSource를 그대로 넘긴다(구조 타입). - 버린 대안: 드릴이 이 client도 함께 지우기. http 배럴이 export하므로 배럴도 고쳐야 하고, 파일 runtime을 쓰지 않는 제품도 업로드 client를 잃는다. 위험·한계 - FileByteSource 모양이 바뀌면 두 타입이 어긋날 수 있다. 통합 테스트가 FileByteSource 값을 client에 넘기므로 check:types가 그 어긋남을 잡는다. 검증 - check:types(테스트의 FileByteSource → client 호환), lint, check:architecture, test:integration 통과. 드릴은 이 커밋 뒤 재실행한다. Refs: docs/reviews/2026-11-03-maturity-review/01-adapters-browser-transfer.md 01-01, README.md 14.6 X2 #7 --- src/adapters/http/fileserver-upload.ts | 21 +++++++++++++++++---- src/adapters/http/index.ts | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/adapters/http/fileserver-upload.ts b/src/adapters/http/fileserver-upload.ts index 47646e07..f3832d7e 100644 --- a/src/adapters/http/fileserver-upload.ts +++ b/src/adapters/http/fileserver-upload.ts @@ -1,4 +1,3 @@ -import type { FileByteSource } from "../../application/ports/browser-file-storage/file.ts"; import { createFailure, type AppFailure, @@ -46,7 +45,8 @@ import type { AuthOperationContext } from "./http-execution-v3.ts"; * public descriptor. * * The file arrives as the `FileByteSource` that `FileContentPort.openSource` - * gives, so no `File` or `Blob` crosses into this adapter. Its bytes are read + * gives (`FileserverByteSource` is its shape), so no `File` or `Blob` crosses + * into this adapter. Its bytes are read * once into the multipart body, at most `maxFileBytes` of them; a file that * declares a larger size is refused before reading. * @@ -59,6 +59,19 @@ import type { AuthOperationContext } from "./http-execution-v3.ts"; export type FileserverFileState = "READY" | "UPLOADED" | "VERIFYING" | "QUARANTINED"; +/** + * The bytes to send: structurally the browser-file-storage port's + * `FileByteSource`, which a product passes as it is. Written here instead of + * imported so this adapter does not depend on that optional runtime's port; + * test:browser-file-storage-removal deletes the port and this client stays. + */ +export type FileserverByteSource = Readonly<{ + byteLength: number | null; + stream( + signal: AbortSignal, + ): AsyncIterable>>; +}>; + /** The stored file, as the backend's `UploadedFileResponse` describes it. */ export type FileserverUploadedFile = Readonly<{ fileId: string; @@ -72,7 +85,7 @@ export type FileserverUploadedFile = Readonly<{ }>; export type FileserverUploadRequest = Readonly<{ - source: FileByteSource; + source: FileserverByteSource; /** The multipart filename, untrusted on the server. Defaults to `upload.bin`. */ filename?: string; /** The part's Content-Type, a claim the server verifies. */ @@ -345,7 +358,7 @@ function snapshotDependencies( } type AdmittedRequest = Readonly<{ - source: FileByteSource; + source: FileserverByteSource; filename: string; mediaType: string; idempotencyKey?: string; diff --git a/src/adapters/http/index.ts b/src/adapters/http/index.ts index 44291460..0e8e1b7e 100644 --- a/src/adapters/http/index.ts +++ b/src/adapters/http/index.ts @@ -47,6 +47,7 @@ export type { CredentialPatchOutcome } from "./http-contract-bridge.ts"; export { createFileserverUploadClient, FILESERVER_UPLOAD_OPERATION_ID, + type FileserverByteSource, type FileserverFileState, type FileserverUploadClient, type FileserverUploadClientDependencies,