From bf485f449a6e39f183ecc13be14ac5c13b00e499 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 17:39:59 +0900 Subject: [PATCH 1/6] =?UTF-8?q?refactor(typecheck):=20=EC=9D=8C=EC=84=B1?= =?UTF-8?q?=20=ED=83=80=EC=9E=85=20fixture=2023=EA=B0=9C=EB=A5=BC=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=EA=B8=B0=20=ED=95=98=EB=82=98=EB=A1=9C=20?= =?UTF-8?q?=EB=8F=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 음성 타입 fixture마다 옵션이 같은 tsconfig 하나, package script 하나, 게이트 명령 하나가 있었다(23벌). 옵션은 모두 같고 파일 하나만 달라서 fixture를 더할 때마다 세 곳을 같이 고쳤다. `tsconfig.recipes.json`도 `tsconfig.test.json`과 lib가 같고 types만 하나 적었다. `tsconfig.web-worker.json`은 `files: []`로 0파일을 검사하고 통과했다 (2026-09-25 리뷰가 기록, FE-GATE-003이 통과로 보였다). 고른 방법(design-docs repo-structure/04-frontend-layout.md 5.3절 (가), 소유자 승인 2026-11-07): - fixture 첫 줄에 기대(`// expect: TS2322`, `// expect: pass`)를 쓰고 `scripts/check-type-fixtures.ts`가 fixture마다 `.tmp/type-fixtures/`에 한 파일 tsconfig를 써서 tsc를 돈다. 판정은 run-ci-gate.ts가 명령마다 하던 것과 같다(exit 1과 `error TS:`). 결과를 fixture별로 출력한다. 기대 줄이 없는 fixture와 fixture 0개는 실패한다. - recipes는 `tsconfig.test.json` include로 옮긴다. - web-worker tsconfig와 script는 지운다(결정 D4). Worker를 들일 때 더하는 단계는 매뉴얼 03에 쓴다(뒤 커밋). - `scripts/check-typecheck-inputs.ts`를 `check:types` 끝에 둔다. package script가 tsc에 넘기는 tsconfig마다 이 repo 파일이 1개 이상인지 본다. `files: []` tsconfig가 통과로 보이던 구멍을 막는다(R8). 버린 것: TypeScript API로 한 프로세스에서 돌리는 방법. 이 repo의 TypeScript 7.0(네이티브판)은 JS API를 싣지 않는다. 위반마다 `@ts-expect-error`를 쓰는 방법(5.3절 (나))은 오류 코드 고정을 잃는다. 위험: recipe가 이제 `vite/client` 타입이 있는 프로그램에서 검사된다. recipe가 `import.meta.env`를 쓰면 전에는 실패했고 이제는 통과한다 (복사한 제품도 Vite라 가치가 작다, 설계 5.1절). CI 계약 기준선을 다시 받았다(명령 99 → 76). 검증(desktop): `check:types:fixtures` 23개 PASS, 각 fixture의 기대 코드가 출력에 그대로 나온다. `TelemetryPort.emit` 인자를 `string`으로 넓히는 변이(2026-09-25 리뷰 07-05)에서 `invalid-diagnostics-port.ts`가 TS2578로 FAIL, 실행기 rc=1. 되돌린 뒤 작업 트리 0줄. `check:types` rc=0 (Typecheck inputs: app 379, node 312, service-worker 22, test 915). Refs: design-docs repo-structure/04-frontend-layout.md 5.3·9.2·9.3절, README.md 3.4절 D4 --- config/ci/contract-baseline.json | 8 +- config/ci/gates.json | 188 +----------------- config/security/secret-scan-policy.json | 2 - docs/architecture/optional-adapter-recipes.md | 2 +- docs/manual/01-add-a-feature.md | 4 +- docs/operations/adapter-remediation-ledger.md | 4 +- .../frontend-platform-testing-strategy.md | 4 +- package.json | 28 +-- scripts/check-optional-recipe-types.ts | 62 ------ scripts/check-type-fixtures.ts | 141 +++++++++++++ scripts/check-typecheck-inputs.ts | 55 +++++ scripts/lib/removal-fixture.ts | 2 +- scripts/test-optional-recipe-removal.ts | 1 - scripts/verify-documentation-readiness.ts | 3 +- .../typecheck/invalid-application-input.ts | 1 + .../typecheck/invalid-application-output.ts | 1 + .../typecheck/invalid-async-overlay.ts | 1 + .../typecheck/invalid-diagnostics-port.ts | 1 + .../invalid-direct-feature-composition.ts | 1 + .../typecheck/invalid-failure-kind.ts | 1 + .../invalid-feature-capability-selection.ts | 1 + .../invalid-feature-contribution-input.ts | 1 + .../typecheck/invalid-feature-input.ts | 1 + .../typecheck/invalid-http-operation-id.ts | 1 + .../typecheck/invalid-http-operation-input.ts | 1 + .../typecheck/invalid-http-route-id.ts | 1 + .../typecheck/invalid-http-wire-mapper.ts | 1 + .../typecheck/invalid-icon-button.tsx | 1 + .../invalid-image-cdn-resolve-signal.ts | 1 + .../fixtures/typecheck/invalid-message-key.ts | 1 + .../typecheck/invalid-message-params.ts | 1 + .../typecheck/invalid-page-action.tsx | 1 + tests/fixtures/typecheck/invalid-port-call.ts | 1 + .../typecheck/invalid-port-implementation.ts | 1 + .../typecheck/invalid-reference-operation.ts | 1 + .../typecheck/invalid-result-narrowing.ts | 1 + .../typecheck/invalid-route-runtime.ts | 1 + .../typecheck/tsconfig.application-input.json | 6 - .../tsconfig.application-output.json | 6 - .../typecheck/tsconfig.async-overlay.json | 6 - .../typecheck/tsconfig.diagnostics-port.json | 6 - .../tsconfig.direct-feature-composition.json | 6 - .../typecheck/tsconfig.failure-kind.json | 6 - ...tsconfig.feature-capability-selection.json | 6 - .../tsconfig.feature-contribution-input.json | 6 - .../typecheck/tsconfig.feature-input.json | 6 - .../typecheck/tsconfig.http-operation-id.json | 6 - .../tsconfig.http-operation-input.json | 6 - .../typecheck/tsconfig.http-route-id.json | 6 - .../typecheck/tsconfig.http-wire-mapper.json | 6 - .../typecheck/tsconfig.icon-button.json | 6 - .../tsconfig.image-cdn-resolve-signal.json | 6 - .../typecheck/tsconfig.message-key.json | 6 - .../typecheck/tsconfig.message-params.json | 6 - .../typecheck/tsconfig.page-action.json | 6 - .../typecheck/tsconfig.port-call.json | 6 - .../tsconfig.port-implementation.json | 6 - .../tsconfig.reference-operation.json | 6 - .../typecheck/tsconfig.result-narrowing.json | 6 - .../typecheck/tsconfig.route-runtime.json | 6 - tests/unit/ci-workflow-generation.test.ts | 6 +- tests/unit/feature-scaffold-drill.test.ts | 4 +- tests/unit/product-index-entrypoints.test.ts | 7 +- tests/unit/supply-chain.test.ts | 2 - tests/unit/type-fixtures.test.ts | 70 +++++++ tsconfig.json | 2 - tsconfig.recipes.json | 9 - tsconfig.test.json | 1 + tsconfig.web-worker.json | 10 - 69 files changed, 316 insertions(+), 460 deletions(-) delete mode 100644 scripts/check-optional-recipe-types.ts create mode 100644 scripts/check-type-fixtures.ts create mode 100644 scripts/check-typecheck-inputs.ts delete mode 100644 tests/fixtures/typecheck/tsconfig.application-input.json delete mode 100644 tests/fixtures/typecheck/tsconfig.application-output.json delete mode 100644 tests/fixtures/typecheck/tsconfig.async-overlay.json delete mode 100644 tests/fixtures/typecheck/tsconfig.diagnostics-port.json delete mode 100644 tests/fixtures/typecheck/tsconfig.direct-feature-composition.json delete mode 100644 tests/fixtures/typecheck/tsconfig.failure-kind.json delete mode 100644 tests/fixtures/typecheck/tsconfig.feature-capability-selection.json delete mode 100644 tests/fixtures/typecheck/tsconfig.feature-contribution-input.json delete mode 100644 tests/fixtures/typecheck/tsconfig.feature-input.json delete mode 100644 tests/fixtures/typecheck/tsconfig.http-operation-id.json delete mode 100644 tests/fixtures/typecheck/tsconfig.http-operation-input.json delete mode 100644 tests/fixtures/typecheck/tsconfig.http-route-id.json delete mode 100644 tests/fixtures/typecheck/tsconfig.http-wire-mapper.json delete mode 100644 tests/fixtures/typecheck/tsconfig.icon-button.json delete mode 100644 tests/fixtures/typecheck/tsconfig.image-cdn-resolve-signal.json delete mode 100644 tests/fixtures/typecheck/tsconfig.message-key.json delete mode 100644 tests/fixtures/typecheck/tsconfig.message-params.json delete mode 100644 tests/fixtures/typecheck/tsconfig.page-action.json delete mode 100644 tests/fixtures/typecheck/tsconfig.port-call.json delete mode 100644 tests/fixtures/typecheck/tsconfig.port-implementation.json delete mode 100644 tests/fixtures/typecheck/tsconfig.reference-operation.json delete mode 100644 tests/fixtures/typecheck/tsconfig.result-narrowing.json delete mode 100644 tests/fixtures/typecheck/tsconfig.route-runtime.json create mode 100644 tests/unit/type-fixtures.test.ts delete mode 100644 tsconfig.recipes.json delete mode 100644 tsconfig.web-worker.json diff --git a/config/ci/contract-baseline.json b/config/ci/contract-baseline.json index 439cde3c..220ad79e 100644 --- a/config/ci/contract-baseline.json +++ b/config/ci/contract-baseline.json @@ -1,11 +1,11 @@ { "schemaVersion": 1, "owner": "DongHyeonka", - "reason": "2026-11-07 소유자 결정: 템플릿 샘플 삭제. 참조 기능 시험 명령과 그 산출물, 지운 라우트의 수동 a11y 기록 산출물 4개를 뺀다", + "reason": "2026-11-07 소유자 결정: 정리 3단계(design-docs repo-structure/README.md 3.4절). 음성 타입 fixture 명령 23개를 실행기 하나(check-types-fixtures)로 합치고 check-types-recipes를 check:types:test에 넣는다", "gates": 27, - "commands": 99, - "commandReferences": 103, + "commands": 76, + "commandReferences": 80, "artifacts": 105, "stages": 5, - "gateShapeSha256": "df584fba26f8448c6a77638351c6906ed91869da82e20f12ac71ea7b2037c989" + "gateShapeSha256": "963249d0ce7771677705f8f81e82fa5524dac2e57349063f96d8136ef252881d" } diff --git a/config/ci/gates.json b/config/ci/gates.json index ab728fce..2ff619ca 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -23,169 +23,10 @@ "expect": "pass" }, { - "id": "check-types-recipes", - "script": "check:types:recipes", + "id": "check-types-fixtures", + "script": "check:types:fixtures", "expect": "pass" }, - { - "id": "check-types-fixture", - "script": "check:types:fixture", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-ts-port", - "script": "check:types:fixture:ts-port", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-ts-result", - "script": "check:types:fixture:ts-result", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2339:" - }, - { - "id": "check-types-fixture-application-output", - "script": "check:types:fixture:application-output", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-application-input", - "script": "check:types:fixture:application-input", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2739:" - }, - { - "id": "check-types-fixture-feature-input", - "script": "check:types:fixture:feature-input", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2345:" - }, - { - "id": "check-types-fixture-failure-kind", - "script": "check:types:fixture:failure-kind", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-reference-operation", - "script": "check:types:fixture:reference-operation", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2741:" - }, - { - "id": "check-types-fixture-http-operation-input", - "script": "check:types:fixture:http-operation-input", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2353:" - }, - { - "id": "check-types-fixture-http-wire-mapper", - "script": "check:types:fixture:http-wire-mapper", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-http-operation-id", - "script": "check:types:fixture:http-operation-id", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2345:" - }, - { - "id": "check-types-fixture-http-route-id", - "script": "check:types:fixture:http-route-id", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-feature-contribution-input", - "script": "check:types:fixture:feature-contribution-input", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-feature-capability-selection", - "script": "check:types:fixture:feature-capability-selection", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2339:" - }, - { - "id": "check-types-fixture-direct-feature-composition", - "script": "check:types:fixture:direct-feature-composition", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2345:" - }, - { - "id": "check-types-fixture-async-overlay", - "script": "check:types:fixture:async-overlay", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2322:" - }, - { - "id": "check-types-fixture-route-runtime", - "script": "check:types:fixture:route-runtime", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2741:" - }, - { - "id": "check-types-fixture-page-action", - "script": "check:types:fixture:page-action", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS1360:" - }, - { - "id": "check-types-fixture-icon-button", - "script": "check:types:fixture:icon-button", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2741:" - }, - { - "id": "check-types-fixture-i18n-key", - "script": "check:types:fixture:i18n-key", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2345:" - }, - { - "id": "check-types-fixture-i18n-params", - "script": "check:types:fixture:i18n-params", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2554:" - }, - { - "id": "check-types-fixture-diagnostics", - "script": "check:types:fixture:diagnostics", - "expect": "pass" - }, - { - "id": "check-types-fixture-image-resolve-signal", - "script": "check:types:fixture:image-resolve-signal", - "expect": "fail", - "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2741:" - }, { "id": "test-runtime-schema", "script": "test:runtime-schema", @@ -1755,30 +1596,7 @@ "name": "typecheck", "commandIds": [ "check-types", - "check-types-recipes", - "check-types-fixture", - "check-types-fixture-ts-port", - "check-types-fixture-ts-result", - "check-types-fixture-application-output", - "check-types-fixture-application-input", - "check-types-fixture-feature-input", - "check-types-fixture-failure-kind", - "check-types-fixture-reference-operation", - "check-types-fixture-http-operation-input", - "check-types-fixture-http-wire-mapper", - "check-types-fixture-http-operation-id", - "check-types-fixture-http-route-id", - "check-types-fixture-feature-contribution-input", - "check-types-fixture-feature-capability-selection", - "check-types-fixture-direct-feature-composition", - "check-types-fixture-async-overlay", - "check-types-fixture-route-runtime", - "check-types-fixture-page-action", - "check-types-fixture-icon-button", - "check-types-fixture-i18n-key", - "check-types-fixture-i18n-params", - "check-types-fixture-diagnostics", - "check-types-fixture-image-resolve-signal" + "check-types-fixtures" ], "logArtifactId": "artifact-artifacts-quality-check-types-txt", "evidenceArtifactIds": [ diff --git a/config/security/secret-scan-policy.json b/config/security/secret-scan-policy.json index adeeabe2..619d13e2 100644 --- a/config/security/secret-scan-policy.json +++ b/config/security/secret-scan-policy.json @@ -22,10 +22,8 @@ "tsconfig.app.json", "tsconfig.base.json", "tsconfig.node.json", - "tsconfig.recipes.json", "tsconfig.service-worker.json", "tsconfig.test.json", - "tsconfig.web-worker.json", "vite.config.ts", "vite.service-worker.config.ts", "vitest.config.ts", diff --git a/docs/architecture/optional-adapter-recipes.md b/docs/architecture/optional-adapter-recipes.md index 69a0483b..c1722693 100644 --- a/docs/architecture/optional-adapter-recipes.md +++ b/docs/architecture/optional-adapter-recipes.md @@ -330,7 +330,7 @@ Web Push를 함께 설치하지 않는다. ## 6. 검증 명령 ```bash -corepack pnpm check:types:recipes +corepack pnpm check:types:test corepack pnpm test:recipes corepack pnpm test:browser-capabilities corepack pnpm build diff --git a/docs/manual/01-add-a-feature.md b/docs/manual/01-add-a-feature.md index 7b33b12d..54b51178 100644 --- a/docs/manual/01-add-a-feature.md +++ b/docs/manual/01-add-a-feature.md @@ -369,7 +369,7 @@ projectRequest: (input) => Object.freeze({ - application이 React·어댑터·presentation을 import하면 `check:architecture`가 `feature-application-does-not-know-runtime`으로 막는다. - 보강 키와 조립 기여의 `featureId`가 다르면 조립이 실패한다. - 메시지: `feature adapter contribution installed an input for ` -- input 모양이 보강 타입과 다르면 `check:types`(FE-GATE-003)가 막는다. 음성 fixture `check:types:fixture:feature-input`도 같은 게이트에서 돈다. +- input 모양이 보강 타입과 다르면 `check:types`(FE-GATE-003)가 막는다. 음성 fixture `tests/fixtures/typecheck/invalid-feature-input.ts`도 같은 게이트의 `check:types:fixtures`에서 돈다. - **못 잡음**: telemetry `kind` 중복. 유일성 검사가 없다. 접두어로 피한다. ④ **쓸 스킬**: `clean-architecture`, `codebase-design` @@ -408,7 +408,7 @@ projectRequest: (input) => Object.freeze({ - presentation이 기능 `adapters/`를 import하면 `feature-presentation-does-not-know-outbound-adapters`로 막는다. - adapters가 presentation을 import하면 `feature-adapters-do-not-know-presentation`으로 막는다. - 기능 루트 파일(`feature-module.ts` 등)이나 계층이 아닌 폴더(`support/` 등)의 파일이 `src/adapters`에 닿으면 `feature-and-app-roots-do-not-reach-adapters`로 막는다. 기능 안에서 `src/adapters`에 닿을 수 있는 곳은 `adapters/` 폴더뿐이다. -- operation ID·route ID·입력 타입을 틀리면 `check:types`가 막는다. 음성 fixture: `check:types:fixture:http-operation-id`, `check:types:fixture:http-route-id`, `check:types:fixture:http-operation-input`. +- operation ID·route ID·입력 타입을 틀리면 `check:types`가 막는다. 음성 fixture: `tests/fixtures/typecheck/invalid-http-operation-id.ts`, `tests/fixtures/typecheck/invalid-http-route-id.ts`, `tests/fixtures/typecheck/invalid-http-operation-input.ts`(`check:types:fixtures`). - 호스트가 주지 않는 capability를 `needs`에 적으면 조립이 실패한다. - 메시지: `feature needs , which the host did not provide` - operation을 계약에 두고 기능 `adapters/`·`application/`에서 쓰지 않으면 `check:registries`(FE-GATE-010)가 실패한다. diff --git a/docs/operations/adapter-remediation-ledger.md b/docs/operations/adapter-remediation-ledger.md index 4c8016c6..efbeaf84 100644 --- a/docs/operations/adapter-remediation-ledger.md +++ b/docs/operations/adapter-remediation-ledger.md @@ -139,7 +139,7 @@ Rollout state starts at `NOT_STARTED`; documented-unimplemented items start at | BT-UP-05 | Refactor | `corepack pnpm exec vitest run tests/unit/resumable-upload-runtime.test.ts` | — | `NOT_PERFORMED` | characterization drift | **Attempted and reverted.** The five internal owners were extracted mechanically, but they require a shared-internals module for `RuntimeDependencies`, `ActiveResolution`, `ReconciliationResolution`, `FAILURE_CODES`, `RECOVERIES`, `reportProgress`, `observeTerminal` and ~40 further bindings to avoid an import cycle. Rather than risk the verified correctness work in this file, the extraction was reverted rather than half-landed. Behaviour and the public facade are unchanged; the file is still 2,239 lines. | | BT-UP-06 | Refactor | `corepack pnpm exec vitest run tests/unit/resumable-upload-runtime.test.ts` | `fix: drain resumable upload teardown` | `FIXED_NOT_RELEASED` | drain not quiescent | Red single-flight dispose case → green 18/18; `close()` closes admission and starts the same drain, `dispose()` aborts the active-operation registry and awaits real settlement before closing the checkpoint store | | BT-UP-07 | Documented gap (Web Locks matrix) | promotion evidence | — | `PROMOTION_BLOCKED` | n/a | — | -| BT-IMG-01 | Type-contract change | `corepack pnpm check:types:test` fixture | `fix: complete presigned capability and upload transport contracts` | `FIXED_NOT_RELEASED` | caller compile break | `resolve()` now requires the lifetime signal; `tests/fixtures/typecheck/invalid-image-cdn-resolve-signal.ts` + `check:types:fixture:image-resolve-signal` fail as designed (2 errors), and all callers pass a signal | +| BT-IMG-01 | Type-contract change | `corepack pnpm check:types:test` fixture | `fix: complete presigned capability and upload transport contracts` | `FIXED_NOT_RELEASED` | caller compile break | `resolve()` now requires the lifetime signal; `tests/fixtures/typecheck/invalid-image-cdn-resolve-signal.ts` (then its own script, merged into `check:types:fixtures` on 2026-11-08) fail as designed (2 errors), and all callers pass a signal | | BT-IMG-02 | Image probe | `corepack pnpm exec vitest run tests/unit/image-cdn-runtime.test.ts` | `fix: parse Cache-Control with quote awareness` | `FIXED_NOT_RELEASED` | Cache-Control parse rejection | Red unmatched-quote cases → green 25/25 | | BT-IMG-03 | Refactor | `corepack pnpm exec vitest run tests/unit/image-cdn-runtime.test.ts` | — | `NOT_PERFORMED` | characterization drift | **Not performed.** Same reasoning as BT-UP-05: a pure cohesion refactor of `image-cdn-runtime.ts` (1,340 lines) with no finding closure. `image-header-metadata.ts` is deliberately left intact per the review. | | BT-IMG-04 | Documented gap (descriptor provider) | promotion evidence | — | `PROMOTION_BLOCKED` | n/a | — | @@ -199,7 +199,7 @@ Captured after every correctness task landed. | `corepack pnpm test:unit` | 1 | 1585 passed / 19 failed tests; the 19 are the unchanged pre-existing `ci-artifact-contract` sandbox failures | | `corepack pnpm check:registries` | 0 | 11 registries PASS | | `corepack pnpm verify:documentation` | 0 | PASS_SCOPED | -| `corepack pnpm check:types:fixture:image-resolve-signal` | 1 | **Expected non-zero.** Negative fixture proving `resolve()` now rejects a call without a lifetime signal (BT-IMG-01). | +| 음성 fixture `invalid-image-cdn-resolve-signal.ts` 단독 tsc(그 script는 2026-11-08 `check:types:fixtures`로 합쳤다) | 1 | **Expected non-zero.** Negative fixture proving `resolve()` now rejects a call without a lifetime signal (BT-IMG-01). | `test:all` stops at `test:unit`, so the later suites above were run directly. diff --git a/docs/testing/frontend-platform-testing-strategy.md b/docs/testing/frontend-platform-testing-strategy.md index 2bf3fb19..5e3e8352 100644 --- a/docs/testing/frontend-platform-testing-strategy.md +++ b/docs/testing/frontend-platform-testing-strategy.md @@ -621,14 +621,14 @@ client route guard는 UX이며 authorization이 아님을 test 이름과 문서 공용 컴포넌트는 한 번의 결함이 모든 페이지로 전파되므로 위험도가 높다. RP-07의 실행 경로는 `check:design-system`, -`check:design-system:fixture`, `check:types:fixture:icon-button`, +`check:design-system:fixture`, `check:types:fixtures`(`invalid-icon-button.tsx`), `tests/component/design-system-platform.test.tsx`와 `tests/e2e/design-system-interactions.spec.ts`다. Story interaction/visual baseline은 VD-08/RP-10에서 추가하며 현재 runtime gallery를 isolated workshop 완료 증거로 사용하지 않는다. RP-08의 국제화 실행 경로는 `check:i18n`, `check:i18n:fixture`, -`check:types:fixture:i18n-key`, `check:types:fixture:i18n-params`, +`check:types:fixtures`(`invalid-message-key.ts`, `invalid-message-params.ts`), `tests/unit/i18n-contract.test.ts`, `tests/component/locale-platform.test.tsx`와 `tests/e2e/i18n.spec.ts`다. diff --git a/package.json b/package.json index d3d1440d..379ea823 100644 --- a/package.json +++ b/package.json @@ -26,27 +26,11 @@ "scan:dependency-advisories": "node scripts/scan-dependency-advisories.ts", "check:diagnostics": "node scripts/generate-product-feature-index.ts && node scripts/check-diagnostics.ts", "check:diagnostics:fixture": "node scripts/generate-product-feature-index.ts && node scripts/check-diagnostics.ts --fixture", - "check:types": "corepack pnpm check:types:app && corepack pnpm check:types:node && corepack pnpm check:types:test && corepack pnpm check:types:recipes && corepack pnpm check:types:web-worker && corepack pnpm check:types:service-worker", + "check:types": "corepack pnpm check:types:app && corepack pnpm check:types:node && corepack pnpm check:types:test && corepack pnpm check:types:service-worker && node scripts/check-typecheck-inputs.ts", "check:types:app": "node scripts/generate-product-feature-index.ts && tsc --project tsconfig.app.json", "check:types:node": "node scripts/generate-product-feature-index.ts && tsc --project tsconfig.node.json", "check:types:test": "node scripts/generate-product-feature-index.ts && tsc --project tsconfig.test.json", - "check:types:recipes": "node scripts/check-optional-recipe-types.ts", - "check:types:fixture": "tsc -p tests/fixtures/typecheck/tsconfig.port-call.json", - "check:types:fixture:ts-port": "tsc -p tests/fixtures/typecheck/tsconfig.port-implementation.json", - "check:types:fixture:ts-result": "tsc -p tests/fixtures/typecheck/tsconfig.result-narrowing.json", - "check:types:fixture:application-output": "tsc -p tests/fixtures/typecheck/tsconfig.application-output.json", - "check:types:fixture:application-input": "tsc -p tests/fixtures/typecheck/tsconfig.application-input.json", - "check:types:fixture:feature-input": "tsc -p tests/fixtures/typecheck/tsconfig.feature-input.json", - "check:types:fixture:failure-kind": "tsc -p tests/fixtures/typecheck/tsconfig.failure-kind.json", - "check:types:fixture:reference-operation": "tsc -p tests/fixtures/typecheck/tsconfig.reference-operation.json", - "check:types:fixture:async-overlay": "tsc -p tests/fixtures/typecheck/tsconfig.async-overlay.json", - "check:types:fixture:route-runtime": "node scripts/generate-product-feature-index.ts && tsc -p tests/fixtures/typecheck/tsconfig.route-runtime.json", - "check:types:fixture:page-action": "node scripts/generate-product-feature-index.ts && tsc -p tests/fixtures/typecheck/tsconfig.page-action.json", - "check:types:fixture:icon-button": "node scripts/generate-product-feature-index.ts && tsc -p tests/fixtures/typecheck/tsconfig.icon-button.json", - "check:types:fixture:i18n-key": "node scripts/generate-product-feature-index.ts && tsc -p tests/fixtures/typecheck/tsconfig.message-key.json", - "check:types:fixture:i18n-params": "node scripts/generate-product-feature-index.ts && tsc -p tests/fixtures/typecheck/tsconfig.message-params.json", - "check:types:fixture:diagnostics": "tsc -p tests/fixtures/typecheck/tsconfig.diagnostics-port.json", - "check:types:fixture:image-resolve-signal": "tsc -p tests/fixtures/typecheck/tsconfig.image-cdn-resolve-signal.json", + "check:types:fixtures": "node scripts/generate-product-feature-index.ts && node scripts/check-type-fixtures.ts", "test:runtime-schema": "node scripts/run-vitest.ts run tests/runtime-schema --reporter=default --reporter=junit --outputFile.junit=artifacts/tests/runtime-schema.xml --passWithNoTests", "test:unit": "node scripts/run-vitest.ts run tests/unit --reporter=default --reporter=junit --outputFile.junit=artifacts/tests/unit.xml", "test:contract": "node scripts/run-vitest.ts run tests/contract --reporter=default --reporter=junit --outputFile.junit=artifacts/tests/contract.xml", @@ -122,15 +106,7 @@ "check:ci": "corepack pnpm check:artifact-schemas && node scripts/check-ci-contract.ts && corepack pnpm check:ci-workflow", "update:ci-contract-baseline": "node scripts/update-ci-contract-baseline.ts", "verify:documentation": "node scripts/generate-product-feature-index.ts && node scripts/verify-documentation-readiness.ts", - "check:types:web-worker": "tsc --project tsconfig.web-worker.json", "check:types:service-worker": "tsc --project tsconfig.service-worker.json", - "check:types:fixture:http-operation-input": "tsc -p tests/fixtures/typecheck/tsconfig.http-operation-input.json", - "check:types:fixture:http-wire-mapper": "tsc -p tests/fixtures/typecheck/tsconfig.http-wire-mapper.json", - "check:types:fixture:http-operation-id": "tsc -p tests/fixtures/typecheck/tsconfig.http-operation-id.json", - "check:types:fixture:http-route-id": "tsc -p tests/fixtures/typecheck/tsconfig.http-route-id.json", - "check:types:fixture:feature-contribution-input": "tsc -p tests/fixtures/typecheck/tsconfig.feature-contribution-input.json", - "check:types:fixture:feature-capability-selection": "tsc -p tests/fixtures/typecheck/tsconfig.feature-capability-selection.json", - "check:types:fixture:direct-feature-composition": "tsc -p tests/fixtures/typecheck/tsconfig.direct-feature-composition.json", "generate:feature-index": "node scripts/generate-product-feature-index.ts", "create:feature": "node scripts/generate-product-feature-index.ts && node scripts/create-feature.ts", "check:feature-index": "node scripts/generate-product-feature-index.ts --check", diff --git a/scripts/check-optional-recipe-types.ts b/scripts/check-optional-recipe-types.ts deleted file mode 100644 index 9b49d6d7..00000000 --- a/scripts/check-optional-recipe-types.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { spawnSync } from "node:child_process"; -import { readdir } from "node:fs/promises"; -import { extname, resolve } from "node:path"; - -const recipeRoot = resolve("recipes"); -const pnpmCli = requireEnvironment("npm_execpath"); - -if (!(await containsTypeScriptSource(recipeRoot))) { - process.stdout.write( - "Optional recipe typecheck: SKIP (no recipe TypeScript sources installed)\n", - ); -} else { - const result = spawnSync( - process.execPath, - [pnpmCli, "exec", "tsc", "--project", "tsconfig.recipes.json"], - { stdio: "inherit" }, - ); - if (result.error) { - throw result.error; - } - process.exitCode = result.status ?? 1; -} - -function requireEnvironment(name: string): string { - const value = process.env[name]; - if (!value) { - throw new Error(`${name} is required to typecheck optional recipes`); - } - return value; -} - -async function containsTypeScriptSource(directory: string): Promise { - let entries; - try { - entries = await readdir(directory, { withFileTypes: true }); - } catch (error) { - if (hasErrorCode(error, "ENOENT")) { - return false; - } - throw error; - } - - for (const entry of entries) { - const target = resolve(directory, entry.name); - if (entry.isDirectory() && (await containsTypeScriptSource(target))) { - return true; - } - if (entry.isFile() && [".ts", ".tsx", ".mts", ".cts"].includes(extname(entry.name))) { - return true; - } - } - return false; -} - -function hasErrorCode(error: unknown, code: string): boolean { - return ( - typeof error === "object" && - error !== null && - "code" in error && - error.code === code - ); -} diff --git a/scripts/check-type-fixtures.ts b/scripts/check-type-fixtures.ts new file mode 100644 index 00000000..eaa0f655 --- /dev/null +++ b/scripts/check-type-fixtures.ts @@ -0,0 +1,141 @@ +import { spawn } from "node:child_process"; +import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +/** + * The negative type fixtures (FE-GATE-003). Each fixture under + * tests/fixtures/typecheck states on its first line what tsc must say about + * it: `// expect: TS2322` (compilation fails and reports TS2322) or + * `// expect: pass` (it compiles; tests/fixtures/typecheck/invalid-diagnostics-port.ts + * holds one `@ts-expect-error` per violation). Every fixture compiles alone + * with tests/fixtures/typecheck/tsconfig.base.json, as the 23 one-file + * tsconfigs and package scripts this runner replaces did (design-docs + * repo-structure/04-frontend-layout.md §5.3 (가)). + * + * The check is the one run-ci-gate.ts applied to each of those commands: + * tsc exits 1 and its output contains `error TS:`. A fixture without an + * expectation line fails, and so does a directory with no fixtures, so a new + * fixture cannot be skipped and an empty run cannot pass (R8). + */ + +export const TYPE_FIXTURE_ROOT = "tests/fixtures/typecheck"; +const BASE_CONFIG = `${TYPE_FIXTURE_ROOT}/tsconfig.base.json`; +/** + * tsc resolves `types` from the tsconfig's directory upwards, so the one-file + * tsconfigs are written inside the repository, in the ignored `.tmp/`. + */ +const CONFIG_ROOT = ".tmp/type-fixtures"; +const EXPECTATION = /^\/\/ expect: (pass|TS\d{4,5})$/u; +/** Helpers that fixtures import are not fixtures. */ +const FIXTURE_FILE = /^invalid-[\w-]+\.tsx?$/u; +const CONCURRENCY = 4; + +export type TypeFixtureExpectation = { kind: "pass" } | { kind: "fail"; code: string }; + +export interface TypeFixtureResult { + file: string; + expectation: TypeFixtureExpectation | undefined; + passed: boolean; + /** The diagnostic lines that met the expectation, or all output on failure. */ + evidence: string[]; +} + +export function parseTypeFixtureExpectation(source: string): TypeFixtureExpectation | undefined { + const match = EXPECTATION.exec(source.split("\n", 1)[0]?.trimEnd() ?? ""); + if (!match?.[1]) return undefined; + return match[1] === "pass" ? { kind: "pass" } : { kind: "fail", code: match[1] }; +} + +export async function listTypeFixtures(root: string): Promise { + return (await readdir(path.join(root, TYPE_FIXTURE_ROOT))) + .filter((name) => FIXTURE_FILE.test(name)) + .sort() + .map((name) => `${TYPE_FIXTURE_ROOT}/${name}`); +} + +export function judgeTypeFixture( + expectation: TypeFixtureExpectation, + exitCode: number | null, + output: string, +): Pick { + const lines = output.split("\n").filter((line) => line.trim().length > 0); + if (expectation.kind === "pass") { + return { passed: exitCode === 0, evidence: lines }; + } + const matching = lines.filter((line) => line.includes(`error ${expectation.code}:`)); + return exitCode === 1 && matching.length > 0 + ? { passed: true, evidence: matching } + : { passed: false, evidence: [`tsc exit ${exitCode}`, ...lines] }; +} + +function runTsc(root: string, config: string): Promise<{ exitCode: number | null; output: string }> { + return new Promise((resolve, reject) => { + const child = spawn(path.join(root, "node_modules/.bin/tsc"), ["--project", config, "--pretty", "false"], { + cwd: root, + stdio: ["ignore", "pipe", "pipe"], + }); + let output = ""; + child.stdout.on("data", (chunk: Buffer) => (output += chunk.toString("utf8"))); + child.stderr.on("data", (chunk: Buffer) => (output += chunk.toString("utf8"))); + child.on("error", reject); + child.on("close", (exitCode) => resolve({ exitCode, output })); + }); +} + +async function checkTypeFixture(root: string, file: string): Promise { + const expectation = parseTypeFixtureExpectation(await readFile(path.join(root, file), "utf8")); + if (!expectation) { + return { file, expectation, passed: false, evidence: ["missing `// expect:` first line"] }; + } + const config = path.join(CONFIG_ROOT, `tsconfig.${path.basename(file).replace(/\.tsx?$/u, "")}.json`); + const fromConfig = (target: string) => path.relative(path.dirname(config), target); + await writeFile( + path.join(root, config), + `${JSON.stringify({ extends: fromConfig(BASE_CONFIG), files: [fromConfig(file)] }, null, 2)}\n`, + ); + const { exitCode, output } = await runTsc(root, config); + return { file, expectation, ...judgeTypeFixture(expectation, exitCode, output) }; +} + +export async function checkTypeFixtures(root: string): Promise { + const fixtures = await listTypeFixtures(root); + await rm(path.join(root, CONFIG_ROOT), { recursive: true, force: true }); + await mkdir(path.join(root, CONFIG_ROOT), { recursive: true }); + const results: TypeFixtureResult[] = new Array(fixtures.length); + let next = 0; + await Promise.all( + Array.from({ length: Math.min(CONCURRENCY, fixtures.length) }, async () => { + while (next < fixtures.length) { + const index = next++; + results[index] = await checkTypeFixture(root, fixtures[index]!); + } + }), + ); + return results; +} + +function describeExpectation(expectation: TypeFixtureExpectation | undefined): string { + if (!expectation) return "no expectation"; + return expectation.kind === "pass" ? "expect pass" : `expect ${expectation.code}`; +} + +if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + const results = await checkTypeFixtures(process.cwd()); + for (const result of results) { + process.stdout.write( + `${result.passed ? "PASS" : "FAIL"} ${result.file} (${describeExpectation(result.expectation)})\n`, + ); + for (const line of result.evidence) process.stdout.write(` ${line}\n`); + } + const failed = results.filter(({ passed }) => !passed); + if (results.length === 0) { + process.stderr.write(`Type fixtures: FAIL (no fixtures under ${TYPE_FIXTURE_ROOT})\n`); + process.exitCode = 1; + } else if (failed.length > 0) { + process.stderr.write(`Type fixtures: FAIL (${failed.length} of ${results.length})\n`); + process.exitCode = 1; + } else { + process.stdout.write(`Type fixtures: PASS (${results.length} fixtures)\n`); + } +} diff --git a/scripts/check-typecheck-inputs.ts b/scripts/check-typecheck-inputs.ts new file mode 100644 index 00000000..a37cdee1 --- /dev/null +++ b/scripts/check-typecheck-inputs.ts @@ -0,0 +1,55 @@ +import { spawnSync } from "node:child_process"; +import { readFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +/** + * R8 of docs/manual/03-outside-feature-folder.md: a check with nothing to + * check fails. tsc passes a tsconfig whose `files` is empty when it extends + * another one, so `check:types:web-worker` compiled zero files and passed + * FE-GATE-003 from 2026-09-25 until it was deleted on 2026-11-08. Every + * tsconfig a package script hands to tsc must list at least one file of this + * repository (lib and node_modules declarations do not count). + */ + +const TSC_PROJECT = /\btsc\s+(?:--project|-p)\s+(\S+)/gu; + +export function typecheckProjects(scripts: Readonly>): string[] { + const projects = new Set(); + for (const command of Object.values(scripts)) { + for (const match of command.matchAll(TSC_PROJECT)) projects.add(match[1]!); + } + return [...projects].sort(); +} + +export function ownInputFiles(listed: string): string[] { + return listed + .split("\n") + .map((line) => line.trim()) + .filter((line) => line.length > 0 && !line.split(path.sep).includes("node_modules")); +} + +if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + const scripts = (JSON.parse(readFileSync("package.json", "utf8")) as { scripts: Record }).scripts; + const projects = typecheckProjects(scripts); + const counts = projects.map((project) => { + const result = spawnSync(path.resolve("node_modules/.bin/tsc"), ["--project", project, "--listFilesOnly"], { + encoding: "utf8", + }); + if (result.error) throw result.error; + return { project, files: ownInputFiles(result.stdout).length }; + }); + const empty = counts.filter(({ files }) => files === 0); + if (projects.length === 0 || empty.length > 0) { + process.stderr.write( + projects.length === 0 + ? "Typecheck inputs: FAIL (no package script runs tsc --project)\n" + : `Typecheck inputs: FAIL (no input files: ${empty.map(({ project }) => project).join(", ")})\n`, + ); + process.exitCode = 1; + } else { + process.stdout.write( + `Typecheck inputs: PASS (${counts.map(({ project, files }) => `${project} ${files}`).join(", ")})\n`, + ); + } +} diff --git a/scripts/lib/removal-fixture.ts b/scripts/lib/removal-fixture.ts index f3246247..0ca323c7 100644 --- a/scripts/lib/removal-fixture.ts +++ b/scripts/lib/removal-fixture.ts @@ -26,7 +26,7 @@ export const REMOVAL_FIXTURE_COPY_TARGETS = Object.freeze([ "src", "tests", "recipes", "scripts", "schemas", "config", "public", ".gitea", ".storybook", "index.html", "package.json", "tsconfig.base.json", "tsconfig.json", "tsconfig.app.json", "tsconfig.node.json", "tsconfig.test.json", - "tsconfig.recipes.json", "tsconfig.web-worker.json", "tsconfig.service-worker.json", + "tsconfig.service-worker.json", "vite.service-worker.config.ts", "vite.config.ts", "vitest.config.ts", "playwright.config.ts", "playwright.capabilities.config.ts", "playwright.dev.config.ts", "playwright.storybook.config.ts", "playwright.visual.config.ts", "eslint.config.ts", diff --git a/scripts/test-optional-recipe-removal.ts b/scripts/test-optional-recipe-removal.ts index e7bca250..78c1c90d 100644 --- a/scripts/test-optional-recipe-removal.ts +++ b/scripts/test-optional-recipe-removal.ts @@ -42,7 +42,6 @@ try { }); const removedCiScripts = new Set([ - "check:types:recipes", "test:recipes", "check:optional-recipes", "check:optional-recipes:source", diff --git a/scripts/verify-documentation-readiness.ts b/scripts/verify-documentation-readiness.ts index 5f72f0df..56fa1587 100644 --- a/scripts/verify-documentation-readiness.ts +++ b/scripts/verify-documentation-readiness.ts @@ -165,7 +165,8 @@ const DOCUMENT_INDEX = "docs/README.md"; const UNCHECKED_DOCUMENTS = new Set(["CHANGELOG.md"]); const NOT_CREATED = new Set([ // Reserved by generic-worker-has-no-network-or-credentials. The generic CPU - // worker is NOT_SELECTED (tsconfig.web-worker.json). + // worker is NOT_SELECTED; docs/manual/03-outside-feature-folder.md says how + // to add it with its own tsconfig. "src/adapters/web-worker", ]); // pnpm's own commands, which are not package scripts. diff --git a/tests/fixtures/typecheck/invalid-application-input.ts b/tests/fixtures/typecheck/invalid-application-input.ts index bf860363..d50d734d 100644 --- a/tests/fixtures/typecheck/invalid-application-input.ts +++ b/tests/fixtures/typecheck/invalid-application-input.ts @@ -1,3 +1,4 @@ +// expect: TS2739 import type { ApplicationApi } from "../../../src/application/create-application.ts"; export const incompleteApplication: ApplicationApi = { diff --git a/tests/fixtures/typecheck/invalid-application-output.ts b/tests/fixtures/typecheck/invalid-application-output.ts index 0164484f..82b64b76 100644 --- a/tests/fixtures/typecheck/invalid-application-output.ts +++ b/tests/fixtures/typecheck/invalid-application-output.ts @@ -1,3 +1,4 @@ +// expect: TS2322 import type { ApplicationOutputPorts } from "../../../src/application/create-application.ts"; export const invalidOutputPorts: ApplicationOutputPorts = { diff --git a/tests/fixtures/typecheck/invalid-async-overlay.ts b/tests/fixtures/typecheck/invalid-async-overlay.ts index a96b75b0..35601c26 100644 --- a/tests/fixtures/typecheck/invalid-async-overlay.ts +++ b/tests/fixtures/typecheck/invalid-async-overlay.ts @@ -1,3 +1,4 @@ +// expect: TS2322 import type { AsyncOverlay } from "../../../src/application/view-models/async-state.ts"; export const invalidPendingConflict: AsyncOverlay = { diff --git a/tests/fixtures/typecheck/invalid-diagnostics-port.ts b/tests/fixtures/typecheck/invalid-diagnostics-port.ts index 68861186..39498117 100644 --- a/tests/fixtures/typecheck/invalid-diagnostics-port.ts +++ b/tests/fixtures/typecheck/invalid-diagnostics-port.ts @@ -1,3 +1,4 @@ +// expect: pass import type { DiagnosticsPort } from "../../../src/application/ports/diagnostics-port.ts"; import type { TelemetryPort } from "../../../src/application/ports/telemetry-port.ts"; diff --git a/tests/fixtures/typecheck/invalid-direct-feature-composition.ts b/tests/fixtures/typecheck/invalid-direct-feature-composition.ts index 48a5d612..6d0836cf 100644 --- a/tests/fixtures/typecheck/invalid-direct-feature-composition.ts +++ b/tests/fixtures/typecheck/invalid-direct-feature-composition.ts @@ -1,3 +1,4 @@ +// expect: TS2345 import type { InstalledHttpOperationExecutor } from "../../../src/adapters/http/index.ts"; import { composeFeatureAdapterInputs } from "../../../src/features/feature-adapter-contribution.ts"; diff --git a/tests/fixtures/typecheck/invalid-failure-kind.ts b/tests/fixtures/typecheck/invalid-failure-kind.ts index b0a118d5..849417e6 100644 --- a/tests/fixtures/typecheck/invalid-failure-kind.ts +++ b/tests/fixtures/typecheck/invalid-failure-kind.ts @@ -1,3 +1,4 @@ +// expect: TS2322 import type { AppFailure } from "../../../src/contracts/errors.ts"; export const invalidFailure: AppFailure = { diff --git a/tests/fixtures/typecheck/invalid-feature-capability-selection.ts b/tests/fixtures/typecheck/invalid-feature-capability-selection.ts index ad39d7a7..1ab8aed4 100644 --- a/tests/fixtures/typecheck/invalid-feature-capability-selection.ts +++ b/tests/fixtures/typecheck/invalid-feature-capability-selection.ts @@ -1,3 +1,4 @@ +// expect: TS2339 import { defineFeatureAdapterContribution } from "../../../src/features/feature-adapter-contribution.ts"; import { createFixtureFeatureInstalledInput } from "./fixture-feature-contract.ts"; diff --git a/tests/fixtures/typecheck/invalid-feature-contribution-input.ts b/tests/fixtures/typecheck/invalid-feature-contribution-input.ts index 0f6f6490..59974e64 100644 --- a/tests/fixtures/typecheck/invalid-feature-contribution-input.ts +++ b/tests/fixtures/typecheck/invalid-feature-contribution-input.ts @@ -1,3 +1,4 @@ +// expect: TS2322 import { defineFeatureAdapterContribution } from "../../../src/features/feature-adapter-contribution.ts"; import type {} from "./fixture-feature-contract.ts"; diff --git a/tests/fixtures/typecheck/invalid-feature-input.ts b/tests/fixtures/typecheck/invalid-feature-input.ts index 23992a44..29586cbd 100644 --- a/tests/fixtures/typecheck/invalid-feature-input.ts +++ b/tests/fixtures/typecheck/invalid-feature-input.ts @@ -1,3 +1,4 @@ +// expect: TS2345 import type { ApplicationApi } from "../../../src/application/ports/in/application-api.ts"; import type { FixtureFeatureInput } from "./fixture-feature-contract.ts"; diff --git a/tests/fixtures/typecheck/invalid-http-operation-id.ts b/tests/fixtures/typecheck/invalid-http-operation-id.ts index 73fab657..97be3e03 100644 --- a/tests/fixtures/typecheck/invalid-http-operation-id.ts +++ b/tests/fixtures/typecheck/invalid-http-operation-id.ts @@ -1,3 +1,4 @@ +// expect: TS2345 import { createFeatureHttpBinding, defineFeatureHttpOperation, diff --git a/tests/fixtures/typecheck/invalid-http-operation-input.ts b/tests/fixtures/typecheck/invalid-http-operation-input.ts index 04bdec93..91f2c13a 100644 --- a/tests/fixtures/typecheck/invalid-http-operation-input.ts +++ b/tests/fixtures/typecheck/invalid-http-operation-input.ts @@ -1,3 +1,4 @@ +// expect: TS2353 import type { FixtureHttpBinding } from "./fixture-feature-contract.ts"; declare const http: FixtureHttpBinding; diff --git a/tests/fixtures/typecheck/invalid-http-route-id.ts b/tests/fixtures/typecheck/invalid-http-route-id.ts index e6afb27b..b36eaada 100644 --- a/tests/fixtures/typecheck/invalid-http-route-id.ts +++ b/tests/fixtures/typecheck/invalid-http-route-id.ts @@ -1,3 +1,4 @@ +// expect: TS2322 import { defineFeatureHttpOperationForRoutes } from "../../../src/adapters/http/index.ts"; import { mapEntityPayload, diff --git a/tests/fixtures/typecheck/invalid-http-wire-mapper.ts b/tests/fixtures/typecheck/invalid-http-wire-mapper.ts index 4be83418..53e6fcea 100644 --- a/tests/fixtures/typecheck/invalid-http-wire-mapper.ts +++ b/tests/fixtures/typecheck/invalid-http-wire-mapper.ts @@ -1,3 +1,4 @@ +// expect: TS2322 import { defineFeatureHttpOperation } from "../../../src/adapters/http/index.ts"; import { TEST_GET_ENTITY_CONTRACT } from "./fixture-feature-contract.ts"; diff --git a/tests/fixtures/typecheck/invalid-icon-button.tsx b/tests/fixtures/typecheck/invalid-icon-button.tsx index b4da306e..4aaed5a1 100644 --- a/tests/fixtures/typecheck/invalid-icon-button.tsx +++ b/tests/fixtures/typecheck/invalid-icon-button.tsx @@ -1,3 +1,4 @@ +// expect: TS2741 import { IconButton, MenuIcon } from "../../../src/presentation/design-system/index.ts"; export const InvalidIconButton = ; diff --git a/tests/fixtures/typecheck/invalid-image-cdn-resolve-signal.ts b/tests/fixtures/typecheck/invalid-image-cdn-resolve-signal.ts index 7bd47b60..d8a5b657 100644 --- a/tests/fixtures/typecheck/invalid-image-cdn-resolve-signal.ts +++ b/tests/fixtures/typecheck/invalid-image-cdn-resolve-signal.ts @@ -1,3 +1,4 @@ +// expect: TS2741 import type { ImageAssetReference, ImageCdnPresentationPort, diff --git a/tests/fixtures/typecheck/invalid-message-key.ts b/tests/fixtures/typecheck/invalid-message-key.ts index 925209fe..24eb6047 100644 --- a/tests/fixtures/typecheck/invalid-message-key.ts +++ b/tests/fixtures/typecheck/invalid-message-key.ts @@ -1,3 +1,4 @@ +// expect: TS2345 import { formatMessage } from "../../../src/presentation/i18n/index.ts"; formatMessage("ko-KR", "unknown.translation.key"); diff --git a/tests/fixtures/typecheck/invalid-message-params.ts b/tests/fixtures/typecheck/invalid-message-params.ts index 49df9774..d23f7af4 100644 --- a/tests/fixtures/typecheck/invalid-message-params.ts +++ b/tests/fixtures/typecheck/invalid-message-params.ts @@ -1,3 +1,4 @@ +// expect: TS2554 import { formatMessage } from "../../../src/presentation/i18n/index.ts"; formatMessage("en-US", "route.documentTitle"); diff --git a/tests/fixtures/typecheck/invalid-page-action.tsx b/tests/fixtures/typecheck/invalid-page-action.tsx index 94335dfb..a7b31643 100644 --- a/tests/fixtures/typecheck/invalid-page-action.tsx +++ b/tests/fixtures/typecheck/invalid-page-action.tsx @@ -1,3 +1,4 @@ +// expect: TS1360 import type { PageActionDefinition } from "../../../src/presentation/templates/index.ts"; export const activeButtonWithoutCallback = { diff --git a/tests/fixtures/typecheck/invalid-port-call.ts b/tests/fixtures/typecheck/invalid-port-call.ts index 069e87bd..d90e1eae 100644 --- a/tests/fixtures/typecheck/invalid-port-call.ts +++ b/tests/fixtures/typecheck/invalid-port-call.ts @@ -1,3 +1,4 @@ +// expect: TS2322 // This deliberately failing fixture proves that TypeScript rejects a wrong shape. function execute(request: { operationId: string }) { diff --git a/tests/fixtures/typecheck/invalid-port-implementation.ts b/tests/fixtures/typecheck/invalid-port-implementation.ts index f24f583c..2c0ba2c4 100644 --- a/tests/fixtures/typecheck/invalid-port-implementation.ts +++ b/tests/fixtures/typecheck/invalid-port-implementation.ts @@ -1,3 +1,4 @@ +// expect: TS2322 interface ClockPort { now(): number; } diff --git a/tests/fixtures/typecheck/invalid-reference-operation.ts b/tests/fixtures/typecheck/invalid-reference-operation.ts index a74abcdb..db048f53 100644 --- a/tests/fixtures/typecheck/invalid-reference-operation.ts +++ b/tests/fixtures/typecheck/invalid-reference-operation.ts @@ -1,3 +1,4 @@ +// expect: TS2741 import type { FixtureHttpBinding } from "./fixture-feature-contract.ts"; declare const http: FixtureHttpBinding; diff --git a/tests/fixtures/typecheck/invalid-result-narrowing.ts b/tests/fixtures/typecheck/invalid-result-narrowing.ts index 5821540e..e7ec22dd 100644 --- a/tests/fixtures/typecheck/invalid-result-narrowing.ts +++ b/tests/fixtures/typecheck/invalid-result-narrowing.ts @@ -1,3 +1,4 @@ +// expect: TS2339 import type { Result } from "../../../src/contracts/result.ts"; export function invalidUnwrap(result: Result): number { diff --git a/tests/fixtures/typecheck/invalid-route-runtime.ts b/tests/fixtures/typecheck/invalid-route-runtime.ts index bc8ec5e0..95d9bdf1 100644 --- a/tests/fixtures/typecheck/invalid-route-runtime.ts +++ b/tests/fixtures/typecheck/invalid-route-runtime.ts @@ -1,3 +1,4 @@ +// expect: TS2741 import { ROUTE_RUNTIME_CONTRACT } from "../../../src/features/installed-feature-contracts.ts"; type RouteId = keyof typeof ROUTE_RUNTIME_CONTRACT; diff --git a/tests/fixtures/typecheck/tsconfig.application-input.json b/tests/fixtures/typecheck/tsconfig.application-input.json deleted file mode 100644 index 481901fb..00000000 --- a/tests/fixtures/typecheck/tsconfig.application-input.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-application-input.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.application-output.json b/tests/fixtures/typecheck/tsconfig.application-output.json deleted file mode 100644 index 14ed9ff6..00000000 --- a/tests/fixtures/typecheck/tsconfig.application-output.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-application-output.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.async-overlay.json b/tests/fixtures/typecheck/tsconfig.async-overlay.json deleted file mode 100644 index ae1dc4ac..00000000 --- a/tests/fixtures/typecheck/tsconfig.async-overlay.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-async-overlay.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.diagnostics-port.json b/tests/fixtures/typecheck/tsconfig.diagnostics-port.json deleted file mode 100644 index e36df82a..00000000 --- a/tests/fixtures/typecheck/tsconfig.diagnostics-port.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-diagnostics-port.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.direct-feature-composition.json b/tests/fixtures/typecheck/tsconfig.direct-feature-composition.json deleted file mode 100644 index 81e59537..00000000 --- a/tests/fixtures/typecheck/tsconfig.direct-feature-composition.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-direct-feature-composition.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.failure-kind.json b/tests/fixtures/typecheck/tsconfig.failure-kind.json deleted file mode 100644 index 713e73fa..00000000 --- a/tests/fixtures/typecheck/tsconfig.failure-kind.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-failure-kind.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.feature-capability-selection.json b/tests/fixtures/typecheck/tsconfig.feature-capability-selection.json deleted file mode 100644 index a2fdc2cd..00000000 --- a/tests/fixtures/typecheck/tsconfig.feature-capability-selection.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-feature-capability-selection.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.feature-contribution-input.json b/tests/fixtures/typecheck/tsconfig.feature-contribution-input.json deleted file mode 100644 index 287af83f..00000000 --- a/tests/fixtures/typecheck/tsconfig.feature-contribution-input.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-feature-contribution-input.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.feature-input.json b/tests/fixtures/typecheck/tsconfig.feature-input.json deleted file mode 100644 index ce3ac52e..00000000 --- a/tests/fixtures/typecheck/tsconfig.feature-input.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-feature-input.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.http-operation-id.json b/tests/fixtures/typecheck/tsconfig.http-operation-id.json deleted file mode 100644 index 98083038..00000000 --- a/tests/fixtures/typecheck/tsconfig.http-operation-id.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-http-operation-id.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.http-operation-input.json b/tests/fixtures/typecheck/tsconfig.http-operation-input.json deleted file mode 100644 index 5c1b229e..00000000 --- a/tests/fixtures/typecheck/tsconfig.http-operation-input.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-http-operation-input.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.http-route-id.json b/tests/fixtures/typecheck/tsconfig.http-route-id.json deleted file mode 100644 index c37d1f7b..00000000 --- a/tests/fixtures/typecheck/tsconfig.http-route-id.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-http-route-id.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.http-wire-mapper.json b/tests/fixtures/typecheck/tsconfig.http-wire-mapper.json deleted file mode 100644 index b6bc81c3..00000000 --- a/tests/fixtures/typecheck/tsconfig.http-wire-mapper.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-http-wire-mapper.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.icon-button.json b/tests/fixtures/typecheck/tsconfig.icon-button.json deleted file mode 100644 index 3efcca1a..00000000 --- a/tests/fixtures/typecheck/tsconfig.icon-button.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-icon-button.tsx" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.image-cdn-resolve-signal.json b/tests/fixtures/typecheck/tsconfig.image-cdn-resolve-signal.json deleted file mode 100644 index 7fff2d6c..00000000 --- a/tests/fixtures/typecheck/tsconfig.image-cdn-resolve-signal.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-image-cdn-resolve-signal.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.message-key.json b/tests/fixtures/typecheck/tsconfig.message-key.json deleted file mode 100644 index 4e28e223..00000000 --- a/tests/fixtures/typecheck/tsconfig.message-key.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-message-key.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.message-params.json b/tests/fixtures/typecheck/tsconfig.message-params.json deleted file mode 100644 index 809efc3f..00000000 --- a/tests/fixtures/typecheck/tsconfig.message-params.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-message-params.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.page-action.json b/tests/fixtures/typecheck/tsconfig.page-action.json deleted file mode 100644 index 4a87502b..00000000 --- a/tests/fixtures/typecheck/tsconfig.page-action.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-page-action.tsx" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.port-call.json b/tests/fixtures/typecheck/tsconfig.port-call.json deleted file mode 100644 index 00cd5818..00000000 --- a/tests/fixtures/typecheck/tsconfig.port-call.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-port-call.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.port-implementation.json b/tests/fixtures/typecheck/tsconfig.port-implementation.json deleted file mode 100644 index 5156ee8a..00000000 --- a/tests/fixtures/typecheck/tsconfig.port-implementation.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-port-implementation.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.reference-operation.json b/tests/fixtures/typecheck/tsconfig.reference-operation.json deleted file mode 100644 index 1a26faae..00000000 --- a/tests/fixtures/typecheck/tsconfig.reference-operation.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-reference-operation.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.result-narrowing.json b/tests/fixtures/typecheck/tsconfig.result-narrowing.json deleted file mode 100644 index 2a61c5aa..00000000 --- a/tests/fixtures/typecheck/tsconfig.result-narrowing.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-result-narrowing.ts" - ] -} diff --git a/tests/fixtures/typecheck/tsconfig.route-runtime.json b/tests/fixtures/typecheck/tsconfig.route-runtime.json deleted file mode 100644 index 0f13ec7c..00000000 --- a/tests/fixtures/typecheck/tsconfig.route-runtime.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "files": [ - "./invalid-route-runtime.ts" - ] -} diff --git a/tests/unit/ci-workflow-generation.test.ts b/tests/unit/ci-workflow-generation.test.ts index d8dae090..cd1392ce 100644 --- a/tests/unit/ci-workflow-generation.test.ts +++ b/tests/unit/ci-workflow-generation.test.ts @@ -196,9 +196,9 @@ describe("CI gate contract", () => { ).filter((gateId) => gateId !== "FE-GATE-016"), ); expect(contract.jobs).toHaveLength(10); - expect(contract.commands).toHaveLength(99); - expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(103); - expect(contract.commands.filter(({ expect }) => expect === "fail")).toHaveLength(30); + expect(contract.commands).toHaveLength(76); + expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(80); + expect(contract.commands.filter(({ expect }) => expect === "fail")).toHaveLength(8); expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(83); expect(contract.artifacts).toHaveLength(105); expect(contract.stages).toHaveLength(5); diff --git a/tests/unit/feature-scaffold-drill.test.ts b/tests/unit/feature-scaffold-drill.test.ts index 603118db..1b1911fe 100644 --- a/tests/unit/feature-scaffold-drill.test.ts +++ b/tests/unit/feature-scaffold-drill.test.ts @@ -38,8 +38,8 @@ describe("feature scaffold drill commands", () => { it("keeps a negative fixture's registered exit and diagnostic", async () => { const contract = await loadCiGateContract(process.cwd()); - expect(scaffoldDrillCommands(contract).find(({ script }) => script === "check:types:fixture")) - .toMatchObject({ expectation: { kind: "fail", expectedExitCode: 1, expectedDiagnosticId: "error TS2322:" } }); + expect(scaffoldDrillCommands(contract).find(({ script }) => script === "check:coverage:fixture")) + .toMatchObject({ expectation: { kind: "fail", expectedExitCode: 1, expectedDiagnosticId: "Risk coverage failed:" } }); }); it("runs a command added to the merge stage without an edit to the drill", async () => { diff --git a/tests/unit/product-index-entrypoints.test.ts b/tests/unit/product-index-entrypoints.test.ts index dea64a61..617423be 100644 --- a/tests/unit/product-index-entrypoints.test.ts +++ b/tests/unit/product-index-entrypoints.test.ts @@ -14,11 +14,8 @@ const NON_NODE_ENTRY_SCRIPTS = [ "check:types:app", "check:types:node", "check:types:test", - "check:types:fixture:route-runtime", - "check:types:fixture:page-action", - "check:types:fixture:icon-button", - "check:types:fixture:i18n-key", - "check:types:fixture:i18n-params", + // Its fixtures, compiled through the TypeScript API, import the index. + "check:types:fixtures", ] as const; const ROOT = process.cwd(); diff --git a/tests/unit/supply-chain.test.ts b/tests/unit/supply-chain.test.ts index bd3d614e..2f8e05c7 100644 --- a/tests/unit/supply-chain.test.ts +++ b/tests/unit/supply-chain.test.ts @@ -564,10 +564,8 @@ describe("supply-chain policy", () => { "tsconfig.app.json", "tsconfig.base.json", "tsconfig.node.json", - "tsconfig.recipes.json", "tsconfig.service-worker.json", "tsconfig.test.json", - "tsconfig.web-worker.json", ]; expect(policy.trackedRoots).toEqual( expect.arrayContaining(mandatory.filter((input) => existsSync(input))), diff --git a/tests/unit/type-fixtures.test.ts b/tests/unit/type-fixtures.test.ts new file mode 100644 index 00000000..69aca025 --- /dev/null +++ b/tests/unit/type-fixtures.test.ts @@ -0,0 +1,70 @@ +import { readFile } from "node:fs/promises"; + +import { describe, expect, it } from "vitest"; + +import { + judgeTypeFixture, + listTypeFixtures, + parseTypeFixtureExpectation, +} from "../../scripts/check-type-fixtures.ts"; +import { ownInputFiles, typecheckProjects } from "../../scripts/check-typecheck-inputs.ts"; + +describe("negative type fixtures (FE-GATE-003)", () => { + it("reads the expectation from the first line only", () => { + expect(parseTypeFixtureExpectation("// expect: TS2322\nconst a = 1;")).toEqual({ kind: "fail", code: "TS2322" }); + expect(parseTypeFixtureExpectation("// expect: pass\n")).toEqual({ kind: "pass" }); + expect(parseTypeFixtureExpectation("import x from './x';\n// expect: TS2322\n")).toBeUndefined(); + expect(parseTypeFixtureExpectation("// expect: 2322\n")).toBeUndefined(); + }); + + it("states an expectation in every fixture", async () => { + const fixtures = await listTypeFixtures(process.cwd()); + expect(fixtures.length).toBeGreaterThan(0); + for (const fixture of fixtures) { + expect(parseTypeFixtureExpectation(await readFile(fixture, "utf8")), fixture).toBeDefined(); + } + }); + + // run-ci-gate.ts applied the same test to each of the 23 commands this + // runner replaced: exit 1 and the registered `error TS:` in the output. + it("passes a failing fixture only on exit 1 with the expected code", () => { + const fail = { kind: "fail", code: "TS2322" } as const; + const output = "a.ts(1,7): error TS2322: Type 'number' is not assignable to type 'string'.\n"; + expect(judgeTypeFixture(fail, 1, output)).toEqual({ + passed: true, + evidence: ["a.ts(1,7): error TS2322: Type 'number' is not assignable to type 'string'."], + }); + expect(judgeTypeFixture(fail, 1, "a.ts(1,7): error TS2339: Property 'x' does not exist.\n").passed).toBe(false); + expect(judgeTypeFixture(fail, 0, "").passed).toBe(false); + expect(judgeTypeFixture(fail, 2, output).passed).toBe(false); + }); + + // 07-05. A port type that widens leaves an `@ts-expect-error` unused (TS2578). + it("fails a fixture expected to compile when tsc reports anything", () => { + expect(judgeTypeFixture({ kind: "pass" }, 0, "").passed).toBe(true); + expect( + judgeTypeFixture({ kind: "pass" }, 1, "a.ts(20,1): error TS2578: Unused '@ts-expect-error' directive.\n"), + ).toEqual({ passed: false, evidence: ["a.ts(20,1): error TS2578: Unused '@ts-expect-error' directive."] }); + }); +}); + +describe("typecheck inputs (R8)", () => { + it("finds every tsconfig a package script hands to tsc", () => { + expect( + typecheckProjects({ + app: "node gen.ts && tsc --project tsconfig.app.json", + sw: "tsc -p tsconfig.sw.json", + lint: "eslint .", + }), + ).toEqual(["tsconfig.app.json", "tsconfig.sw.json"]); + }); + + it("counts only this repository's files", () => { + expect( + ownInputFiles( + "/repo/node_modules/typescript/lib/lib.es5.d.ts\n/repo/node_modules/@types/node/index.d.ts\n/repo/src/app.ts\n", + ), + ).toEqual(["/repo/src/app.ts"]); + expect(ownInputFiles("/repo/node_modules/typescript/lib/lib.es5.d.ts\n")).toEqual([]); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 76e73be3..05f6d79c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,8 +4,6 @@ { "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }, { "path": "./tsconfig.test.json" }, - { "path": "./tsconfig.recipes.json" }, - { "path": "./tsconfig.web-worker.json" }, { "path": "./tsconfig.service-worker.json" } ] } diff --git a/tsconfig.recipes.json b/tsconfig.recipes.json deleted file mode 100644 index e2601f9f..00000000 --- a/tsconfig.recipes.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "lib": ["ES2022", "DOM", "DOM.Iterable"], - "types": ["node"] - }, - "include": ["recipes/**/*.ts"], - "exclude": ["dist", "node_modules"] -} diff --git a/tsconfig.test.json b/tsconfig.test.json index 85e00a5c..ffccc065 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -7,6 +7,7 @@ "include": [ "tests/**/*.ts", "tests/**/*.tsx", + "recipes/**/*.ts", "vitest.config.ts", "playwright*.config.ts" ], diff --git a/tsconfig.web-worker.json b/tsconfig.web-worker.json deleted file mode 100644 index 8d3399ca..00000000 --- a/tsconfig.web-worker.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "lib": ["ES2022", "WebWorker"], - "types": [], - "skipLibCheck": false - }, - "//": "§16.2 Generic CPU Worker is NOT_SELECTED: src/adapters/web-worker does not exist yet. Add it to include when a task group is contributed.", - "files": [] -} -- 2.54.0 From 79dc945a67d91c91e1e64a918231b4d86c491454 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 17:41:01 +0900 Subject: [PATCH 2/6] =?UTF-8?q?refactor(layout):=20=EB=A3=A8=ED=8A=B8=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EB=AA=A9=EB=A1=9D=EC=9D=84=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EB=B6=80=20=ED=95=98=EB=82=98=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EA=B3=A0=EB=A5=B4=EA=B3=A0=20schemas/=EB=A5=BC=20=EC=98=AE?= =?UTF-8?q?=EA=B8=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 루트 항목 하나를 옮기려면 코드 7곳의 루트 경로 목록을 같이 고쳐야 했다(복사 대상, 비밀값 검사 범위, 공급망 시험의 필수 입력, 이력 문서 검사, 규모 입력, vite 입력, TS 전용 규칙). 서로 다른 부분집합이고 한 곳에서 선언하지 않았다. 목록이 갈라져 공급망 생성이 깨진 적도 있다 (removal-fixture.ts 주석). 루트에는 JSON Schema 5개만 담은 `schemas/`가 `config/` 옆에 따로 있었다. `artifacts/`(출력 폴더)에는 사람이 쓴 수동 a11y 기록이, `config/hosting/`(호스트 계약)에는 시험 fixture가 섞였다. 고른 방법(design-docs repo-structure/04-frontend-layout.md 9.2절 3단계, 11절 R1·R2, 소유자 승인 2026-11-07): - `config/repository-layout.json`이 루트 항목마다 종류·역할·읽는 곳과 들어가는 목록(`sets`, 항목 안 경로는 `setPaths`)을 적는다. `scripts/lib/repository-layout.ts`가 읽고 검증한다. 6곳은 이름 붙은 집합을 고른다. JSON인 비밀값 검사 정책은 집합의 사본을 두고 시험이 같은지 본다(정책 파일은 릴리스 후보에 실려 형식을 바꾸지 않았다). 공급망 시험의 필수 입력 목록은 그 시험으로 대신한다. - `tests/unit/repository-layout.test.ts`: 등록부에 없는 루트 항목이 추적되면 실패(R1). 7곳이 등록부 모듈을 쓰고 루트 이름 둘 이상의 문자열 배열을 갖지 않는지(R2). - `schemas/artifacts/` → `config/schemas/artifacts/`, recipe 카탈로그 스키마 → `config/schemas/recipes/`. 정책 입력 순서(ASCII)에 맞춰 `config/schemas/`가 `config/security/` 앞에 온다. - 수동 a11y 기록 3개 → `docs/accessibility/route-reviews/`. `artifacts/`는 `.gitkeep`만 추적한다. 기록은 단위 시험이 읽어서 drill 사본에도 복사한다(`fixture-copy` 집합의 `docs/accessibility/route-reviews`). - `config/hosting/response-headers.fixture.json` → `tests/fixtures/hosting/response-headers.json`. 버린 것: 비밀값 검사 정책이 집합 이름을 참조하게 바꾸는 방법. 정책 파일은 릴리스 후보와 로컬 증거 평가가 읽는 형식이라 바꾸면 릴리스 증거 계약이 바뀐다. 루트 항목이 지워졌는데 등록부에 남는 경우는 시험하지 않았다. drill 사본은 일부만 복사해 그 방향을 볼 수 없다. 그런 항목은 그 집합을 쓰는 곳(복사, 비밀값 검사)에서 실패한다. 위험: 하네스 작업(fe-c)이 더할 `AGENTS.md`·`.claude/`를 미리 등록했다 (optional). 등록부가 이력 문서(`SPEC.md`)와 `CLAUDE.md` 이름을 적어서 이력 문서 검사에서 등록부 파일은 뺐다. 다운스트림은 자기 루트 항목을 등록부에 더해야 한다(CHANGELOG). CI 계약 기준선을 다시 받았다(a11y 기록 산출물 id·경로). 검증(desktop): 아래 4단계 커밋까지 쌓은 트리에서 test:unit, check:types, check:ci, lint, verify:documentation을 돌렸다(그 커밋에 적음). 이 커밋 단독으로 test:unit·check:ci·check:types를 돌렸다. Refs: design-docs repo-structure/04-frontend-layout.md 2.4·9.2·11절, README.md 3.4절 --- .gitea/workflows/quality-gates.yml | 6 +- .gitignore | 3 - README.md | 2 +- config/ci/contract-baseline.json | 4 +- config/ci/gates.json | 18 +- .../recipes/frontend-capability-recipes.json | 2 +- config/repository-layout.json | 320 ++++++++++++++++++ .../artifacts/build-manifest.schema.json | 0 .../dependency-inventory.schema.json | 0 .../artifacts/registry-snapshot.schema.json | 0 .../supply-chain-verification.schema.json | 0 .../frontend-capability-recipes.schema.json | 0 config/security/secret-scan-policy.json | 1 - docs/accessibility/manual-checklist.md | 2 +- .../accessibility/route-reviews}/APP_HOME.md | 0 .../route-reviews}/EXAMPLES_PLATFORM.md | 0 .../accessibility/route-reviews}/NOT_FOUND.md | 0 docs/architecture/optional-adapter-recipes.md | 2 +- docs/architecture/starter-experience.md | 2 +- docs/manual/01-add-a-feature.md | 6 +- docs/manual/03-outside-feature-folder.md | 6 +- docs/manual/reference/create-feature.md | 8 +- docs/manual/reference/errors.md | 4 +- docs/manual/reference/global-ids.md | 2 +- docs/operations/ci-quality-gates.md | 2 +- scripts/check-architecture.ts | 8 +- scripts/check-optional-recipes.ts | 2 +- scripts/check-registries.ts | 2 +- scripts/contracts/release-artifacts.ts | 4 +- scripts/create-feature.ts | 4 +- scripts/generate-artifact-schemas.ts | 8 +- scripts/lib/local-release-evidence.ts | 6 +- scripts/lib/release-candidate.ts | 6 +- scripts/lib/removal-fixture.ts | 33 +- scripts/lib/repository-layout.ts | 141 ++++++++ scripts/lib/vite-build-inputs.ts | 15 +- scripts/verify-a11y-manual.ts | 4 +- scripts/verify-documentation-readiness.ts | 2 +- scripts/verify-extreme-scale.ts | 31 +- scripts/verify-hosting-headers.ts | 2 +- scripts/verify-release.ts | 2 +- .../fixtures/hosting/response-headers.json | 0 tests/platform/release/cache-policy.test.ts | 2 +- .../ci-workflow-generation.test.ts.snap | 6 +- tests/unit/create-feature.test.ts | 16 +- .../unit/deletable-history-documents.test.ts | 30 +- tests/unit/documentation-readiness.test.ts | 8 +- tests/unit/hosting-probe.test.ts | 11 +- tests/unit/json-schema.test.ts | 12 +- tests/unit/manual-a11y-evidence.test.ts | 2 +- tests/unit/release-artifacts.test.ts | 2 +- tests/unit/repository-layout.test.ts | 135 ++++++++ .../second-api-feature-registries.test.ts | 2 +- tests/unit/security-followup-fixture.ts | 6 +- .../unit/service-worker-build-output.test.ts | 4 +- tests/unit/supply-chain.test.ts | 41 --- ...template-feature-removal-documents.test.ts | 6 +- tests/unit/tracked-artifacts.test.ts | 12 +- 58 files changed, 751 insertions(+), 204 deletions(-) create mode 100644 config/repository-layout.json rename {schemas => config/schemas}/artifacts/build-manifest.schema.json (100%) rename {schemas => config/schemas}/artifacts/dependency-inventory.schema.json (100%) rename {schemas => config/schemas}/artifacts/registry-snapshot.schema.json (100%) rename {schemas => config/schemas}/artifacts/supply-chain-verification.schema.json (100%) rename {schemas/config => config/schemas/recipes}/frontend-capability-recipes.schema.json (100%) rename {artifacts/tests/a11y-manual => docs/accessibility/route-reviews}/APP_HOME.md (100%) rename {artifacts/tests/a11y-manual => docs/accessibility/route-reviews}/EXAMPLES_PLATFORM.md (100%) rename {artifacts/tests/a11y-manual => docs/accessibility/route-reviews}/NOT_FOUND.md (100%) create mode 100644 scripts/lib/repository-layout.ts rename config/hosting/response-headers.fixture.json => tests/fixtures/hosting/response-headers.json (100%) create mode 100644 tests/unit/repository-layout.test.ts diff --git a/.gitea/workflows/quality-gates.yml b/.gitea/workflows/quality-gates.yml index 35af29d9..20d19234 100644 --- a/.gitea/workflows/quality-gates.yml +++ b/.gitea/workflows/quality-gates.yml @@ -170,6 +170,9 @@ jobs: artifacts/security/supply-chain-coherence.json \ artifacts/security/supply-chain-verification.json \ artifacts/security/vulnerability-report.json \ + config/schemas/artifacts/build-manifest.schema.json \ + config/schemas/artifacts/dependency-inventory.schema.json \ + config/schemas/artifacts/supply-chain-verification.schema.json \ config/security/dependency-baseline.approval.json \ config/security/dependency-baseline.json \ config/security/dependency-change-evidence.json \ @@ -177,9 +180,6 @@ jobs: config/security/secret-scan-policy.json \ config/security/vulnerability-exceptions.json \ config/security/vulnerability-policy.json \ - schemas/artifacts/build-manifest.schema.json \ - schemas/artifacts/dependency-inventory.schema.json \ - schemas/artifacts/supply-chain-verification.schema.json \ scripts/contracts/release-artifacts.ts \ scripts/create-release-candidate.ts \ scripts/generate-supply-chain.ts \ diff --git a/.gitignore b/.gitignore index 34cdbac7..fd872656 100644 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,6 @@ artifacts/runbooks/* !artifacts/tests/ artifacts/tests/* !artifacts/tests/.gitkeep -!artifacts/tests/a11y-manual/ -artifacts/tests/a11y-manual/* -!artifacts/tests/a11y-manual/*.md # Local environment overrides. `.env.example` is the tracked template; every # other `.env*` file is a developer's own machine and never enters the repo. diff --git a/README.md b/README.md index 8b0d536b..f2c7a518 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,7 @@ Two gates intentionally need external evidence: - `review:a11y-manual` (release gate FE-GATE-028) needs a signed human keyboard/focus/screen-reader review of every registered route, one record - per route at `artifacts/tests/a11y-manual/.md`. The routes are + per route at `docs/accessibility/route-reviews/.md`. The routes are `ROUTE_REGISTRY`; `verify:documentation` fails, naming the route ID, when a registered route has no record. The merge gate FE-GATE-009 runs only `review:a11y-manual -- --format-only`, which checks that every route record diff --git a/config/ci/contract-baseline.json b/config/ci/contract-baseline.json index 220ad79e..7426f344 100644 --- a/config/ci/contract-baseline.json +++ b/config/ci/contract-baseline.json @@ -1,11 +1,11 @@ { "schemaVersion": 1, "owner": "DongHyeonka", - "reason": "2026-11-07 소유자 결정: 정리 3단계(design-docs repo-structure/README.md 3.4절). 음성 타입 fixture 명령 23개를 실행기 하나(check-types-fixtures)로 합치고 check-types-recipes를 check:types:test에 넣는다", + "reason": "2026-11-07 소유자 결정: 정리 3단계(design-docs repo-structure/README.md 3.4절). 음성 타입 fixture 명령 23개를 실행기 하나로 합치고, 수동 a11y 기록을 docs/accessibility/route-reviews로, JSON Schema를 config/schemas로 옮긴다", "gates": 27, "commands": 76, "commandReferences": 80, "artifacts": 105, "stages": 5, - "gateShapeSha256": "963249d0ce7771677705f8f81e82fa5524dac2e57349063f96d8136ef252881d" + "gateShapeSha256": "5b2ded190e5c1cbfc31f0d8c90fa358defe87850d99dc4db5439426b9ed72a90" } diff --git a/config/ci/gates.json b/config/ci/gates.json index 2ff619ca..5877462a 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -985,14 +985,14 @@ ] }, { - "id": "artifact-artifacts-tests-a11y-manual-APP-HOME-md", - "path": "artifacts/tests/a11y-manual/APP_HOME.md", + "id": "artifact-docs-accessibility-route-reviews-APP-HOME-md", + "path": "docs/accessibility/route-reviews/APP_HOME.md", "schemaId": "markdown", "production": "source-controlled" }, { - "id": "artifact-artifacts-tests-a11y-manual-NOT-FOUND-md", - "path": "artifacts/tests/a11y-manual/NOT_FOUND.md", + "id": "artifact-docs-accessibility-route-reviews-NOT-FOUND-md", + "path": "docs/accessibility/route-reviews/NOT_FOUND.md", "schemaId": "markdown", "production": "source-controlled" }, @@ -2004,8 +2004,8 @@ ], "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-028-txt", "evidenceArtifactIds": [ - "artifact-artifacts-tests-a11y-manual-APP-HOME-md", - "artifact-artifacts-tests-a11y-manual-NOT-FOUND-md", + "artifact-docs-accessibility-route-reviews-APP-HOME-md", + "artifact-docs-accessibility-route-reviews-NOT-FOUND-md", "artifact-artifacts-tests-a11y-manual-report-json" ], "retentionClassId": "release-coherence" @@ -2241,6 +2241,9 @@ "artifacts/security/supply-chain-coherence.json", "artifacts/security/supply-chain-verification.json", "artifacts/security/vulnerability-report.json", + "config/schemas/artifacts/build-manifest.schema.json", + "config/schemas/artifacts/dependency-inventory.schema.json", + "config/schemas/artifacts/supply-chain-verification.schema.json", "config/security/dependency-baseline.approval.json", "config/security/dependency-baseline.json", "config/security/dependency-change-evidence.json", @@ -2248,9 +2251,6 @@ "config/security/secret-scan-policy.json", "config/security/vulnerability-exceptions.json", "config/security/vulnerability-policy.json", - "schemas/artifacts/build-manifest.schema.json", - "schemas/artifacts/dependency-inventory.schema.json", - "schemas/artifacts/supply-chain-verification.schema.json", "scripts/contracts/release-artifacts.ts", "scripts/create-release-candidate.ts", "scripts/generate-supply-chain.ts", diff --git a/config/recipes/frontend-capability-recipes.json b/config/recipes/frontend-capability-recipes.json index 386e792f..06a8329e 100644 --- a/config/recipes/frontend-capability-recipes.json +++ b/config/recipes/frontend-capability-recipes.json @@ -1,5 +1,5 @@ { - "$schema": "../../schemas/config/frontend-capability-recipes.schema.json", + "$schema": "../schemas/recipes/frontend-capability-recipes.schema.json", "schemaVersion": 1, "decisionId": "VD-10", "defaultStatus": "NOT_INSTALLED", diff --git a/config/repository-layout.json b/config/repository-layout.json new file mode 100644 index 00000000..a118a672 --- /dev/null +++ b/config/repository-layout.json @@ -0,0 +1,320 @@ +{ + "schemaVersion": 1, + "kinds": { + "source": "코드와 시험. 계층과 도구가 읽는다", + "tool-convention": "도구가 루트에서 이 이름으로 찾는 설정 파일·폴더", + "gate-input": "게이트와 런타임이 읽는 기준 데이터", + "document": "사람이 읽는 문서", + "history": "끝난 라운드의 기록. 이력 폴더로 옮길 대상이다(R10)", + "output": "실행 출력. 추적하는 것은 `.gitkeep`뿐이다(R3)" + }, + "sets": { + "fixture-copy": "제거·생성 drill과 사본 시험이 복사하는 것(scripts/lib/removal-fixture.ts)", + "fixture-documents": "기능을 더하거나 지우는 drill이 문서까지 맞는지 보려고 더 복사하는 문서(scripts/lib/removal-fixture.ts)", + "secret-scan": "비밀값 검사와 공급망 목록의 범위. config/security/secret-scan-policy.json의 trackedRoots가 이 집합과 같아야 한다", + "history-free": "이력 문서를 읽으면 안 되는 코드(tests/unit/deletable-history-documents.test.ts)", + "scale-source": "규모 증거에서 '지금 코드'를 정하는 입력(scripts/verify-extreme-scale.ts)", + "vite-build": "vite build가 읽는 입력(scripts/lib/vite-build-inputs.ts)", + "typescript-only": "JS 파일을 두면 안 되는 곳(scripts/check-architecture.ts)" + }, + "entries": [ + { + "path": ".claude", + "kind": "tool-convention", + "role": "Claude Code 설정·규칙·스킬. 하네스 작업(fe-c)이 더한다", + "readBy": "Claude Code", + "optional": true + }, + { + "path": ".dependency-cruiser.json", + "kind": "tool-convention", + "role": "import 규칙과 kernel 예외의 정본", + "readBy": "scripts/check-architecture.ts (FE-GATE-010)", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source"] + }, + { + "path": ".env.example", + "kind": "tool-convention", + "role": "빌드 시점 공개 변수의 견본", + "readBy": "Vite(VITE_*), 사람" + }, + { + "path": ".gitea", + "kind": "tool-convention", + "role": "Gitea Actions workflow. config/ci/gates.json에서 생성한다", + "readBy": "Gitea Actions, scripts/generate-ci-workflow.ts, check:ci (FE-GATE-010)", + "sets": ["fixture-copy", "history-free"], + "setPaths": { + "secret-scan": [".gitea/workflows/quality-gates.yml"] + } + }, + { + "path": ".gitignore", + "kind": "tool-convention", + "role": "추적하지 않을 파일", + "readBy": "git", + "sets": ["fixture-copy"] + }, + { + "path": ".npmrc", + "kind": "tool-convention", + "role": "pnpm 설정", + "readBy": "pnpm", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": ".nvmrc", + "kind": "tool-convention", + "role": "Node 버전", + "readBy": "nvm, CI", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": ".storybook", + "kind": "tool-convention", + "role": "Storybook 설정. 갤러리와 visual 골든의 대상", + "readBy": "storybook, build:storybook (FE-GATE-011)", + "sets": ["fixture-copy", "secret-scan", "scale-source", "typescript-only"] + }, + { + "path": "AGENTS.md", + "kind": "tool-convention", + "role": "에이전트 진입 문서. 하네스 작업(fe-c)이 더한다", + "readBy": "코딩 에이전트", + "optional": true + }, + { + "path": "CHANGELOG.md", + "kind": "document", + "role": "버전별 변경과 다운스트림이 할 일", + "readBy": "tests/unit/changelog-review-ids.test.ts, 사람", + "sets": ["fixture-documents"] + }, + { + "path": "CLAUDE.md", + "kind": "tool-convention", + "role": "Claude Code 진입 문서", + "readBy": "Claude Code" + }, + { + "path": "PRODUCT.md", + "kind": "tool-convention", + "role": "제품 맥락. 디자인 도구가 루트에서 찾는다", + "readBy": "디자인 스킬" + }, + { + "path": "README.md", + "kind": "document", + "role": "시작·설정·검증", + "readBy": "verify:documentation (FE-GATE-017), 사람", + "sets": ["fixture-documents"] + }, + { + "path": "SPEC.md", + "kind": "history", + "role": "2026-09-25 라운드 요구사항. 문서 체계 작업(fe-b)이 이력 폴더로 옮기고 이 항목을 뺀다", + "readBy": "사람" + }, + { + "path": "artifacts", + "kind": "output", + "role": "게이트와 시험의 실행 출력", + "readBy": "scripts/run-ci-gate.ts, CI 업로드" + }, + { + "path": "config", + "kind": "gate-input", + "role": "게이트·런타임·보안·성능의 기준 데이터와 JSON Schema(config/schemas)", + "readBy": "scripts/, tests/, src/", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source"] + }, + { + "path": "docs", + "kind": "document", + "role": "매뉴얼·설계·운영 문서와 수동 접근성 검토 기록", + "readBy": "verify:documentation (FE-GATE-017), review:a11y-manual (FE-GATE-009·028)", + "sets": ["fixture-documents"], + "setPaths": { + "fixture-copy": ["docs/accessibility/route-reviews"] + } + }, + { + "path": "eslint.config.ts", + "kind": "tool-convention", + "role": "lint 규칙", + "readBy": "eslint (FE-GATE-002)", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source"] + }, + { + "path": "index.html", + "kind": "tool-convention", + "role": "Vite 진입 HTML", + "readBy": "Vite", + "sets": ["fixture-copy", "secret-scan", "vite-build"] + }, + { + "path": "package.json", + "kind": "tool-convention", + "role": "의존성과 package script", + "readBy": "pnpm, 모든 게이트", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source", "vite-build"] + }, + { + "path": "playwright.capabilities.config.ts", + "kind": "tool-convention", + "role": "브라우저 capability 시험 설정", + "readBy": "test:browser-capabilities (FE-GATE-008)", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": "playwright.config.ts", + "kind": "tool-convention", + "role": "e2e 설정(빌드 미리보기)", + "readBy": "test:e2e (FE-GATE-008)", + "sets": ["fixture-copy", "secret-scan", "history-free"] + }, + { + "path": "playwright.dev.config.ts", + "kind": "tool-convention", + "role": "dev 서버 대상 e2e 설정", + "readBy": "test:e2e:dev", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": "playwright.storybook.config.ts", + "kind": "tool-convention", + "role": "Storybook 정적 빌드 시험 설정", + "readBy": "test:storybook (FE-GATE-008)", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": "playwright.visual.config.ts", + "kind": "tool-convention", + "role": "visual 골든 설정", + "readBy": "test:visual (FE-GATE-008)", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": "pnpm-lock.yaml", + "kind": "tool-convention", + "role": "잠금 파일", + "readBy": "pnpm, 공급망 생성", + "sets": ["fixture-copy", "secret-scan", "scale-source"] + }, + { + "path": "pnpm-workspace.yaml", + "kind": "tool-convention", + "role": "pnpm 11 설정", + "readBy": "pnpm, scripts/lib/package-script-graph.ts", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": "public", + "kind": "tool-convention", + "role": "개발 서버가 서빙하는 런타임 문서", + "readBy": "Vite", + "sets": ["fixture-copy", "secret-scan", "vite-build"] + }, + { + "path": "recipes", + "kind": "source", + "role": "선택 기능 설치 원본. 기본 빌드에 들어가지 않는다", + "readBy": "tsconfig.test.json, test:recipes (FE-GATE-007), check:optional-recipes (FE-GATE-012)", + "optional": true, + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source", "typescript-only"] + }, + { + "path": "renovate.json", + "kind": "tool-convention", + "role": "보안 업데이트 봇 설정", + "readBy": "Renovate" + }, + { + "path": "scripts", + "kind": "source", + "role": "게이트·생성기·drill 스크립트", + "readBy": "package.json scripts", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source", "typescript-only"], + "setPaths": { + "vite-build": ["scripts/lib/run-isolation.ts", "scripts/lib/vite-module-inventory.ts"] + } + }, + { + "path": "src", + "kind": "source", + "role": "앱 계층", + "readBy": "빌드와 모든 게이트", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source", "vite-build", "typescript-only"] + }, + { + "path": "tests", + "kind": "source", + "role": "시험과 fixture", + "readBy": "test:* scripts, playwright 설정", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source", "typescript-only"] + }, + { + "path": "tsconfig.app.json", + "kind": "tool-convention", + "role": "src 타입 검사(DOM, Node 타입 없음)", + "readBy": "check:types:app (FE-GATE-003), Vite", + "sets": ["fixture-copy", "secret-scan", "scale-source", "vite-build"] + }, + { + "path": "tsconfig.base.json", + "kind": "tool-convention", + "role": "공통 컴파일 옵션", + "readBy": "다른 tsconfig의 extends", + "sets": ["fixture-copy", "secret-scan", "vite-build"] + }, + { + "path": "tsconfig.json", + "kind": "tool-convention", + "role": "편집기용 solution tsconfig(files 없음, references만)", + "readBy": "편집기", + "sets": ["fixture-copy", "secret-scan", "scale-source"] + }, + { + "path": "tsconfig.node.json", + "kind": "tool-convention", + "role": "scripts·설정 파일 타입 검사(NodeNext)", + "readBy": "check:types:node (FE-GATE-003)", + "sets": ["fixture-copy", "secret-scan", "scale-source"] + }, + { + "path": "tsconfig.service-worker.json", + "kind": "tool-convention", + "role": "Service Worker 타입 검사(WebWorker, DOM 없음)", + "readBy": "check:types:service-worker (FE-GATE-003)", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": "tsconfig.test.json", + "kind": "tool-convention", + "role": "tests·recipes·시험 설정 파일 타입 검사", + "readBy": "check:types:test (FE-GATE-003)", + "sets": ["fixture-copy", "secret-scan", "scale-source"] + }, + { + "path": "vite.config.ts", + "kind": "tool-convention", + "role": "앱 빌드", + "readBy": "Vite", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source", "vite-build"] + }, + { + "path": "vite.service-worker.config.ts", + "kind": "tool-convention", + "role": "Service Worker 빌드", + "readBy": "scripts/build-frontend.ts", + "sets": ["fixture-copy", "secret-scan"] + }, + { + "path": "vitest.config.ts", + "kind": "tool-convention", + "role": "단위·컴포넌트 시험 설정", + "readBy": "scripts/run-vitest.ts", + "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source"] + } + ] +} diff --git a/schemas/artifacts/build-manifest.schema.json b/config/schemas/artifacts/build-manifest.schema.json similarity index 100% rename from schemas/artifacts/build-manifest.schema.json rename to config/schemas/artifacts/build-manifest.schema.json diff --git a/schemas/artifacts/dependency-inventory.schema.json b/config/schemas/artifacts/dependency-inventory.schema.json similarity index 100% rename from schemas/artifacts/dependency-inventory.schema.json rename to config/schemas/artifacts/dependency-inventory.schema.json diff --git a/schemas/artifacts/registry-snapshot.schema.json b/config/schemas/artifacts/registry-snapshot.schema.json similarity index 100% rename from schemas/artifacts/registry-snapshot.schema.json rename to config/schemas/artifacts/registry-snapshot.schema.json diff --git a/schemas/artifacts/supply-chain-verification.schema.json b/config/schemas/artifacts/supply-chain-verification.schema.json similarity index 100% rename from schemas/artifacts/supply-chain-verification.schema.json rename to config/schemas/artifacts/supply-chain-verification.schema.json diff --git a/schemas/config/frontend-capability-recipes.schema.json b/config/schemas/recipes/frontend-capability-recipes.schema.json similarity index 100% rename from schemas/config/frontend-capability-recipes.schema.json rename to config/schemas/recipes/frontend-capability-recipes.schema.json diff --git a/config/security/secret-scan-policy.json b/config/security/secret-scan-policy.json index 619d13e2..47c00289 100644 --- a/config/security/secret-scan-policy.json +++ b/config/security/secret-scan-policy.json @@ -7,7 +7,6 @@ "tests", "config", "public", - "schemas", ".storybook", ".gitea/workflows/quality-gates.yml", ".dependency-cruiser.json", diff --git a/docs/accessibility/manual-checklist.md b/docs/accessibility/manual-checklist.md index 313cd9b8..7efc1122 100644 --- a/docs/accessibility/manual-checklist.md +++ b/docs/accessibility/manual-checklist.md @@ -1,7 +1,7 @@ # Manual accessibility review checklist Automated axe checks do not establish WCAG conformance. A human reviewer must -review every route record in `artifacts/tests/a11y-manual/` against one +review every route record in `docs/accessibility/route-reviews/` against one release candidate and sign them. The required scope is the route registry (`ROUTE_REGISTRY` in `src/features/installed-feature-contracts.ts`): one record per route, named `.md`. Copy the template fields exactly; the diff --git a/artifacts/tests/a11y-manual/APP_HOME.md b/docs/accessibility/route-reviews/APP_HOME.md similarity index 100% rename from artifacts/tests/a11y-manual/APP_HOME.md rename to docs/accessibility/route-reviews/APP_HOME.md diff --git a/artifacts/tests/a11y-manual/EXAMPLES_PLATFORM.md b/docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md similarity index 100% rename from artifacts/tests/a11y-manual/EXAMPLES_PLATFORM.md rename to docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md diff --git a/artifacts/tests/a11y-manual/NOT_FOUND.md b/docs/accessibility/route-reviews/NOT_FOUND.md similarity index 100% rename from artifacts/tests/a11y-manual/NOT_FOUND.md rename to docs/accessibility/route-reviews/NOT_FOUND.md diff --git a/docs/architecture/optional-adapter-recipes.md b/docs/architecture/optional-adapter-recipes.md index c1722693..bde220aa 100644 --- a/docs/architecture/optional-adapter-recipes.md +++ b/docs/architecture/optional-adapter-recipes.md @@ -15,7 +15,7 @@ production readiness를 뜻하지 않는다. | 항목 | 경로 | production 포함 | | --- | --- | --- | | 선택/금지/예산 SSOT | `config/recipes/frontend-capability-recipes.json` | 정책만 | -| catalog JSON schema | `schemas/config/frontend-capability-recipes.schema.json` | 아니오 | +| catalog JSON schema | `config/schemas/recipes/frontend-capability-recipes.schema.json` | 아니오 | | TypeScript port | `recipes/frontend-capabilities/contracts.ts` | 아니오 | | fake/unavailable | `recipes/frontend-capabilities/fake-adapters.ts` | 아니오 | | contract test | `tests/recipes/optional-capability-contracts.test.ts` | 아니오 | diff --git a/docs/architecture/starter-experience.md b/docs/architecture/starter-experience.md index ef39a92c..2c2e8dec 100644 --- a/docs/architecture/starter-experience.md +++ b/docs/architecture/starter-experience.md @@ -222,7 +222,7 @@ Files outside the feature directory. Everything else a feature needs is in | `config/scale/feature-shape-ceilings.json` `initialJavascript` (tracked) | every added or removed feature, and every template change that moves the initial JavaScript: `node scripts/scale/measure-feature-shape-growth.ts --initial-baseline --write`. Commit it with the change; on a merge conflict run the command again | `test:unit` (the feature-shape growth test compares it with a build) | | `src/contexts//context-module.ts` | the feature needs a new context | `generate:feature-index`: `Feature belongs to undeclared context ` | | `src/contexts//context-layout.tsx` | the context needs its own frame instead of `AppShell` (see "Product home and layouts" below) | nothing: without it the context renders in `AppShell` | -| `artifacts/tests/a11y-manual/.md` | every route the feature adds. Copy a record and reset it to `Status: pending-manual-review` | `test:unit` (`tests/unit/manual-a11y-evidence.test.ts`), `verify:documentation` (names the route IDs) and FE-GATE-009 (`review:a11y-manual -- --format-only`). FE-GATE-028 requires the signed review at release | +| `docs/accessibility/route-reviews/.md` | every route the feature adds. Copy a record and reset it to `Status: pending-manual-review` | `test:unit` (`tests/unit/manual-a11y-evidence.test.ts`), `verify:documentation` (names the route IDs) and FE-GATE-009 (`review:a11y-manual -- --format-only`). FE-GATE-028 requires the signed review at release | | `tests/e2e/accessibility.spec.ts` | never per feature (1103/16-03): it fills every path parameter with one value and answers each API request from the installed descriptor, a list read with an empty list in its `responseEnvelope` frame. Edit it only for a protected page that sends something other than an installed GET before it renders | `test:a11y` (FE-GATE-009): a request no installed GET declares fails the route; so does an alert box (`role="alert"`) on a page that read only lists | | `src/features/product-capabilities.ts` (product-owned) | `needs` names a capability the template does not build: type it in `ProductFeaturePlatformCapabilities`. `FeaturePlatformCapabilities` extends it, so the app, scripts and tests typecheck programs all see the key (an augmentation inside `product-composition.ts` is not seen by the scripts' program) | `check:types`: `Type '""' is not assignable to type 'keyof FeaturePlatformCapabilities'` in the feature | | `src/bootstrap/product-composition.ts` (product-owned) | `needs` names a capability the template does not build: return the capability here, typed in `product-capabilities.ts`. `indexedDb` is built as in `recipes/frontend-capabilities/indexeddb-feature-capability.ts`. Credentials for a product auth profile are returned here too. A product that owns the session (a BFF's httpOnly cookie) returns its session owner from `composeProductSessionOwner` instead of installing it on the host global before boot | `check:types`; at runtime `feature needs , which the host did not provide`. Without the session owner, `AUTH_MODE: "external"` boots with the session `integration-failed` | diff --git a/docs/manual/01-add-a-feature.md b/docs/manual/01-add-a-feature.md index 54b51178..1597c2c7 100644 --- a/docs/manual/01-add-a-feature.md +++ b/docs/manual/01-add-a-feature.md @@ -430,7 +430,7 @@ projectRequest: (input) => Object.freeze({ - `presentation/-routes.ts`: 링크용 URL 함수. route ID를 받아 `buildRouteUrl`(`src/presentation/routes/route-codecs.ts`)로 경로를 채운다. - 문구 `route..title`, `route..navigation` (ko-KR, en-US). 화면의 문서 제목과 메뉴 이름은 이 문구다. - 계약 `routes`의 `title`·`navigationLabel`은 화면이 읽지 않는다. FE-REG-ROUTE 기준선 행과 lab 측정(`scripts/test-performance.ts`, 플랫폼 라우트만)이 읽는다. 생성 명령은 문구와 같은 값을 넣는다. 값을 바꾸면 `check:registries`가 behavior-change로 기록한다. -- 기능 폴더 밖: `artifacts/tests/a11y-manual/.md`(pending 기록). 생성 명령이 만든다. +- 기능 폴더 밖: `docs/accessibility/route-reviews/.md`(pending 기록). 생성 명령이 만든다. ① **정할 것** @@ -506,7 +506,7 @@ export function useInvoiceListFilters(): InvoiceListSearch { - `context-routes.ts`의 handle이 계약에 없는 route ID를 가리키면 context 적재가 거부한다. - 메시지: `Route handle loaded by context is not a contract route of its features (...)` - 라우트별 a11y 기록이 없으면 세 곳이 잡는다. - - `verify:documentation`(FE-GATE-017): `artifacts/tests/a11y-manual/ has no record for route IDs: ` + - `verify:documentation`(FE-GATE-017): `docs/accessibility/route-reviews/ has no record for route IDs: ` - `review:a11y-manual -- --format-only`(FE-GATE-009): `missing record` - `test:unit`의 `tests/unit/manual-a11y-evidence.test.ts` - en-US 문구 키가 ko-KR과 다르면 `check:i18n`(FE-GATE-010)이 `en-US catalog keys do not match ko-KR`로 실패한다. @@ -790,7 +790,7 @@ corepack pnpm test:sample-removal -- --feature=invoice-feature - 템플릿 테스트가 예시 ID(`invoice-feature` 등)를 데이터로 쓰는 것은 잔여로 세지 않는다(1105/16-04). 그래서 매뉴얼 예시 이름으로 만든 기능도 이 단계를 통과한다. - spec 본문은 이름 단위로 찾는다(1106/16-01). 적힌 그대로(대소문자 구분) 찾고, 앞뒤에 `[A-Za-z0-9_-]`가 붙으면 다른 이름이다. `test.describe("invoice-feature", …)`는 잔여이고, `product-feature`를 지울 때 `generate-product-feature-index.ts`처럼 더 긴 이름 안에 든 것은 잔여가 아니다. spec은 `test:all`(vitest)도 드릴의 다른 단계도 돌리지 않으므로 이 검사가 아니면 다음 CI의 브라우저 게이트에서야 실패한다. - `-`가 없는 한 단어 ID·폴더 이름(`messages`, `status`)은 spec 본문에서 찾지 않는다. 템플릿 spec이 그 단어를 평범하게 쓰므로(`status: 200`, `getByRole("status")`) 찾으면 템플릿 spec이 잔여로 나온다. -- **못 잡음**: 기능을 가리키지 않는 폴더 밖 파일. 예: route ID나 URL만 적은 e2e spec, 한 단어 ID만 본문에 적은 spec, `artifacts/tests/a11y-manual/.md`. 기능 전용 spec은 [03 문서](03-outside-feature-folder.md)의 목록대로 손으로 지운다. vitest 테스트(`*.test.ts`) 안에서 기능 ID를 글자로만 적은 것도 잔여로 세지 않는다. 그 테스트가 지운 기능에 기대면 같은 드릴의 `test:all`이 실패한다. 드릴은 `src`와 `tests`만 찾고, a11y 기록은 남아도 검사가 실패하지 않는다. +- **못 잡음**: 기능을 가리키지 않는 폴더 밖 파일. 예: route ID나 URL만 적은 e2e spec, 한 단어 ID만 본문에 적은 spec, `docs/accessibility/route-reviews/.md`. 기능 전용 spec은 [03 문서](03-outside-feature-folder.md)의 목록대로 손으로 지운다. vitest 테스트(`*.test.ts`) 안에서 기능 ID를 글자로만 적은 것도 잔여로 세지 않는다. 그 테스트가 지운 기능에 기대면 같은 드릴의 `test:all`이 실패한다. 드릴은 `src`와 `tests`만 찾고, a11y 기록은 남아도 검사가 실패하지 않는다. ④ **쓸 스킬**: `documentation-and-adrs`, `deprecation-and-migration` diff --git a/docs/manual/03-outside-feature-folder.md b/docs/manual/03-outside-feature-folder.md index d96aeef6..ecdb4cd9 100644 --- a/docs/manual/03-outside-feature-folder.md +++ b/docs/manual/03-outside-feature-folder.md @@ -24,7 +24,7 @@ - `src/contexts//context-module.ts` - 새 context일 때만 만든다. `--context`를 주면 만들지 않는다. - 왜 밖인가: context는 여러 기능이 함께 쓰는 소속 선언이다. 기능 하나가 갖지 않는다. -- `artifacts/tests/a11y-manual/.md` +- `docs/accessibility/route-reviews/.md` - 라우트마다 하나. `Status: pending-manual-review`로 만든다. - 왜 밖인가: 수동 접근성 검토 기록은 라우트 단위로 한 폴더에 모은다. 릴리스 검토자가 한 곳에서 서명한다. - pending 기록은 merge 게이트를 통과하고 릴리스 게이트를 넘지 못한다(원칙 7). @@ -62,7 +62,7 @@ create:feature가 pending 기록을 만든다 1. 릴리스 후보 하나를 띄운다. 2. `docs/accessibility/manual-checklist.md`의 M1~M7과 스크린 리더 항목을 그 라우트에서 확인한다. -3. `artifacts/tests/a11y-manual/.md`를 채운다. +3. `docs/accessibility/route-reviews/.md`를 채운다. - `Status: reviewed`, `Release ID`, `Reviewer`, `Reviewed at`, `Signature`, `Attestation: accepted` - 항목마다 `pass` 또는 `not-applicable (<구체적 이유>)` 4. 모든 라우트 기록의 `Release ID`가 같아야 한다. @@ -205,7 +205,7 @@ src/features/product-capabilities.ts (SERVICE_WORKER = ACTIVE) - `src/features//`, `tests/features//` - 그 context의 마지막 기능이면 `src/contexts//` -- `artifacts/tests/a11y-manual/.md` (라우트마다) +- `docs/accessibility/route-reviews/.md` (라우트마다) - 남아도 검사는 실패하지 않는다. 검사는 등록된 라우트의 기록만 읽는다. 그래서 잊기 쉽다. - 기능 전용 `tests/e2e/` spec - `config/runtime/.json`의 `FEATURE_OVERRIDES` 키 diff --git a/docs/manual/reference/create-feature.md b/docs/manual/reference/create-feature.md index f515d8f7..c57895af 100644 --- a/docs/manual/reference/create-feature.md +++ b/docs/manual/reference/create-feature.md @@ -81,7 +81,7 @@ corepack pnpm create:feature [--context ] [--with-create [--key 기능 폴더 밖: - `src/contexts/-context/context-module.ts`: 새 context일 때만 -- `artifacts/tests/a11y-manual/.md`: 라우트마다 pending 기록 +- `docs/accessibility/route-reviews/.md`: 라우트마다 pending 기록 ## 뼈대 모양 @@ -95,7 +95,7 @@ corepack pnpm create:feature [--context ] [--with-create [--key - 쿼리 1개: `LIST_STANDARD` profile. - 무효화 topic 1개, namespace 1개, edge 1개. - 빈 배열 응답은 공유 빈 상태 화면으로 그린다. `tests/e2e/accessibility.spec.ts`는 이 목록 조회에 빈 목록을 Envelope 모양으로 답하고, 경고 상자가 없는지 본 뒤 axe를 돌린다. 그래서 생성한 목록 라우트는 빈 상태 화면으로 검사된다. -- `--with-create`의 상세 라우트는 자원 하나를 읽는다. 빈 목록으로 답할 수 없어 실패 화면에서만 axe를 돌린다. 그래서 `artifacts/tests/a11y.json`은 이 라우트를 통과(`scope`)로 세지 않고 `notChecked`에 이유와 함께 적는다. 화면 내용의 접근성은 수동 검토 기록(`artifacts/tests/a11y-manual/.md`)이 맡는다. +- `--with-create`의 상세 라우트는 자원 하나를 읽는다. 빈 목록으로 답할 수 없어 실패 화면에서만 axe를 돌린다. 그래서 `artifacts/tests/a11y.json`은 이 라우트를 통과(`scope`)로 세지 않고 `notChecked`에 이유와 함께 적는다. 화면 내용의 접근성은 수동 검토 기록(`docs/accessibility/route-reviews/.md`)이 맡는다. 한도·마감 같은 숫자는 `scripts/create-feature.ts`의 템플릿이 정본이다. @@ -119,7 +119,7 @@ create:feature: in (new context), route at created <파일> ... Next: - 1. Before a release, have a person review and sign artifacts/tests/a11y-manual/.md (FE-GATE-028). ... + 1. Before a release, have a person review and sign docs/accessibility/route-reviews/.md (FE-GATE-028). ... 2. Run the merge gates: corepack pnpm ci:gate -- FE-GATE- for each gate of the merge stage ... The feature's own tests: node scripts/run-vitest.ts run tests/features/ ... The registry baseline does not change: ... @@ -138,7 +138,7 @@ create:feature warning: no --package was given, so src/features//contracts/< 생성한 기능을 지우려면 만든 것을 지우고 생성기를 다시 돌린다. ```bash -rm -r src/features/ tests/features/ artifacts/tests/a11y-manual/.md +rm -r src/features/ tests/features/ docs/accessibility/route-reviews/.md rm -r src/contexts/-context # 새 context를 만들었을 때만 corepack pnpm generate:feature-index node scripts/write-dev-release-manifest.ts # dev manifest에서 그 기능의 계약 패키지를 뺀다 diff --git a/docs/manual/reference/errors.md b/docs/manual/reference/errors.md index 13f0823c..6bd93f7f 100644 --- a/docs/manual/reference/errors.md +++ b/docs/manual/reference/errors.md @@ -175,8 +175,8 @@ lint / check:architecture / check:i18n → FE-GATE-002, FE-GATE-010 | 메시지 | 원인 | 고칠 곳 | |---|---|---| -| `artifacts/tests/a11y-manual/ has no record for route IDs: ` (`verify:documentation`) | 라우트의 a11y 기록 파일이 없다 | 기존 pending 기록을 복사해 제목과 `Route ID`를 바꾼다 | -| `Manual accessibility record format is invalid:` 다음 `artifacts/tests/a11y-manual/.md: missing record` (FE-GATE-009) | 같은 원인 | 같은 곳 | +| `docs/accessibility/route-reviews/ has no record for route IDs: ` (`verify:documentation`) | 라우트의 a11y 기록 파일이 없다 | 기존 pending 기록을 복사해 제목과 `Route ID`를 바꾼다 | +| `Manual accessibility record format is invalid:` 다음 `docs/accessibility/route-reviews/.md: missing record` (FE-GATE-009) | 같은 원인 | 같은 곳 | | `a11y.json not written:` 다음 `a11y: reads one resource () but has no failure-state record in artifacts/tests/a11y-data-state` (`test:a11y`, FE-GATE-009) | 라우트의 `paramsSchema`가 한 자원을 읽는 GET의 입력인데, 접근성 spec이 그 라우트를 실패 화면으로만 봤다는 기록이 없다(1106/11-01). spec이 기록 호출을 놓쳤거나, 그 라우트의 페이지가 그 GET을 부르지 않아 spec이 실패 화면을 보지 않았다. 앞의 경우 그대로면 `a11y.json`이 그 라우트를 통과로 센다 | 페이지가 그 GET을 부르면 `tests/e2e/accessibility.spec.ts`의 기록 호출(`recordA11yDataState`)을 본다. 이때 기능 파일은 고치지 않는다. 페이지가 그 GET을 부르지 않으면(예: `/things/:thingId/parts/new` 같은 하위 항목 작성 폼이 상세 GET과 같은 `ThingParams`를 쓴다) 그 라우트에 자기 `paramsSchema`를 따로 둔다. 기능의 라우트 계약과 `contracts/-schema-metadata.ts`를 고친다 | | `Manual accessibility evidence is incomplete:` 다음 `: ` (FE-GATE-028) | 서명하지 않은 기록 | [03 문서](../03-outside-feature-folder.md#수동-접근성-검토-서명) | | `release IDs do not match` (FE-GATE-028) | 라우트마다 다른 릴리스로 검토했다 | 같은 릴리스 후보로 다시 검토한다 | diff --git a/docs/manual/reference/global-ids.md b/docs/manual/reference/global-ids.md index 522b6249..c1364732 100644 --- a/docs/manual/reference/global-ids.md +++ b/docs/manual/reference/global-ids.md @@ -50,7 +50,7 @@ - 형식: `qinv.` + 소문자·숫자 26자. - `scripts/create-feature.ts`의 `randomTopicSuffix`가 같은 형식으로 만든다. - 다른 기능의 값을 복사하지 않는다. -- route ID는 `_<화면>` 꼴로 짓는다(`INVOICE_DETAIL`). 라우트를 더하면 a11y 기록 파일도 더한다(`artifacts/tests/a11y-manual/.md`). +- route ID는 `_<화면>` 꼴로 짓는다(`INVOICE_DETAIL`). 라우트를 더하면 a11y 기록 파일도 더한다(`docs/accessibility/route-reviews/.md`). - 문구 키는 ko-KR과 en-US에 같은 키를 넣는다. `check:i18n`이 비교한다. ## 정본 위치 diff --git a/docs/operations/ci-quality-gates.md b/docs/operations/ci-quality-gates.md index e65b6c49..1f6a349a 100644 --- a/docs/operations/ci-quality-gates.md +++ b/docs/operations/ci-quality-gates.md @@ -126,7 +126,7 @@ DOCUMENTATION_READY (off-chain) `DOCUMENTATION_READY`(`verify:documentation`)가 검사하는 범위는 좁다 (`scripts/verify-documentation-readiness.ts`). -- 설치된 라우트마다 수동 접근성 기록 `artifacts/tests/a11y-manual/.md`가 +- 설치된 라우트마다 수동 접근성 기록 `docs/accessibility/route-reviews/.md`가 있는지. 없으면 route ID를 적고 실패한다 - README가 빌드와 승인 단계가 읽는 환경 변수를 모두 적는지 - 입구 문서가 실제 `src` 최상위 폴더와 `.dependency-cruiser.json` 규칙 이름을 diff --git a/scripts/check-architecture.ts b/scripts/check-architecture.ts index fbb07a33..250bc142 100644 --- a/scripts/check-architecture.ts +++ b/scripts/check-architecture.ts @@ -9,6 +9,7 @@ import { ESLint } from "eslint"; import { architectureDependencyReportArtifactSchema } from "./contracts/release-artifacts.ts"; import { checkArchitectureLintFixtures } from "./lib/architecture-lint-fixtures.ts"; import { formatArchitectureViolation } from "./lib/architecture-violation-message.ts"; +import { selectRepositoryEntries } from "./lib/repository-layout.ts"; import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts"; type PathRule = Readonly<{ path?: string; pathNot?: string }>; @@ -1044,8 +1045,11 @@ async function runGraphFixtureChecks(): Promise { } async function inspectTypeScriptOnlyPolicy(): Promise { - const requiredRoots = ["src", "scripts", "tests", ".storybook"] as const; - const optionalRoots = ["recipes"] as const; + // The typescript-only set of config/repository-layout.json (R2). An optional + // root (recipes/) may be gone after a removal drill. + const selected = selectRepositoryEntries("typescript-only"); + const requiredRoots = selected.filter(({ optional }) => !optional).map(({ path }) => path); + const optionalRoots = selected.filter(({ optional }) => optional).map(({ path }) => path); const checkedRoots = [...requiredRoots, ...optionalRoots]; const files = ( await Promise.all( diff --git a/scripts/check-optional-recipes.ts b/scripts/check-optional-recipes.ts index 535e9c87..8a7206f4 100644 --- a/scripts/check-optional-recipes.ts +++ b/scripts/check-optional-recipes.ts @@ -54,7 +54,7 @@ try { assertMatchesJsonSchema( JSON.parse( await readFile( - "schemas/config/frontend-capability-recipes.schema.json", + "config/schemas/recipes/frontend-capability-recipes.schema.json", "utf8", ), ), diff --git a/scripts/check-registries.ts b/scripts/check-registries.ts index 313ababb..d2129d9c 100644 --- a/scripts/check-registries.ts +++ b/scripts/check-registries.ts @@ -748,7 +748,7 @@ if (usesRepositoryBaseline && failures.length === 0) { assertMatchesJsonSchema( JSON.parse( await readFile( - "schemas/artifacts/registry-snapshot.schema.json", + "config/schemas/artifacts/registry-snapshot.schema.json", "utf8", ), ), diff --git a/scripts/contracts/release-artifacts.ts b/scripts/contracts/release-artifacts.ts index 40a7a21c..180234d7 100644 --- a/scripts/contracts/release-artifacts.ts +++ b/scripts/contracts/release-artifacts.ts @@ -880,7 +880,7 @@ const manualA11yResultSchema = z }) .strict() .superRefine((result, context) => { - if (result.path !== `artifacts/tests/a11y-manual/${result.routeId}.md`) { + if (result.path !== `docs/accessibility/route-reviews/${result.routeId}.md`) { context.addIssue({ code: "custom", path: ["path"], message: "path must match routeId" }); } const hasIdentity = Boolean( @@ -1429,7 +1429,7 @@ export const documentationReviewArtifactSchema = z reportDigestValid: z.boolean(), /** * The manual accessibility review scope: the installed routes that have no - * record file under artifacts/tests/a11y-manual/. It is derived from the + * record file under docs/accessibility/route-reviews/. It is derived from the * route registry, not read off a document (1101/14-05). */ routeScope: z.array( diff --git a/scripts/create-feature.ts b/scripts/create-feature.ts index 576ce866..7889dc6b 100644 --- a/scripts/create-feature.ts +++ b/scripts/create-feature.ts @@ -375,7 +375,7 @@ export function planFeature( : []), ...planned.map( (route) => - [`artifacts/tests/a11y-manual/${route.routeId}.md`, renderA11yRecord(route.routeId)] as const, + [`docs/accessibility/route-reviews/${route.routeId}.md`, renderA11yRecord(route.routeId)] as const, ), ]); return Object.freeze({ @@ -1767,7 +1767,7 @@ function report(plan: FeaturePlan): string { "", "Next:", ` 1. Before a release, have a person review and sign ${plan.routes - .map((route) => `artifacts/tests/a11y-manual/${route.routeId}.md`) + .map((route) => `docs/accessibility/route-reviews/${route.routeId}.md`) .join(", ")} (FE-GATE-028). The merge gates check only their format.`, " 2. Run the merge gates: corepack pnpm ci:gate -- FE-GATE- for each gate of the merge stage in config/ci/gates.json (README lists the loop). test:feature-scaffold runs them on a generated feature except the browser gates FE-GATE-008/009 and test:system.", ` The feature's own tests: node scripts/run-vitest.ts run tests/features/${plan.id} (test:coverage runs them in CI)`, diff --git a/scripts/generate-artifact-schemas.ts b/scripts/generate-artifact-schemas.ts index af9187ec..333f25e1 100644 --- a/scripts/generate-artifact-schemas.ts +++ b/scripts/generate-artifact-schemas.ts @@ -15,22 +15,22 @@ import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts"; const ARTIFACT_SCHEMA_DEFINITIONS = Object.freeze([ { - relativePath: "schemas/artifacts/build-manifest.schema.json", + relativePath: "config/schemas/artifacts/build-manifest.schema.json", id: undefined, schema: buildManifestArtifactSchema, }, { - relativePath: "schemas/artifacts/dependency-inventory.schema.json", + relativePath: "config/schemas/artifacts/dependency-inventory.schema.json", id: "https://clean-architecture-frontend.local/schemas/dependency-inventory.schema.json", schema: dependencyInventoryArtifactSchema, }, { - relativePath: "schemas/artifacts/registry-snapshot.schema.json", + relativePath: "config/schemas/artifacts/registry-snapshot.schema.json", id: undefined, schema: registrySnapshotArtifactSchema, }, { - relativePath: "schemas/artifacts/supply-chain-verification.schema.json", + relativePath: "config/schemas/artifacts/supply-chain-verification.schema.json", id: "https://clean-architecture-frontend.local/schemas/supply-chain-verification.schema.json", schema: supplyChainVerificationArtifactSchema, }, diff --git a/scripts/lib/local-release-evidence.ts b/scripts/lib/local-release-evidence.ts index 34051e35..9149872e 100644 --- a/scripts/lib/local-release-evidence.ts +++ b/scripts/lib/local-release-evidence.ts @@ -122,12 +122,12 @@ export async function verifyLocalSupplyChainEvidence( for (const [schemaPath, artifact, label] of [ [ - "schemas/artifacts/dependency-inventory.schema.json", + "config/schemas/artifacts/dependency-inventory.schema.json", inventory, "dependency inventory", ], [ - "schemas/artifacts/supply-chain-verification.schema.json", + "config/schemas/artifacts/supply-chain-verification.schema.json", verification, "supply-chain verification", ], @@ -1020,7 +1020,7 @@ export async function assessLocalEvidenceForProducer(input: Readonly<{ assertMatchesJsonSchema( await readJson( repositoryRoot, - "schemas/artifacts/build-manifest.schema.json", + "config/schemas/artifacts/build-manifest.schema.json", ), buildManifest, "build manifest", diff --git a/scripts/lib/release-candidate.ts b/scripts/lib/release-candidate.ts index 33403792..6ddb3cf5 100644 --- a/scripts/lib/release-candidate.ts +++ b/scripts/lib/release-candidate.ts @@ -58,6 +58,9 @@ export const LOCAL_EVIDENCE_VERIFIER_SOURCE_PATHS = Object.freeze([ ] as const); export const LOCAL_EVIDENCE_POLICY_INPUT_PATHS = Object.freeze([ + "config/schemas/artifacts/build-manifest.schema.json", + "config/schemas/artifacts/dependency-inventory.schema.json", + "config/schemas/artifacts/supply-chain-verification.schema.json", "config/security/dependency-baseline.approval.json", "config/security/dependency-baseline.json", "config/security/dependency-change-evidence.json", @@ -65,9 +68,6 @@ export const LOCAL_EVIDENCE_POLICY_INPUT_PATHS = Object.freeze([ "config/security/secret-scan-policy.json", "config/security/vulnerability-exceptions.json", "config/security/vulnerability-policy.json", - "schemas/artifacts/build-manifest.schema.json", - "schemas/artifacts/dependency-inventory.schema.json", - "schemas/artifacts/supply-chain-verification.schema.json", ...LOCAL_EVIDENCE_VERIFIER_SOURCE_PATHS, ] as const); diff --git a/scripts/lib/removal-fixture.ts b/scripts/lib/removal-fixture.ts index 0ca323c7..ce3469cd 100644 --- a/scripts/lib/removal-fixture.ts +++ b/scripts/lib/removal-fixture.ts @@ -20,23 +20,20 @@ import { linkFixtureNodeModules, } from "./fixture-node-modules.ts"; import { generateCiWorkflow } from "../generate-ci-workflow.ts"; +import { selectRepositoryPaths } from "./repository-layout.ts"; import { updateCiContractBaseline } from "../update-ci-contract-baseline.ts"; -export const REMOVAL_FIXTURE_COPY_TARGETS = Object.freeze([ - "src", "tests", "recipes", "scripts", "schemas", "config", "public", - ".gitea", ".storybook", "index.html", "package.json", "tsconfig.base.json", - "tsconfig.json", "tsconfig.app.json", "tsconfig.node.json", "tsconfig.test.json", - "tsconfig.service-worker.json", - "vite.service-worker.config.ts", "vite.config.ts", "vitest.config.ts", - "playwright.config.ts", "playwright.capabilities.config.ts", "playwright.dev.config.ts", - "playwright.storybook.config.ts", "playwright.visual.config.ts", "eslint.config.ts", - ".dependency-cruiser.json", ".nvmrc", ".gitignore", - // Install and workspace identity. Without these the fixture is not the same - // project: `corepack pnpm` resolves a different store, and the provider - // suites — which build a release candidate containing `pnpm-lock.yaml` — - // cannot assemble their fixture at all. - ".npmrc", "pnpm-lock.yaml", "pnpm-workspace.yaml", -] as const); +/** + * The fixture-copy set of config/repository-layout.json (R2). It includes the + * install and workspace identity (`.npmrc`, `pnpm-lock.yaml`, + * `pnpm-workspace.yaml`): without them the fixture is not the same project, + * `corepack pnpm` resolves a different store, and the provider suites — which + * build a release candidate containing `pnpm-lock.yaml` — cannot assemble + * their fixture at all. It also carries the manual a11y review records + * (docs/accessibility/route-reviews), which unit tests read, without the rest + * of `docs/`. + */ +export const REMOVAL_FIXTURE_COPY_TARGETS = selectRepositoryPaths("fixture-copy"); /** * This is the only copy-target list. Each removal script used to keep its own, @@ -53,11 +50,7 @@ export const REMOVAL_FIXTURE_COPY_TARGETS = Object.freeze([ * the documents describe the capability they delete, and what those drills * prove is that the code still builds and tests without it. */ -export const REMOVAL_FIXTURE_DOCUMENT_TARGETS = Object.freeze([ - "README.md", - "CHANGELOG.md", - "docs", -] as const); +export const REMOVAL_FIXTURE_DOCUMENT_TARGETS = selectRepositoryPaths("fixture-documents"); /** * 1103/02-06. Tests that read REMOVAL_FIXTURE_DOCUMENT_TARGETS. A fixture diff --git a/scripts/lib/repository-layout.ts b/scripts/lib/repository-layout.ts new file mode 100644 index 00000000..0d05ab01 --- /dev/null +++ b/scripts/lib/repository-layout.ts @@ -0,0 +1,141 @@ +import { readFileSync } from "node:fs"; + +/** + * The repository root registry, config/repository-layout.json (R1 in + * docs/manual/03-outside-feature-folder.md). Every tracked root item has an + * entry, and every list of root paths is a named set chosen from it (R2). + * Seven places used to keep their own literal lists of root paths, each a + * different subset, so moving one root item meant editing all seven + * (design-docs repo-structure/04-frontend-layout.md §2.4). + */ + +export const REPOSITORY_LAYOUT_SETS = Object.freeze([ + "fixture-copy", + "fixture-documents", + "secret-scan", + "history-free", + "scale-source", + "vite-build", + "typescript-only", +] as const); +export type RepositoryLayoutSet = (typeof REPOSITORY_LAYOUT_SETS)[number]; + +export const REPOSITORY_LAYOUT_KINDS = Object.freeze([ + "source", + "tool-convention", + "gate-input", + "document", + "history", + "output", +] as const); +export type RepositoryLayoutKind = (typeof REPOSITORY_LAYOUT_KINDS)[number]; + +export type RepositoryLayoutEntry = Readonly<{ + /** A root item name: one path segment, no slash. */ + path: string; + kind: RepositoryLayoutKind; + role: string; + readBy: string; + /** A removal drill or a product copy may not have it; a selection skips it when absent. */ + optional: boolean; + /** The sets that select the whole item. */ + sets: readonly RepositoryLayoutSet[]; + /** The sets that select only these paths inside the item. */ + setPaths: Readonly>>; +}>; + +export const REPOSITORY_LAYOUT_FILE = "config/repository-layout.json"; + +export function parseRepositoryLayout(value: unknown): readonly RepositoryLayoutEntry[] { + const document = record(value, "layout"); + if (document["schemaVersion"] !== 1) throw new Error("layout: schemaVersion must be 1"); + const entries = document["entries"]; + if (!Array.isArray(entries) || entries.length === 0) { + throw new Error("layout: entries must be a non-empty array"); + } + const seen = new Set(); + return Object.freeze( + entries.map((raw, index) => { + const entry = record(raw, `entries[${index}]`); + const at = `entries[${index}]`; + const itemPath = text(entry["path"], `${at}.path`); + if (itemPath.includes("/")) throw new Error(`${at}.path: a root item has no slash: ${itemPath}`); + if (seen.has(itemPath)) throw new Error(`${at}.path: duplicate root item ${itemPath}`); + seen.add(itemPath); + const kind = text(entry["kind"], `${at}.kind`); + if (!(REPOSITORY_LAYOUT_KINDS as readonly string[]).includes(kind)) { + throw new Error(`${at}.kind: unknown kind ${kind}`); + } + const sets = (entry["sets"] ?? []) as unknown; + if (!Array.isArray(sets)) throw new Error(`${at}.sets must be an array`); + const setPaths = record(entry["setPaths"] ?? {}, `${at}.setPaths`); + for (const set of [...sets, ...Object.keys(setPaths)]) { + if (!(REPOSITORY_LAYOUT_SETS as readonly string[]).includes(set as string)) { + throw new Error(`${at}: unknown set ${String(set)}`); + } + } + for (const [set, paths] of Object.entries(setPaths)) { + if (!Array.isArray(paths) || paths.length === 0) { + throw new Error(`${at}.setPaths.${set} must be a non-empty array`); + } + for (const inner of paths) { + if (typeof inner !== "string" || !inner.startsWith(`${itemPath}/`)) { + throw new Error(`${at}.setPaths.${set}: ${String(inner)} is not inside ${itemPath}`); + } + } + if (sets.includes(set)) throw new Error(`${at}: ${set} selects the whole item and paths in it`); + } + return Object.freeze({ + path: itemPath, + kind: kind as RepositoryLayoutKind, + role: text(entry["role"], `${at}.role`), + readBy: text(entry["readBy"], `${at}.readBy`), + optional: entry["optional"] === true, + sets: Object.freeze([...sets] as RepositoryLayoutSet[]), + setPaths: Object.freeze(setPaths as Partial>), + }); + }), + ); +} + +export const REPOSITORY_LAYOUT: readonly RepositoryLayoutEntry[] = parseRepositoryLayout( + JSON.parse(readFileSync(new URL(`../../${REPOSITORY_LAYOUT_FILE}`, import.meta.url), "utf8")), +); + +/** The paths a set selects, in registry order. */ +export function selectRepositoryPaths( + set: RepositoryLayoutSet, + layout: readonly RepositoryLayoutEntry[] = REPOSITORY_LAYOUT, +): readonly string[] { + return Object.freeze( + layout.flatMap((entry) => + entry.sets.includes(set) ? [entry.path] : [...(entry.setPaths[set] ?? [])], + ), + ); +} + +/** Like selectRepositoryPaths, with whether a drill or a copy may lack each path. */ +export function selectRepositoryEntries( + set: RepositoryLayoutSet, + layout: readonly RepositoryLayoutEntry[] = REPOSITORY_LAYOUT, +): readonly Readonly<{ path: string; optional: boolean }>[] { + return Object.freeze( + layout.flatMap((entry) => + (entry.sets.includes(set) ? [entry.path] : [...(entry.setPaths[set] ?? [])]).map( + (selected) => Object.freeze({ path: selected, optional: entry.optional }), + ), + ), + ); +} + +function record(value: unknown, at: string): Record { + if (typeof value !== "object" || value === null || Array.isArray(value)) { + throw new Error(`${at} must be an object`); + } + return value as Record; +} + +function text(value: unknown, at: string): string { + if (typeof value !== "string" || value.trim() === "") throw new Error(`${at} must be a non-empty string`); + return value; +} diff --git a/scripts/lib/vite-build-inputs.ts b/scripts/lib/vite-build-inputs.ts index cc94af25..7db5777b 100644 --- a/scripts/lib/vite-build-inputs.ts +++ b/scripts/lib/vite-build-inputs.ts @@ -1,3 +1,5 @@ +import { selectRepositoryPaths } from "./repository-layout.ts"; + /** * 1105/15-03. The files `vite build` reads from the repository root, for the * measurements and tests that copy them into a temporary root and build @@ -7,15 +9,6 @@ * a new local import in vite.config.ts broke both, and both had to be edited * (7f9a515, 799ab7f). tests/unit/vite-build-inputs.test.ts fails, naming the * file, when vite.config.ts imports a local file this list does not cover. + * The list is the vite-build set of config/repository-layout.json (R2). */ -export const VITE_BUILD_INPUTS = Object.freeze([ - "src", - "public", - "index.html", - "package.json", - "vite.config.ts", - "tsconfig.base.json", - "tsconfig.app.json", - "scripts/lib/run-isolation.ts", - "scripts/lib/vite-module-inventory.ts", -] as const); +export const VITE_BUILD_INPUTS = selectRepositoryPaths("vite-build"); diff --git a/scripts/verify-a11y-manual.ts b/scripts/verify-a11y-manual.ts index 5c562943..ef205fd8 100644 --- a/scripts/verify-a11y-manual.ts +++ b/scripts/verify-a11y-manual.ts @@ -24,7 +24,7 @@ type ManualA11yResult = Readonly<{ if (process.argv.includes("--format-only")) { const failures: string[] = []; for (const routeId of MANUAL_A11Y_ROUTE_IDS) { - const path = `artifacts/tests/a11y-manual/${routeId}.md`; + const path = `docs/accessibility/route-reviews/${routeId}.md`; const record = await readFile(path, "utf8").catch(() => null); const invalid = record === null ? ["missing record"] : validateManualA11yRecordFormat(record, routeId); if (invalid.length > 0) failures.push(`${path}: ${invalid.join(", ")}`); @@ -41,7 +41,7 @@ if (process.argv.includes("--format-only")) { const results: ManualA11yResult[] = []; for (const routeId of MANUAL_A11Y_ROUTE_IDS) { - const path = `artifacts/tests/a11y-manual/${routeId}.md`; + const path = `docs/accessibility/route-reviews/${routeId}.md`; const evidence = await readFile(path, "utf8"); const validation = validateManualA11yEvidence(evidence); const failures = diff --git a/scripts/verify-documentation-readiness.ts b/scripts/verify-documentation-readiness.ts index 56fa1587..9bbf0648 100644 --- a/scripts/verify-documentation-readiness.ts +++ b/scripts/verify-documentation-readiness.ts @@ -21,7 +21,7 @@ import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts"; * every new feature edit two template-owned documents (1101/14-05), so the * documents now name this folder and the record files are what is checked. */ -const MANUAL_A11Y_RECORDS = "artifacts/tests/a11y-manual/"; +const MANUAL_A11Y_RECORDS = "docs/accessibility/route-reviews/"; type DocumentationReview = Readonly<{ sourcePath: string; diff --git a/scripts/verify-extreme-scale.ts b/scripts/verify-extreme-scale.ts index 8bffa3bb..ae97e6c9 100644 --- a/scripts/verify-extreme-scale.ts +++ b/scripts/verify-extreme-scale.ts @@ -5,6 +5,8 @@ import { mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises"; import { arch, platform, userInfo } from "node:os"; import path from "node:path"; +import { selectRepositoryPaths } from "./lib/repository-layout.ts"; + /** * Executable evidence for the extreme-scale acceptance matrix. * @@ -46,20 +48,8 @@ export const EXTREME_SCALE_GATES = Object.freeze([ "check:scale:release", ] as const); -/** Inputs whose content defines "the current code" for this evidence. */ -const SOURCE_ROOTS = Object.freeze(["src", "scripts", "tests", "config", ".storybook", "recipes"]); -const SOURCE_FILES = Object.freeze([ - "package.json", - "pnpm-lock.yaml", - ".dependency-cruiser.json", - "eslint.config.ts", - "vite.config.ts", - "vitest.config.ts", - "tsconfig.json", - "tsconfig.app.json", - "tsconfig.test.json", - "tsconfig.node.json", -]); +/** Inputs whose content defines "the current code": the scale-source set of config/repository-layout.json (R2). */ +const SOURCE_PATHS = selectRepositoryPaths("scale-source"); async function listFiles(directory: string): Promise { const found: string[] = []; @@ -80,8 +70,17 @@ async function listFiles(directory: string): Promise { /** sha256 over every source input (path + content), in a stable order. */ export async function sourceDigest(root: string): Promise> { const files = [ - ...(await Promise.all(SOURCE_ROOTS.map((entry) => listFiles(path.join(root, entry))))).flat(), - ...SOURCE_FILES.map((file) => path.join(root, file)).filter((file) => existsSync(file)), + ...( + await Promise.all( + SOURCE_PATHS.map((entry) => path.join(root, entry)).map(async (target) => + (await stat(target).catch(() => null))?.isDirectory() + ? listFiles(target) + : existsSync(target) + ? [target] + : [], + ), + ) + ).flat(), ] .map((file) => path.relative(root, file)) .sort(); diff --git a/scripts/verify-hosting-headers.ts b/scripts/verify-hosting-headers.ts index f77db9f2..d46073d5 100644 --- a/scripts/verify-hosting-headers.ts +++ b/scripts/verify-hosting-headers.ts @@ -129,7 +129,7 @@ if (liveTarget?.passed && !slotEmpty) { } else { mode = "fixture"; const fixture = await readDocument( - "config/hosting/response-headers.fixture.json", + "tests/fixtures/hosting/response-headers.json", ); responses = responseHeaders(fixture.responses); } diff --git a/scripts/verify-release.ts b/scripts/verify-release.ts index a5a718c7..c4eb5a9f 100644 --- a/scripts/verify-release.ts +++ b/scripts/verify-release.ts @@ -95,7 +95,7 @@ const buildManifestDocument: unknown = JSON.parse( ); assertMatchesJsonSchema( JSON.parse( - await readFile("schemas/artifacts/build-manifest.schema.json", "utf8"), + await readFile("config/schemas/artifacts/build-manifest.schema.json", "utf8"), ), buildManifestDocument, "build manifest", diff --git a/config/hosting/response-headers.fixture.json b/tests/fixtures/hosting/response-headers.json similarity index 100% rename from config/hosting/response-headers.fixture.json rename to tests/fixtures/hosting/response-headers.json diff --git a/tests/platform/release/cache-policy.test.ts b/tests/platform/release/cache-policy.test.ts index 8e23764b..4914f769 100644 --- a/tests/platform/release/cache-policy.test.ts +++ b/tests/platform/release/cache-policy.test.ts @@ -15,7 +15,7 @@ async function json(relative: string): Promise { const policy = (await json<{ surfaces: Surfaces }>("config/hosting/cache-policy.json")).surfaces; const fixtureHeaders = ( await json<{ responses: Record> }>( - "config/hosting/response-headers.fixture.json", + "tests/fixtures/hosting/response-headers.json", ) ).responses; diff --git a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap index a64963d1..0cbd5db1 100644 --- a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap +++ b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap @@ -173,6 +173,9 @@ jobs: artifacts/security/supply-chain-coherence.json \\ artifacts/security/supply-chain-verification.json \\ artifacts/security/vulnerability-report.json \\ + config/schemas/artifacts/build-manifest.schema.json \\ + config/schemas/artifacts/dependency-inventory.schema.json \\ + config/schemas/artifacts/supply-chain-verification.schema.json \\ config/security/dependency-baseline.approval.json \\ config/security/dependency-baseline.json \\ config/security/dependency-change-evidence.json \\ @@ -180,9 +183,6 @@ jobs: config/security/secret-scan-policy.json \\ config/security/vulnerability-exceptions.json \\ config/security/vulnerability-policy.json \\ - schemas/artifacts/build-manifest.schema.json \\ - schemas/artifacts/dependency-inventory.schema.json \\ - schemas/artifacts/supply-chain-verification.schema.json \\ scripts/contracts/release-artifacts.ts \\ scripts/create-release-candidate.ts \\ scripts/generate-supply-chain.ts \\ diff --git a/tests/unit/create-feature.test.ts b/tests/unit/create-feature.test.ts index b85d6221..addc1b40 100644 --- a/tests/unit/create-feature.test.ts +++ b/tests/unit/create-feature.test.ts @@ -88,14 +88,14 @@ describe("create:feature rendering", () => { "src/features/invoice-feature/feature-module.ts", "tests/features/invoice-feature/invoice-feature-input.test.ts", "tests/features/invoice-feature/invoice-list-page.test.tsx", - "artifacts/tests/a11y-manual/INVOICE_LIST.md", + "docs/accessibility/route-reviews/INVOICE_LIST.md", ]), ); expect([...created.files.keys()].some((file) => file.includes("/domain/"))).toBe(false); expect(created.files.get("src/contexts/invoice-context/context-module.ts")).toContain( 'CONTEXT_ROUTE_PATH = "invoice/*"', ); - expect(created.files.get("artifacts/tests/a11y-manual/INVOICE_LIST.md")).toMatch( + expect(created.files.get("docs/accessibility/route-reviews/INVOICE_LIST.md")).toMatch( /^Status: pending-manual-review$/mu, ); }); @@ -232,8 +232,8 @@ describe("create:feature --with-create", () => { "src/features/invoice-feature/presentation/use-invoice-item.ts", "src/features/invoice-feature/presentation/use-invoice-create.ts", "tests/features/invoice-feature/invoice-create-page.test.tsx", - "artifacts/tests/a11y-manual/INVOICE_DETAIL.md", - "artifacts/tests/a11y-manual/INVOICE_CREATE.md", + "docs/accessibility/route-reviews/INVOICE_DETAIL.md", + "docs/accessibility/route-reviews/INVOICE_CREATE.md", ]), ); expect(created.routes).toEqual([ @@ -522,13 +522,13 @@ describe("create:feature writing", () => { it("refuses to overwrite and writes nothing when one target exists", async () => { const root = await emptyRoot(); const files = plan({ id: "invoice-feature" }).files; - await mkdir(path.join(root, "artifacts/tests/a11y-manual"), { recursive: true }); - await writeFile(path.join(root, "artifacts/tests/a11y-manual/INVOICE_LIST.md"), "kept\n"); + await mkdir(path.join(root, "docs/accessibility/route-reviews"), { recursive: true }); + await writeFile(path.join(root, "docs/accessibility/route-reviews/INVOICE_LIST.md"), "kept\n"); await expect(writeFeatureFiles(root, files)).rejects.toThrow( - /refusing to overwrite: artifacts\/tests\/a11y-manual\/INVOICE_LIST\.md/u, + /refusing to overwrite: docs\/accessibility\/route-reviews\/INVOICE_LIST\.md/u, ); - expect(await readdir(root)).toEqual(["artifacts"]); + expect(await readdir(root)).toEqual(["docs"]); }); it("refuses an existing feature directory", async () => { diff --git a/tests/unit/deletable-history-documents.test.ts b/tests/unit/deletable-history-documents.test.ts index 77dcdf98..5e32cfe8 100644 --- a/tests/unit/deletable-history-documents.test.ts +++ b/tests/unit/deletable-history-documents.test.ts @@ -1,8 +1,10 @@ -import { readdir, readFile } from "node:fs/promises"; +import { readdir, readFile, stat } from "node:fs/promises"; import path from "node:path"; import { describe, expect, it } from "vitest"; +import { selectRepositoryPaths } from "../../scripts/lib/repository-layout.ts"; + /** * README.md, "Files you can delete after copying", tells a new project that * the build and the gates read none of the history documents except @@ -10,15 +12,11 @@ import { describe, expect, it } from "vitest"; * promise: they do not copy `docs/`. A test that opens a review document broke * all three removal checks (fix of 11-04), so the promise is checked here. */ -const CODE_ROOTS = ["src", "tests", "scripts", "config", "recipes", "schemas", ".gitea"]; -const ROOT_FILES = [ - "package.json", - "vite.config.ts", - "vitest.config.ts", - "eslint.config.ts", - "playwright.config.ts", - ".dependency-cruiser.json", -]; +// The history-free set of config/repository-layout.json (R2). The registry +// itself names every root item, history documents included (R1); naming a +// root item is not reading it. +const CODE_PATHS = selectRepositoryPaths("history-free"); +const LAYOUT_REGISTRY = "config/repository-layout.json"; // Built from pieces so that this file does not match itself. const REVIEWS = ["docs", "reviews", ""].join("/"); @@ -58,12 +56,16 @@ async function codeFiles(directory: string): Promise { } async function linesMatching(patterns: readonly RegExp[]): Promise { - const files = [ - ...(await Promise.all(CODE_ROOTS.map(codeFiles))).flat(), - ...ROOT_FILES, - ]; + const files = ( + await Promise.all( + CODE_PATHS.map(async (entry) => + (await stat(entry).catch(() => null))?.isDirectory() ? codeFiles(entry) : [entry], + ), + ) + ).flat(); const matches: string[] = []; for (const file of files) { + if (file === LAYOUT_REGISTRY) continue; const lines = (await readFile(file, "utf8").catch(() => "")).split("\n"); lines.forEach((line, index) => { if (patterns.some((pattern) => pattern.test(line))) diff --git a/tests/unit/documentation-readiness.test.ts b/tests/unit/documentation-readiness.test.ts index ea9a5dd2..1cd46162 100644 --- a/tests/unit/documentation-readiness.test.ts +++ b/tests/unit/documentation-readiness.test.ts @@ -7,7 +7,7 @@ import path from "node:path"; import { describe, expect, it } from "vitest"; // The pin says which commit of the paired backend the documents describe. -const INPUTS = ["README.md", "docs", "artifacts/tests/a11y-manual", "config/contracts/backend-contract-pin.json"]; +const INPUTS = ["README.md", "docs", "config/contracts/backend-contract-pin.json"]; const PAIRED_BACKEND = "clean-architecture-backend-template"; type Changes = Readonly string>>; @@ -121,9 +121,9 @@ describe("verify:documentation failure output (1101/14-06)", () => { }); it("names the route ID that has no manual review record", async () => { - const result = await verify({}, ["artifacts/tests/a11y-manual/EXAMPLES_PLATFORM.md"]); + const result = await verify({}, ["docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md"]); expect(result.status).toBe(1); - expect(result.stderr).toContain("artifacts/tests/a11y-manual/ has no record for route IDs: EXAMPLES_PLATFORM"); + expect(result.stderr).toContain("docs/accessibility/route-reviews/ has no record for route IDs: EXAMPLES_PLATFORM"); expect(result.stderr).toMatch(/FAIL_UNVERIFIED \(failed: route scope\)/u); expect(result.stderr).not.toContain("scoped-review evidence"); }); @@ -131,7 +131,7 @@ describe("verify:documentation failure output (1101/14-06)", () => { it("names every failed check", async () => { const result = await verify( { "README.md": (readme) => readme.replaceAll("`RELEASE_TARGET`", "") }, - ["artifacts/tests/a11y-manual/EXAMPLES_PLATFORM.md"], + ["docs/accessibility/route-reviews/EXAMPLES_PLATFORM.md"], ); expect(result.stderr).toContain("README.md does not name: RELEASE_TARGET"); expect(result.stderr).toMatch(/\(failed: route scope, runtime variables\)/u); diff --git a/tests/unit/hosting-probe.test.ts b/tests/unit/hosting-probe.test.ts index 0d980b33..1e221633 100644 --- a/tests/unit/hosting-probe.test.ts +++ b/tests/unit/hosting-probe.test.ts @@ -133,7 +133,7 @@ describe("SPA fallback and worker script surfaces (1101/13-04)", () => { }); expect(appRoute?.path).toMatch(/^\/[^.]+$/u); const { responses } = JSON.parse( - await readFile("config/hosting/response-headers.fixture.json", "utf8"), + await readFile("tests/fixtures/hosting/response-headers.json", "utf8"), ) as { responses: Record }; expect(responses["appRoute"]).toEqual(responses["index"]); }); @@ -510,11 +510,16 @@ describe("verify-hosting-headers on a promoted release root (1101/13-01)", () => const root = await mkdtemp(path.join(tmpdir(), "hosting-release-root-")); try { await mkdir(path.join(root, "config/hosting"), { recursive: true }); - for (const file of ["cache-policy.json", "security-headers.json", "response-headers.fixture.json"]) { + for (const file of ["cache-policy.json", "security-headers.json"]) { await copyFile(`config/hosting/${file}`, path.join(root, "config/hosting", file)); } + await mkdir(path.join(root, "tests/fixtures/hosting"), { recursive: true }); + await copyFile( + "tests/fixtures/hosting/response-headers.json", + path.join(root, "tests/fixtures/hosting/response-headers.json"), + ); if (editFixture) { - const fixturePath = path.join(root, "config/hosting/response-headers.fixture.json"); + const fixturePath = path.join(root, "tests/fixtures/hosting/response-headers.json"); const fixture = JSON.parse(await readFile(fixturePath, "utf8")) as { responses: Record>; }; diff --git a/tests/unit/json-schema.test.ts b/tests/unit/json-schema.test.ts index ad6c0430..fb5bfd0a 100644 --- a/tests/unit/json-schema.test.ts +++ b/tests/unit/json-schema.test.ts @@ -29,7 +29,7 @@ async function json(path: string): Promise { describe("checked-in JSON Schema execution", () => { it("accepts a build manifest and rejects undeclared output fields", async () => { - const schema = await json("schemas/artifacts/build-manifest.schema.json"); + const schema = await json("config/schemas/artifacts/build-manifest.schema.json"); const manifest = { schemaVersion: 1, buildId: "build-1", @@ -66,7 +66,7 @@ describe("checked-in JSON Schema execution", () => { it("resolves local schema definitions in the recipe catalog", async () => { const [schema, catalog] = await Promise.all([ - json("schemas/config/frontend-capability-recipes.schema.json"), + json("config/schemas/recipes/frontend-capability-recipes.schema.json"), json("config/recipes/frontend-capability-recipes.json"), ]); @@ -80,7 +80,7 @@ describe("checked-in JSON Schema execution", () => { await generateArtifactSchemas({ root }); const generatedPath = path.join( root, - "schemas/artifacts/dependency-inventory.schema.json", + "config/schemas/artifacts/dependency-inventory.schema.json", ); const generated = await readFile(generatedPath, "utf8"); expect(generated.endsWith("\n")).toBe(true); @@ -101,7 +101,7 @@ describe("checked-in JSON Schema execution", () => { it.each([ { name: "dependency inventory", - path: "schemas/artifacts/dependency-inventory.schema.json", + path: "config/schemas/artifacts/dependency-inventory.schema.json", value: { schemaVersion: 2, packageManager: "pnpm@11.17.0", @@ -124,7 +124,7 @@ describe("checked-in JSON Schema execution", () => { }, { name: "registry snapshot", - path: "schemas/artifacts/registry-snapshot.schema.json", + path: "config/schemas/artifacts/registry-snapshot.schema.json", value: { schemaVersion: 2, generatedAt: "2026-08-01T00:00:00.000Z", @@ -144,7 +144,7 @@ describe("checked-in JSON Schema execution", () => { }, { name: "supply-chain verification", - path: "schemas/artifacts/supply-chain-verification.schema.json", + path: "config/schemas/artifacts/supply-chain-verification.schema.json", value: { schemaVersion: 1, localStatus: "PASS", diff --git a/tests/unit/manual-a11y-evidence.test.ts b/tests/unit/manual-a11y-evidence.test.ts index dbd5672d..1bb99468 100644 --- a/tests/unit/manual-a11y-evidence.test.ts +++ b/tests/unit/manual-a11y-evidence.test.ts @@ -87,7 +87,7 @@ describe("manual accessibility evidence", () => { it("accepts every checked-in route record", () => { for (const routeId of MANUAL_A11Y_ROUTE_IDS) { - const record = readFileSync(`artifacts/tests/a11y-manual/${routeId}.md`, "utf8"); + const record = readFileSync(`docs/accessibility/route-reviews/${routeId}.md`, "utf8"); expect(validateManualA11yRecordFormat(record, routeId), routeId).toEqual([]); } }); diff --git a/tests/unit/release-artifacts.test.ts b/tests/unit/release-artifacts.test.ts index 760cfdff..83067e57 100644 --- a/tests/unit/release-artifacts.test.ts +++ b/tests/unit/release-artifacts.test.ts @@ -216,7 +216,7 @@ describe("release artifact contracts", () => { it.each([ ["viteManifest", "package.json"], - ["runtimeConfigSchema", "schemas/artifacts/build-manifest.schema.json"], + ["runtimeConfigSchema", "config/schemas/artifacts/build-manifest.schema.json"], ["moduleInventory", "package.json"], ] as const)("rejects %s outside its approved output root", async (field, value) => { const mismatches = await verifyBuildManifestOutputs( diff --git a/tests/unit/repository-layout.test.ts b/tests/unit/repository-layout.test.ts new file mode 100644 index 00000000..769dfc31 --- /dev/null +++ b/tests/unit/repository-layout.test.ts @@ -0,0 +1,135 @@ +import { spawnSync } from "node:child_process"; +import { existsSync, readFileSync } from "node:fs"; + +import { describe, expect, it } from "vitest"; + +import { + parseRepositoryLayout, + REPOSITORY_LAYOUT, + REPOSITORY_LAYOUT_FILE, + selectRepositoryEntries, + selectRepositoryPaths, +} from "../../scripts/lib/repository-layout.ts"; + +/** + * The repository root registry: R1 (every root item is registered) and R2 + * (root path lists are chosen from the registry) of + * design-docs repo-structure/04-frontend-layout.md §11. + */ + +function trackedFiles(): string[] { + const listed = spawnSync("git", ["ls-files", "-z"], { encoding: "utf8" }); + if (listed.error || listed.status !== 0) { + throw new Error(`git ls-files failed: ${listed.error?.message ?? listed.stderr}`); + } + return listed.stdout.split("\0").filter((file) => file !== ""); +} + +const rootItemNames = new Set(REPOSITORY_LAYOUT.map((entry) => entry.path)); + +describe("repository layout registry (R1)", () => { + // A removal fixture copies part of the repository, so the claim is one way: + // whatever is tracked at the root is registered. A registered path that is + // gone fails where a set uses it (a copy or the secret scan cannot find it). + it("has an entry for every tracked root item", () => { + const roots = new Set(trackedFiles().map((file) => file.split("/")[0]!)); + expect( + [...roots].filter((root) => !rootItemNames.has(root)).sort(), + `add an entry with its role to ${REPOSITORY_LAYOUT_FILE}`, + ).toEqual([]); + }); + + it("rejects an entry that is not a root item, a duplicate and a path outside its item", () => { + const entry = { path: "src", kind: "source", role: "app", readBy: "build" }; + expect(() => parseRepositoryLayout({ schemaVersion: 1, entries: [{ ...entry, path: "src/app" }] })).toThrow( + /no slash/u, + ); + expect(() => parseRepositoryLayout({ schemaVersion: 1, entries: [entry, entry] })).toThrow(/duplicate/u); + expect(() => + parseRepositoryLayout({ + schemaVersion: 1, + entries: [{ ...entry, setPaths: { "vite-build": ["scripts/lib/run-isolation.ts"] } }], + }), + ).toThrow(/not inside src/u); + expect(() => parseRepositoryLayout({ schemaVersion: 1, entries: [{ ...entry, kind: "misc" }] })).toThrow( + /unknown kind/u, + ); + expect(() => parseRepositoryLayout({ schemaVersion: 1, entries: [{ ...entry, sets: ["everything"] }] })).toThrow( + /unknown set/u, + ); + }); + + it("selects whole items and paths inside items in registry order", () => { + const layout = parseRepositoryLayout({ + schemaVersion: 1, + entries: [ + { path: ".gitea", kind: "tool-convention", role: "ci", readBy: "gitea", setPaths: { "secret-scan": [".gitea/workflows/a.yml"] } }, + { path: "recipes", kind: "source", role: "recipes", readBy: "tsc", optional: true, sets: ["secret-scan"] }, + { path: "src", kind: "source", role: "app", readBy: "build", sets: ["secret-scan", "vite-build"] }, + ], + }); + expect(selectRepositoryPaths("secret-scan", layout)).toEqual([".gitea/workflows/a.yml", "recipes", "src"]); + expect(selectRepositoryPaths("vite-build", layout)).toEqual(["src"]); + expect(selectRepositoryEntries("secret-scan", layout).filter(({ optional }) => optional)).toEqual([ + { path: "recipes", optional: true }, + ]); + }); +}); + +/** + * design-docs repo-structure/04-frontend-layout.md §2.4: seven places kept + * their own literal lists of root paths, each a different subset. Six are + * code; the seventh is the secret scan policy, a JSON document the release + * candidate carries, which keeps a copy of its set held equal here. + */ +const LAYOUT_CONSUMERS = Object.freeze([ + "scripts/lib/removal-fixture.ts", + "scripts/lib/vite-build-inputs.ts", + "scripts/verify-extreme-scale.ts", + "scripts/check-architecture.ts", + "tests/unit/deletable-history-documents.test.ts", +]); +/** It checked the policy against a list of its own; the copy check below replaces it. */ +const FORMER_CONSUMERS = Object.freeze(["tests/unit/supply-chain.test.ts"]); + +const STRING = String.raw`(?:"[^"\n]*"|'[^'\n]*'|` + "`[^`\\n]*`)"; +const STRING_ARRAY = new RegExp(String.raw`\[\s*${STRING}(?:\s*,\s*${STRING})+\s*,?\s*\]`, "gu"); + +/** Array literals of two or more string literals that are root item names. */ +function literalRootLists(source: string, roots: ReadonlySet): string[] { + const code = source.replace(/^\s*\/\/.*$/gmu, ""); + return [...code.matchAll(STRING_ARRAY)] + .map(([literal]) => [...literal.matchAll(new RegExp(STRING, "gu"))].map(([value]) => value.slice(1, -1))) + .filter((values) => new Set(values.filter((value) => roots.has(value))).size >= 2) + .map((values) => values.join(", ")); +} + +describe("root path lists (R2)", () => { + it.each(LAYOUT_CONSUMERS)("%s chooses a set from the registry", (consumer) => { + const source = readFileSync(consumer, "utf8"); + expect(source).toMatch(/repository-layout\.ts/u); + expect(literalRootLists(source, rootItemNames)).toEqual([]); + }); + + it.each(FORMER_CONSUMERS)("%s keeps no list of root paths", (consumer) => { + expect(literalRootLists(readFileSync(consumer, "utf8"), rootItemNames)).toEqual([]); + }); + + it("finds a literal root list", () => { + expect(literalRootLists(`const ROOTS = ["src", "tests", "other"];`, rootItemNames)).toEqual(["src, tests, other"]); + expect(literalRootLists(`const ROOTS = ["src"];\nconst X = ["a", "b"];`, rootItemNames)).toEqual([]); + }); + + // A removal fixture deletes some of these inputs on purpose — removing the + // browser file/storage capability takes the whole browser-capability harness + // with it — and prunes the policy to match. The claim is about the inputs + // this checkout has. + it("keeps the secret scan policy's roots equal to the secret-scan set", () => { + const policy = JSON.parse(readFileSync("config/security/secret-scan-policy.json", "utf8")) as { + trackedRoots: string[]; + }; + expect([...policy.trackedRoots].sort()).toEqual( + [...selectRepositoryPaths("secret-scan").filter((input) => existsSync(input))].sort(), + ); + }); +}); diff --git a/tests/unit/second-api-feature-registries.test.ts b/tests/unit/second-api-feature-registries.test.ts index 2dc6ba0d..37090de0 100644 --- a/tests/unit/second-api-feature-registries.test.ts +++ b/tests/unit/second-api-feature-registries.test.ts @@ -205,7 +205,7 @@ async function repositoryWithSecondFeature(featureContract = FEATURE_CONTRACT) { for (const entry of [ "src", "config/contracts", - "schemas/artifacts", + "config/schemas/artifacts", "scripts/check-diagnostics.ts", ]) { await cp(path.resolve(entry), path.join(root, entry), { recursive: true }); diff --git a/tests/unit/security-followup-fixture.ts b/tests/unit/security-followup-fixture.ts index 7ec9770e..abd55b60 100644 --- a/tests/unit/security-followup-fixture.ts +++ b/tests/unit/security-followup-fixture.ts @@ -436,6 +436,9 @@ export async function createArchivedAssessmentFixture(): Promise<{ })) .sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0)); const policyPaths = [ + "config/schemas/artifacts/build-manifest.schema.json", + "config/schemas/artifacts/dependency-inventory.schema.json", + "config/schemas/artifacts/supply-chain-verification.schema.json", "config/security/dependency-baseline.approval.json", "config/security/dependency-baseline.json", "config/security/dependency-change-evidence.json", @@ -443,9 +446,6 @@ export async function createArchivedAssessmentFixture(): Promise<{ "config/security/secret-scan-policy.json", "config/security/vulnerability-exceptions.json", "config/security/vulnerability-policy.json", - "schemas/artifacts/build-manifest.schema.json", - "schemas/artifacts/dependency-inventory.schema.json", - "schemas/artifacts/supply-chain-verification.schema.json", "scripts/contracts/release-artifacts.ts", "scripts/create-release-candidate.ts", "scripts/generate-supply-chain.ts", diff --git a/tests/unit/service-worker-build-output.test.ts b/tests/unit/service-worker-build-output.test.ts index 0ec124e3..813e3936 100644 --- a/tests/unit/service-worker-build-output.test.ts +++ b/tests/unit/service-worker-build-output.test.ts @@ -113,11 +113,11 @@ describe("worker script hosting headers (0929/06-05)", () => { await rm(path.join(root, "dist"), { recursive: true, force: true }); await symlink(builds!.dist.active, path.join(root, "dist")); const fixture = JSON.parse( - await readFile("config/hosting/response-headers.fixture.json", "utf8"), + await readFile("tests/fixtures/hosting/response-headers.json", "utf8"), ) as { responses: Record> }; fixture.responses["serviceWorker"]!["cache-control"] = workerCacheControl; await writeFile( - path.join(root, "config/hosting/response-headers.fixture.json"), + path.join(root, "tests/fixtures/hosting/response-headers.json"), JSON.stringify(fixture), ); const env: NodeJS.ProcessEnv = { ...process.env }; diff --git a/tests/unit/supply-chain.test.ts b/tests/unit/supply-chain.test.ts index 2f8e05c7..1a247063 100644 --- a/tests/unit/supply-chain.test.ts +++ b/tests/unit/supply-chain.test.ts @@ -1,5 +1,4 @@ import { createHash, generateKeyPairSync, sign } from "node:crypto"; -import { existsSync } from "node:fs"; import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; @@ -532,46 +531,6 @@ describe("supply-chain policy", () => { ]); }); - // A removal fixture deletes some of these inputs on purpose — removing the - // browser file/storage capability takes the whole browser-capability harness - // with it. The claim is about the inputs this checkout has. - it("covers every mandatory release input in the secret scan policy", async () => { - const policy = JSON.parse( - await readFile("config/security/secret-scan-policy.json", "utf8"), - ) as { trackedRoots: string[] }; - const mandatory = [ - "index.html", - ".dependency-cruiser.json", - ".nvmrc", - ".npmrc", - "eslint.config.ts", - "package.json", - "pnpm-lock.yaml", - "pnpm-workspace.yaml", - "scripts", - "schemas", - "config", - ".gitea/workflows/quality-gates.yml", - "vite.config.ts", - "vite.service-worker.config.ts", - "vitest.config.ts", - "playwright.config.ts", - "playwright.capabilities.config.ts", - "playwright.dev.config.ts", - "playwright.storybook.config.ts", - "playwright.visual.config.ts", - "tsconfig.json", - "tsconfig.app.json", - "tsconfig.base.json", - "tsconfig.node.json", - "tsconfig.service-worker.json", - "tsconfig.test.json", - ]; - expect(policy.trackedRoots).toEqual( - expect.arrayContaining(mandatory.filter((input) => existsSync(input))), - ); - }); - it("parses every top-level lockfile package and validates SRI", () => { const parsed = parsePnpmLockfilePackages(` packages: diff --git a/tests/unit/template-feature-removal-documents.test.ts b/tests/unit/template-feature-removal-documents.test.ts index f0ba8b96..67a5e6e1 100644 --- a/tests/unit/template-feature-removal-documents.test.ts +++ b/tests/unit/template-feature-removal-documents.test.ts @@ -23,7 +23,7 @@ import { REMOVAL_FIXTURE_COPY_TARGETS } from "../../scripts/lib/removal-fixture. */ const CHECKER = "scripts/verify-documentation-readiness.ts"; /** What verify:documentation reads besides the code. */ -const DOCUMENTS = Object.freeze(["README.md", "CHANGELOG.md", "docs", "artifacts/tests/a11y-manual"]); +const DOCUMENTS = Object.freeze(["README.md", "CHANGELOG.md", "docs"]); const LISTED_SAMPLE = Object.freeze({ featureId: "listed-sample-feature", @@ -83,7 +83,7 @@ async function copyWithListedSample() { for (const entry of removableTemplateFeaturePaths(LISTED_SAMPLE)) { await rm(path.join(root, entry), { recursive: true, force: true }); } - await rm(path.join(root, "artifacts/tests/a11y-manual/LISTED_SAMPLE_LIST.md"), { force: true }); + await rm(path.join(root, "docs/accessibility/route-reviews/LISTED_SAMPLE_LIST.md"), { force: true }); expect(node(["scripts/generate-product-feature-index.ts"]).status).toBe(0); }, cleanUp: () => rm(parent, { recursive: true, force: true }), @@ -100,7 +100,7 @@ async function verifyDocuments(document: string, mutate: (text: string) => strin const root = path.join(parent, "frontend"); try { // The pin says which commit of the paired backend the documents describe. - const inputs = ["README.md", "docs", "artifacts/tests/a11y-manual", "config/contracts/backend-contract-pin.json"]; + const inputs = ["README.md", "docs", "config/contracts/backend-contract-pin.json"]; for (const entry of inputs) await cp(entry, path.join(root, entry), { recursive: true }); const target = path.join(root, document); await writeFile(target, mutate(await readFile(target, "utf8"))); diff --git a/tests/unit/tracked-artifacts.test.ts b/tests/unit/tracked-artifacts.test.ts index 856600b1..b4639ea1 100644 --- a/tests/unit/tracked-artifacts.test.ts +++ b/tests/unit/tracked-artifacts.test.ts @@ -5,15 +5,15 @@ import { describe, expect, it } from "vitest"; /** * 0929/14-01. `artifacts/` is run output, but screenshots and a coverage * report were committed there and stayed tracked with nothing reading them. - * `.gitignore` ignores the folder as a whole and re-includes only what people - * write or keep: the folder markers and the manual a11y reviews, which the - * a11y gates read (`config/ci/gates.json`). A file `git add -f` puts outside - * that list fails here. + * `.gitignore` ignores the folder as a whole and re-includes only the folder + * markers. The manual a11y reviews, which people write and the a11y gates + * read, moved to docs/accessibility/route-reviews/ on 2026-11-08, so the + * folder is output only (docs/manual/03-outside-feature-folder.md, R3). A + * file `git add -f` puts outside that list fails here. */ const ALLOWED = [ /^artifacts\/runbooks\/\.gitkeep$/u, /^artifacts\/tests\/\.gitkeep$/u, - /^artifacts\/tests\/a11y-manual\/[^/]+\.md$/u, ]; function trackedArtifacts(): string[] { @@ -27,7 +27,7 @@ function trackedArtifacts(): string[] { } describe("tracked artifacts", () => { - it("are only the folder markers and the manual a11y reviews", () => { + it("are only the folder markers", () => { expect( trackedArtifacts().filter((file) => !ALLOWED.some((pattern) => pattern.test(file))), ).toEqual([]); -- 2.54.0 From e902e657d1b7e272ecd2c46dd2ae2ae95dedae97 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 17:41:27 +0900 Subject: [PATCH 3/6] =?UTF-8?q?test(layout):=20=EC=A0=80=EC=9E=A5=EC=86=8C?= =?UTF-8?q?=20=EB=B0=B0=EC=B9=98=20=EA=B7=9C=EC=B9=99=20R3~R9=EB=A5=BC=20?= =?UTF-8?q?=EA=B2=80=EC=82=AC=EB=A1=9C=20=EB=91=90=EA=B3=A0=20=EB=A7=A4?= =?UTF-8?q?=EB=89=B4=EC=96=BC=EC=97=90=20=EC=A0=81=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 소유자가 2026-11-07에 지적한 것(매뉴얼이 생긴 뒤에도 남은 샘플, 역할이 겹치는 루트 폴더, 0파일 검사, 문서 속 인프라 설정)은 매뉴얼과 리뷰가 먼저 잡아야 했다. 지금은 그 규칙이 글로도 검사로도 없다. 그래서 같은 지적이 다시 나와도 게이트가 모른다. 고른 방법(design-docs repo-structure/04-frontend-layout.md 11절, 기계 검사가 「예」인 규칙을 표의 게이트 칸대로): - R4·R5 `tests/unit/example-feature-rules.test.ts`(FE-GATE-005): 샘플 목록은 FE-GATE-020의 `test:sample-removal`(인자 없이, 빌드와 test:all 포함)이 증명한다. 목록 샘플의 기능 ID·라우트가 visual·e2e의 `goto`, gates.json 산출물 경로, `config/scale/`에 나오면 실패한다. 템플릿 목록은 비어 있어 가짜 샘플로 판정 함수를 시험한다. - R6·R7(문서) `verify:documentation`(FE-GATE-017): `docs/manual/`이 목록 샘플 경로를 가리키면, 현재 문서에 ```nginx```·```hcl``` 블록이나 `kind: Deployment` 같은 매니페스트 줄이 있으면 실패한다. 이력 폴더는 보지 않는다. 산출물 `documentation-review.json`에 `layoutRuleViolations`를 더했다. - R7(파일)·R9 `tests/unit/repository-layout.test.ts`(FE-GATE-005): nginx·Terraform·Helm·Kustomize 파일과 Kubernetes 매니페스트 YAML이 추적되면 실패. 옵션이 같은 tsconfig 쌍이 있으면 실패. - R3은 `tests/unit/tracked-artifacts.test.ts`, R8은 앞 커밋의 `check-typecheck-inputs.ts`·`check-type-fixtures.ts`가 맡는다. R10의 기계 몫(루트 *.md 등록)은 R1이다. - 매뉴얼 03에 E절(R1~R10 규칙과 검사, 루트 항목을 더하는 순서)과 C절 「Web Worker를 들일 때 tsconfig 더하기」(결정 D4)를 더했다. 위험: R5는 문자열 검색이라 샘플 ID를 다르게 쓴 대상(예: 라우트 경로를 조립하는 spec)은 놓친다. R7 문서 검사는 코드 블록 언어 태그와 매니페스트 줄로만 본다. R13(리뷰 가이드)은 design-docs 몫이라 넣지 않았다. 검증(desktop): 이 커밋에서 test:unit, check:types, check:ci, lint, verify:documentation, check:architecture를 돌렸다. Refs: design-docs repo-structure/04-frontend-layout.md 11절, README.md 3.4절 --- docs/manual/03-outside-feature-folder.md | 46 ++++++++ scripts/contracts/release-artifacts.ts | 15 ++- scripts/verify-documentation-readiness.ts | 49 +++++++++ tests/unit/example-feature-rules.test.ts | 126 ++++++++++++++++++++++ tests/unit/repository-layout.test.ts | 73 ++++++++++++- 5 files changed, 305 insertions(+), 4 deletions(-) create mode 100644 tests/unit/example-feature-rules.test.ts diff --git a/docs/manual/03-outside-feature-folder.md b/docs/manual/03-outside-feature-folder.md index ecdb4cd9..3e2f4108 100644 --- a/docs/manual/03-outside-feature-folder.md +++ b/docs/manual/03-outside-feature-folder.md @@ -184,6 +184,28 @@ src/features/product-capabilities.ts (SERVICE_WORKER = ACTIVE) - 템플릿이 아직 연결하지 않은 것: 활성화 화면(`onUpdateWaiting`·`requestActivation()`). 확인할 것 목록은 `docs/architecture/optional-adapter-recipes.md`의 "Service Worker를 켤 때 확인할 것"에 있다. - realtime·Web Worker·오프라인 명령을 고르면 조립이 `Selected optional capabilities have no runtime to start them`로 거절한다. 템플릿 조립에 아직 그 런타임이 없다. +### Web Worker를 들일 때 tsconfig 더하기 + +템플릿에는 Web Worker 코드가 없다. 그래서 Worker용 tsconfig도 없다. 빈 tsconfig는 0파일을 검사하고 통과한다(아래 E절 R8). 2026-11-08에 지웠다. Worker 코드를 처음 넣는 변경에서 아래를 함께 한다. + +1. Worker 코드를 `src/adapters/web-worker/`에 둔다. 그 폴더의 `index.ts`가 배럴이다. +2. 루트에 `tsconfig.web-worker.json`을 만든다. lib가 `WebWorker`이고 DOM이 없어서, Worker 코드가 `document`·`window`를 쓰면 실패한다. `tsconfig.service-worker.json`과 같은 이유다. + + ```json + { + "extends": "./tsconfig.base.json", + "compilerOptions": { "lib": ["ES2022", "WebWorker"], "types": [], "skipLibCheck": false }, + "include": ["src/adapters/web-worker"], + "exclude": ["src/adapters/web-worker/index.ts"] + } + ``` + +3. Worker 진입 파일을 `tsconfig.app.json`의 `exclude`에 더한다. 배럴처럼 페이지가 import하는 파일은 app 프로그램에 남긴다. +4. `tsconfig.json`의 `references`에 `{ "path": "./tsconfig.web-worker.json" }`을 더한다. 편집기가 Worker 파일에 이 설정을 쓴다. +5. `package.json`에 `"check:types:web-worker": "tsc --project tsconfig.web-worker.json"`을 더하고 `check:types` 사슬에 잇는다. 사슬 끝의 `node scripts/check-typecheck-inputs.ts`가 이 tsconfig의 입력이 0개면 실패시킨다. +6. `config/repository-layout.json`에 `tsconfig.web-worker.json` 항목을 더한다(E절 R1). `sets`는 `tsconfig.service-worker.json`과 같게 `fixture-copy`·`secret-scan`이다. `config/security/secret-scan-policy.json`의 `trackedRoots`에도 같은 이름을 더한다(R2). +7. `scripts/verify-documentation-readiness.ts`의 `NOT_CREATED`에서 `src/adapters/web-worker`를 뺀다. + --- ## D. 고치지 않는다 @@ -199,6 +221,30 @@ src/features/product-capabilities.ts (SERVICE_WORKER = ACTIVE) --- +## E. 저장소 배치 규칙 (R1~R10) + +기능 밖의 루트 폴더·설정·검사를 더하거나 옮길 때 지킨다. 2026-11-07 소유자 지적(샘플이 남아 있음, 역할이 겹치는 루트 폴더, 0파일 검사, 문서 속 인프라 설정)이 다시 나오지 않게 하는 규칙이다. 설계와 근거는 design-docs `repo-structure/04-frontend-layout.md` 11절이다. + +| ID | 규칙 | 검사 | +| --- | --- | --- | +| R1 | 루트 항목은 모두 `config/repository-layout.json`에 있다. 항목마다 종류(source·tool-convention·gate-input·document·history·output), 역할, 읽는 곳을 적는다 | `tests/unit/repository-layout.test.ts`(FE-GATE-005). 등록부에 없는 루트 항목이 추적되면 실패 | +| R2 | 루트 경로 목록은 등록부의 이름 붙은 집합(`sets`, 하위 경로는 `setPaths`)에서만 고른다. 목록을 코드에 새로 적지 않는다. JSON 정책 파일(`config/security/secret-scan-policy.json`)은 그 집합의 사본을 갖고 시험이 같은지 본다 | 같은 시험. 목록을 쓰던 곳이 `scripts/lib/repository-layout.ts`를 import하는지, 루트 이름 두 개 이상의 문자열 배열이 없는지 | +| R3 | 추적 파일은 읽는 곳이 있다. `artifacts/`는 출력 전용이라 `.gitkeep`만 추적한다. 사람이 쓴 기록은 `docs/` 아래에 둔다(수동 a11y 기록은 `docs/accessibility/route-reviews/`) | `tests/unit/tracked-artifacts.test.ts`(FE-GATE-005). `config/` 아래 고아 JSON은 리뷰가 본다 | +| R4 | 템플릿이나 제품이 넣은 샘플 기능은 `scripts/lib/removable-template-features.ts` 목록에 있고, 복사본에서 지우고 빌드·시험하는 drill로 증명한다. 문서 검사만으로는 안 된다 | `tests/unit/example-feature-rules.test.ts`(FE-GATE-005). FE-GATE-020이 `test:sample-removal`을 목록 전체로 도는지 | +| R5 | 게이트의 검사 대상(visual 골든, e2e 라우트, 게이트 증거 목록, 규모 측정)은 플랫폼 화면·시험 fixture·생성기 출력이다. 지울 샘플 기능이 아니다 | 같은 시험. 샘플의 기능 ID·라우트가 visual·e2e의 `goto`, `config/ci/gates.json` 산출물 경로, `config/scale/`에 나오면 실패 | +| R6 | 매뉴얼의 예제 위치는 `create:feature` 출력이나 매뉴얼 안 코드 조각을 가리킨다. 지울 샘플 기능의 경로를 가리키지 않는다 | `verify:documentation`(FE-GATE-017). `docs/manual/`에 목록 샘플의 경로가 나오면 실패 | +| R7 | 이 repo에 둘 수 있는 실행 환경 파일은 개발 의존 서비스용 compose와 개발 Dockerfile뿐이다. nginx·Kubernetes·Helm·Terraform 설정은 인프라 repo에 두고 링크한다. 호스트에 요구하는 것은 계약(`config/hosting/`)과 검사(FE-GATE-019)로 둔다 | 파일: `tests/unit/repository-layout.test.ts`(FE-GATE-005). 문서: `verify:documentation`(FE-GATE-017)이 현재 문서의 ```` ```nginx ````·```` ```hcl ```` 블록과 `kind: Deployment` 같은 매니페스트 줄을 막는다. 이력 폴더(`docs/history/`, `docs/reviews/`, `docs/superpowers/`)는 기록이라 보지 않는다 | +| R8 | 검사 대상이 0개인 게이트 명령은 실패하거나 SKIP을 출력한다. 통과로 보이면 안 된다 | FE-GATE-003: `scripts/check-typecheck-inputs.ts`(package script가 tsc에 넘기는 tsconfig마다 이 repo 파일이 1개 이상), `scripts/check-type-fixtures.ts`(fixture 0개면 실패) | +| R9 | tsconfig는 lib·types·모듈 해석 중 하나가 다를 때만 새로 만든다. 옵션이 같고 파일만 다르면 실행기 하나로 돈다(예: 음성 타입 fixture는 `check:types:fixtures` 하나) | `tests/unit/repository-layout.test.ts`(FE-GATE-005). 옵션이 같은 tsconfig 쌍이 있으면 실패 | +| R10 | 이력 문서(끝난 라운드의 계획·작업 목록·보고)는 루트나 숨김 폴더에 두지 않고 이력 폴더 한 곳에 둔다. 정본으로 쓰이는 부분은 이력에 두지 않는다 | 루트 `*.md`는 R1 등록부에 종류와 함께 있어야 한다. "정본으로 쓰이는가"는 리뷰가 본다 | + +루트 항목을 더하거나 옮길 때의 순서: + +1. `config/repository-layout.json`에 항목을 더하거나 고친다. 종류·역할·읽는 곳을 적는다(R1). +2. 그 항목이 들어갈 집합을 `sets`(항목 전체)나 `setPaths`(항목 안 경로)에 적는다. 집합의 뜻은 파일 머리의 `sets` 설명에 있다(R2). +3. `secret-scan` 집합을 바꿨으면 `config/security/secret-scan-policy.json`의 `trackedRoots`도 같게 고친다. +4. 새 tsconfig라면 R9를 먼저 본다. 다른 tsconfig와 옵션이 같으면 만들지 않는다. + ## 기능을 지울 때 `corepack pnpm test:sample-removal -- --feature=`는 복사본에서 지워 보고 게이트를 돈다. 실제 저장소에서 지울 때는 아래를 함께 지운다. diff --git a/scripts/contracts/release-artifacts.ts b/scripts/contracts/release-artifacts.ts index 180234d7..13d30bdd 100644 --- a/scripts/contracts/release-artifacts.ts +++ b/scripts/contracts/release-artifacts.ts @@ -1472,6 +1472,18 @@ export const documentationReviewArtifactSchema = z }) .strict(), ).min(1), + // R6·R7 of docs/manual/03-outside-feature-folder.md: a manual example that + // points at a deletable sample feature, or infrastructure configuration + // copied into a current document. + layoutRuleViolations: z.array( + z + .object({ + path: nonEmptyString, + rule: z.enum(["R6", "R7"]), + detail: nonEmptyString, + }) + .strict(), + ), results: z.array( z .object({ @@ -1523,9 +1535,10 @@ export const documentationReviewArtifactSchema = z entry.missingScripts.length === 0 && entry.unknownGateIds.length === 0, ) && + artifact.layoutRuleViolations.length === 0 && artifact.results.every(({ passed }) => passed)) ) { - context.addIssue({ code: "custom", path: ["passed"], message: "must agree with report digest, documented scope, source structure, document references and review results" }); + context.addIssue({ code: "custom", path: ["passed"], message: "must agree with report digest, documented scope, source structure, document references, layout rules and review results" }); } }); diff --git a/scripts/verify-documentation-readiness.ts b/scripts/verify-documentation-readiness.ts index 9bbf0648..470f08bb 100644 --- a/scripts/verify-documentation-readiness.ts +++ b/scripts/verify-documentation-readiness.ts @@ -409,6 +409,48 @@ const documentReferencesValid = documentReferences.every( (entry) => entry.missingPaths.length === 0 && entry.missingScripts.length === 0 && entry.unknownGateIds.length === 0, ); +// Repository layout rules of docs/manual/03-outside-feature-folder.md. +// R6: the manual's examples point at generator output or at code blocks in +// the manual, never at a sample feature a copy is meant to delete (the +// template's own sample took the manual's examples with it on 2026-11-07). +// R7: host, cluster and infrastructure configuration (nginx, Kubernetes, +// Helm, Terraform) lives in the infrastructure repository; a current document +// links to it and states the host contract (config/hosting/, FE-GATE-019) +// instead of carrying a copy. The history folders are records and keep what +// they recorded. +// Built from pieces: tests/unit/deletable-history-documents.test.ts fails on +// code that names a history folder, and this names them to skip them. +const HISTORY_DOCUMENT_FOLDERS = ["history", "reviews", "superpowers"].map((folder) => `docs/${folder}/`); +const INFRASTRUCTURE_FENCE = /^\s*```\s*(nginx|hcl|terraform|helm)\b/iu; +const INFRASTRUCTURE_MANIFEST = + /^\s*kind:\s*(Deployment|StatefulSet|DaemonSet|Ingress|Service|ConfigMap|CronJob|HelmRelease|Kustomization)\s*$/u; +const sampleFeaturePaths = REMOVABLE_TEMPLATE_FEATURES.flatMap((feature) => removableTemplateFeaturePaths(feature)); +const currentDocuments = [ + "README.md", + ...((await readdir("docs", { recursive: true }).catch(() => [])) as string[]) + .filter((name) => name.endsWith(".md")) + .map((name) => `docs/${name}`) + .filter((name) => !HISTORY_DOCUMENT_FOLDERS.some((folder) => name.startsWith(folder))), +].sort(); +const layoutRuleViolations: { path: string; rule: "R6" | "R7"; detail: string }[] = []; +for (const document of currentDocuments) { + const text = await readFile(document, "utf8").catch(() => null); + if (text === null) continue; + let fenced = false; + text.split("\n").forEach((line, index) => { + if (/^\s*```/u.test(line)) fenced = !fenced; + if (INFRASTRUCTURE_FENCE.test(line) || (fenced && INFRASTRUCTURE_MANIFEST.test(line))) { + layoutRuleViolations.push({ path: document, rule: "R7", detail: `line ${index + 1}: ${line.trim()}` }); + } + if (!document.startsWith("docs/manual/")) return; + for (const samplePath of sampleFeaturePaths) { + if (line.includes(samplePath)) { + layoutRuleViolations.push({ path: document, rule: "R6", detail: `line ${index + 1}: ${samplePath}` }); + } + } + }); +} + // 1101/14-06. Each failed check is named, so the stderr points at the file to // fix rather than at the diagram review whatever failed. 1101/14-05: the last // two only compare the two hand-kept copies of the 2026-07-18 diagram review; @@ -419,6 +461,7 @@ const failedChecks = [ ...(missingRuntimeVariables.length === 0 ? [] : ["runtime variables"]), ...(sourceStructureDocumented ? [] : ["source structure"]), ...(documentReferencesValid ? [] : ["document references"]), + ...(layoutRuleViolations.length === 0 ? [] : ["repository layout rules"]), ...(reportDigestValid ? [] : ["2026-07-18 diagram review copy digest"]), ...(results.length === 2 && results.every((result) => result.passed) ? [] @@ -442,6 +485,7 @@ await writeValidatedJsonArtifact({ missingRuntimeVariables, sourceStructure, documentReferences, + layoutRuleViolations, results, passed, }, @@ -479,6 +523,11 @@ if (!passed) { ); } } + for (const violation of layoutRuleViolations) { + process.stderr.write( + `${violation.path} breaks ${violation.rule} of docs/manual/03-outside-feature-folder.md: ${violation.detail}\n`, + ); + } if (documentReferences.some((entry) => entry.missingPaths.some((file) => file.startsWith("../")))) { const checked = [...pairedTrees] .filter(([, tree]) => "paths" in tree) diff --git a/tests/unit/example-feature-rules.test.ts b/tests/unit/example-feature-rules.test.ts new file mode 100644 index 00000000..880abcfe --- /dev/null +++ b/tests/unit/example-feature-rules.test.ts @@ -0,0 +1,126 @@ +import { readdir, readFile } from "node:fs/promises"; +import path from "node:path"; + +import { describe, expect, it } from "vitest"; + +import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts"; +import { + REMOVABLE_TEMPLATE_FEATURES, + type RemovableTemplateFeature, +} from "../../scripts/lib/removable-template-features.ts"; +import { INSTALLED_FEATURE_CONTRACTS } from "../../src/features/installed-feature-contracts.ts"; + +/** + * R4 and R5 of docs/manual/03-outside-feature-folder.md. A sample feature + * that the template or a project ships is listed in + * scripts/lib/removable-template-features.ts, and the list is proven by a + * drill that builds and tests a copy without it (R4). The gates' own targets + * (visual goldens, e2e routes, the gate evidence list, scale measurements) + * are platform screens, test fixtures and generator output, never a sample a + * copy is meant to delete (R5): the template's reference sample was the + * target of nine gates when it was deleted on 2026-11-07. + */ + +type ExampleFeature = Readonly<{ featureId: string; routeIds: readonly string[]; routePaths: readonly string[] }>; + +type GateTargets = Readonly<{ + gotoTargets: readonly Readonly<{ file: string; target: string }>[]; + artifactPaths: readonly string[]; + scaleFiles: readonly Readonly<{ file: string; text: string }>[]; +}>; + +function exampleFeatures(features: readonly RemovableTemplateFeature[]): ExampleFeature[] { + return features.map(({ featureId }) => { + // The template installs no feature, so the composed list's type is empty. + const contracts = INSTALLED_FEATURE_CONTRACTS as readonly Readonly<{ featureId: string; routes: object }>[]; + const routes = contracts.filter((contract) => contract.featureId === featureId).flatMap( + (contract) => Object.values(contract.routes as Record), + ); + return { + featureId, + routeIds: routes.map(({ routeId }) => routeId), + routePaths: routes.map(({ path: routePath }) => routePath).filter((routePath) => routePath !== "/"), + }; + }); +} + +function gateTargetsNamingExamples(examples: readonly ExampleFeature[], targets: GateTargets): string[] { + return examples.flatMap(({ featureId, routeIds, routePaths }) => [ + ...targets.gotoTargets + .filter(({ target }) => target.includes(featureId) || routePaths.some((routePath) => target === routePath || target.startsWith(`${routePath}/`) || target.startsWith(`${routePath}?`))) + .map(({ file, target }) => `${file}: goto ${target}`), + ...targets.artifactPaths + .filter((artifact) => artifact.includes(featureId) || routeIds.some((routeId) => artifact.includes(`/${routeId}.`))) + .map((artifact) => `config/ci/gates.json: ${artifact}`), + ...targets.scaleFiles.filter(({ text }) => text.includes(featureId)).map(({ file }) => `${file}: ${featureId}`), + ]); +} + +async function specFiles(directory: string): Promise { + return ((await readdir(directory, { recursive: true })) as string[]) + .filter((name) => /\.ts$/u.test(name)) + .map((name) => path.join(directory, name)); +} + +async function repositoryGateTargets(): Promise { + const gotoTargets: { file: string; target: string }[] = []; + for (const file of [...(await specFiles("tests/visual")), ...(await specFiles("tests/e2e"))]) { + const source = await readFile(file, "utf8"); + for (const [, target = ""] of source.matchAll(/\.goto\(\s*["'`]([^"'`]+)["'`]/gu)) gotoTargets.push({ file, target }); + } + const contract = await loadCiGateContract(process.cwd()); + const scaleFiles = await Promise.all( + (await readdir("config/scale")).map(async (name) => ({ + file: `config/scale/${name}`, + text: await readFile(`config/scale/${name}`, "utf8"), + })), + ); + return { gotoTargets, artifactPaths: contract.artifacts.map(({ path: artifact }) => artifact), scaleFiles }; +} + +describe("sample features (R4)", () => { + it("are all proven by the removal drill in FE-GATE-020", async () => { + const contract = await loadCiGateContract(process.cwd()); + const removability = contract.gates.find(({ id }) => id === "FE-GATE-020"); + const scripts = new Set( + contract.commands + .filter(({ id }) => removability?.commandIds.includes(id)) + .map(({ script }) => script), + ); + expect(scripts).toContain("test:sample-removal"); + // Without `--feature` the drill deletes every listed sample. + const packageScripts = (JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record }) + .scripts; + expect(packageScripts["test:sample-removal"]).not.toMatch(/--feature/u); + // It builds and tests the copy; a documents-only check does not prove removal. + const drill = await readFile("scripts/test-sample-removal.ts", "utf8"); + expect(drill).toMatch(/check\(`\$\{prefix\}build`, "build"\)/u); + expect(drill).toMatch(/check\(`\$\{prefix\}unit-integration`, "test:all"\)/u); + }); +}); + +describe("gate targets (R5)", () => { + it("name no sample feature", async () => { + expect(gateTargetsNamingExamples(exampleFeatures(REMOVABLE_TEMPLATE_FEATURES), await repositoryGateTargets())).toEqual( + [], + ); + }); + + it("finds a sample's route in a visual spec, the evidence list and a scale record", () => { + const sample = { featureId: "order-feature", routeIds: ["ORDER_LIST"], routePaths: ["/orders"] }; + expect( + gateTargetsNamingExamples([sample], { + gotoTargets: [ + { file: "tests/visual/a.visual.spec.ts", target: "/orders?page=2" }, + { file: "tests/visual/a.visual.spec.ts", target: "/examples/platform" }, + ], + artifactPaths: ["docs/accessibility/route-reviews/ORDER_LIST.md", "artifacts/quality/bundle.json"], + scaleFiles: [{ file: "config/scale/feature-shape-growth.json", text: '{"sourceFeature":"order-feature"}' }], + }), + ).toEqual([ + "tests/visual/a.visual.spec.ts: goto /orders?page=2", + "config/ci/gates.json: docs/accessibility/route-reviews/ORDER_LIST.md", + "config/scale/feature-shape-growth.json: order-feature", + ]); + }); +}); diff --git a/tests/unit/repository-layout.test.ts b/tests/unit/repository-layout.test.ts index 769dfc31..b6ae701d 100644 --- a/tests/unit/repository-layout.test.ts +++ b/tests/unit/repository-layout.test.ts @@ -1,5 +1,6 @@ import { spawnSync } from "node:child_process"; import { existsSync, readFileSync } from "node:fs"; +import path from "node:path"; import { describe, expect, it } from "vitest"; @@ -12,9 +13,11 @@ import { } from "../../scripts/lib/repository-layout.ts"; /** - * The repository root registry: R1 (every root item is registered) and R2 - * (root path lists are chosen from the registry) of - * design-docs repo-structure/04-frontend-layout.md §11. + * The repository layout rules of docs/manual/03-outside-feature-folder.md + * that a file listing can check: R1 (every root item is registered), R2 (root + * path lists are chosen from the registry), R7 for files (no infrastructure + * configuration in this repository) and R9 (a tsconfig differs in its + * options, not only in its files). R3 is tests/unit/tracked-artifacts.test.ts. */ function trackedFiles(): string[] { @@ -133,3 +136,67 @@ describe("root path lists (R2)", () => { ); }); }); + +/** R7. Development compose files and Dockerfiles may live here; host and cluster configuration may not. */ +const INFRASTRUCTURE_FILE = + /(?:^|\/)(?:nginx[^/]*|[^/]+\.tf|[^/]+\.tfvars|Chart\.ya?ml|kustomization\.ya?ml|helmfile\.ya?ml)$/iu; +const KUBERNETES_MANIFEST = /^apiVersion:\s*\S+\s*$[\s\S]*^kind:\s*\S+\s*$/mu; + +describe("infrastructure configuration (R7)", () => { + it("is not tracked in this repository", () => { + const files = trackedFiles(); + const manifests = files + .filter((file) => /\.ya?ml$/u.test(file) && existsSync(file)) + .filter((file) => KUBERNETES_MANIFEST.test(readFileSync(file, "utf8"))); + expect([...files.filter((file) => INFRASTRUCTURE_FILE.test(file)), ...manifests]).toEqual([]); + }); + + it("recognises the file kinds the rule names", () => { + expect(["deploy/nginx.conf", "infra/main.tf", "chart/Chart.yaml", "kustomization.yml"].filter((file) => + INFRASTRUCTURE_FILE.test(file), + )).toHaveLength(4); + expect(KUBERNETES_MANIFEST.test("apiVersion: apps/v1\nkind: Deployment\n")).toBe(true); + expect(INFRASTRUCTURE_FILE.test("compose.yaml")).toBe(false); + }); +}); + +type TsconfigDocument = Readonly<{ + extends?: string; + compilerOptions?: Record; + files?: readonly string[]; + references?: readonly unknown[]; +}>; + +function effectiveCompilerOptions(file: string): Record { + const document = JSON.parse(readFileSync(file, "utf8")) as TsconfigDocument; + const inherited = document.extends?.startsWith(".") + ? effectiveCompilerOptions(path.join(path.dirname(file), document.extends)) + : {}; + return { ...inherited, ...document.compilerOptions }; +} + +/** Pairs of tsconfig files whose options are the same; a solution tsconfig (references only) has none. */ +function sameOptionTsconfigs(files: readonly string[]): string[] { + const options = files + .filter((file) => { + const document = JSON.parse(readFileSync(file, "utf8")) as TsconfigDocument; + return !(document.references && document.files?.length === 0); + }) + .map((file) => ({ + file, + options: JSON.stringify(Object.entries(effectiveCompilerOptions(file)).sort(([a], [b]) => a.localeCompare(b))), + })); + return options.flatMap((left, index) => + options.slice(index + 1).filter((right) => right.options === left.options).map((right) => `${left.file} = ${right.file}`), + ); +} + +describe("tsconfig files (R9)", () => { + // tests/fixtures/typecheck had 23 one-file tsconfigs with one set of + // options until 2026-11-08; scripts/check-type-fixtures.ts runs them now. + it("differ in lib, types or module resolution, not only in their files", () => { + const tsconfigs = trackedFiles().filter((file) => /(?:^|\/)tsconfig[^/]*\.json$/u.test(file) && existsSync(file)); + expect(tsconfigs.length).toBeGreaterThan(1); + expect(sameOptionTsconfigs(tsconfigs)).toEqual([]); + }); +}); -- 2.54.0 From 8d9cb621fbc2d5ca4d456c2393968037b8bc9734 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 17:42:15 +0900 Subject: [PATCH 4/6] =?UTF-8?q?docs(changelog):=20=EC=A0=95=EB=A6=AC=203?= =?UTF-8?q?=C2=B74=EB=8B=A8=EA=B3=84=EC=99=80=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EB=A6=BC=EC=9D=B4=20=ED=95=A0=20=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=20=EC=A0=81=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 정리 단계 미출시 절에 3단계(합치기)와 4단계(배치 규칙 검사)를 더한다. 다운스트림이 할 일 7~12(음성 타입 fixture 기대 줄, 지운 tsconfig, a11y 기록과 스키마 이동, 루트 등록부, CI 계약 기준선)와 계약 표 세 줄, 알려진 제한 둘(R2가 보는 범위, R5의 문자열 검색)을 적었다. 위험: 다운스트림에 적용해 보지 않았다(절의 알려진 제한과 같다). 검증(desktop): `tests/unit/changelog-review-ids.test.ts`를 포함한 test:unit. Refs: design-docs repo-structure/04-frontend-layout.md 9.2절 --- CHANGELOG.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b74de10f..b9372db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ ## 미출시 — `48c7695b` → 정리 단계 -2026-11-07 소유자가 지시한 저장소 정리다(design-docs `repo-structure/04-frontend-layout.md` 9.2절, 결정은 `repo-structure/README.md` 3.4절). 범위는 `main` `48c7695b`(PR #9 병합) 다음부터다. 1단계(PR #11, `85f941c4`~`121e1125`, `main` `f33e4778`에 합침)와 2단계(브랜치 `chore/layout-2-sample-removal`, `c7e80f2f`부터 브랜치 끝까지)를 담는다. 3단계(합치기)는 아직 없다. 기준점 `48c7695b`를 빼면 이 절의 해시는 모두 이 범위에 있다. +2026-11-07 소유자가 지시한 저장소 정리다(design-docs `repo-structure/04-frontend-layout.md` 9.2절, 결정은 `repo-structure/README.md` 3.4절). 범위는 `main` `48c7695b`(PR #9 병합) 다음부터다. 1단계(PR #11, `85f941c4`~`121e1125`, `main` `f33e4778`에 합침), 2단계(브랜치 `chore/layout-2-sample-removal`, `c7e80f2f`~`ad3a071f`), 3단계(합치기)와 4단계(배치 규칙 검사)(브랜치 `chore/layout-3-merge`, `bf485f44`부터 브랜치 끝까지)를 담는다. 기준점 `48c7695b`를 빼면 이 절의 해시는 모두 이 범위에 있다. ### 먼저 할 일 (BREAKING) @@ -32,10 +32,16 @@ 4. **CI 계약 기준선과 workflow를 자기 값으로 다시 기록한 프로젝트는 다시 기록한다.** FE-GATE-007에서 `test:reference-feature` 명령과 그 산출물이, FE-GATE-009·028에서 지운 라우트의 수동 접근성 기록 산출물 4개가 빠졌다. `CI_CONTRACT_BASELINE_OWNER=<팀> CI_CONTRACT_BASELINE_REASON=<이유> corepack pnpm update:ci-contract-baseline`, 그다음 `corepack pnpm generate:ci-workflow` (`e3c8db48`) 5. **초기 JS 기록을 다시 쓴다.** `config/scale/feature-shape-ceilings.json`의 `initialJavascript`에 `firstFeatureGzipBytes`가 더해졌고, 측정은 참조 기능 대신 생성 기능을 복사해 잰다. `node scripts/scale/measure-feature-shape-growth.ts --initial-baseline --write`. 다시 쓰지 않으면 `test:unit`이 기록과 빌드가 다르다며 실패한다 (`b2042de9`) 6. **`src/features/` 아래에 기능이 아닌 폴더를 두었으면 밖으로 옮긴다.** 생성기는 `NOT_A_FEATURE` 표식을 더 읽지 않는다. 선언 없는 폴더는 `src/features/ has no feature-module.ts; add one, or keep code that is no feature outside src/features`로 실패한다. 템플릿의 local-draft 샘플은 `tests/fixtures/indexeddb-consumer/`로 옮겼다 (`b72cd7d4`) +7. **음성 타입 fixture를 더한 프로젝트는 첫 줄에 기대를 쓰고 fixture별 tsconfig·script를 지운다.** 템플릿은 `tests/fixtures/typecheck/tsconfig.<이름>.json` 23개와 `check:types:fixture*` script 23개를 `check:types:fixtures` 하나(`scripts/check-type-fixtures.ts`)로 합쳤다. `invalid-*.ts(x)` fixture마다 첫 줄에 `// expect: TS2322`(실패와 그 진단) 또는 `// expect: pass`를 쓴다. 없으면 `check:types:fixtures`가 `` missing `// expect:` first line ``으로 실패한다. 자기 `config/ci/product-gates.json`이 옛 명령 id(`check-types-fixture-*`)를 참조했으면 `check-types-fixtures`로 바꾼다 (`bf485f44`) +8. **`tsconfig.recipes.json`·`tsconfig.web-worker.json`과 그 script(`check:types:recipes`, `check:types:web-worker`)가 없어졌다.** recipe는 `check:types:test`가 검사한다. 자기 recipe tsconfig를 고쳤으면 그 옵션을 `tsconfig.test.json`에 옮긴다. Web Worker 코드를 들인 프로젝트는 매뉴얼 03 C절 「Web Worker를 들일 때 tsconfig 더하기」대로 tsconfig와 script를 되살린다. `check:types` 끝의 `check-typecheck-inputs.ts`는 tsc에 넘기는 tsconfig의 입력이 0개면 `Typecheck inputs: FAIL (no input files: )`로 실패한다 (`bf485f44`) +9. **수동 a11y 기록을 옮긴다.** `artifacts/tests/a11y-manual/.md` → `docs/accessibility/route-reviews/.md`(자기 라우트 기록도 `git mv`). `.gitignore`가 더는 `artifacts/` 아래 `.md`를 들이지 않는다. 남기면 `tests/unit/tracked-artifacts.test.ts`가 그 파일을 이름으로 실패시키고, 옮기지 않으면 `verify:documentation`이 `docs/accessibility/route-reviews/ has no record for route IDs: `로 실패한다 (`79dc945a`) +10. **루트 `schemas/`를 `config/schemas/`로 옮긴다.** 산출물 스키마는 `config/schemas/artifacts/`, recipe 카탈로그 스키마는 `config/schemas/recipes/`다. 자기 스키마를 `schemas/`에 두었으면 같은 곳으로 옮기고 `$schema` 상대 경로를 고친다. hosting 응답 fixture는 `config/hosting/response-headers.fixture.json` → `tests/fixtures/hosting/response-headers.json` (`79dc945a`) +11. **자기 루트 항목을 등록부에 더한다.** 루트 항목마다 `config/repository-layout.json`에 종류·역할·읽는 곳을 적는다. 제품이 더한 루트 항목(예: `Dockerfile`, `compose.yaml`, `deploy/`)이 없으면 `tests/unit/repository-layout.test.ts`가 `add an entry with its role to config/repository-layout.json`으로 실패한다. 비밀값 검사 범위에 넣을 항목은 `sets`에 `secret-scan`을 적고 `config/security/secret-scan-policy.json`의 `trackedRoots`에도 같은 이름을 더한다. 둘이 다르면 같은 시험이 실패한다. 루트 경로 목록을 코드에 새로 적지 말고 `selectRepositoryPaths(<집합>)`으로 고른다(매뉴얼 03 E절 R2) (`79dc945a`) +12. **CI 계약 기준선을 자기 값으로 다시 기록한 프로젝트는 다시 기록한다.** FE-GATE-003 명령이 25개에서 2개로, FE-GATE-009·028의 수동 a11y 기록 산출물 경로와 id가 바뀌었다. 4단계와 같은 명령이다 (`bf485f44`, `79dc945a`) #### 옮긴 뒤 확인 -1. 로컬 merge 게이트 14개를 돈다. 이 절 때문에 먼저 볼 것: `check:registries`(3단계), `check:ci`(4단계), `test:unit`(5단계), `generate:feature-index`(6단계), `verify:documentation`(지운 샘플 경로를 적은 자기 문서), `test:sample-removal`(인자 없이 돌면 목록이 빈 템플릿에서는 `SKIP`을 출력한다). +1. 로컬 merge 게이트 14개를 돈다. 이 절 때문에 먼저 볼 것: `check:registries`(3단계), `check:ci`(4·12단계), `test:unit`(5·9·11단계), `generate:feature-index`(6단계), `check:types`·`check:types:fixtures`(7·8단계), `verify:documentation`(지운 샘플 경로를 적은 자기 문서, 9단계, 매뉴얼 03 E절 R6·R7), `test:sample-removal`(인자 없이 돌면 목록이 빈 템플릿에서는 `SKIP`을 출력한다). 2. 시각 골든: 갤러리 두 장(`design-system-gallery-dark`, `state-surfaces-light`)은 이제 Storybook 정적 빌드의 story를 찍는다. 자기 골든을 다시 찍은 프로젝트는 `corepack pnpm test:visual:update`로 그 둘을 다시 찍는다. 3. `/examples/ui`·`/examples/states`·`/examples/auth`를 열던 자기 e2e는 플랫폼 라우트나 자기 화면으로 옮긴다. 템플릿의 그런 spec은 옮겼다(아래 표). @@ -50,9 +56,13 @@ | [계약] | 규모 측정이 참조 기능 대신 생성 기능을 복사해 잰다(`planShapeFeatures`). `initialJavascript`에 `firstFeatureGzipBytes`(기능이 없는 템플릿에 첫 기능을 더할 때의 비용)가 생겼고, context 비용은 둘째 기능을 새 context에 둘 때와 같은 context에 둘 때의 차이다. 기록: 템플릿 194,354 B·17파일, 첫 기능 6,327 B, 기능 하나 539 B, context 하나 4 B. 성장 기준선(0·25·100개)도 다시 쟀다. 위 "먼저 할 일" 5 | `scripts/scale/measure-feature-shape-growth.ts`, `config/scale/` | `b2042de9`, `9c87cc4d` | | [계약] | 생성기가 `NOT_A_FEATURE` 표식을 읽지 않는다. local-draft 샘플은 IndexedDB 소비자 시험 fixture(`tests/fixtures/indexeddb-consumer/`)가 됐다. 위 "먼저 할 일" 6 | `scripts/generate-product-feature-index.ts`, `recipes/frontend-capabilities/indexeddb-feature-capability.ts` | `b72cd7d4` | | [계약] | 브라우저 soak(`scripts/scale/browser-soak.ts`, nightly 밖)이 기본으로 생성 기능을 넣은 빌드를 만들어 그 목록 라우트에서 실패하는 백엔드를 관찰한다. `--dist`를 주면 `--feature-route`도 준다. 결과 칸 이름이 `featureVisits`·`settledFeatureVisits`·`apiRequestsPerFeatureVisit`으로 바뀌었다 | `scripts/scale/browser-soak.ts` | `e3c8db48` | +| [계약] **BREAKING** | 음성 타입 fixture 23개를 실행기 하나로 돈다. fixture 첫 줄의 `// expect:`가 기대이고, 판정은 전과 같다(tsc exit 1과 `error TS:`). fixture별 결과와 맞은 진단 줄을 출력한다. `TelemetryPort.emit` 인자를 넓히는 변이(0925/07-05)에서 실패하는 것을 확인했다. recipes tsconfig는 test에 합쳤고 web-worker tsconfig(0파일 검사)는 지웠다(결정 D4). 위 "먼저 할 일" 7·8 | `scripts/check-type-fixtures.ts`, `scripts/check-typecheck-inputs.ts`, `tests/fixtures/typecheck/`, `package.json`, `config/ci/gates.json` | `bf485f44` | +| [계약] **BREAKING** | 루트 등록부 `config/repository-layout.json`이 생겼다. 루트 경로 목록을 쓰던 7곳(복사 대상, 비밀값 검사 범위, 공급망 시험, 이력 문서 검사, 규모 입력, vite 입력, TS 전용 규칙)이 등록부의 집합을 고른다. `schemas/`·수동 a11y 기록·hosting 응답 fixture를 옮겼다. 위 "먼저 할 일" 9~11 | `config/repository-layout.json`, `scripts/lib/repository-layout.ts`, `config/schemas/`, `docs/accessibility/route-reviews/`, `tests/fixtures/hosting/` | `79dc945a` | +| [계약] | 저장소 배치 규칙 R1~R10을 매뉴얼 03 E절에 적고, 기계로 볼 수 있는 것을 게이트에 넣었다: R1·R2·R7(파일)·R9 `tests/unit/repository-layout.test.ts`, R3 `tests/unit/tracked-artifacts.test.ts`, R4·R5 `tests/unit/example-feature-rules.test.ts`(이상 FE-GATE-005), R6·R7(문서) `verify:documentation`(FE-GATE-017, 산출물에 `layoutRuleViolations`), R8 FE-GATE-003 | `docs/manual/03-outside-feature-folder.md`, `scripts/verify-documentation-readiness.ts`, `scripts/contracts/release-artifacts.ts` | `e902e657` | ### 그 밖의 수정 +- 정리 3단계에서 문서가 가리키던 옛 명령·경로(`check:types:fixture:*`, `check:types:recipes`, a11y 기록과 스키마 경로)를 새 이름으로 바꿨다 (`bf485f44`, `79dc945a`). - 정리 1단계: 읽는 곳 없는 산출물 13개를 지우고 `artifacts/`를 폴더째 무시한다(`85f941c4`). 아무도 읽지 않는 `config/schemas/` JSON Schema 4개를 지웠다(`0805910c`). 루트 `tasks/`와 `.superpowers/` 기록을 `docs/history/`로 옮겼다(`429b8d88`). nginx 설정 예시를 지우고 호스트가 지킬 조건만 남겼다(`121e1125`). - `/examples/ui`·`/examples/states`를 열던 e2e(반응형, 스크롤 복원, 타이포그래피, 건너뛰기 링크)는 홈과 `/examples/platform`으로 옮겼다 (`e7210c71`). - 매뉴얼(`docs/manual/`)의 예제 칸은 생성기 출력 경로와 매뉴얼 안 코드 조각을 가리킨다. 코드 조각 일곱 개(problem details 백엔드의 분류와 매핑, 도메인 모델, 검색값 읽기, 실패 행동, 403 페이지 시험)는 `tests/unit/manual-code-blocks.test.ts`가 생성 기능 위에서 타입 검사·lint·아키텍처 검사·동작 시험을 돌린다. problem details 예는 소유자 결정대로 02 결정표 4절에 있다 (`01cac930`). @@ -62,6 +72,8 @@ ### 알려진 제한 - 두 다운스트림에 시험 병합을 하지 않아 충돌 수를 모른다(S4 가정 F4). +- R2 검사는 등록부를 쓰는 7곳만 본다. 그 밖에 루트 이름 둘 이상을 담은 문자열 배열이 약 20곳 남았다(예: `tests/e2e/support/fixture-builds.ts`의 복사 제외 목록, `scripts/check-test-evidence.ts`의 playwright 설정 목록). 뜻이 다른 목록이라 이번에 옮기지 않았다. +- R5는 문자열 검색이라 샘플 ID나 라우트 경로를 조립해 쓰는 시험은 놓친다. - 성능 lab(FE-GATE-026)의 기능 라우트 측정(`featureRouteInteractionMs`)은 템플릿에 공개 기능 라우트가 없어 `measured: false`다. 제품 기능이 생기면 잰다. - `TEMPLATE_FIXTURE` 출처와 `REFERENCE_EXTERNAL_BEARER` 별칭이 플랫폼 코드에 남았다. 쓰는 기능이 없다. - visual 골든의 픽셀 비교는 색 허용치(`threshold` 0.2)를 넘지 않는 미세한 토큰 변경(예: 어두운 테마 `--color-danger` red-500 → red-600)을 잡지 못한다. 옛 골든도 같았다. -- 2.54.0 From c54c3813253a82740fbf76d24107a2d89d7632c3 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 17:51:30 +0900 Subject: [PATCH 5/6] =?UTF-8?q?docs(readme):=20=EB=AC=B8=EC=84=9C=20?= =?UTF-8?q?=EC=83=89=EC=9D=B8=EC=9D=98=20a11y=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=EB=A5=BC=20=EC=98=AE=EA=B8=B4=20=EA=B3=B3?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B0=94=EA=BE=BC=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `docs/README.md` 표가 수동 a11y 기록을 아직 `artifacts/tests/a11y-manual/`로 가리킨다. 기록은 `docs/accessibility/route-reviews/`로 옮겼다(79dc945a). `verify:documentation`은 `.gitignore`가 무시하는 경로를 생성 출력으로 보고 넘겨서 이 줄을 잡지 못했다. 검증(desktop): verify:documentation, test:unit. --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index fc22ea81..7913a446 100644 --- a/docs/README.md +++ b/docs/README.md @@ -60,7 +60,7 @@ checkout이 없거나 그 커밋이 없으면 실패 대신 확인하지 못한 | 파일 | 읽는 명령 | |---|---| | 이 파일, `architecture/review-ledger.json`, `architecture/review-evidence.md` | `verify:documentation` (FE-GATE-017) | -| repo 루트의 `artifacts/tests/a11y-manual/` 라우트별 기록 | `verify:documentation` (FE-GATE-017), `review:a11y-manual` (FE-GATE-009, FE-GATE-028) | +| `docs/accessibility/route-reviews/` 라우트별 기록 | `verify:documentation` (FE-GATE-017), `review:a11y-manual` (FE-GATE-009, FE-GATE-028) | | `reviews/adapters/INVENTORY.md` | `check:adapter-inventory` (FE-GATE-010) | | `operations/adapter-remediation-ledger.md`, `operations/adapter-remediation-dispositions.json` | `check:remediation-ledger` (게이트 밖. 이유는 `config/ci/ungated-scripts.json`) | -- 2.54.0 From 16eb200fd1a27e74b0d75e8b9316d37f5732e549 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 22:51:59 +0900 Subject: [PATCH 6/6] =?UTF-8?q?chore(layout):=20=ED=95=98=EB=84=A4?= =?UTF-8?q?=EC=8A=A4=EA=B0=80=20=EB=8D=94=ED=95=A0=20.gitattributes?= =?UTF-8?q?=EB=A5=BC=20=EB=A3=A8=ED=8A=B8=20=EB=93=B1=EB=A1=9D=EB=B6=80?= =?UTF-8?q?=EC=97=90=20=EB=AF=B8=EB=A6=AC=20=EC=A0=81=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 하네스 PR(#13)이 루트에 `.gitattributes`(작업 장부 파일의 병합 규칙)를 더한다. 이 PR이 먼저 들어가고 그 PR이 나중에 들어가면 등록부에 없는 루트 항목이 생겨 `tests/unit/repository-layout.test.ts`(R1)가 실패한다. `AGENTS.md`·`.claude`처럼 optional 항목으로 미리 적는다. 없으면 고르는 집합이 없어 다른 검사에 영향이 없다. 검증(desktop): test:unit, check:ci, verify:documentation. --- config/repository-layout.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/repository-layout.json b/config/repository-layout.json index a118a672..1a329d9a 100644 --- a/config/repository-layout.json +++ b/config/repository-layout.json @@ -38,6 +38,13 @@ "role": "빌드 시점 공개 변수의 견본", "readBy": "Vite(VITE_*), 사람" }, + { + "path": ".gitattributes", + "kind": "tool-convention", + "role": "git 병합 규칙. 하네스 작업(fe-c)이 더한다", + "readBy": "git", + "optional": true + }, { "path": ".gitea", "kind": "tool-convention", -- 2.54.0