refactor(typecheck): 음성 타입 fixture 23개를 실행기 하나로 돈다
음성 타입 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<code>:`). 결과를 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
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
+3
-185
@@ -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": [
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -369,7 +369,7 @@ projectRequest: (input) => Object.freeze({
|
||||
- application이 React·어댑터·presentation을 import하면 `check:architecture`가 `feature-application-does-not-know-runtime`으로 막는다.
|
||||
- 보강 키와 조립 기여의 `featureId`가 다르면 조립이 실패한다.
|
||||
- 메시지: `feature adapter contribution <id> installed an input for <other>`
|
||||
- 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 <id> needs <capability>, which the host did not provide`
|
||||
- operation을 계약에 두고 기능 `adapters/`·`application/`에서 쓰지 않으면 `check:registries`(FE-GATE-010)가 실패한다.
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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`다.
|
||||
|
||||
|
||||
+2
-26
@@ -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",
|
||||
|
||||
@@ -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<boolean> {
|
||||
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
|
||||
);
|
||||
}
|
||||
@@ -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<code>:`. 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<string[]> {
|
||||
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<TypeFixtureResult, "passed" | "evidence"> {
|
||||
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<TypeFixtureResult> {
|
||||
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<TypeFixtureResult[]> {
|
||||
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`);
|
||||
}
|
||||
}
|
||||
@@ -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<Record<string, string>>): string[] {
|
||||
const projects = new Set<string>();
|
||||
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<string, string> }).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`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -42,7 +42,6 @@ try {
|
||||
});
|
||||
|
||||
const removedCiScripts = new Set([
|
||||
"check:types:recipes",
|
||||
"test:recipes",
|
||||
"check:optional-recipes",
|
||||
"check:optional-recipes:source",
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2739
|
||||
import type { ApplicationApi } from "../../../src/application/create-application.ts";
|
||||
|
||||
export const incompleteApplication: ApplicationApi = {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
import type { ApplicationOutputPorts } from "../../../src/application/create-application.ts";
|
||||
|
||||
export const invalidOutputPorts: ApplicationOutputPorts = {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
import type { AsyncOverlay } from "../../../src/application/view-models/async-state.ts";
|
||||
|
||||
export const invalidPendingConflict: AsyncOverlay = {
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2345
|
||||
import type { InstalledHttpOperationExecutor } from "../../../src/adapters/http/index.ts";
|
||||
import { composeFeatureAdapterInputs } from "../../../src/features/feature-adapter-contribution.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
import type { AppFailure } from "../../../src/contracts/errors.ts";
|
||||
|
||||
export const invalidFailure: AppFailure = {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2339
|
||||
import { defineFeatureAdapterContribution } from "../../../src/features/feature-adapter-contribution.ts";
|
||||
import { createFixtureFeatureInstalledInput } from "./fixture-feature-contract.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
import { defineFeatureAdapterContribution } from "../../../src/features/feature-adapter-contribution.ts";
|
||||
import type {} from "./fixture-feature-contract.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";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2345
|
||||
import {
|
||||
createFeatureHttpBinding,
|
||||
defineFeatureHttpOperation,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2353
|
||||
import type { FixtureHttpBinding } from "./fixture-feature-contract.ts";
|
||||
|
||||
declare const http: FixtureHttpBinding;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
import { defineFeatureHttpOperationForRoutes } from "../../../src/adapters/http/index.ts";
|
||||
import {
|
||||
mapEntityPayload,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
import { defineFeatureHttpOperation } from "../../../src/adapters/http/index.ts";
|
||||
import { TEST_GET_ENTITY_CONTRACT } from "./fixture-feature-contract.ts";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2741
|
||||
import { IconButton, MenuIcon } from "../../../src/presentation/design-system/index.ts";
|
||||
|
||||
export const InvalidIconButton = <IconButton><MenuIcon /></IconButton>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2741
|
||||
import type {
|
||||
ImageAssetReference,
|
||||
ImageCdnPresentationPort,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2345
|
||||
import { formatMessage } from "../../../src/presentation/i18n/index.ts";
|
||||
|
||||
formatMessage("ko-KR", "unknown.translation.key");
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2554
|
||||
import { formatMessage } from "../../../src/presentation/i18n/index.ts";
|
||||
|
||||
formatMessage("en-US", "route.documentTitle");
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS1360
|
||||
import type { PageActionDefinition } from "../../../src/presentation/templates/index.ts";
|
||||
|
||||
export const activeButtonWithoutCallback = {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
// This deliberately failing fixture proves that TypeScript rejects a wrong shape.
|
||||
|
||||
function execute(request: { operationId: string }) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2322
|
||||
interface ClockPort {
|
||||
now(): number;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2741
|
||||
import type { FixtureHttpBinding } from "./fixture-feature-contract.ts";
|
||||
|
||||
declare const http: FixtureHttpBinding;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2339
|
||||
import type { Result } from "../../../src/contracts/result.ts";
|
||||
|
||||
export function invalidUnwrap(result: Result<number, string>): number {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// expect: TS2741
|
||||
import { ROUTE_RUNTIME_CONTRACT } from "../../../src/features/installed-feature-contracts.ts";
|
||||
|
||||
type RouteId = keyof typeof ROUTE_RUNTIME_CONTRACT;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-application-input.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-application-output.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-async-overlay.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-diagnostics-port.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-direct-feature-composition.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-failure-kind.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-feature-capability-selection.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-feature-contribution-input.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-feature-input.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-http-operation-id.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-http-operation-input.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-http-route-id.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-http-wire-mapper.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-icon-button.tsx"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-image-cdn-resolve-signal.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-message-key.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-message-params.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-page-action.tsx"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-port-call.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-port-implementation.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-reference-operation.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-result-narrowing.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"files": [
|
||||
"./invalid-route-runtime.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);
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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))),
|
||||
|
||||
@@ -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<code>:` 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([]);
|
||||
});
|
||||
});
|
||||
@@ -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" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["recipes/**/*.ts"],
|
||||
"exclude": ["dist", "node_modules"]
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
"include": [
|
||||
"tests/**/*.ts",
|
||||
"tests/**/*.tsx",
|
||||
"recipes/**/*.ts",
|
||||
"vitest.config.ts",
|
||||
"playwright*.config.ts"
|
||||
],
|
||||
|
||||
@@ -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": []
|
||||
}
|
||||
Reference in New Issue
Block a user