소유자 결정(2026-11-07, design-docs repo-structure/README.md 3.4절)으로 템플릿 샘플을 지운다. 샘플이 맡던 시험 대상은 앞 커밋들이 옮겼다. 참조 기능과 예제 화면, 두 context, 그 시험, e2e 3개, 수동 접근성 기록 7개, 런타임 프로필 키, test:reference-feature(명령, 산출물, 게이트 참조), 커버리지 정책 행을 지웠다. removable-template-features 목록은 비우고 장치는 남겼다: test:sample-removal은 인자가 없으면 목록을 하나씩 지우고, 비면 SKIP을 출력하고 보고서에 건너뛴 사례를 남긴다. 기능 스위치 시험과 홈 시작 링크 스위치 시험은 시험 전용 fixture 기능으로 옮겼다. browser soak은 생성 기능을 넣은 빌드에서 돈다. 문서의 샘플 경로를 고쳤다. 날짜가 붙은 설계·리뷰 기록의 본문은 그대로 두었다. 레지스트리 기준선(update:registry-baseline, OWNER DongHyeonka), CI 계약 기준선과 workflow, 초기 JS 기록(194,354B, 17파일, 첫 기능 6,327B, 기능 539B, context 4B)을 다시 받았다. 위험: 레지스트리 행 삭제는 breaking이다. 샘플을 고쳐 쓰는 다운스트림은 수정/삭제 충돌을 만난다. 성능 lab의 기능 라우트 측정은 템플릿에 공개 기능 라우트가 없어 measured:false다. TEMPLATE_FIXTURE 출처는 플랫폼 코드에 남았다. 검증(desktop): check:types, lint, check:architecture, check:registries, check:ci, verify:documentation, test:unit, test:component, test:contract, test:integration, test:recipes, test:coverage(Risk coverage PASS 378/378, 문턱 68개), test:e2e 183, test:a11y, test:visual, test:storybook, test:browser-capabilities, test:feature-scaffold PASS(76 checks), test:sample-removal SKIP, build, check:bundle.
208 lines
5.8 KiB
TypeScript
208 lines
5.8 KiB
TypeScript
import { spawnSync } from "node:child_process";
|
|
import { readFile, readdir } from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
function requiredPnpmCli(): string {
|
|
const executable = process.env.npm_execpath;
|
|
if (!executable) {
|
|
throw new Error(
|
|
"check:browser-file-storage-boundaries must run through pnpm",
|
|
);
|
|
}
|
|
return executable;
|
|
}
|
|
|
|
function runEslint(path: string) {
|
|
return spawnSync(
|
|
process.execPath,
|
|
[
|
|
requiredPnpmCli(),
|
|
"exec",
|
|
"eslint",
|
|
path,
|
|
"--no-ignore",
|
|
"--max-warnings=0",
|
|
],
|
|
{ encoding: "utf8" },
|
|
);
|
|
}
|
|
|
|
function runEslintSource(source: string, virtualPath: string) {
|
|
return spawnSync(
|
|
process.execPath,
|
|
[
|
|
requiredPnpmCli(),
|
|
"exec",
|
|
"eslint",
|
|
"--stdin",
|
|
"--stdin-filename",
|
|
virtualPath,
|
|
"--no-ignore",
|
|
"--max-warnings=0",
|
|
],
|
|
{ encoding: "utf8", input: source },
|
|
);
|
|
}
|
|
|
|
const allowed = runEslint(
|
|
"tests/fixtures/browser-file-storage-boundaries/allowed",
|
|
);
|
|
const forbiddenRoot =
|
|
"tests/fixtures/browser-file-storage-boundaries/forbidden";
|
|
const forbiddenFiles = (
|
|
await readdir(forbiddenRoot, { withFileTypes: true })
|
|
)
|
|
.filter((entry) => entry.isFile() && /\.tsx?$/u.test(entry.name))
|
|
.map((entry) => path.join(forbiddenRoot, entry.name));
|
|
const forbiddenResults = forbiddenFiles.map((file) => ({
|
|
file,
|
|
result: runEslint(file),
|
|
}));
|
|
const acceptedForbidden = forbiddenResults.filter(
|
|
({ result }) => result.status === 0,
|
|
);
|
|
const indexedDbBypassSource = await readFile(
|
|
path.join(forbiddenRoot, "direct-indexeddb.ts"),
|
|
"utf8",
|
|
);
|
|
const objectUrlBypassSource = await readFile(
|
|
path.join(forbiddenRoot, "object-url.ts"),
|
|
"utf8",
|
|
);
|
|
const blobBypassSource = await readFile(
|
|
path.join(forbiddenRoot, "direct-blob.ts"),
|
|
"utf8",
|
|
);
|
|
const crossContextAdapterSource = await readFile(
|
|
"tests/fixtures/browser-file-storage-boundaries/allowed/cross-context-host.ts",
|
|
"utf8",
|
|
);
|
|
const browserStorageAdapterSource = await readFile(
|
|
"tests/fixtures/browser-file-storage-boundaries/allowed/browser-storage-host.ts",
|
|
"utf8",
|
|
);
|
|
const protectedSourceFixtureNames = [
|
|
"aliased-globalthis.ts",
|
|
"class-field-alias.ts",
|
|
"constructor-root-escape.ts",
|
|
"default-parameter-alias.ts",
|
|
"direct-blob.ts",
|
|
"dynamic-capability-key.ts",
|
|
"global-object-container.ts",
|
|
"identity-wrapped-global.ts",
|
|
"instance-property-alias.ts",
|
|
"property-descriptor-access.ts",
|
|
] as const;
|
|
const protectedSourceFixtures = await Promise.all(
|
|
protectedSourceFixtureNames.map(async (file) => ({
|
|
file,
|
|
source: await readFile(path.join(forbiddenRoot, file), "utf8"),
|
|
})),
|
|
);
|
|
const approvedAdapterResults = [
|
|
{
|
|
file: "src/adapters/storage/indexeddb/boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
indexedDbBypassSource,
|
|
"src/adapters/storage/indexeddb/boundary-fixture.ts",
|
|
),
|
|
},
|
|
{
|
|
file: "src/adapters/cross-context-invalidation/boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
crossContextAdapterSource,
|
|
"src/adapters/cross-context-invalidation/boundary-fixture.ts",
|
|
),
|
|
},
|
|
{
|
|
file: "src/adapters/storage/boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
browserStorageAdapterSource,
|
|
"src/adapters/storage/boundary-fixture.ts",
|
|
),
|
|
},
|
|
{
|
|
file: "src/adapters/browser-transfer/boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
blobBypassSource,
|
|
"src/adapters/browser-transfer/boundary-fixture.ts",
|
|
),
|
|
},
|
|
];
|
|
const rejectedApprovedAdapters = approvedAdapterResults.filter(
|
|
({ result }) => result.status !== 0,
|
|
);
|
|
const misplacedAdapterResults = [
|
|
{
|
|
file: "src/adapters/http/boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
indexedDbBypassSource,
|
|
"src/adapters/http/boundary-fixture.ts",
|
|
),
|
|
},
|
|
{
|
|
file: "src/features/fixture-feature/adapters/boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
objectUrlBypassSource,
|
|
"src/features/fixture-feature/adapters/boundary-fixture.ts",
|
|
),
|
|
},
|
|
{
|
|
file: "src/adapters/http/cross-context-boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
crossContextAdapterSource,
|
|
"src/adapters/http/cross-context-boundary-fixture.ts",
|
|
),
|
|
},
|
|
{
|
|
file: "src/adapters/http/browser-storage-boundary-fixture.ts",
|
|
result: runEslintSource(
|
|
browserStorageAdapterSource,
|
|
"src/adapters/http/browser-storage-boundary-fixture.ts",
|
|
),
|
|
},
|
|
...protectedSourceFixtures.map(({ file, source }) => {
|
|
const virtualPath = `src/presentation/${file}`;
|
|
return {
|
|
file: virtualPath,
|
|
result: runEslintSource(source, virtualPath),
|
|
};
|
|
}),
|
|
];
|
|
const acceptedMisplacedAdapters = misplacedAdapterResults.filter(
|
|
({ result }) => result.status === 0,
|
|
);
|
|
|
|
if (
|
|
allowed.status !== 0 ||
|
|
rejectedApprovedAdapters.length > 0 ||
|
|
forbiddenFiles.length === 0 ||
|
|
acceptedForbidden.length > 0 ||
|
|
acceptedMisplacedAdapters.length > 0
|
|
) {
|
|
process.stderr.write(allowed.stderr || allowed.stdout);
|
|
for (const { file, result } of rejectedApprovedAdapters) {
|
|
process.stderr.write(
|
|
`${file}: owned browser capability adapter was rejected\n`,
|
|
);
|
|
process.stderr.write(result.stderr || result.stdout);
|
|
}
|
|
for (const { file, result } of acceptedForbidden) {
|
|
process.stderr.write(
|
|
`${file}: forbidden browser API fixture was accepted\n`,
|
|
);
|
|
process.stderr.write(result.stderr || result.stdout);
|
|
}
|
|
for (const { file, result } of acceptedMisplacedAdapters) {
|
|
process.stderr.write(
|
|
`${file}: native browser storage access outside its owned adapter was accepted\n`,
|
|
);
|
|
process.stderr.write(result.stderr || result.stdout);
|
|
}
|
|
process.exit(1);
|
|
}
|
|
|
|
process.stdout.write(
|
|
`Browser file/storage boundaries: PASS (owned adapter allowed, ${forbiddenFiles.length + misplacedAdapterResults.length} direct or misplaced native access cases rejected)\n`,
|
|
);
|