fix(http): Fileserver 업로드 client가 browser-file-storage 포트를 import하지 않는다

문제
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<Uint8Array, { code }>를 낸다)를 두고 배럴로 낸다. 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
This commit is contained in:
DongHyeonka
2026-11-05 01:35:37 +09:00
parent 72b8ab1507
commit 3d3d6527ef
2 changed files with 18 additions and 4 deletions
+17 -4
View File
@@ -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<Result<Uint8Array, Readonly<{ code: string }>>>;
}>;
/** 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;
+1
View File
@@ -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,