From 731612c04d1dcfd63ec04cd94f8b3d821b5d67c9 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 12:50:28 +0900 Subject: [PATCH 1/6] =?UTF-8?q?fix(typecheck):=20route-runtime=20=EC=9D=8C?= =?UTF-8?q?=EC=84=B1=20fixture=EA=B0=80=20=EC=9D=B4=20=EC=A0=9C=ED=92=88?= =?UTF-8?q?=EC=9D=98=20=EA=B2=BD=EB=A1=9C=EB=A1=9C=20=EC=A7=84=EB=8B=A8?= =?UTF-8?q?=EC=9D=84=20=EB=82=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FE-GATE-003의 route-runtime 음성 fixture는 템플릿 그대로 `{ APP_HOME: true } satisfies Record`이다. 이 제품에는 APP_HOME 경로가 없어서, 기대한 「빠진 경로」 진단(TS2740) 대신 「모르는 속성」(TS2353)이 나와 UNEXPECTED_DIAGNOSTIC로 떨어진다. 템플릿 e47a0ab2와 같은 방식으로 고친다. 정확히 한 경로만 뺀 `Omit, "TECH_LOG_HOME">`을 대입하고, 기대 진단을 TS2741로 바꾼다. 빠진 키가 하나면 경로 수와 상관없이 TS2741이다(TS2739· TS2740은 빠진 목록의 길이에 따라 갈린다). 뺄 경로는 이 제품에 있는 TECH_LOG_HOME이다. 검증: tsc -p tests/fixtures/typecheck/tsconfig.route-runtime.json이 TS2741(missingRuntime)과 TS2353(ORPHAN_ROUTE, 두 번째 음성 경우)을 낸다. --- config/ci/gates.json | 2 +- tests/fixtures/typecheck/invalid-route-runtime.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/config/ci/gates.json b/config/ci/gates.json index 6b47221..61bbb81 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -144,7 +144,7 @@ "script": "check:types:fixture:route-runtime", "expect": "fail", "expectedExitCode": 1, - "expectedDiagnosticId": "error TS2740:" + "expectedDiagnosticId": "error TS2741:" }, { "id": "check-types-fixture-page-action", diff --git a/tests/fixtures/typecheck/invalid-route-runtime.ts b/tests/fixtures/typecheck/invalid-route-runtime.ts index 9fa3f9d..cfd12b0 100644 --- a/tests/fixtures/typecheck/invalid-route-runtime.ts +++ b/tests/fixtures/typecheck/invalid-route-runtime.ts @@ -2,9 +2,13 @@ import { ROUTE_RUNTIME_CONTRACT } from "../../../src/features/installed-feature- type RouteId = keyof typeof ROUTE_RUNTIME_CONTRACT; -export const missingRuntime = { - APP_HOME: true, -} satisfies Record; +// Exactly one route is left out, as the template does since e47a0ab2 (2026-11-07): +// one missing key is TS2741 at any route count, where a short or long list of +// missing keys is TS2739 or TS2740. The left-out route must exist here: this +// product has no APP_HOME, and the template's literal { APP_HOME: true } failed +// as an unknown property (TS2353) instead of the missing-runtime error. +declare const withoutHome: Omit, "TECH_LOG_HOME">; +export const missingRuntime: Record = withoutHome; export const orphanRuntime = { ...Object.fromEntries( -- 2.54.0 From ed47b562bc4df4fb33e677b85f02824b3b5b64b6 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 12:50:28 +0900 Subject: [PATCH 2/6] =?UTF-8?q?perf(build):=20react-dom=EC=9D=84=20?= =?UTF-8?q?=EC=9E=90=EA=B8=B0=20=EC=B2=AD=ED=81=AC=EB=A1=9C=20=EB=B9=BC=20?= =?UTF-8?q?=EB=B9=8C=EB=93=9C=20id=EB=A7=8C=20=EB=B0=94=EB=80=90=20?= =?UTF-8?q?=EB=B0=B0=ED=8F=AC=EC=9D=98=20=EC=BA=90=EC=8B=9C=20=EC=86=90?= =?UTF-8?q?=EC=8B=A4=EC=9D=84=20=EC=A4=84=EC=9D=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 빌드 id는 부트 실패 화면이 보여 주므로 render-boot-failure 청크에 들어간다(getBuildConfig). react-dom과 scheduler가 같은 청크에 있어서 빌드 id만 다른 두 빌드에서 그 190,478 B 청크의 이름이 바뀌었다. 해시 자산은 오래 캐시되는데, 재방문 사용자는 코드가 같아도 배포마다 이만큼 다시 받았다. 단위 시험 build-environment-bundle이 이 청크가 바뀐다고 실패했다. 템플릿 af6d0a9f(1103/15-06)와 같은 방식이다. manualChunks에서 react-dom· scheduler를 react-dom 청크로 뺀다. 시험은 템플릿 새 판처럼 디자인 시스템 청크를 이름 대신 내용(ui-button--pending)으로 찾아 고정됐는지 보고, react-dom 청크가 고정이며 render-boot-failure가 아닌지 본다. 이전 시험은 빌드 id를 일부러 담는 render-boot-failure를 공용 청크로 잘못 골랐다. 위험·한계: 정규식은 pnpm의 node_modules 배치를 가정한다. 배치가 바뀌어 그룹이 비면 시험이 실패한다. boot(약 320 KB)는 빌드 id로 설정을 대조하므로 계속 이름이 바뀐다(템플릿과 같음). 검증: 빌드 id만 다른 두 빌드에서 이름이 바뀐 청크는 boot·index· render-boot-failure 셋이고, render-boot-failure는 12,138 B로 줄었다. react-dom 청크와 디자인 시스템 청크는 두 빌드에서 이름이 같다. --- tests/unit/build-environment-bundle.test.ts | 35 +++++++++++++++------ vite.config.ts | 15 ++++++++- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/tests/unit/build-environment-bundle.test.ts b/tests/unit/build-environment-bundle.test.ts index 2229565..848b957 100644 --- a/tests/unit/build-environment-bundle.test.ts +++ b/tests/unit/build-environment-bundle.test.ts @@ -1,5 +1,5 @@ import { spawnSync } from "node:child_process"; -import { mkdtemp, readdir, readFile, rm } from "node:fs/promises"; +import { mkdtemp, readFile, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; @@ -67,16 +67,31 @@ describe("build variables in the bundle (13-06)", () => { const second = await build({ ...DECLARED, VITE_BUILD_ID: "build-probe-2" }); expect(second.run.status).toBe(0); - // The shared application chunk, which Vite names after one of its modules: - // `design-system-*` upstream. This product's route chunk split - // (vite.config.ts) leaves `render-boot-failure-*` as that chunk here. - const designSystem = async (outDir: string) => - (await readdir(path.join(outDir, "assets"))).filter((name) => - name.startsWith("render-boot-failure-"), - ); - const firstChunks = await designSystem(first.outDir); + // The design system, found by what it holds rather than by name: this + // product's route chunk split (vite.config.ts) names chunks after route + // modules, and upstream's `design-system-*` does not exist here. + // (The previous check looked at `render-boot-failure-*`, which holds the + // build id on purpose and can never keep its name.) + const designSystem = ({ contents }: Awaited>) => + contents + .filter(({ file, text }) => + file.endsWith(".js") && text.includes("ui-button--pending"), + ) + .map(({ file }) => path.basename(file)); + const firstChunks = designSystem(first); expect(firstChunks).toHaveLength(1); - expect(await designSystem(second.outDir)).toEqual(firstChunks); + expect(designSystem(second)).toEqual(firstChunks); + + // Template 1103/15-06. react-dom sat in the boot-failure chunk with the + // build id, so every release renamed it and returning visitors downloaded + // it again. Its own chunk keeps the name while only the build id changes. + const reactDom = ({ contents }: Awaited>) => + contents + .filter(({ file, text }) => file.endsWith(".js") && text.includes("__reactContainer$")) + .map(({ file }) => path.basename(file)); + expect(reactDom(first)).toHaveLength(1); + expect(reactDom(first)[0]).not.toMatch(/render-boot-failure/u); + expect(reactDom(second)).toEqual(reactDom(first)); }, 120_000); it("refuses a VITE_* variable the build does not declare", async () => { diff --git a/vite.config.ts b/vite.config.ts index 84be581..ef99e85 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -65,6 +65,10 @@ const techLogRouteChunks = Object.freeze({ "/public/pages/public-not-found-page.tsx": "route-not-found", } as const); +// pnpm lays packages out as node_modules/.pnpm/@/node_modules/. +const REACT_DOM_MODULE = + /[\\/]node_modules[\\/](?:\.pnpm[\\/][^\\/]+[\\/]node_modules[\\/])?(?:react-dom|scheduler)[\\/]/; + function routeChunkName(moduleId: string): string | undefined { const normalized = moduleId.replaceAll("\\", "/"); const featurePath = "/src/features/tech-log/presentation"; @@ -139,10 +143,19 @@ export default defineConfig(({ mode }) => { // 09-03. The entry now imports the app dynamically, so Vite's preload // helper would land in the entry chunk and every lazy chunk would // import the entry, whose hash changes with each build id. + // + // Template 1103/15-06 (af6d0a9f). react-dom and scheduler shared the + // boot-failure chunk with the build id (getBuildConfig), so a release + // that only changed the build id renamed that 190 KB chunk and + // returning visitors downloaded it again. In a chunk of their own they + // keep their name; only boot, the entry and the small boot-failure + // screen, which hold or import the build id, are renamed. manualChunks: (id: string) => id.includes("vite/preload-helper") ? "preload-helper" - : routeChunkName(id), + : REACT_DOM_MODULE.test(id) + ? "react-dom" + : routeChunkName(id), }, }, }, -- 2.54.0 From 588ebca54f64472b85e9cdb1d2efae6b2e5ec9e0 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 12:50:28 +0900 Subject: [PATCH 3/6] =?UTF-8?q?fix(registry):=209=EC=9B=94=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=EC=9D=84=20registry=EC=97=90=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=ED=95=98=EA=B3=A0=20=EA=B7=BC=EA=B1=B0?= =?UTF-8?q?=EB=A5=BC=20=EB=82=A8=EA=B8=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit check-registries가 이 repo에서 실패한다. 9월 커밋(67a54917 주제 변형 화면, b9e29369 UX 리뷰 H1)이 경로 계약을 바꿨지만 governance와 schema registry는 그대로였다. 2026-09-29 템플릿 동기화의 baseline 승인도 「TechLog 경로 변경은 승인하지 않은 채 남긴다」고 적었다. 단위 시험 second-api-feature-registries가 이 실패를 그대로 드러냈다. - schema registry에 TechLogTopicVariantParams(route-params, REJECT_UNKNOWN)를 더한다. 코덱(tech-log-route-codecs.ts)은 이미 있다. - governance의 FE-REG-ROUTE 허용 값에 TechLogTopicVariantParams, TechLogStudioDocumentsSearch, TechLogStudioPublicationsSearch를 더한다. - breaking 변경 여섯에 근거를 남긴다: 출시 화면이 주 내비에서 빠짐 (navigationLabel·navigationOrder), Studio 문서·게시 목록이 검색·필터· 쪽수를 주소에서 읽음(searchSchema·searchCodec). baseline은 다시 만들지 않는다. 이 repo는 지금까지 breaking 변경마다 근거를 더하고 baseline은 템플릿 동기화 때만 승인했다(c5c8b942 등). 위험·한계: 근거의 내용은 이미 운영에 나간 변경을 사후에 적은 것이다. 검증: node scripts/check-registries.ts가 "11 registries PASS; compatibility=breaking"을 낸다(고치기 전 11건 실패). --- .../contracts/registry-change-evidence.json | 48 +++++++++++++++++++ config/contracts/registry-governance.json | 5 +- .../contracts/tech-log-route-contract.ts | 5 ++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/config/contracts/registry-change-evidence.json b/config/contracts/registry-change-evidence.json index a63998d..73564a6 100644 --- a/config/contracts/registry-change-evidence.json +++ b/config/contracts/registry-change-evidence.json @@ -488,6 +488,54 @@ "compatibilityWindow": "The deployed release consumes only its same-release registry snapshot; the rows leave the registries, the bundle and the contract set in one release.", "rollback": "Revert the template sync commit (rollback ref backup/main-before-template-af3d8e6), or reinstall the sample with its presentation, feature-module.ts and context-routes.ts.", "owner": "tech-log-frontend" + }, + { + "changeId": "FE-REG-ROUTE:TECH_LOG_RELEASES:navigationLabel:field-type-changed", + "versionBump": "The releases page leaves the primary navigation (navigationLabel \"변경 기록\" and navigationOrder 30 become null, 2026-09). The route, path /releases, title and chunk are unchanged.", + "migration": "Nothing to migrate: /releases still resolves and the public shell keeps its link to it (public-shell.tsx, publicSiteConfig.releasesPath); only the primary navigation entry is gone.", + "compatibilityWindow": "None needed. Bookmarks and links to /releases keep working; no route id or path changed.", + "rollback": "Restore navigationLabel \"변경 기록\" and navigationOrder 30 on TECH_LOG_RELEASES in src/features/tech-log/contracts/tech-log-route-contract.ts.", + "owner": "tech-log-frontend" + }, + { + "changeId": "FE-REG-ROUTE:TECH_LOG_RELEASES:navigationOrder:field-type-changed", + "versionBump": "The releases page leaves the primary navigation (navigationLabel \"변경 기록\" and navigationOrder 30 become null, 2026-09). The route, path /releases, title and chunk are unchanged.", + "migration": "Nothing to migrate: /releases still resolves and the public shell keeps its link to it (public-shell.tsx, publicSiteConfig.releasesPath); only the primary navigation entry is gone.", + "compatibilityWindow": "None needed. Bookmarks and links to /releases keep working; no route id or path changed.", + "rollback": "Restore navigationLabel \"변경 기록\" and navigationOrder 30 on TECH_LOG_RELEASES in src/features/tech-log/contracts/tech-log-route-contract.ts.", + "owner": "tech-log-frontend" + }, + { + "changeId": "FE-REG-ROUTE:TECH_LOG_STUDIO_DOCUMENTS:searchSchema:field-type-changed", + "versionBump": "TECH_LOG_STUDIO_DOCUMENTS reads its search, filter and page state from the URL through TechLogStudioDocumentsSearch (STRIP_UNKNOWN), 2026-09 UX review H1. Before, the list kept that state in memory and lost it on back navigation.", + "migration": "Old links without a query string open the list unfiltered on page 1, as before. Unknown keys are stripped, not rejected.", + "compatibilityWindow": "None needed: STRIP_UNKNOWN accepts every URL the previous contract accepted.", + "rollback": "Set searchSchema back to null on TECH_LOG_STUDIO_DOCUMENTS in tech-log-route-contract.ts, drop TechLogStudioDocumentsSearch from TECH_LOG_ROUTE_CODECS and the route runtime searchCodec back to none; the list then keeps its state in memory again.", + "owner": "tech-log-frontend" + }, + { + "changeId": "FE-REG-ROUTE:TECH_LOG_STUDIO_PUBLICATIONS:searchSchema:field-type-changed", + "versionBump": "TECH_LOG_STUDIO_PUBLICATIONS reads its search, filter and page state from the URL through TechLogStudioPublicationsSearch (STRIP_UNKNOWN), 2026-09 UX review H1. Before, the list kept that state in memory and lost it on back navigation.", + "migration": "Old links without a query string open the list unfiltered on page 1, as before. Unknown keys are stripped, not rejected.", + "compatibilityWindow": "None needed: STRIP_UNKNOWN accepts every URL the previous contract accepted.", + "rollback": "Set searchSchema back to null on TECH_LOG_STUDIO_PUBLICATIONS in tech-log-route-contract.ts, drop TechLogStudioPublicationsSearch from TECH_LOG_ROUTE_CODECS and the route runtime searchCodec back to none; the list then keeps its state in memory again.", + "owner": "tech-log-frontend" + }, + { + "changeId": "FE-REG-ROUTE-RUNTIME:TECH_LOG_STUDIO_DOCUMENTS:searchCodec:field-changed", + "versionBump": "TECH_LOG_STUDIO_DOCUMENTS reads its search, filter and page state from the URL through TechLogStudioDocumentsSearch (STRIP_UNKNOWN), 2026-09 UX review H1. Before, the list kept that state in memory and lost it on back navigation.", + "migration": "Old links without a query string open the list unfiltered on page 1, as before. Unknown keys are stripped, not rejected.", + "compatibilityWindow": "None needed: STRIP_UNKNOWN accepts every URL the previous contract accepted.", + "rollback": "Set searchSchema back to null on TECH_LOG_STUDIO_DOCUMENTS in tech-log-route-contract.ts, drop TechLogStudioDocumentsSearch from TECH_LOG_ROUTE_CODECS and the route runtime searchCodec back to none; the list then keeps its state in memory again.", + "owner": "tech-log-frontend" + }, + { + "changeId": "FE-REG-ROUTE-RUNTIME:TECH_LOG_STUDIO_PUBLICATIONS:searchCodec:field-changed", + "versionBump": "TECH_LOG_STUDIO_PUBLICATIONS reads its search, filter and page state from the URL through TechLogStudioPublicationsSearch (STRIP_UNKNOWN), 2026-09 UX review H1. Before, the list kept that state in memory and lost it on back navigation.", + "migration": "Old links without a query string open the list unfiltered on page 1, as before. Unknown keys are stripped, not rejected.", + "compatibilityWindow": "None needed: STRIP_UNKNOWN accepts every URL the previous contract accepted.", + "rollback": "Set searchSchema back to null on TECH_LOG_STUDIO_PUBLICATIONS in tech-log-route-contract.ts, drop TechLogStudioPublicationsSearch from TECH_LOG_ROUTE_CODECS and the route runtime searchCodec back to none; the list then keeps its state in memory again.", + "owner": "tech-log-frontend" } ] } diff --git a/config/contracts/registry-governance.json b/config/contracts/registry-governance.json index af0c136..3173e39 100644 --- a/config/contracts/registry-governance.json +++ b/config/contracts/registry-governance.json @@ -60,6 +60,7 @@ "ReferenceResourceParams", "TechLogExploreKindParams", "TechLogSlugParams", + "TechLogTopicVariantParams", "TechLogVersionParams", "TechLogDocumentIdParams", "TechLogPublicationEventIdParams", @@ -72,7 +73,9 @@ "TechLogExploreSearch", "TechLogExploreKindSearch", "TechLogSearchQuery", - "TechLogCaseStateSearch" + "TechLogCaseStateSearch", + "TechLogStudioDocumentsSearch", + "TechLogStudioPublicationsSearch" ], "loadingSurface": [ "app-shell", diff --git a/src/features/tech-log/contracts/tech-log-route-contract.ts b/src/features/tech-log/contracts/tech-log-route-contract.ts index 5388f28..6ca7e2f 100644 --- a/src/features/tech-log/contracts/tech-log-route-contract.ts +++ b/src/features/tech-log/contracts/tech-log-route-contract.ts @@ -94,6 +94,11 @@ export const TECH_LOG_ROUTE_SCHEMA_REGISTRY = Object.freeze({ "route-params", "REJECT_UNKNOWN", ), + TechLogTopicVariantParams: routeSchema( + "TechLogTopicVariantParams", + "route-params", + "REJECT_UNKNOWN", + ), TechLogVersionParams: routeSchema( "TechLogVersionParams", "route-params", -- 2.54.0 From a06cc8e4c461daebc4d1a2b54cb394b8accda8b4 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 12:50:28 +0900 Subject: [PATCH 4/6] =?UTF-8?q?fix(ci):=20=EC=8B=9C=ED=97=98=EA=B3=BC=20de?= =?UTF-8?q?v=20server=EA=B0=80=20CI=EC=9D=98=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=8B=9D=EB=B3=84=EA=B0=92=EC=9D=84=20=EB=AC=BC=EB=A0=A4?= =?UTF-8?q?=EB=B0=9B=EC=A7=80=20=EC=95=8A=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI workflow는 전체 env에 VITE_BUILD_ID=gitea--와 VITE_COMMIT_SHA를 둔다. Vite는 이 값을 import.meta.env에 넣는다. 그래서 CI와 같은 env로 돌리면 앱을 local-build fixture release로 조립하는 시험 (runtime-application, boot-unexpected-failure, runtime-composition-service-worker-telemetry)이 CONFIG_BUILD_MISMATCH로 실패한다. 로컬에서는 값이 없어 늘 통과한다. 템플릿 af312dee를 그대로 가져온다. vitest.config.ts가 두 값을 지우고, dev server를 띄우는 Playwright 설정 둘은 webServer env로 VITE_BUILD_ID=local-build, VITE_COMMIT_SHA=local을 준다. build·preview를 쓰는 설정은 빌드가 같은 값으로 config.json을 만들므로 그대로 둔다. 위험·한계: vitest 안에서 CI 빌드 식별값을 검사하려는 시험은 값을 직접 넣어야 한다(지금은 없다). capability e2e(FE-GATE-008)는 돌리지 않았다. 검증: VITE_BUILD_ID를 준 채로 세 component 시험이 통과한다. --- playwright.capabilities.config.ts | 5 +++++ playwright.dev.config.ts | 5 +++++ vitest.config.ts | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/playwright.capabilities.config.ts b/playwright.capabilities.config.ts index b62dc4b..7097233 100644 --- a/playwright.capabilities.config.ts +++ b/playwright.capabilities.config.ts @@ -30,6 +30,11 @@ export default defineConfig({ "corepack pnpm dev --host 127.0.0.1 --port 4174", url: "http://127.0.0.1:4174", reuseExistingServer: false, + // Template af312dee. The dev server serves public/config.json, the local + // profile, whose BUILD_ID is local-build. CI sets VITE_BUILD_ID for the whole + // workflow; built into the dev bundle it makes every page a rolling-release + // mismatch that reloads once and then fails closed (CONFIG_BUILD_MISMATCH). + env: { VITE_BUILD_ID: "local-build", VITE_COMMIT_SHA: "local" }, }, projects: [ { diff --git a/playwright.dev.config.ts b/playwright.dev.config.ts index 95cc321..2fc83fe 100644 --- a/playwright.dev.config.ts +++ b/playwright.dev.config.ts @@ -12,5 +12,10 @@ export default defineConfig({ command: "corepack pnpm dev --host 127.0.0.1", url: "http://127.0.0.1:5173", reuseExistingServer: true, + // Template af312dee. The dev server serves public/config.json, the local + // profile, whose BUILD_ID is local-build. CI sets VITE_BUILD_ID for the whole + // workflow; built into the dev bundle it makes every page a rolling-release + // mismatch that reloads once and then fails closed (CONFIG_BUILD_MISMATCH). + env: { VITE_BUILD_ID: "local-build", VITE_COMMIT_SHA: "local" }, }, }); diff --git a/vitest.config.ts b/vitest.config.ts index ba3e421..b7b293e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,6 +6,14 @@ import { configDefaults, defineConfig } from "vitest/config"; // protects direct `vitest` invocations as well. process.env.NODE_ENV = "test"; +// Template af312dee. CI sets VITE_BUILD_ID and VITE_COMMIT_SHA for the whole +// workflow (.gitea/workflows/quality-gates.yml). Vite builds them into +// `import.meta.env`, so a test that composes the app against its local-build +// fixture release saw CONFIG_BUILD_MISMATCH in CI and passed everywhere else. +// Tests start with the local build identity. +delete process.env["VITE_BUILD_ID"]; +delete process.env["VITE_COMMIT_SHA"]; + // tests/system needs CI-runner host facilities (see docs/testing/taxonomy.md). // It runs only when a caller names it, as `test:system` does; a bare `vitest` // run leaves it out. -- 2.54.0 From f14ff71c9b8c570947abe28c29c2d260ab6bdaa0 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 12:50:28 +0900 Subject: [PATCH 5/6] =?UTF-8?q?fix(test):=20=EB=82=A1=EC=9D=80=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EB=91=98=EC=9D=84=20=EC=A7=80=EA=B8=88=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=EC=97=90=20=EB=A7=9E=EC=B6=98=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 앞 단계 시험이 실패해 가려져 있던 실패 둘이다. 둘 다 main에서도 같다. - request-fanout(아키텍처 시험)이 collect-catalog.ts의 반복 안 gateway.getCatalog()를 행마다 요청하는 N+1로 잡는다. 이것은 다음 요청이 앞 응답의 nextCursor에 기대는 커서 페이지 넘기기라 묶을 수 없다. 검사기가 정한 방식대로 그 줄에 `// fanout-reviewed: <이유>`를 단다. - release-manifest 시험이 TechLog Studio 계약 버전을 3.0.0으로 기대한다. 계약(contracts/studio/canonical-source.json)은 3.1.0이다. 시험은 일부러 값을 글자 그대로 두는 설계라 그 값을 3.1.0으로 맞춘다. 검증: 두 시험 파일이 통과한다(고치기 전 각 1건 실패, main에서도 같음). --- src/features/tech-log/application/collect-catalog.ts | 2 +- tests/runtime-schema/release-manifest.test.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/tech-log/application/collect-catalog.ts b/src/features/tech-log/application/collect-catalog.ts index d284639..0a71f24 100644 --- a/src/features/tech-log/application/collect-catalog.ts +++ b/src/features/tech-log/application/collect-catalog.ts @@ -27,7 +27,7 @@ export async function collectCatalog( const items: CatalogPage["items"][number][] = []; let cursor: string | undefined; for (let page = 0; page < MAX_PAGES; page += 1) { - const result: CatalogPage = await gateway.getCatalog( + const result: CatalogPage = await gateway.getCatalog( // fanout-reviewed: cursor pagination; each page needs the previous page's nextCursor, so the calls cannot be batched { ...query, limit: PAGE_SIZE, ...(cursor === undefined ? {} : { cursor }) }, options, ); diff --git a/tests/runtime-schema/release-manifest.test.ts b/tests/runtime-schema/release-manifest.test.ts index ff2a1c1..0b13768 100644 --- a/tests/runtime-schema/release-manifest.test.ts +++ b/tests/runtime-schema/release-manifest.test.ts @@ -114,7 +114,9 @@ describe("expected contract set composition", () => { (entry) => entry.packageId === "@tech-log/studio-contract", ); expect(techLog).toBeTruthy(); - expect(techLog?.version).toBe("3.0.0"); + // src/features/tech-log/contracts/studio/canonical-source.json (3.1.0 since + // the Studio contract gained project publication and home ordering). + expect(techLog?.version).toBe("3.1.0"); }); }); -- 2.54.0 From 953381a99831adfe2f0bf9ad2bd5ebb38bbc8020 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 13:10:47 +0900 Subject: [PATCH 6/6] =?UTF-8?q?fix(ci):=20coverage=20=EC=A6=9D=EA=B1=B0=20?= =?UTF-8?q?=EA=B2=80=EC=82=AC=EA=B0=80=20summary=EC=9D=98=20branchesTrue?= =?UTF-8?q?=EB=A5=BC=20=EB=B0=9B=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FE-GATE-005의 증거 검사(scripts/lib/ci-artifact-validator.ts)는 coverage-summary.json 항목마다 lines·statements·functions·branches만 허용하는 .strict() schema를 쓴다. istanbul-lib-coverage 3.2.2는 summary에 branchesTrue를 넣으므로, 시험이 모두 통과해도 증거 단계에서 게이트가 "Unrecognized key: branchesTrue"로 실패한다. 같은 파일을 읽는 risk-coverage 검사는 이 키를 허용해 두 검사기가 갈라져 있었다. 템플릿 bca5fc27을 그대로 가져온다(git apply, 충돌 없음). 키 목록을 scripts/lib/coverage-summary-metrics.ts 한 곳에 두고 두 검사기가 같이 쓴다. 평가하는 네 지표와 보고기가 더할 수 있는 선택 지표(branchesTrue)를 나누고, 선택 지표도 counter 형식은 그대로 검사한다. 위험·한계: 다른 모르는 키는 여전히 거절한다(의도). 검증: 템플릿 커밋의 tests/unit/coverage-summary-artifact.test.ts를 같이 가져왔다. 결과는 이 브랜치 전체 게이트 실행에 적는다. --- scripts/lib/ci-artifact-validator.ts | 17 +++-- scripts/lib/coverage-summary-metrics.ts | 24 +++++++ scripts/lib/risk-coverage.ts | 20 +++--- tests/unit/coverage-summary-artifact.test.ts | 66 ++++++++++++++++++++ 4 files changed, 112 insertions(+), 15 deletions(-) create mode 100644 scripts/lib/coverage-summary-metrics.ts create mode 100644 tests/unit/coverage-summary-artifact.test.ts diff --git a/scripts/lib/ci-artifact-validator.ts b/scripts/lib/ci-artifact-validator.ts index 2c30946..c39cd78 100644 --- a/scripts/lib/ci-artifact-validator.ts +++ b/scripts/lib/ci-artifact-validator.ts @@ -9,6 +9,10 @@ import type { CiGateArtifactSchema, } from "../contracts/ci-gates.ts"; import { ciContractReportSchema } from "./ci-contract-report.ts"; +import { + COVERAGE_SUMMARY_METRICS, + COVERAGE_SUMMARY_OPTIONAL_METRICS, +} from "./coverage-summary-metrics.ts"; import { architectureDependencyReportArtifactSchema, automatedA11yArtifactSchema, @@ -76,16 +80,17 @@ const coverageCounterSchema = z context.addIssue({ code: "custom", path: ["pct"], message: "coverage pct is not exact" }); } }); +// 1103/12-09. The key list is shared with the risk coverage gate, which reads +// the same file; this schema used to refuse the `branchesTrue` the reporter +// always writes. const coverageSummarySchema = z .record( z.string(), z - .object({ - lines: coverageCounterSchema, - statements: coverageCounterSchema, - functions: coverageCounterSchema, - branches: coverageCounterSchema, - }) + .object(Object.fromEntries([ + ...COVERAGE_SUMMARY_METRICS.map((metric) => [metric, coverageCounterSchema]), + ...COVERAGE_SUMMARY_OPTIONAL_METRICS.map((metric) => [metric, coverageCounterSchema.optional()]), + ])) .strict(), ) .refine((value) => "total" in value, "coverage summary lacks total"); diff --git a/scripts/lib/coverage-summary-metrics.ts b/scripts/lib/coverage-summary-metrics.ts new file mode 100644 index 0000000..9579bb3 --- /dev/null +++ b/scripts/lib/coverage-summary-metrics.ts @@ -0,0 +1,24 @@ +/** + * The keys of one entry in Vitest's `coverage-summary.json`. Two readers check + * that file: the CI evidence validator (ci-artifact-validator.ts) and the risk + * coverage gate (risk-coverage.ts). They kept separate lists, and the + * validator refused `branchesTrue` while the gate accepted it, so FE-GATE-005 + * failed at its evidence step after every test had passed (1103/12-09). + */ + +/** The four metrics both readers evaluate. */ +export const COVERAGE_SUMMARY_METRICS = Object.freeze([ + "lines", + "statements", + "functions", + "branches", +] as const); + +/** + * Keys the reporter may add. istanbul-lib-coverage 3.2.2 puts `branchesTrue` + * in every blank summary, so the total always carries it. Each is still + * checked as a counter; neither reader evaluates it. + */ +export const COVERAGE_SUMMARY_OPTIONAL_METRICS = Object.freeze([ + "branchesTrue", +] as const); diff --git a/scripts/lib/risk-coverage.ts b/scripts/lib/risk-coverage.ts index c0b6bc2..230da53 100644 --- a/scripts/lib/risk-coverage.ts +++ b/scripts/lib/risk-coverage.ts @@ -8,14 +8,12 @@ import { import path from "node:path"; import babelParser from "@babel/eslint-parser"; +import { + COVERAGE_SUMMARY_METRICS as coverageMetrics, + COVERAGE_SUMMARY_OPTIONAL_METRICS, +} from "./coverage-summary-metrics.ts"; import { normalizeRepositoryRelativePath } from "./repository-file-inventory.ts"; -const coverageMetrics = [ - "lines", - "statements", - "functions", - "branches", -] as const; const teamIdPattern = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u; const maximumWaiverDurationMs = 90 * 24 * 60 * 60 * 1_000; @@ -643,16 +641,20 @@ function parseCoverageCounter(value: unknown, label: string): CoverageCounter { function parseCoverageMetrics(value: unknown, label: string): CoverageMetrics { if (!isRecord(value)) throw new TypeError(`${label} must be an object`); + const optionalMetrics: readonly string[] = COVERAGE_SUMMARY_OPTIONAL_METRICS; const unknownMetrics = Object.keys(value).filter( - (metric) => metric !== "branchesTrue" && !coverageMetrics.includes(metric as CoverageMetric), + (metric) => + !optionalMetrics.includes(metric) && !coverageMetrics.includes(metric as CoverageMetric), ); if (unknownMetrics.length > 0) { throw new TypeError( `${label} has unknown coverage metric keys: ${unknownMetrics.sort().join(", ")}`, ); } - if (value.branchesTrue !== undefined) { - parseCoverageCounter(value.branchesTrue, `${label}.branchesTrue`); + for (const metric of optionalMetrics) { + if (value[metric] !== undefined) { + parseCoverageCounter(value[metric], `${label}.${metric}`); + } } const parsed = {} as Record; for (const metric of coverageMetrics) { diff --git a/tests/unit/coverage-summary-artifact.test.ts b/tests/unit/coverage-summary-artifact.test.ts new file mode 100644 index 0000000..960c3c5 --- /dev/null +++ b/tests/unit/coverage-summary-artifact.test.ts @@ -0,0 +1,66 @@ +import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; + +import { afterEach, describe, expect, it } from "vitest"; + +import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts"; +import { validateCiArtifact } from "../../scripts/lib/ci-artifact-validator.ts"; + +const SUMMARY_PATH = "artifacts/tests/coverage/coverage-summary.json"; +const roots: string[] = []; + +afterEach(async () => { + await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true }))); +}); + +const counter = (total: number, covered = total) => ({ + total, + covered, + skipped: 0, + pct: total === 0 ? 100 : Math.floor((covered / total) * 10_000) / 100, +}); +const metrics = { + lines: counter(4), + statements: counter(4), + functions: counter(1), + branches: counter(2), +}; + +async function validateSummary(summary: unknown): Promise { + const contract = await loadCiGateContract(process.cwd()); + const artifact = contract.artifacts.find((entry) => entry.path === SUMMARY_PATH); + const schema = contract.artifactSchemas.find((entry) => entry.id === artifact?.schemaId); + if (!artifact || !schema) throw new Error(`the CI contract no longer declares ${SUMMARY_PATH}`); + const root = await mkdtemp(path.join(tmpdir(), "coverage-summary-artifact-")); + roots.push(root); + await mkdir(path.join(root, path.dirname(SUMMARY_PATH)), { recursive: true }); + await writeFile(path.join(root, SUMMARY_PATH), `${JSON.stringify(summary)}\n`); + await validateCiArtifact({ root, artifact, schema }); +} + +// 1103/12-09. istanbul-lib-coverage 3.2.2 puts `branchesTrue` in every blank +// summary, so the json-summary total always carries it. The CI evidence check +// refused the key that the risk-coverage gate reading the same file accepts, +// and FE-GATE-005 failed after every test had passed. +describe("coverage summary evidence (1103/12-09)", () => { + it("accepts the summary the coverage reporter writes, with branchesTrue", async () => { + await expect(validateSummary({ + total: { ...metrics, branchesTrue: counter(0) }, + "src/a.ts": metrics, + })).resolves.toBeUndefined(); + }); + + it("accepts a summary without branchesTrue", async () => { + await expect(validateSummary({ total: metrics, "src/a.ts": metrics })) + .resolves.toBeUndefined(); + }); + + it("still validates branchesTrue as a counter and refuses other keys", async () => { + await expect(validateSummary({ + total: { ...metrics, branchesTrue: { ...counter(0), pct: 0 } }, + })).rejects.toThrow(/pct/u); + await expect(validateSummary({ total: { ...metrics, branchesFalse: counter(0) } })) + .rejects.toThrow(/branchesFalse/u); + }); +}); -- 2.54.0