Merge remote-tracking branch 'origin/main' into fix/r9-living-docs-sync
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Canceled after 0s
frontend-quality-gates / merge / static checks (pull_request) Canceled after 0s
frontend-quality-gates / merge / tests (pull_request) Canceled after 0s
frontend-quality-gates / merge / browser tests (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Canceled after 0s
frontend-quality-gates / external-vulnerability-provider (pull_request) Canceled after 0s
frontend-quality-gates / external-provenance-provider (pull_request) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (pull_request) Canceled after 0s

# Conflicts:
#	AGENTS.md
#	docs/work/reference/decisions.md
This commit is contained in:
DongHyeonka
2026-11-13 04:30:07 +09:00
67 changed files with 1437 additions and 701 deletions
+1 -1
View File
@@ -19,6 +19,6 @@ description: 이 프론트 repo에서 pnpm·게이트·테스트·빌드·브라
- 먼저 무엇을 돌릴지만 보려면 `--dry-run`.
4. 스크립트가 하는 일: 지금 트리를 패치로 보내고, desktop 공유 checkout에서 새 worktree를 만들어 같은 트리인지 해시로 보고, 깨끗한 커밋 하나로 만들어 오프라인 설치 뒤 `flock /tmp/claude-gates/heavy.lock` 아래 CI env(`CI=true` 등)로 돌린다. 공유 checkout의 브랜치와 stash는 건드리지 않는다. push하지 않는다.
5. 결과를 읽는다: desktop `/tmp/claude-gates/<작업 이름>/summary.txt`(첫 줄이 트리 해시), 게이트별 로그, `gate-artifacts/`, `status-after.txt`(비어 있어야 한다).
6. FE-GATE-013은 desktop에서 호스트 제약(user namespace)으로 실패한다. `parts`로 뒤 명령 결과를 함께 적는다. 실패가 그 제약 하나뿐이고 뒤 명령이 모두 rc=0일 때만 merge 판정에서 뺀다(`docs/work/reference/gates.md` 3절).
6. FE-GATE-013은 `scripts/verify.sh`가 시스템 컨테이너(`scripts/run-in-system-container.sh`) 안에서 돌린다. 다른 게이트와 같이 rc로 적는다. 컨테이너를 띄울 수 없는 호스트에서만 `VERIFY_HOST_ENVIRONMENT=off`로 호스트에서 돌리고, 실패가 user namespace 제약 하나뿐이고 뒤 명령이 모두 rc=0일 때 merge 판정에서 뺀다(`docs/work/reference/gates.md` 3절).
7. 실패하면 기준 커밋에서도 돌려 이번 변경 몫인지 가린다. 다시 돌려 통과한 결과를 "통과"로 쓰지 않는다.
8. 보고에는 단계·게이트, rc, 시간, 핵심 숫자, 직전 부하, 트리 해시, 로그 경로를 적는다(`docs/work/operate.md` 8절 표).
+2 -2
View File
@@ -39,7 +39,7 @@ paths:
7. 같은 사실(스키마 메타, 레지스트리 행, 허용 키, 빌드 입력 목록, 저장 키)을 원본과 따로 손으로 적는다. 원본에서 뽑거나 대조 시험을 같이 둔다. — `docs/work/reference/structure.md` 8절, 결함 패턴 S1
8. 제품마다 다른 것을 템플릿 소유 파일에 넣는다. 동기화마다 같은 파일이 충돌한다. 제품 소유 자리(`src/bootstrap/product-composition.ts`, `src/contracts/product-contracts.ts`, `config/ci/product-gates.json`)에 둔다. — `docs/work/reference/structure.md` 10절, 결함 패턴 S4
9. adapter 파일을 더하거나 옮기고 `docs/reviews/adapters/INVENTORY.md`를 같은 커밋에서 고치지 않는다(`check:adapter-inventory` 실패). 최상위 `src/` 폴더를 바꾸고 `docs/architecture/layers.md` 표와 세 문서의 같은 문장을 고치지 않는다(`verify:documentation` 실패). — `docs/work/reference/structure.md` 3절
10. 지우거나 옮긴 코드가 지키던 시험·검사를 같이 잃는다. 지우기 전에 그 코드를 읽는 시험·검사를 `git grep`으로 찾는다. 지울 수 있다고 한 단위는 지워도 FE-GATE-020이 통과해야 한다. — `docs/work/reference/structure.md` 9·12절, 결함 패턴 T10·G11
10. 지우거나 옮긴 코드가 지키던 시험·검사를 같이 잃는다. 지우기 전에 그 코드를 읽는 시험·검사를 `git grep`으로 찾는다. 지울 수 있다고 한 단위는 지워도 FE-GATE-020(기능)과 FE-GATE-030(선택 runtime, main 단계)이 통과해야 한다. — `docs/work/reference/structure.md` 9·12절, 결함 패턴 T10·G11
11. 공개 포트·배럴 표면의 시그니처를 바꾼다. 추가만 하고, 깨야 하면 결정 표에 적고 BREAKING으로 커밋한다. 이름은 새 이름을 내고 옛 이름을 한 릴리스 동안 `@deprecated` 별칭으로 남긴다. — `docs/work/reference/structure.md` 9절
12. `src/bootstrap`에 업무 규칙이나 페이지 흐름을 둔다. 판정·정책은 `src/application`·`src/platform`·기능 폴더다. — `src/bootstrap/AGENTS.md`
@@ -62,7 +62,7 @@ pnpm은 desktop에서만 돈다(`docs/work/operate.md` 4.1절). 노트북에서
- 경계 전체: `scripts/verify.sh gate FE-GATE-010`(`check:architecture`, `check:adapter-inventory`, `check:registries`, `check:request-fanout`, `check:app-build-input`, `check:browser-file-storage-boundaries`, `check:realtime-boundaries`)
- 규칙을 고쳤으면 `check:architecture`가 함께 돌리는 그래프 fixture(`tests/fixtures/architecture/dependency-graph/barrel` 등)가 거절과 허용을 둘 다 고정하는지 본다. 규칙을 꺼 본 사본에서 그 fixture 검사가 실패해야 한다. ESLint 계층 패턴은 `tests/unit/architecture-lint-fixtures.test.ts`(FE-GATE-005)가 같은 일을 한다.
- 지울 수 있는 단위·구조를 바꿨으면: `scripts/verify.sh gate FE-GATE-020`(14~21분, 드릴 복사 목록은 `scripts/lib/removal-fixture.ts`)
- 지울 수 있는 단위·구조를 바꿨으면: `scripts/verify.sh gate FE-GATE-020 FE-GATE-030`(합쳐 약 11분, 드릴 복사 목록은 `scripts/lib/removal-fixture.ts`). FE-GATE-030은 PR에서 돌지 않는다
- 최상위 폴더·문서 문장: `scripts/verify.sh script verify:documentation`
- 편집 직후 훅(N3)은 의심 import를 알리기만 한다. 그래프 전체(사이클)는 `check:architecture`만 본다.
+1 -1
View File
@@ -57,7 +57,7 @@ pnpm·브라우저는 desktop에서만 돈다(`docs/work/operate.md` 4.1절).
- 작업 중: `scripts/verify.sh exec -- node scripts/run-vitest.ts run <파일>`, 브라우저 spec 하나는 `scripts/verify.sh exec -- corepack pnpm exec playwright test <spec>`
- 층별 게이트: FE-GATE-004(runtime-schema), FE-GATE-005(unit·contract·coverage·scale pr), FE-GATE-006(component), FE-GATE-007(integration·HTTP 시나리오 증거·recipes), FE-GATE-008(e2e·browser-capabilities·storybook·visual·시험 증거), FE-GATE-009(a11y). 예: `scripts/verify.sh gate FE-GATE-006`
- FE-GATE-013(system)은 desktop에서 호스트 제약(user namespace)으로 실패한다. `scripts/verify.sh parts FE-GATE-013`으로 뒤 명령까지 돌리고 `docs/work/reference/gates.md` 3절 문구로 적는다.
- FE-GATE-013(system)은 `scripts/verify.sh`가 시스템 컨테이너(`scripts/run-in-system-container.sh`) 안에서 돌린다. 컨테이너를 띄울 수 없는 호스트에서만 `docs/work/reference/gates.md` 3절 조건과 문구로 적는다.
- 시험 기반 자체(음성 fixture가 정해진 오류로 실패해야 통과, `check:ci:gating`): `scripts/verify.sh gate FE-GATE-029`
- 커밋 전 묶음은 `docs/work/reference/gates.md` 2절 표, merge 가능 판정은 `scripts/verify.sh merge`.
- 흔들림을 고친 뒤 같은 조건 반복 실행(예: 30회)으로 실패 0과 횟수를 적는다. — `docs/work/reference/testing.md` 5절
+15 -4
View File
@@ -24,6 +24,10 @@ on:
permissions:
contents: read
concurrency:
group: frontend-quality-gates-${{ gitea.event_name }}-${{ gitea.ref }}-${{ inputs.stage }}
cancel-in-progress: ${{ gitea.event_name != 'workflow_dispatch' }}
env:
CI: "true"
VITE_BUILD_ID: "gitea-${{ gitea.run_id }}-${{ gitea.run_attempt }}"
@@ -106,7 +110,7 @@ jobs:
run: corepack pnpm ci:gate -- FE-GATE-007
- name: "FE-GATE-013 / security"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-013
run: scripts/run-in-system-container.sh corepack pnpm ci:gate -- FE-GATE-013
- name: "FE-GATE-020 / removability"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-020
@@ -123,6 +127,10 @@ jobs:
if: ${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
container:
image: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07"
env:
CI_RUNNER_IMAGE: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07"
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
@@ -134,9 +142,9 @@ jobs:
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: Install Playwright browsers
- name: Install visual-test fonts
run: |
corepack pnpm exec playwright install --with-deps chromium firefox webkit
$(command -v sudo || true) apt-get update
$(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
- name: "FE-GATE-008 / e2e"
if: ${{ !cancelled() }}
@@ -574,7 +582,7 @@ jobs:
if-no-files-found: error
main_gate:
name: "main / checker self-tests"
name: "main / self-tests and removal drills"
if: ${{ (gitea.event_name == 'push' && startsWith(gitea.ref, 'refs/heads/')) || (gitea.event_name == 'workflow_dispatch' && inputs.stage == 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
@@ -592,6 +600,9 @@ jobs:
- name: "FE-GATE-029 / checker-self-tests"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-029
- name: "FE-GATE-030 / optional-removability"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-030
- name: Upload main gate evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
+1 -1
View File
@@ -25,7 +25,7 @@
## 검증
- 진입점은 `scripts/verify.sh <단계>`다. 단계는 `config/ci/gates.json`의 stage id(`merge` 등), 게이트 하나는 `scripts/verify.sh gate FE-GATE-005`(안에서 `corepack pnpm ci:gate FE-GATE-005`). pnpm 단계는 desktop으로 옮겨 돈다.
- "merge 가능"은 merge 단계 게이트 전부를 `CI=true`로 돌려 통과한 것이다. 골라 돌린 결과로 말하지 않는다. desktop의 FE-GATE-013은 `docs/work/reference/gates.md` 3절 문구로 적는다.
- "merge 가능"은 merge 단계 게이트 전부를 `CI=true`로 돌려 통과한 것이다. 골라 돌린 결과로 말하지 않는다. FE-GATE-013은 `scripts/run-in-system-container.sh` 안에서 돈다(`docs/work/reference/gates.md` 3절).
- 문서·지침을 고쳤으면 `scripts/verify.sh docs`(노트북)와 desktop `scripts/verify.sh script verify:documentation`.
## 일하는 방식
+37
View File
@@ -11,6 +11,43 @@
- 괄호 안 ID는 리뷰 발견 ID다. `MMDD/NN-MM`으로 적는다. `MMDD`는 리뷰 폴더 `docs/reviews/YYYY-MM-DD-maturity-review/`의 월일이고, 근거와 재현 조건은 그 폴더의 영역 문서에 있다. 복사한 프로젝트가 README대로 `docs/reviews/`를 지웠다면 이 폴더와 `PRODUCT.md`는 원본 템플릿 repo에서 찾는다. 라운드마다 `NN-MM`을 새로 매기므로 같은 `14-02`라도 라운드가 다르면 다른 결함이다. `F-N`은 그 라운드 `FOLLOW-UP.md`의 ID다. 리뷰 README의 절은 `MMDD README N.N`으로 적고 다시 돌린 항목은 그 뒤에 `X2`처럼 번호를 붙인다. 영역 문서가 따로 매긴 ID는 `MMDD NN 영역 P-NN-NN`, 짝 백엔드 리뷰의 ID는 `백엔드 리뷰 MMDD/NN-MM`으로 적는다. `tests/unit/changelog-review-ids.test.ts`가 라운드 없는 ID와 이 꼴을 벗어난 참조를 막는다.
- 0.2.0의 커밋 해시는 브랜치 `fix/maturity-review-2026-09-25`에서 만들었고, `main`에서도 같은 해시로 찾을 수 있다(2026-11-03에 52개 모두 확인). 그 뒤 절은 절 머리에 범위(기준 커밋과 브랜치)를 적고, 그 절의 해시는 모두 그 범위에 있다. 통합에서 해시를 다시 쓴 뒤(fixup 접기, rebase)에는 절의 해시와 범위 커밋 본문의 해시를 `git merge-base --is-ancestor <해시> <브랜치 끝>`으로 하나씩 대조하고, 결과를 그 라운드 리뷰 README의 조치 절에 적는다. 1105 통합은 이 대조를 하지 않아, 올린 커밋 `287dc6f`의 본문이 다시 짓기 전 해시 둘을 가리킨다. 맞는 해시는 그 라운드 리뷰 README의 D7 행에 있다 (1106/14-02, 1105 README 16.2). 0.2.0의 커밋 제목은 라운드 없이 ID만 적었다(`git log --grep '03-03'`).
## 미출시 — `db6a6eb6` → CI를 runner에서 초록으로, merge 시간 줄이기
Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 않고 같은 시험을 두 번 도는 곳과 job마다 같은 것을 내려받는 곳을 없앤다. 제품 코드는 바뀌지 않는다.
### 먼저 할 일
- FE-GATE-013은 `scripts/run-in-system-container.sh`가 띄우는 privileged systemd 컨테이너 안에서 돈다. 자기 runner가 job에서 Docker로 privileged 컨테이너를 띄울 수 없으면 이 게이트가 실패한다. 그런 runner면 `docs/operations/ci-quality-gates.md` FE-GATE-013 절의 호스트 조건을 갖춘 runner에서 돌린다.
- merge / browser tests job이 Playwright 공식 이미지(`config/ci/gates.json`의 `browser-install.image`, digest 고정)에서 돈다. `@playwright/test`를 올릴 때 이 digest도 같은 버전으로 바꾼다(`tests/unit/ci-browser-image.test.ts`가 막는다).
- devDependencies에서 `dependency-cruiser`가 빠진다. 그 CLI를 따로 쓰고 있었으면 다시 더한다.
- 선택 runtime 제거 드릴 셋이 merge의 FE-GATE-020에서 main 단계의 새 게이트 FE-GATE-030으로 옮는다. main job 이름이 `main / self-tests and removal drills`로 바뀐다. 그 이름을 필수 검사로 걸었으면 바꾼다. 선택 runtime을 바꾸는 PR은 `scripts/verify.sh gate FE-GATE-030`을 직접 돌린다.
### 보안·계약 변경
| 표시 | 변경 | 영향 경로 | 커밋 |
| --- | --- | --- | --- |
| [계약] | 게이트 필드 `hostEnvironment`(`"system-container"`)를 더한다. 생성기와 `scripts/verify.sh`가 그 게이트를 `scripts/run-in-system-container.sh`로 감싸고, 실행 검사는 계약이 정한 접두어로 돈 줄만 센다. FE-GATE-013에 준다 | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `scripts/generate-ci-workflow.ts`, `scripts/verify.sh`, `scripts/run-in-system-container.sh`, `config/ci/system-container.Dockerfile` | `1d3eb901` |
| [계약] | 게이트 FE-GATE-030 `optional-removability`(main 단계)를 더하고 FE-GATE-020에서 선택 runtime 제거 드릴 셋을 옮긴다. 정규 게이트 ID는 001..030, MAIN_READY는 029·030, 계약 보고서 `gateCount`는 29다(소유자 결정 2026-11-12) | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `scripts/lib/promotion-readiness.ts`, `scripts/lib/ci-contract-report.ts`, `scripts/lib/feature-scaffold-drill.ts` | `8de1403b` |
| [계약] | `browser-install` 단계에 `image`(Playwright 레지스트리 noble 태그 + digest)를 더한다. 생성기는 그 job의 container와 job env `CI_RUNNER_IMAGE`로 그리고, 단계는 글꼴만 설치한다. gate-sequence job에만 둔다 | 같은 파일, `tests/unit/ci-browser-image.test.ts` | `92abfd20` |
### 그 밖의 변경
| 변경 | 영향 경로 | 커밋 |
| --- | --- | --- |
| `fixture-node-modules` 시험이 「CI 아님」 설치를 `CI=false`로 흉내 낸다. runner의 벤더 변수(`GITEA_ACTIONS` 등) 때문에 FE-GATE-005·020이 runner에서만 실패했다 | `tests/unit/fixture-node-modules.test.ts` | `ddfcb6f6` |
| `scripts/verify.sh parts`가 게이트 명령의 `args`를 넘긴다 | `scripts/verify.sh`, `scripts/tests/test_verify.py` | `79a225b6` |
| `check:browser-file-storage-boundaries`가 fixture마다 eslint를 띄우지 않고 ESLint API 한 번으로 같은 판정을 한다 | `scripts/check-browser-file-storage-boundaries.ts` | `0d8e4f5a` |
| FE-GATE-020 드릴이 한 복사본에서 같은 시험 파일을 두 번 돌지 않는다: scaffold 드릴은 `test:coverage`가 도는 plain suite를 빼고, feature-removal은 `test:all` 대신 `test:coverage` 밖에 남는 suite만 더 돈다 | `scripts/lib/feature-scaffold-drill.ts`, `scripts/test-sample-removal.ts`, `tests/unit/removal-drill-test-paths.test.ts` | `b4210753` |
| 쓰지 않는 `dependency-cruiser`를 지우고 의존성 기준선을 다시 승인한다 | `package.json`, `pnpm-lock.yaml`, `config/security/dependency-baseline*.json` | `66138440` |
| vitest setup이 DOM이 있는 시험 파일에만 Testing Library를 불러온다 | `tests/setup.ts` | `1f09c1cc` |
| 같은 PR·브랜치에 새 push가 오면 workflow `concurrency`가 앞 run을 취소한다. 수동 실행은 ref·stage마다 group이 따로이고 돌고 있는 run을 취소하지 않는다 | `scripts/generate-ci-workflow.ts`, `.gitea/workflows/quality-gates.yml` | `2f5eb2b4` |
| coverage include·exclude를 저장소 루트로 시작하는 패턴으로 바꾼다. vitest가 패턴을 절대 경로 어디에서나 맞춰, 이름이 `src`로 끝나는 폴더에 둔 checkout에서 루트 파일이 coverage에 들어가 risk-coverage가 실패했다 | `vitest.config.ts`, `scripts/lib/coverage-scope.ts`, `scripts/lib/v8-coverage-counter-semantics.ts` | `543518ad` |
| 위험 커버리지 모듈 목록이 `@babel/core`로 파싱하고 기본 fs를 동기로 쓴다. 판정과 검사 순서는 같다 | `scripts/lib/risk-coverage.ts` | `0bb1f0af` |
| `generateArtifactSchemas`가 writer를 받는다. 스키마 생성 시험은 fsync 없는 writer로 임시 폴더에 쓴다 | `scripts/generate-artifact-schemas.ts`, `tests/unit/json-schema.test.ts` | `198e9856` |
| HTTP 실행기의 deadline 분류 시험이 가짜 시계로 대기 지점에서 deadline을 낸다. 실제 30ms deadline이 부하에서 backoff 전에 지나 TIMEOUT 대신 전송 실패로 끝났다 | `tests/unit/http-execution-v3.test.ts` | `37a85004` |
| 위험 커버리지가 `"use strict"` 밖의 지시문(`"use client"` 등)을 문장으로 센다. V8 coverage가 그렇게 센다(`check:v8-coverage-counter-semantics` fixture에 지시문 모듈 둘) | `scripts/lib/risk-coverage.ts`, `scripts/lib/v8-coverage-counter-semantics.ts` | `0c3c9d33` |
| e2e fixture build를 브라우저 project마다가 아니라 run에 한 번 만든다. global setup이 공유 폴더를 만들고 처음 닿은 worker만 build한다. 자기 spec에서 `prepareServiceWorkerBuilds`를 부르면 `key`를 준다 | `playwright.config.ts`, `tests/e2e/support/shared-fixture-builds.ts`, `tests/e2e/support/fixture-builds.ts`, `tests/e2e/support/service-worker-builds.ts` | `c6d7f43a` |
## 미출시 — `8327e221` → 하네스와 작업 매뉴얼
2026-11-07 소유자가 정한 Claude Code 작업 환경(하네스)을 백엔드 템플릿과 같은 방식으로 둔다(design-docs `harness/01-harness-design.md` 13절). 루트 지침 `AGENTS.md`(정본)와 `CLAUDE.md`(가져오기), `.claude/`(규칙·스킬·서브에이전트·권한·훅), 작업 매뉴얼 `docs/work/`, 검증 진입점 `scripts/verify.sh`, 장부 `docs/ledger/`다. 제품 코드와 게이트 동작은 바뀌지 않는다.
+1 -1
View File
@@ -207,7 +207,7 @@ done
```
- FE-GATE-008과 FE-GATE-009는 Playwright 브라우저가 필요하다. FE-GATE-012는 먼저 앱을 빌드한다.
- FE-GATE-013은 bubblewrap이 비특권 user·network namespace를 만들 수 있는 Linux 호스트가 필요하다. Ubuntu 23.10 이후는 기본으로 거절한다. 첫 단계가 그렇게 알려 주고, 고치는 법은 `docs/operations/ci-quality-gates.md`에 있다.
- FE-GATE-013은 systemd와 bubblewrap이 있는 호스트가 필요해 `scripts/run-in-system-container.sh`가 띄우는 privileged systemd 컨테이너 안에서 돈다. Docker가 그런 컨테이너를 띄울 수 있어야 한다. 위 반복문에서는 `scripts/run-in-system-container.sh corepack pnpm ci:gate -- FE-GATE-013`으로 돌린다. 자세한 조건은 `docs/operations/ci-quality-gates.md`에 있다.
- `config/ci/product-gates.json`에 적은 제품 검사(`PRODUCT-GATE-NNN`)는 workflow의 `product_merge_gate` job에서 돌고, release 단계가 그 job을 기다린다.
workflow처럼 돌리려면 workflow의 환경을 먼저 준다. `CI=true`이면 실행기와 release 빌드가 CI 빌드 식별값을 요구한다. 테스트가 사본으로 만드는 빌드(fixture 빌드, 시각 골든 빌드, 브라우저 시험의 dev 서버)는 이 값과 상관없이 로컬 빌드로 돈다(`scripts/lib/build-environment.ts`의 `localBuildEnvironment`). 깨끗한 clone에서 돌린다. `ci:gate`는 게이트의 첫 실패 명령에서 멈춘다.
+33 -13
View File
@@ -1574,6 +1574,12 @@
"path": "artifacts/quality/gates/FE-GATE-029.txt",
"schemaId": "text",
"production": "runner-generated"
},
{
"id": "artifact-artifacts-quality-gates-FE-GATE-030-txt",
"path": "artifacts/quality/gates/FE-GATE-030.txt",
"schemaId": "text",
"production": "runner-generated"
}
],
"gates": [
@@ -1802,7 +1808,8 @@
"hostRequirements": [
"Linux with executable /usr/bin/bwrap (with --size), /usr/bin/prlimit, /usr/bin/systemd-run, /usr/bin/systemctl and /usr/bin/tar, an active systemd user manager 254 or newer, and unified cgroup v2 with delegated memory, pids and cpu controllers",
"unprivileged user and network namespaces for bwrap (the provider sandbox runs bwrap --unshare-pid --unshare-ipc --unshare-uts --unshare-net); Ubuntu 23.10 and later refuse them while kernel.apparmor_restrict_unprivileged_userns=1 unless /usr/bin/bwrap has an AppArmor profile that allows userns; scripts/check-system-test-prerequisites.ts probes this before test:system runs"
]
],
"hostEnvironment": "system-container"
},
{
"id": "FE-GATE-014",
@@ -1879,18 +1886,12 @@
"name": "removability",
"commandIds": [
"test-sample-removal",
"test-feature-scaffold",
"test-optional-recipe-removal",
"test-browser-file-storage-removal",
"test-realtime-removal"
"test-feature-scaffold"
],
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-020-txt",
"evidenceArtifactIds": [
"artifact-artifacts-tests-sample-removal-xml",
"artifact-artifacts-tests-feature-scaffold-xml",
"artifact-artifacts-tests-optional-recipe-removal-xml",
"artifact-artifacts-tests-browser-file-storage-runtime-removal-xml",
"artifact-artifacts-tests-realtime-runtime-removal-xml"
"artifact-artifacts-tests-feature-scaffold-xml"
],
"retentionClassId": "merge-cycle"
},
@@ -2031,6 +2032,22 @@
"artifact-artifacts-security-supply-chain-provider-fixtures-json"
],
"retentionClassId": "merge-cycle"
},
{
"id": "FE-GATE-030",
"name": "optional-removability",
"commandIds": [
"test-optional-recipe-removal",
"test-browser-file-storage-removal",
"test-realtime-removal"
],
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-030-txt",
"evidenceArtifactIds": [
"artifact-artifacts-tests-optional-recipe-removal-xml",
"artifact-artifacts-tests-browser-file-storage-runtime-removal-xml",
"artifact-artifacts-tests-realtime-runtime-removal-xml"
],
"retentionClassId": "merge-cycle"
}
],
"stages": [
@@ -2107,7 +2124,8 @@
"readiness": "MAIN_READY",
"needs": [],
"gateIds": [
"FE-GATE-029"
"FE-GATE-029",
"FE-GATE-030"
]
}
],
@@ -2221,7 +2239,8 @@
"kind": "frozen-install"
},
{
"kind": "browser-install"
"kind": "browser-install",
"image": "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07"
},
{
"kind": "run-gate"
@@ -2858,13 +2877,14 @@
},
{
"id": "main_gate",
"displayName": "main / checker self-tests",
"displayName": "main / self-tests and removal drills",
"kind": "gate-sequence",
"needs": [],
"condition": "main",
"timeoutMinutes": 45,
"gateIds": [
"FE-GATE-029"
"FE-GATE-029",
"FE-GATE-030"
],
"browserGateIds": [],
"environment": [],
+16
View File
@@ -0,0 +1,16 @@
# The host FE-GATE-013 runs on (scripts/run-in-system-container.sh): systemd as
# PID 1 with a lingering root user manager, cgroup v2 delegation, bubblewrap and
# the tools the provider sandbox calls (config/ci/gates.json hostRequirements).
# Node and pnpm are not installed here: the script copies in the caller's own,
# so the gate runs with the same versions as the job that called it.
FROM docker.io/library/ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
bubblewrap ca-certificates dbus dbus-user-session git systemd systemd-sysv tar util-linux \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /var/lib/systemd/linger \
&& touch /var/lib/systemd/linger/root
STOPSIGNAL SIGRTMIN+3
CMD ["/sbin/init"]
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"snapshotDigest": "1be535686bed2315cc986f51b991b269c359ce1dca34d47faee6d35b0d57cfd3",
"snapshotDigest": "ddb6db119f9f57236cc293189e013f03232371d2f0b90dc363fba36e92e5717d",
"owner": "DongHyeonka",
"reason": "1103/13-03 dev-only advisory fixes: vite 8.1.6, vitest and coverage-v8 4.1.12, storybook 10.6.5, in-range updates of undici, brace-expansion, nanoid, source-map-js, postcss",
"approvedAt": "2026-11-04T13:27:48.076Z"
"reason": "remove the unused dev dependency dependency-cruiser (check:architecture replaced its CLI, which cannot read TypeScript 7; D-11)",
"approvedAt": "2026-11-11T14:48:22.848Z"
}
+3 -246
View File
@@ -1,9 +1,9 @@
{
"schemaVersion": 2,
"packageManager": "pnpm@11.17.0",
"lockfileSha256": "3a818cf0ea62509ded18f9989e0df6704eb1258b8caa9543f9b227fe91fb6d30",
"dependencyCount": 562,
"directDependencyCount": 35,
"lockfileSha256": "fe32c358ba14ea2294d9afa8655ba311944931dea338ae99a9524e1566ff5938",
"dependencyCount": 542,
"directDependencyCount": 34,
"dependencies": [
{
"name": "@adobe/css-tools",
@@ -3045,16 +3045,6 @@
"integrity": "sha512-6aN99yL695Hi9SuIk1oC88l9o0gmxL1nGWWQ/kNy81HigJ0FoaoTXpytCj6ItzgyCEwA9kF1wixsTuv5cjsgng==",
"dependencies": []
},
{
"name": "acorn-jsx-walk",
"version": "2.0.0",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-uuo6iJj4D4ygkdzd6jPtcxs8vZgDX9YFIkqczGImoypX2fQ4dVImmu3UzA4ynixCIMTrEOWW+95M2HuBaCEOVA==",
"dependencies": []
},
{
"name": "acorn-jsx",
"version": "5.3.2",
@@ -3067,30 +3057,6 @@
"acorn@8.17.0"
]
},
{
"name": "acorn-loose",
"version": "8.5.2",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-PPvV6g8UGMGgjrMu+n/f9E/tCSkNQ2Y97eFvuVdJfG11+xdIeDcLyNdC8SHcrHbRqkfwLASdplyR6B6sKM1U4A==",
"dependencies": [
"acorn@8.17.0"
]
},
{
"name": "acorn-walk",
"version": "8.3.5",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==",
"dependencies": [
"acorn@8.17.0"
]
},
{
"name": "acorn",
"version": "8.17.0",
@@ -3324,19 +3290,6 @@
"integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",
"dependencies": []
},
{
"name": "chalk",
"version": "4.1.2",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dependencies": [
"ansi-styles@4.3.0",
"supports-color@7.2.0"
]
},
{
"name": "check-error",
"version": "2.1.3",
@@ -3393,16 +3346,6 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dependencies": []
},
{
"name": "commander",
"version": "15.0.0",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==",
"dependencies": []
},
{
"name": "convert-source-map",
"version": "2.0.0",
@@ -3559,35 +3502,6 @@
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
"dependencies": []
},
{
"name": "dependency-cruiser",
"version": "18.1.0",
"direct": true,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-pbsH0gQ15BxXi97SCuMeVgsh8VzYpziGIVaMdnALbVu+TYjSZrW9/nOvsPU+NjHLmJSF9R1UijjoACq6Ne/ybQ==",
"dependencies": [
"acorn-jsx-walk@2.0.0",
"acorn-jsx@5.3.2",
"acorn-loose@8.5.2",
"acorn-walk@8.3.5",
"acorn@8.17.0",
"commander@15.0.0",
"enhanced-resolve@5.24.2",
"ignore@7.0.6",
"interpret@3.1.1",
"is-installed-globally@1.0.0",
"json5@2.2.3",
"picomatch@4.0.5",
"prompts@2.4.2",
"rechoir@0.8.0",
"safe-regex@2.1.1",
"semver@7.8.5",
"tsconfig-paths-webpack-plugin@4.2.0",
"watskeburt@6.0.0"
]
},
{
"name": "dequal",
"version": "2.0.3",
@@ -4164,18 +4078,6 @@
"path-scurry@2.0.2"
]
},
{
"name": "global-directory",
"version": "4.0.1",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==",
"dependencies": [
"ini@4.1.1"
]
},
{
"name": "globals",
"version": "17.7.0",
@@ -4295,16 +4197,6 @@
"integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
"dependencies": []
},
{
"name": "ignore",
"version": "7.0.6",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==",
"dependencies": []
},
{
"name": "import-meta-resolve",
"version": "4.2.0",
@@ -4335,26 +4227,6 @@
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dependencies": []
},
{
"name": "ini",
"version": "4.1.1",
"direct": false,
"scope": "development",
"optional": false,
"license": "ISC",
"integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==",
"dependencies": []
},
{
"name": "interpret",
"version": "3.1.1",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==",
"dependencies": []
},
{
"name": "is-core-module",
"version": "2.16.2",
@@ -4421,19 +4293,6 @@
"is-docker@3.0.0"
]
},
{
"name": "is-installed-globally",
"version": "1.0.0",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-K55T22lfpQ63N4KEN57jZUAaAYqYHEe8veb/TycJRk9DdSCLLcovXz/mL6mOnhQaZsQGwPhuFopdQIlqGSEjiQ==",
"dependencies": [
"global-directory@4.0.1",
"is-path-inside@4.0.0"
]
},
{
"name": "is-node-process",
"version": "1.2.0",
@@ -4444,16 +4303,6 @@
"integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==",
"dependencies": []
},
{
"name": "is-path-inside",
"version": "4.0.0",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==",
"dependencies": []
},
{
"name": "is-potential-custom-element-name",
"version": "1.0.1",
@@ -4657,16 +4506,6 @@
"json-buffer@3.0.1"
]
},
{
"name": "kleur",
"version": "3.0.3",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
"dependencies": []
},
{
"name": "levn",
"version": "0.4.1",
@@ -5498,19 +5337,6 @@
"react-is@17.0.2"
]
},
{
"name": "prompts",
"version": "2.4.2",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==",
"dependencies": [
"kleur@3.0.3",
"sisteransi@1.0.5"
]
},
{
"name": "punycode",
"version": "2.3.1",
@@ -5632,18 +5458,6 @@
"tslib@2.8.1"
]
},
{
"name": "rechoir",
"version": "0.8.0",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",
"dependencies": [
"resolve@1.22.12"
]
},
{
"name": "redent",
"version": "3.0.0",
@@ -5657,16 +5471,6 @@
"strip-indent@3.0.0"
]
},
{
"name": "regexp-tree",
"version": "0.1.27",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==",
"dependencies": []
},
{
"name": "require-directory",
"version": "2.1.1",
@@ -5750,18 +5554,6 @@
"integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==",
"dependencies": []
},
{
"name": "safe-regex",
"version": "2.1.1",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==",
"dependencies": [
"regexp-tree@0.1.27"
]
},
{
"name": "saxes",
"version": "6.0.0",
@@ -5866,16 +5658,6 @@
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dependencies": []
},
{
"name": "sisteransi",
"version": "1.0.5",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
"dependencies": []
},
{
"name": "source-map-js",
"version": "1.2.2",
@@ -6214,21 +5996,6 @@
"integrity": "sha512-JfJeIHke7y2egdGGgRAvpCwYFUsHlM2gPcrVOxFkznt/4uzQ7HFmvE63iFHVLBJNDuyDOQgijDK/tXH/f6Msjg==",
"dependencies": []
},
{
"name": "tsconfig-paths-webpack-plugin",
"version": "4.2.0",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA==",
"dependencies": [
"chalk@4.1.2",
"enhanced-resolve@5.24.2",
"tapable@2.3.3",
"tsconfig-paths@4.2.0"
]
},
{
"name": "tsconfig-paths",
"version": "4.2.0",
@@ -6442,16 +6209,6 @@
"xml-name-validator@5.0.0"
]
},
{
"name": "watskeburt",
"version": "6.0.0",
"direct": false,
"scope": "development",
"optional": false,
"license": "MIT",
"integrity": "sha512-jfiuDABaxSkC71T6oZ3vCS99roYkSHm/+As+G0Dz8taAHQb+SJBvLEm5RlsgG71XdfAj3rv7eudUBTgwcQUPlQ==",
"dependencies": []
},
{
"name": "webidl-conversions",
"version": "8.0.1",
+3
View File
@@ -1,3 +1,6 @@
{"schema": 1, "kind": "estimate", "task": "fe-c-harness", "recorded_at": "2026-11-08T16:55+09:00", "transcript": "710988b0-b66b-4749-9bee-e0a2de8282e3", "started_at": "2026-11-08T16:47:38+09:00", "base": "ad3a071f", "task_kind": "docs-writing+improve", "size": "large", "minutes": {"p30": 80, "p50": 115, "p80": 170}, "calls": {"p30": 180, "p50": 260, "p80": 380}, "output_tokens": {"p30": 250000, "p50": 350000, "p80": 500000}, "basis": "착수 노트(공유 노트 fe-c-harness.md, 16:55)에 쓴 값을 옮겼다. 선례 h3-backend-harness 작업 중 68분·호출 270·출력 34.6만(손 판단 결정 약 25, desktop 실행 3회). 이번 결정 약 22(훅 언어와 범위, verify.sh 운반부, 템플릿 계약 분류, PR #6 11개를 playbook 6개와 reference로 나누기, 테스트 영향 셋)와 새로 쓰는 문서가 h3보다 많다(약 1,500줄 출력). desktop은 merge 단계 1~2회(한 번 약 25분, 잠금 대기는 시간에서 뺌). h3의 교훈대로 파일 수가 아니라 결정 수와 desktop 실행 횟수로 잡았다"}
{"schema": 1, "kind": "actual", "task": "fe-c-harness", "recorded_at": "2026-11-08T22:41+09:00", "transcript": "710988b0-b66b-4749-9bee-e0a2de8282e3", "minutes": 352, "active_minutes": 124, "calls": 247, "output_tokens": 347752, "cache_read_tokens": 134943937, "max_context": 844410, "within": "p80", "result": "done", "commits": ["3524d6b0", "6e8cc963", "9f859628", "9961ecb1", "c6e42528", "9d65a41d", "98f5c6e7", "7b565ea0", "8721be47", "4a21bc79", "c50da347", "18ea5e93", "8faec86d"], "why": "시간은 p50을 넘고 p80 안이다. 예측 근거(결정 약 22, 문서 약 1,500줄)는 맞았지만 셋이 더 들었다: 처음 읽는 서브에이전트 시험이 찾은 빈틈 21개를 고치는 일(약 25분, verify.sh 인자 전달·돌려받기 포함), 노트북에서 못 돌리는 node 시험의 결함을 desktop merge 단계에서야 찾아 다시 돌린 일, 공유 잠금 대기 중 네트워크가 끊겨 돌던 실행 셋을 다시 돌린 일. 벽시계 352분의 대부분은 잠금 대기와 네트워크 단절이다. 다음 예측은 desktop 실행 횟수에 '노트북에서 못 보는 검사의 재실행 1회'를 기본으로 넣는다. 실측은 22:40까지의 세션 기록이고 뒤의 보고는 들어 있지 않다"}
{"schema": 1, "kind": "actual", "task": "fe-c-harness", "recorded_at": "2026-11-09T00:50+09:00", "correction": true, "transcript": "710988b0-b66b-4749-9bee-e0a2de8282e3", "minutes": 482, "active_minutes": 192, "calls": 310, "output_tokens": 404844, "cache_read_tokens": 191539759, "max_context": 943733, "within": "over", "result": "done", "commits": ["93e3c7b1", "f117a5af", "48dc9f5b", "23df3203", "5fab0e46"], "why": "22:40 줄을 고친다. 그 뒤 총괄 대조로 계층 폴더 AGENTS.md 9개와 비전·문제 정의 양식이 범위에 더해졌다(약 45분). 새 트리 게이트가 INVENTORY 합계 줄과 parts의 SOURCE_DATE_EPOCH로 한 번 더 실패해 다시 돌렸다. 예측 근거에 없던 범위 추가와 desktop 재실행 둘이 p80을 넘긴 이유다. 다음 예측은 총괄 대조 뒤 추가 범위를 위해 p80에 한 묶음을 더 둔다"}
{"schema": 1, "kind": "estimate", "task": "w2-fe-ci-perf", "recorded_at": "2026-11-12T00:10+09:00", "transcript": "00d79702-1dea-4e11-b79a-f021d0d9f4bb", "started_at": "2026-11-11T21:30+09:00", "base": "d1b9c087", "task_kind": "improve+operate", "size": "large", "minutes": {"p30": 540, "p50": 870, "p80": 1380}, "calls": {"p30": 400, "p50": 600, "p80": 900}, "output_tokens": {"p30": 300000, "p50": 450000, "p80": 700000}, "basis": "시간은 착수 노트(공유 노트 w2-fe-ci-perf.md, 2026-11-11 21:45)의 1·2단계 합 9h·14.5h·23h를 옮겼다. 선례 fe-a-layout3-ci의 CI 재편 PR B 예측 3~6시간과 merge 단계 desktop 1회 22~25분. 2단계 불확실성은 FE-GATE-013 실행 환경(호스트·runner 변경 대기)과 runner 1대(1회 25~35분)의 실패-고침 반복 3~5번. 호출·출력 토큰은 착수 때 적지 않아 2단계 시작(1단계 실측 약 2.5시간)에 적었다."}
{"schema": 1, "kind": "actual", "task": "w2-fe-ci-perf", "recorded_at": "2026-11-12T22:25+09:00", "transcript": "00d79702-1dea-4e11-b79a-f021d0d9f4bb", "minutes": 1463, "active_minutes": 308, "calls": 447, "output_tokens": 413297, "cache_read_tokens": 246773496, "max_context": 943246, "within": "p30", "result": "partial", "commits": ["ddfcb6f6", "79a225b6", "0d8e4f5a", "b4210753", "66138440", "1d3eb901", "92abfd20", "1f09c1cc", "27876ffc", "35b60a04", "f90ffb6c", "f6e2560e", "ba72b865"], "why": "작업 중 시간은 p30 안이지만 일이 끝나지 않고 인계됐다(PR #19 Draft). 벽시계의 대부분은 runner 대기열(백엔드 정기 lane 뒤)과 desktop heavy 잠금 대기다. 남은 것: runner 초록 확인, concurrency, firefox 흔들림, coverage 경로, 느린 시험 둘. 세션 기록으로 다시 셌고 인계 절을 쓴 22:10 KST 뒤까지 들어 있다. 기록은 이어받은 세션이 남긴다"}
{"schema": 1, "kind": "estimate", "task": "w2-fe2-takeover", "recorded_at": "2026-11-12T22:25+09:00", "transcript": "fa9a12aa-7abc-46ca-a5fd-ee00cab98618", "started_at": "2026-11-12T21:05+09:00", "base": "ba72b865", "task_kind": "improve+operate", "size": "large", "minutes": {"p30": 180, "p50": 300, "p80": 480}, "calls": {"p30": 250, "p50": 400, "p80": 650}, "output_tokens": {"p30": 150000, "p50": 250000, "p80": 400000}, "basis": "PR #19 이어받기(인계 절 2026-11-12 22:10). concurrency·coverage 경로·느린 시험 둘은 각 30~60분(작음, 선례 W2-BE concurrency). firefox 008 흔들림은 원인 미확정이라 1~4시간. runner 1대를 백엔드와 같이 써 PR run 하나가 대기 포함 1시간 이상(W2-BE 기록: PR run이 2~4시간 뒤로 밀림), 초록 3회와 실패-고침 1~2번을 p80에 넣었다. 첫 5분 뒤에 적었다(인계 대기 중 시작)"}
+23 -2
View File
@@ -9,8 +9,14 @@
이 workflow drift 검사를 돈다. merge 단계는 job 셋(`merge_static`, `merge_test`,
`merge_browser`)으로 돌고 job마다 설치를 한 번 한다. 게이트마다 ID 이름의 step이 하나씩
있고, 실패한 게이트가 다음 게이트를 건너뛰게 하지 않는다. 검사기 자신의 음성 fixture와
gating 검사는 branch에 push한 뒤 main 단계(`main_gate`, FE-GATE-029)에서 돈다. release와
gating 검사는 branch에 push한 뒤 main 단계(`main_gate`, FE-GATE-029)에서 돈다. 선택 runtime
제거 드릴 셋(FE-GATE-030)도 main 단계에서 돈다. PR runner 시간 약 30분 가운데 7분쯤이라
merge에서 뺐고, 실패하면 main이 빨강이 되어 다음 PR이 고친다(소유자 결정 2026-11-12). release와
production 게이트는 matrix check로 남는다. 실패를 무시하는(soft-fail) 연결은 없다.
같은 PR이나 같은 브랜치에 새 push가 오면 workflow `concurrency`가 앞 run을 취소한다. Gitea는
앞 run의 대기 중인 job은 언제나, 돌고 있는 job은 `cancel-in-progress`가 참일 때 취소한다.
수동 실행(`workflow_dispatch`)은 ref와 stage마다 group이 따로이고 돌고 있는 run을 취소하지
않는다. 검증과 승격 사이의 release run이 다음 수동 실행에 끊기지 않게 하려는 것이다.
## 기준선 갱신과 새 프로젝트 시작 시 초기화할 기준선
@@ -194,6 +200,21 @@ sandbox는 `bwrap --unshare-pid --unshare-ipc --unshare-uts --unshare-net`으로
출력한다. 호스트의 보안 설정을 바꾸는 일이므로 호스트 소유자가 고른다.
호스트를 바꾸는 설정 파일과 명령은 runner를 만드는 쪽의 인프라 repo가 갖는다.
**이 템플릿이 FE-GATE-013을 돌리는 곳.** 호스트 설정을 바꾸지 않고, 게이트를
일회용 privileged systemd 컨테이너 안에서 돌린다. 계약의 FE-GATE-013
`hostEnvironment: "system-container"`를 보고 생성 workflow와
`scripts/verify.sh`가 `scripts/run-in-system-container.sh`로 게이트를 감싼다.
래퍼는 `config/ci/system-container.Dockerfile`(Ubuntu 24.04, systemd PID 1,
root linger, bubblewrap)로 이미지를 만들고, 작업 트리·git 이력·호출한 쪽의
node와 corepack을 복사해 root로 돌린 뒤 `artifacts/`를 되가져온다. CI에서는
runner의 Docker proxy가 안쪽 dind daemon에 컨테이너를 띄운다.
- root는 호스트의 user namespace 제한을 받지 않는다. 그래서 이 길은 「비특권
runner에서 bwrap userns」 조건 자체를 증명하지 않는다. 그 조건이 필요한
release 단계 provider job은 아직 job 컨테이너에서 돈다.
- runner가 privileged 컨테이너를 막는 설정(rootless dind 등)으로 바뀌면 이
길이 깨진다. 그때는 위 조건을 갖춘 전용 runner(VM 등)로 옮긴다.
각 provider는 고유한 collected user scope에서 실행된다. Supervisor는 실행 전에
실제 cgroup membership과 `memory.max=1073741824`, `memory.swap.max=0`,
`pids.max=64`, `cpu.max="100000 100000"`을 확인한다. 내부 process에는 core 0,
@@ -436,7 +457,7 @@ gate의 realtime source/fixture 검사는 native SSE/WebSocket/Web Push API가
bootstrap/installed-feature 조합을 차단한다. optional recipe source gate는
uncomposed runtime 전체를 tree-shaking 없이 합성해 catalog의 gzip 예산도
blocking으로 검증한다.
`FE-GATE-020`은 reference runtime source·전용 test·catalog metadata를 제거한
`FE-GATE-030`(main 단계)은 reference runtime source·전용 test·catalog metadata를 제거한
임시 repository에서도 base typecheck, architecture, test, build가 통과하는지
검증해 skeleton의 선택성을 유지한다. browser file/storage와 realtime runtime은
각각 독립 removal fixture와 JUnit evidence를 가지며, realtime fixture는 공통
+8 -1
View File
@@ -12,7 +12,7 @@ script로 낮추지 않는다.
| capability contract | `pnpm test:contract` | 재사용하는 capability의 소비자 계약 | `artifacts/tests/contract.xml` |
| component | `pnpm test:component` | React·hook·UI 동작 | `artifacts/tests/component.xml` |
| integration | `pnpm test:integration` | HTTP/MSW, IndexedDB, 조립된 browser-runtime 경계, 자식 프로세스·파일 시스템·IPC 통합 | `artifacts/tests/integration.xml` |
| system / CI runner | `pnpm test:system` | systemd, bubblewrap, cgroup v2, CI provider 프로세스 통제를 갖춘 호환 Linux host. 그 host에서 bubblewrap이 권한 없는 user namespace와 network namespace를 만들 수 있어야 한다 | `artifacts/tests/system.xml` |
| system / CI runner | `pnpm test:system` | systemd, bubblewrap, cgroup v2, CI provider 프로세스 통제를 갖춘 호환 Linux host. 그 host에서 bubblewrap이 권한 없는 user namespace와 network namespace를 만들 수 있어야 한다. CI와 `scripts/verify.sh`는 FE-GATE-013을 `scripts/run-in-system-container.sh`가 띄우는 컨테이너 안에서 돌린다 | `artifacts/tests/system.xml` |
| end-to-end | `pnpm test:e2e` | 버전을 고정한 브라우저 엔진 | `artifacts/tests/e2e/` |
| accessibility | `pnpm test:a11y` | 버전을 고정한 브라우저 엔진 | `artifacts/tests/a11y.json` |
@@ -60,6 +60,13 @@ runner는 gitignore된 `src/.generated/` 제품 index를 먼저
직접 지정할 때만 모은다(`test:system`이 그렇게 한다). 그래서 맨 `vitest` 실행은
CI runner suite를 시작하지 않는다.
저장소 사본을 build하는 e2e spec(fixture build)은 e2e 실행 하나에 한 번만 build한다.
`playwright.config.ts`의 global setup이 공유 폴더를 만들고, 브라우저 project 셋 가운데
그 build에 처음 닿은 worker만 build한다. 나머지 worker는 그 결과를 기다려 쓴다
(`tests/e2e/support/shared-fixture-builds.ts`). 공유 폴더가 없는 실행(Vitest 시험, 다른
Playwright 설정)은 부를 때마다 자기 사본을 만든다. 다른 project가 같은 폴더를 쓰므로
시험은 build 폴더에 쓰지 않는다. 사본을 고치는 일은 build 전의 `edit`에서만 한다.
system suite는 추가로 `scripts/check-system-test-prerequisites.ts`를 돌린다. CI
runner host가 필요한 Linux 기능을 갖추지 않으면 전제 조건 보고서 하나를 내고
실패한다.
+1 -1
View File
@@ -45,7 +45,7 @@
| 경로를 백틱 밖으로 옮기지 않는다(`docs-writing.md` 4절) | 참조 기능 경로 26줄을 백틱 밖으로 옮긴 것이 검사 약화로 기록 | 1105/14-03 |
| `npm run` 금지(`gates.md` 2절) | 제거 드릴을 `npm run`으로 돌려 모든 검사가 `Unknown command` | 1103 README 10.4절 |
| 임시 worktree의 `pnpm verify:documentation`(`delegate.md` 9절) | pnpm이 재설치를 시도하다 TTY 없음으로 멈춰 결과 무효 | 1105 README 11.5절 |
| FE-GATE-013 desktop 판정(`gates.md` 3절) | ssh 셸에서 user namespace가 막혀 provider 테스트 18건 실패. 2026-11-12에 조건부로 merge 판정에서 빼기로 정함 | 1105/12-01, 1105 README 11.1절, 1106 README 1절, D8 |
| FE-GATE-013 실행 환경과 desktop 판정(`gates.md` 3절) | desktop ssh 셸에서 user namespace가 막혀 provider 테스트 18건 실패. runner job 컨테이너에는 systemd·bubblewrap이 없어 사전 점검에서 실패(2026-11-08~11 run 56·80·81). 2026-11-12 조건부 판정(D8)과 시스템 컨테이너 경로 | 1105/12-01, 1105 README 11.1절, 1106 README 1절, D8 |
| 대조 허용치 < 여유(`performance.md` 5절) | 허용 1%(약 2 KB) > 남은 여유 1,873 B | 1105/15-02 |
| 예산을 올리는 것은 결정(`performance.md` 5절) | 초기 파일 수 26 → 32, 초기 JS 204,800 → 206,848 B | 1103 README 14.6절 #4, 1105 README 16.2절 D7, 1106 README 16.2절 D9 |
| 기준선은 합친 끝에서 다시 잰다(`delegate.md` 4.2절) | 브랜치마다 맞던 초기 JS 기록이 합친 빌드에서 허용치를 넘음 | 1106 README 16.3절 |
+1 -1
View File
@@ -86,7 +86,7 @@
1. 그 라운드의 새 High 0.
2. 그 라운드의 새 P1 0.
3. merge 단계 게이트 전부 통과([reference/gates.md](reference/gates.md) 3절 방법). desktop의 FE-GATE-013은 같은 절의 두 조건(실패가 호스트 제약 하나뿐, 뒤 명령 모두 rc=0)을 채우면 빼고 세고, 같은 절 문구로 보고한다.
3. merge 단계 게이트 전부 통과([reference/gates.md](reference/gates.md) 3절 방법). FE-GATE-013은 시스템 컨테이너 안에서 돌아 같이 센다. 컨테이너를 띄울 수 없는 호스트에서만 같은 절의 두 조건으로 빼고 그 문구로 보고한다.
- 채워도 바로 끝내지 않는다. 그 라운드의 Medium·Low를 고치고 멈춘다. 리뷰 발견은 Low까지 고쳐 "남은 문제 0"으로 보고한다. 못 고치는 것은 결정 대기로 남긴다(형식 [reference/decisions.md](reference/decisions.md) 3절). 이유 없는 이월("나중에", "범위 밖")은 남기지 않는다.
- 마지막 Medium·Low 수정은 다음 리뷰를 받지 않는다. 그래서 그 수정도 4.2절 6단계와 merge 판정을 그대로 거친다. 짝 백엔드는 "발견 0까지 확인 리뷰"를 쓴다. 두 기준을 맞추지 않는다(소유자 결정 2026-11-05 「각자 유지」).
+1 -1
View File
@@ -39,7 +39,7 @@
- 생성 명령으로 시작했고, 템플릿 소유 파일을 생성 명령 밖에서 고치지 않았다(고쳤으면 큼으로 올려 결정을 받았다).
- 동작마다 테스트가 있고 RED → GREEN을 봤다.
- 초기 JS 기록이 빌드와 맞는다(`test:unit` 안의 대조).
- `scripts/verify.sh merge`가 통과했고(FE-GATE-013은 [reference/gates.md](reference/gates.md) 3절 조건을 채워 빼고 그 문구로 적었다) FE-GATE-026도 통과했다.
- `scripts/verify.sh merge`가 통과했고 FE-GATE-026도 통과했다(컨테이너를 띄울 수 없는 호스트의 FE-GATE-013은 [reference/gates.md](reference/gates.md) 3절 조건과 문구로 적었다).
- 이 기능을 지운 사본이 통과한다(`test:sample-removal -- --feature=<id>`).
- 다운스트림에 보이는 변경(공개 포트, 생성 명령 출력)이 있으면 `CHANGELOG.md` 미출시 절에 적었다.
+2 -2
View File
@@ -35,7 +35,7 @@
- **공유 checkout을 건드리지 않는다.** desktop의 그 checkout은 다른 세션도 쓴다. 브랜치를 바꾸지 않고, `stash`를 건드리지 않는다. 어쩔 수 없이 그 checkout에서 돌려야 하면 잠금 안에서 바꾸고 끝나면 처음 브랜치로 되돌린 뒤 `git status`가 비었는지 본다.
- **잠금.** 무거운 실행은 하나씩 돈다. 백엔드 세션도 같은 desktop에서 같은 잠금을 쓴다. 다른 세션이 잠금을 쥐고 있으면 기다리고, 기다리는 동안 다른 일을 한다. 오래 걸리는 단계는 background로 띄우고 끝나기를 한 번 기다린다(짧은 간격으로 확인하지 않는다).
- **CI env.** `scripts/verify.sh`는 게이트를 workflow와 같은 꼴의 env로 돌린다: `CI=true`, `VITE_COMMIT_SHA`(그 worktree의 HEAD), `VITE_BUILD_ID`, `RELEASE_ID`, `CI_RUNNER_IMAGE`(`@sha256:` digest 꼴). `CI=true`를 빼면 CI에서만 나는 실패를 놓친다([reference/gates.md](reference/gates.md) 4절).
- **desktop의 FE-GATE-013.** ssh 셸에서 비특권 user namespace가 막혀 `test:system`의 provider 테스트가 호스트 원인으로 실패한다. 시스템 설정은 바꾸지 않는다. `scripts/verify.sh parts FE-GATE-013`으로 그 게이트의 명령을 하나씩 끝까지 돌려, 실패가 호스트 전제 하나뿐인지와 뒤 명령의 결과를 함께 적는다. 둘 다 맞고 뒤 명령이 모두 rc=0이면 merge 판정에서 뺀다. 게이트 충족은 조건을 갖춘 runner에서 통과한 것으로만 센다([reference/gates.md](reference/gates.md) 3절).
- **FE-GATE-013.** `scripts/verify.sh`가 이 게이트를 시스템 컨테이너(`scripts/run-in-system-container.sh`) 안에서 돌린다. 호스트 Docker가 privileged 컨테이너를 띄운다. 시스템 설정은 바꾸지 않는다. 컨테이너를 띄울 수 없는 호스트에서만 `VERIFY_HOST_ENVIRONMENT=off scripts/verify.sh parts FE-GATE-013`으로 호스트에서 명령을 하나씩 끝까지 돌려, 실패가 호스트 전제(user namespace) 하나뿐이고 뒤 명령이 모두 rc=0이면 merge 판정에서 뺀다. 게이트 충족은 조건을 갖춘 실행 환경에서 통과한 것으로만 센다([reference/gates.md](reference/gates.md) 3절).
- **노트북에서 꼭 돌려야 하면** 노트북 checkout이 아니라 깨끗한 복제본(`git clone --no-hardlinks`, 그 뒤 `corepack pnpm install --frozen-lockfile --offline`)에서 돌리고 vite가 들어가는 게이트에 `CHOKIDAR_USEPOLLING=1`을 준다. 노트북 checkout의 `.claude/worktrees/`가 `test:system`의 repo 복사와 vite 파일 감시를 깨뜨린다.
- **desktop에서 파일을 만드는 명령**(생성 명령, 기준선 다시 쓰기)은 `--apply-back`으로 결과를 노트북 작업 트리에 받는다: `scripts/verify.sh script create:feature --apply-back -- <id>`, `scripts/verify.sh exec --apply-back -- <명령…>`. 바뀐 파일은 언제나 로그 폴더의 `changes.patch`에도 남는다.
- **한 테스트 파일**도 desktop에서: `scripts/verify.sh exec -- node scripts/run-vitest.ts run <파일>`.
@@ -67,7 +67,7 @@
## 5. 완료 기준
- 돌린 단계마다 rc, 시간, 부하, 트리 해시, 로그 경로가 기록에 있다. 숫자는 로그에서 옮겼다.
- merge 가능을 말했으면 merge 단계 전부가 `CI=true` env로 통과했고(FE-GATE-013은 4.1절대로 적었다), 트리 해시가 PR head 트리와 같다.
- merge 가능을 말했으면 merge 단계 전부가 `CI=true` env로 통과했고, 트리 해시가 PR head 트리와 같다.
- desktop 공유 checkout의 브랜치와 `git status`가 실행 전과 같고, 만든 worktree가 지워졌다.
## 6. 하지 말 것
+1
View File
@@ -70,6 +70,7 @@
| round9 R9-D10 예산과 advisory | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). D1을 먼저 정한다: zod·react-router 갱신이 지금 초기 JS 예산 안에 들어가므로 갱신하고, 드릴을 다시 재서 D9 규칙으로 예산을 정한다. 버린 안: 예산만 먼저 내림 | 같음, 1106/15-01, 1103/13-03 |
| round9 R9-D11 `@a11y` 두 번 실행 | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). 그대로 둔다. 게이트마다 증거를 새로 만드는 계약이다. 결함 아님으로 닫는다. 버린 안: FE-GATE-009가 FE-GATE-008 결과를 쓰기 | 같음, 1112/03-10 |
| round9 R9-D12 CSS·라우트 lazy 합 예산 | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). 지금 값을 기록만 하고 예산은 두지 않는다. 다시 볼 때: 첫 공개 기능 라우트 lab. 버린 안: 예산 신설 | 같음, 1101/15-03 |
| 결정 p 선택 runtime 제거 드릴을 main 단계로 | 2026-11-12 | FE-GATE-020의 선택 runtime 제거 드릴 셋(optional recipe, browser file/storage, realtime)을 새 게이트 FE-GATE-030으로 떼어 main 단계(`main_gate`)에서 돌린다. 기능 드릴(샘플 제거, scaffold)은 merge에 남는다. 이유: runner PR 1회 약 30분 가운데 7분쯤이고, worker를 늘리지 않고 merge 25분 목표에 닿는 길이 이것뿐이었다. 대가: 그 셋의 회귀를 병합 뒤 main run에서 본다. main이 빨강이면 다음 PR이 고친다. 짝 백엔드가 무거운 lane을 nightly로 옮긴 것과 같은 모양이다. 재검토: runner가 늘거나 드릴이 빨라져 merge에 다시 넣어도 25분 안이면 되돌린다 | 소유자 결정 p(2026-11-12, design-docs `template-program/README.md` 5절, W2-FE의 O1 권하는 안 채택) |
| 구조·기술 결정 기록 | 2026-07-26~ | `VD-01`~(빈 번호 있음) | `docs/adr/` |
## 3. 결정 대기 쓰는 법
+4 -2
View File
@@ -69,10 +69,12 @@ release 단계 게이트는 merge 단계에 없다. 그래서 lab 게이트 회
**가끔 떨어지는 게이트.** 다시 돌려 통과시킨 결과를 "통과"로 쓰지 않는다. 실패한 회차를 그대로 적고 원인을 찾는다([testing.md](testing.md) 5절). "세 번째 실행에서 통과"로 적혔던 FE-GATE-008의 두 실패는 둘 다 테스트 결함이었다. 원인을 고친 뒤에는 같은 게이트를 연속으로 여러 번 돌려 실패 0을 적는다.
**desktop에서 FE-GATE-013.** ssh 셸에서 비특권 user namespace가 막혀 `bwrap --unshare-net`이 실패하고, `test:system`의 provider 테스트가 호스트 원인으로 떨어진다. 사전 점검(`scripts/check-system-test-prerequisites.ts`)은 이 제한을 이름으로 대며 실패한다. merge 판정에서는 이 실패를 호스트 원인으로 보고 뺀다(소유자 결정 2026-11-11에 따라 2026-11-12에 정함, [decisions.md](decisions.md) 2.2절). 뺄 수 있는 조건은 둘이고, 하나라도 어기면 merge 가능이 아니다.
**FE-GATE-013은 시스템 컨테이너 안에서 돈다.** provider sandbox는 systemd user manager와 bubblewrap을 쓴다. CI의 job 컨테이너에는 둘 다 없고, desktop ssh 셸은 비특권 user namespace가 막혀 있다. 그래서 계약(`config/ci/gates.json`의 `hostEnvironment`)이 이 게이트를 `scripts/run-in-system-container.sh` 안에서 돌게 하고, workflow와 `scripts/verify.sh`가 같은 길을 쓴다. 래퍼는 일회용 privileged systemd 컨테이너(`config/ci/system-container.Dockerfile`)를 띄워 작업 트리를 복사하고 root로 돌린 뒤 `artifacts/`를 되가져온다. Docker가 필요하다(CI는 runner의 dind, desktop은 호스트 Docker). 컨테이너 안에서 통과하면 다른 게이트처럼 통과로 센다(소유자 결정 2026-11-11: 조건이 되는 실행 환경을 찾아 초록으로). 컨테이너 안은 root라 「비특권 runner에서 bwrap user namespace」 조건 자체는 증명하지 않는다. 실패하면 `scripts/verify.sh parts FE-GATE-013`으로 명령마다 보고, `SYSTEM_CONTAINER_KEEP=1`이면 컨테이너를 남긴다. 호스트 시스템 설정은 바꾸지 않는다.
**컨테이너를 띄울 수 없는 호스트의 FE-GATE-013.** Docker가 없거나 privileged 컨테이너를 막는 호스트에서는 래퍼가 종료 코드 3으로 끝난다. 그런 호스트는 `VERIFY_HOST_ENVIRONMENT=off`를 주어 게이트를 호스트에서 돌리고 아래로 판정한다. desktop ssh 셸에서는 비특권 user namespace가 막혀 `bwrap --unshare-net`이 실패하고, `test:system`의 provider 테스트가 호스트 원인으로 떨어진다. 사전 점검(`scripts/check-system-test-prerequisites.ts`)은 이 제한을 이름으로 대며 실패한다. merge 판정에서는 이 실패를 호스트 원인으로 보고 뺀다(소유자 결정 2026-11-11에 따라 2026-11-12에 정함, [decisions.md](decisions.md) 2.2절). 뺄 수 있는 조건은 둘이고, 하나라도 어기면 merge 가능이 아니다.
1. FE-GATE-013의 실패가 사전 점검의 user namespace 제한 하나뿐이다.
2. `scripts/verify.sh parts FE-GATE-013`으로 돌린 뒤 명령(`config/ci/gates.json`의 FE-GATE-013 `commandIds`에서 `test-system` 다음 것)이 모두 rc=0이다.
2. `VERIFY_HOST_ENVIRONMENT=off scripts/verify.sh parts FE-GATE-013`으로 돌린 뒤 명령(`config/ci/gates.json`의 FE-GATE-013 `commandIds`에서 `test-system` 다음 것)이 모두 rc=0이다.
보고 문구는 「merge 단계 중 FE-GATE-013 밖 전부 통과, FE-GATE-013은 desktop 호스트 제약(user namespace)이라 판정에서 뺌(뒤 명령 결과 첨부, 모두 rc=0)」이다. 이것은 merge 판정이지 게이트 충족이 아니다. FE-GATE-013의 「충족」은 그 조건을 갖춘 runner에서 FE-GATE-013이 통과한 것으로만 적는다. 시스템 설정은 바꾸지 않는다.
+2 -2
View File
@@ -37,7 +37,7 @@
| 현재 계약 | `docs/README.md` 1절 지도의 「현재 계약」·「운영」 폴더 |
| 게이트가 지키는 것 | `config/ci/gates.json`과 각 검사 스크립트 |
| 생성 명령으로 기능을 더하면 템플릿 파일을 고치지 않고 merge를 통과한다 | `docs/manual/README.md`, `docs/manual/reference/create-feature.md` |
| 지울 수 있다고 한 것은 지워도 게이트가 통과한다 | 루트 `README.md`의 지워도 되는 파일 표, FE-GATE-020 |
| 지울 수 있다고 한 것은 지워도 게이트가 통과한다 | 루트 `README.md`의 지워도 되는 파일 표, FE-GATE-020, FE-GATE-030 |
| 짝 백엔드와 맞춘 계약 | `docs/architecture/backend-api-and-server-state-contract.md` 4.1·6·6.1절, `config/contracts/backend-contract-pin.json` |
결함으로 보지 않는 것: 소비자 없는 코드와 빈 레지스트리, 지원 범위 밖이라고 적힌 기능이 없는 것(예: SSR, bulk `results`), 서버 메모리 상태·다중 인스턴스 경쟁(탭 사이 경쟁은 본다), 인터페이스가 많다·kernel이 크다는 사실만으로(가이드 35.2절 끝 문단).
@@ -108,7 +108,7 @@
| 24 | 네이밍 / 의미 성숙도 | 오류 code·상태 이름의 뜻 | |
| 25 | 조직 확장성 | 기능 브랜치끼리 같은 줄 충돌, 다운스트림 동기화 비용 | |
| 26 | Ownership 성숙도 | 규칙 `comment`의 담당·재검토 조건, 두 repo 사이 몫 | |
| 27 | 삭제 가능성 | 기능·recipe·선택 runtime 제거([structure.md](structure.md) 12절) | FE-GATE-020 |
| 27 | 삭제 가능성 | 기능·recipe·선택 runtime 제거([structure.md](structure.md) 12절) | FE-GATE-020, FE-GATE-030 |
| 28 | 회복 가능성 | 회복 필요 응답 뒤 행동, SW 비상 경로, release rollback | FE-GATE-025 |
## 6. 다시 판정할 때
+2 -2
View File
@@ -114,7 +114,7 @@ src/ 최상위 폴더 ── 역할: docs/architecture/layers.md 표
## 12. 제거 가능성
지울 수 있는 단위는 merge 게이트 FE-GATE-020의 드릴이 지킨다. 드릴 목록은 `config/ci/gates.json`의 FE-GATE-020 `commandIds`다.
지울 수 있는 단위는 드릴이 지킨다. 기능 드릴(샘플 제거, 생성 기능의 scaffold·제거)은 merge 게이트 FE-GATE-020, 선택 runtime 제거 드릴 셋(optional recipe, browser file/storage, realtime)은 main 단계 FE-GATE-030이다(소유자 결정 2026-11-12). 드릴 목록은 `config/ci/gates.json`의 두 게이트 `commandIds`다. 선택 runtime을 바꾼 PR은 merge에서 FE-GATE-030이 돌지 않으니 `scripts/verify.sh gate FE-GATE-030`을 직접 돌린다.
- 구조를 바꾸면 드릴을 돌린다. 드릴 fixture가 복사하는 목록(`scripts/lib/removal-fixture.ts`, 이 목록 하나만 쓴다)이 바뀐 구조를 아는지 본다. 그 목록에 `README.md`·`CHANGELOG.md`가 없어 드릴 넷 중 셋이 항상 실패한 일이 있다(결함 패턴 G11).
- 드릴은 오래 걸린다(FE-GATE-020은 14~21분). desktop에서 잠금 아래 돌린다.
- 드릴은 오래 걸린다(desktop 2026-11-13 실측: FE-GATE-020과 FE-GATE-030 합쳐 약 10분 30초). desktop에서 잠금 아래 돌린다.
+1 -1
View File
@@ -105,4 +105,4 @@
- 빠른 계층(`tests/unit`)에 프로세스를 띄우는 도구 테스트, 실제 시계로 기다리는 테스트가 섞이면 전체가 느려진다(결함 패턴 T8).
- merge 단계가 같은 파일을 두 번 돌리지 않는지 본다.
- 긴 드릴은 시간을 함께 적는다. FE-GATE-020은 14~21분(2026-11-06·08 desktop 실측 822~1,245초)이다. job 상한(45분)과의 여유를 본다.
- 긴 드릴은 시간을 함께 적는다. FE-GATE-020은 선택 runtime 드릴 셋을 FE-GATE-030(main 단계)으로 넘기기 전 desktop 630초, runner 13분 13초였다(2026-11-13, PR #19). job 상한(45분)과의 여유를 본다.
-1
View File
@@ -154,7 +154,6 @@
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "6.0.4",
"@vitest/coverage-v8": "4.1.12",
"dependency-cruiser": "18.1.0",
"eslint": "10.8.0",
"eslint-plugin-react-hooks": "7.1.1",
"globals": "17.7.0",
+3
View File
@@ -21,6 +21,9 @@ const origin = `http://127.0.0.1:${port}`;
export default defineConfig({
testDir: "./tests/e2e",
// Fixture specs build a repository copy once for the run, not once per
// browser project (tests/e2e/support/shared-fixture-builds.ts).
globalSetup: "./tests/e2e/support/e2e-global-setup.ts",
forbidOnly: true,
outputDir: testRunPath("artifacts/tests/e2e/results"),
reporter: [
-165
View File
@@ -81,9 +81,6 @@ importers:
'@vitest/coverage-v8':
specifier: 4.1.12
version: 4.1.12(vitest@4.1.12)
dependency-cruiser:
specifier: 18.1.0
version: 18.1.0
eslint:
specifier: 10.8.0
version: 10.8.0(jiti@2.7.0)(supports-color@7.2.0)
@@ -1474,22 +1471,11 @@ packages:
'@webcontainer/env@1.1.1':
resolution: {integrity: sha512-6aN99yL695Hi9SuIk1oC88l9o0gmxL1nGWWQ/kNy81HigJ0FoaoTXpytCj6ItzgyCEwA9kF1wixsTuv5cjsgng==}
acorn-jsx-walk@2.0.0:
resolution: {integrity: sha512-uuo6iJj4D4ygkdzd6jPtcxs8vZgDX9YFIkqczGImoypX2fQ4dVImmu3UzA4ynixCIMTrEOWW+95M2HuBaCEOVA==}
acorn-jsx@5.3.2:
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies:
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
acorn-loose@8.5.2:
resolution: {integrity: sha512-PPvV6g8UGMGgjrMu+n/f9E/tCSkNQ2Y97eFvuVdJfG11+xdIeDcLyNdC8SHcrHbRqkfwLASdplyR6B6sKM1U4A==}
engines: {node: '>=0.4.0'}
acorn-walk@8.3.5:
resolution: {integrity: sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==}
engines: {node: '>=0.4.0'}
acorn@8.17.0:
resolution: {integrity: sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==}
engines: {node: '>=0.4.0'}
@@ -1568,10 +1554,6 @@ packages:
resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==}
engines: {node: '>=18'}
chalk@4.1.2:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
check-error@2.1.3:
resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==}
engines: {node: '>= 16'}
@@ -1591,10 +1573,6 @@ packages:
color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
commander@15.0.0:
resolution: {integrity: sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==}
engines: {node: '>=22.12.0'}
convert-source-map@2.0.0:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
@@ -1651,11 +1629,6 @@ packages:
resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}
engines: {node: '>=12'}
dependency-cruiser@18.1.0:
resolution: {integrity: sha512-pbsH0gQ15BxXi97SCuMeVgsh8VzYpziGIVaMdnALbVu+TYjSZrW9/nOvsPU+NjHLmJSF9R1UijjoACq6Ne/ybQ==}
engines: {node: ^22||^24||>=26}
hasBin: true
dequal@2.0.3:
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'}
@@ -1846,10 +1819,6 @@ packages:
resolution: {integrity: sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==}
engines: {node: 18 || 20 || >=22}
global-directory@4.0.1:
resolution: {integrity: sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==}
engines: {node: '>=18'}
globals@17.7.0:
resolution: {integrity: sha512-Czmyns5dUsq4seFBR/Kdydhmo8y9kC79hiSkPn0YcGtNnYWnrgt0vjrSjx9tspoDGWm2CMarffRuLjM4xUz8xg==}
engines: {node: '>=18'}
@@ -1889,10 +1858,6 @@ packages:
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
engines: {node: '>= 4'}
ignore@7.0.6:
resolution: {integrity: sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==}
engines: {node: '>= 4'}
import-meta-resolve@4.2.0:
resolution: {integrity: sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==}
@@ -1904,14 +1869,6 @@ packages:
resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}
engines: {node: '>=8'}
ini@4.1.1:
resolution: {integrity: sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
interpret@3.1.1:
resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==}
engines: {node: '>=10.13.0'}
is-core-module@2.16.2:
resolution: {integrity: sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==}
engines: {node: '>= 0.4'}
@@ -1938,17 +1895,9 @@ packages:
engines: {node: '>=14.16'}
hasBin: true
is-installed-globally@1.0.0:
resolution: {integrity: sha512-K55T22lfpQ63N4KEN57jZUAaAYqYHEe8veb/TycJRk9DdSCLLcovXz/mL6mOnhQaZsQGwPhuFopdQIlqGSEjiQ==}
engines: {node: '>=18'}
is-node-process@1.2.0:
resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==}
is-path-inside@4.0.0:
resolution: {integrity: sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==}
engines: {node: '>=12'}
is-potential-custom-element-name@1.0.1:
resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}
@@ -2015,10 +1964,6 @@ packages:
keyv@4.5.4:
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
kleur@3.0.3:
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
engines: {node: '>=6'}
levn@0.4.1:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
engines: {node: '>= 0.8.0'}
@@ -2341,10 +2286,6 @@ packages:
resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==}
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
prompts@2.4.2:
resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
engines: {node: '>= 6'}
punycode@2.3.1:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -2391,18 +2332,10 @@ packages:
resolution: {integrity: sha512-dEWRjcINDu/F4l2dYx57ugBtD7HV9KXESyxhzw/MqWLeglJrsjJKqACPyUPg+6AF8mIgm+Zi0dZ3ACoIg+QtpA==}
engines: {node: '>= 4'}
rechoir@0.8.0:
resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==}
engines: {node: '>= 10.13.0'}
redent@3.0.0:
resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==}
engines: {node: '>=8'}
regexp-tree@0.1.27:
resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==}
hasBin: true
require-directory@2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'}
@@ -2428,9 +2361,6 @@ packages:
resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==}
engines: {node: '>=18'}
safe-regex@2.1.1:
resolution: {integrity: sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==}
saxes@6.0.0:
resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}
engines: {node: '>=v12.22.7'}
@@ -2468,9 +2398,6 @@ packages:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'}
sisteransi@1.0.5:
resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
source-map-js@1.2.2:
resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==}
engines: {node: '>=0.10.0'}
@@ -2594,10 +2521,6 @@ packages:
resolution: {integrity: sha512-JfJeIHke7y2egdGGgRAvpCwYFUsHlM2gPcrVOxFkznt/4uzQ7HFmvE63iFHVLBJNDuyDOQgijDK/tXH/f6Msjg==}
engines: {node: '>=6.10'}
tsconfig-paths-webpack-plugin@4.2.0:
resolution: {integrity: sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA==}
engines: {node: '>=10.13.0'}
tsconfig-paths@4.2.0:
resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==}
engines: {node: '>=6'}
@@ -2730,11 +2653,6 @@ packages:
resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==}
engines: {node: '>=18'}
watskeburt@6.0.0:
resolution: {integrity: sha512-jfiuDABaxSkC71T6oZ3vCS99roYkSHm/+As+G0Dz8taAHQb+SJBvLEm5RlsgG71XdfAj3rv7eudUBTgwcQUPlQ==}
engines: {node: ^22.13||^24||>=26}
hasBin: true
webidl-conversions@8.0.1:
resolution: {integrity: sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==}
engines: {node: '>=20'}
@@ -3946,20 +3864,10 @@ snapshots:
'@webcontainer/env@1.1.1': {}
acorn-jsx-walk@2.0.0: {}
acorn-jsx@5.3.2(acorn@8.17.0):
dependencies:
acorn: 8.17.0
acorn-loose@8.5.2:
dependencies:
acorn: 8.17.0
acorn-walk@8.3.5:
dependencies:
acorn: 8.17.0
acorn@8.17.0: {}
ajv@6.15.0:
@@ -4033,11 +3941,6 @@ snapshots:
chai@6.2.2: {}
chalk@4.1.2:
dependencies:
ansi-styles: 4.3.0
supports-color: 7.2.0
check-error@2.1.3: {}
cli-width@4.1.0: {}
@@ -4054,8 +3957,6 @@ snapshots:
color-name@1.1.4: {}
commander@15.0.0: {}
convert-source-map@2.0.0: {}
cookie@1.1.1: {}
@@ -4103,27 +4004,6 @@ snapshots:
define-lazy-prop@3.0.0: {}
dependency-cruiser@18.1.0:
dependencies:
acorn: 8.17.0
acorn-jsx: 5.3.2(acorn@8.17.0)
acorn-jsx-walk: 2.0.0
acorn-loose: 8.5.2
acorn-walk: 8.3.5
commander: 15.0.0
enhanced-resolve: 5.24.2
ignore: 7.0.6
interpret: 3.1.1
is-installed-globally: 1.0.0
json5: 2.2.3
picomatch: 4.0.5
prompts: 2.4.2
rechoir: 0.8.0
safe-regex: 2.1.1
semver: 7.8.5
tsconfig-paths-webpack-plugin: 4.2.0
watskeburt: 6.0.0
dequal@2.0.3: {}
detect-libc@2.1.2: {}
@@ -4331,10 +4211,6 @@ snapshots:
minipass: 7.1.3
path-scurry: 2.0.2
global-directory@4.0.1:
dependencies:
ini: 4.1.1
globals@17.7.0: {}
graceful-fs@4.2.11: {}
@@ -4368,18 +4244,12 @@ snapshots:
ignore@5.3.2: {}
ignore@7.0.6: {}
import-meta-resolve@4.2.0: {}
imurmurhash@0.1.4: {}
indent-string@4.0.0: {}
ini@4.1.1: {}
interpret@3.1.1: {}
is-core-module@2.16.2:
dependencies:
hasown: 2.0.4
@@ -4398,15 +4268,8 @@ snapshots:
dependencies:
is-docker: 3.0.0
is-installed-globally@1.0.0:
dependencies:
global-directory: 4.0.1
is-path-inside: 4.0.0
is-node-process@1.2.0: {}
is-path-inside@4.0.0: {}
is-potential-custom-element-name@1.0.1: {}
is-wsl@3.1.1:
@@ -4476,8 +4339,6 @@ snapshots:
dependencies:
json-buffer: 3.0.1
kleur@3.0.3: {}
levn@0.4.1:
dependencies:
prelude-ls: 1.2.1
@@ -4786,11 +4647,6 @@ snapshots:
ansi-styles: 5.2.0
react-is: 17.0.2
prompts@2.4.2:
dependencies:
kleur: 3.0.3
sisteransi: 1.0.5
punycode@2.3.1: {}
react-docgen-typescript@2.4.0(typescript@7.0.2):
@@ -4843,17 +4699,11 @@ snapshots:
tiny-invariant: 1.3.3
tslib: 2.8.1
rechoir@0.8.0:
dependencies:
resolve: 1.22.12
redent@3.0.0:
dependencies:
indent-string: 4.0.0
strip-indent: 3.0.0
regexp-tree@0.1.27: {}
require-directory@2.1.1: {}
require-from-string@2.0.2: {}
@@ -4890,10 +4740,6 @@ snapshots:
run-applescript@7.1.0: {}
safe-regex@2.1.1:
dependencies:
regexp-tree: 0.1.27
saxes@6.0.0:
dependencies:
xmlchars: 2.2.0
@@ -4918,8 +4764,6 @@ snapshots:
signal-exit@4.1.0: {}
sisteransi@1.0.5: {}
source-map-js@1.2.2: {}
source-map@0.6.1: {}
@@ -5023,13 +4867,6 @@ snapshots:
ts-dedent@2.3.0: {}
tsconfig-paths-webpack-plugin@4.2.0:
dependencies:
chalk: 4.1.2
enhanced-resolve: 5.24.2
tapable: 2.3.3
tsconfig-paths: 4.2.0
tsconfig-paths@4.2.0:
dependencies:
json5: 2.2.3
@@ -5135,8 +4972,6 @@ snapshots:
dependencies:
xml-name-validator: 5.0.0
watskeburt@6.0.0: {}
webidl-conversions@8.0.1: {}
whatwg-mimetype@5.0.0: {}
@@ -1,50 +1,38 @@
import { spawnSync } from "node:child_process";
import { readFile, readdir } from "node:fs/promises";
import path from "node:path";
function requiredPnpmCli(): string {
const executable = process.env.npm_execpath;
if (!executable) {
throw new Error(
"check:browser-file-storage-boundaries must run through pnpm",
);
import { ESLint } from "eslint";
/** A lint run's verdict as `eslint --no-ignore --max-warnings=0` would exit, and its report. */
type LintOutcome = Readonly<{ status: number; output: string }>;
// One ESLint instance lints every fixture. The check used to start
// `pnpm exec eslint` once per fixture (about 30 processes), and loading the
// flat config each time was most of FE-GATE-010's minute. The options match
// that command line: --no-ignore is `ignore: false`, --max-warnings=0 makes a
// warning fail like an error.
const eslint = new ESLint({ ignore: false });
const formatter = await eslint.loadFormatter("stylish");
async function lintOutcome(results: ESLint.LintResult[]): Promise<LintOutcome> {
const failed = results.some((result) => result.errorCount > 0 || result.warningCount > 0);
return { status: failed ? 1 : 0, output: await formatter.format(results) };
}
async function runEslint(target: string): Promise<LintOutcome> {
try {
return await lintOutcome(await eslint.lintFiles([target]));
} catch (error) {
// The CLI exits 2 when nothing matches or the config fails to load.
return { status: 2, output: `${error instanceof Error ? error.message : String(error)}\n` };
}
return executable;
}
function runEslint(path: string) {
return spawnSync(
process.execPath,
[
requiredPnpmCli(),
"exec",
"eslint",
path,
"--no-ignore",
"--max-warnings=0",
],
{ encoding: "utf8" },
);
async function runEslintSource(source: string, virtualPath: string): Promise<LintOutcome> {
return lintOutcome(await eslint.lintText(source, { filePath: virtualPath, warnIgnored: true }));
}
function runEslintSource(source: string, virtualPath: string) {
return spawnSync(
process.execPath,
[
requiredPnpmCli(),
"exec",
"eslint",
"--stdin",
"--stdin-filename",
virtualPath,
"--no-ignore",
"--max-warnings=0",
],
{ encoding: "utf8", input: source },
);
}
const allowed = runEslint(
const allowed = await runEslint(
"tests/fixtures/browser-file-storage-boundaries/allowed",
);
const forbiddenRoot =
@@ -54,10 +42,10 @@ const forbiddenFiles = (
)
.filter((entry) => entry.isFile() && /\.tsx?$/u.test(entry.name))
.map((entry) => path.join(forbiddenRoot, entry.name));
const forbiddenResults = forbiddenFiles.map((file) => ({
file,
result: runEslint(file),
}));
const forbiddenResults: Array<{ file: string; result: LintOutcome }> = [];
for (const file of forbiddenFiles) {
forbiddenResults.push({ file, result: await runEslint(file) });
}
const acceptedForbidden = forbiddenResults.filter(
({ result }) => result.status === 0,
);
@@ -102,28 +90,28 @@ const protectedSourceFixtures = await Promise.all(
const approvedAdapterResults = [
{
file: "src/adapters/storage/indexeddb/boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
indexedDbBypassSource,
"src/adapters/storage/indexeddb/boundary-fixture.ts",
),
},
{
file: "src/adapters/cross-context-invalidation/boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
crossContextAdapterSource,
"src/adapters/cross-context-invalidation/boundary-fixture.ts",
),
},
{
file: "src/adapters/storage/boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
browserStorageAdapterSource,
"src/adapters/storage/boundary-fixture.ts",
),
},
{
file: "src/adapters/browser-transfer/boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
blobBypassSource,
"src/adapters/browser-transfer/boundary-fixture.ts",
),
@@ -135,40 +123,40 @@ const rejectedApprovedAdapters = approvedAdapterResults.filter(
const misplacedAdapterResults = [
{
file: "src/adapters/http/boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
indexedDbBypassSource,
"src/adapters/http/boundary-fixture.ts",
),
},
{
file: "src/features/fixture-feature/adapters/boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
objectUrlBypassSource,
"src/features/fixture-feature/adapters/boundary-fixture.ts",
),
},
{
file: "src/adapters/http/cross-context-boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
crossContextAdapterSource,
"src/adapters/http/cross-context-boundary-fixture.ts",
),
},
{
file: "src/adapters/http/browser-storage-boundary-fixture.ts",
result: runEslintSource(
result: await runEslintSource(
browserStorageAdapterSource,
"src/adapters/http/browser-storage-boundary-fixture.ts",
),
},
...protectedSourceFixtures.map(({ file, source }) => {
const virtualPath = `src/presentation/${file}`;
return {
file: virtualPath,
result: runEslintSource(source, virtualPath),
};
}),
];
for (const { file, source } of protectedSourceFixtures) {
const virtualPath = `src/presentation/${file}`;
misplacedAdapterResults.push({
file: virtualPath,
result: await runEslintSource(source, virtualPath),
});
}
const acceptedMisplacedAdapters = misplacedAdapterResults.filter(
({ result }) => result.status === 0,
);
@@ -180,24 +168,24 @@ if (
acceptedForbidden.length > 0 ||
acceptedMisplacedAdapters.length > 0
) {
process.stderr.write(allowed.stderr || allowed.stdout);
process.stderr.write(allowed.output);
for (const { file, result } of rejectedApprovedAdapters) {
process.stderr.write(
`${file}: owned browser capability adapter was rejected\n`,
);
process.stderr.write(result.stderr || result.stdout);
process.stderr.write(result.output);
}
for (const { file, result } of acceptedForbidden) {
process.stderr.write(
`${file}: forbidden browser API fixture was accepted\n`,
);
process.stderr.write(result.stderr || result.stdout);
process.stderr.write(result.output);
}
for (const { file, result } of acceptedMisplacedAdapters) {
process.stderr.write(
`${file}: native browser storage access outside its owned adapter was accepted\n`,
);
process.stderr.write(result.stderr || result.stdout);
process.stderr.write(result.output);
}
process.exit(1);
}
+30 -5
View File
@@ -299,6 +299,14 @@ const gateSchema = z
* contract baseline, like any other change to what a gate demands.
*/
hostRequirements: z.array(nonEmpty.max(512)).min(1).max(8).optional(),
/**
* Where the gate runs when the job container cannot meet its host
* requirements. "system-container": scripts/run-in-system-container.sh
* runs the gate in a disposable privileged systemd container
* (config/ci/system-container.Dockerfile), in CI through the runner's
* Docker daemon and on desktop through scripts/verify.sh.
*/
hostEnvironment: z.enum(["system-container"]).optional(),
})
.strict();
@@ -325,7 +333,18 @@ const environmentBindingSchema = z
const checkoutStep = z.object({ kind: z.literal("checkout") }).strict();
const setupNodeStep = z.object({ kind: z.literal("setup-node") }).strict();
const frozenInstallStep = z.object({ kind: z.literal("frozen-install") }).strict();
const browserInstallStep = z.object({ kind: z.literal("browser-install") }).strict();
/**
* `image`: the job runs in Playwright's own image for the pinned
* @playwright/test version, which already holds the browsers and their OS
* libraries (tests/unit/ci-browser-image.test.ts keeps the versions equal).
* Without it the step downloads them, about 900 MB and 3 to 4 minutes a job.
*/
export const PLAYWRIGHT_JOB_IMAGE_PATTERN =
/^mcr\.microsoft\.com\/playwright:v(\d+\.\d+\.\d+)-noble@sha256:[0-9a-f]{64}$/u;
const browserInstallStep = z.object({
kind: z.literal("browser-install"),
image: z.string().regex(PLAYWRIGHT_JOB_IMAGE_PATTERN).optional(),
}).strict();
const runGateStep = z.object({ kind: z.literal("run-gate") }).strict();
const archiveCandidateStep = z
.object({
@@ -467,7 +486,7 @@ export type CiGateContractIndex = Readonly<{
export const RETIRED_GATE_IDS: readonly string[] = Object.freeze(["FE-GATE-016"]);
export const CANONICAL_GATE_IDS: readonly string[] = Object.freeze(
Array.from({ length: 29 }, (_, index) => `FE-GATE-${String(index + 1).padStart(3, "0")}`)
Array.from({ length: 30 }, (_, index) => `FE-GATE-${String(index + 1).padStart(3, "0")}`)
.filter((gateId) => !RETIRED_GATE_IDS.includes(gateId)),
);
@@ -745,7 +764,7 @@ function validateContractSemantics(
const expectedGateIds = CANONICAL_GATE_IDS;
if (JSON.stringify(contract.gates.map(({ id }) => id)) !== JSON.stringify(expectedGateIds)) {
issue(`gate registry must contain FE-GATE-001..029 without retired ${RETIRED_GATE_IDS.join(", ")} in canonical order`);
issue(`gate registry must contain FE-GATE-001..030 without retired ${RETIRED_GATE_IDS.join(", ")} in canonical order`);
}
const expectedStages: ReadonlyArray<readonly [string, string, readonly string[], readonly string[]]> = [
["merge", "MERGE_READY", [], PROMOTION_FORMULA.MERGE_READY],
@@ -837,8 +856,11 @@ function validateContractSemantics(
field_gate: ["FE-GATE-018"],
documentation_gate: ["FE-GATE-017"],
// F2. The checkers' own negative fixtures and the gating coverage check
// run after a merge to main, not on every pull request.
main_gate: ["FE-GATE-029"],
// run after a merge to main, not on every pull request. So do the optional
// runtime removal drills (FE-GATE-030, owner decision 2026-11-12 p): about
// seven of a pull request's thirty runner minutes, the same shape as the
// paired backend's nightly lanes.
main_gate: ["FE-GATE-029", "FE-GATE-030"],
};
if (JSON.stringify(contract.jobs.map(({ id }) => id)) !== JSON.stringify(Object.keys(expectedJobOwnership))) {
issue("job registry must contain the exact thirteen canonical jobs in semantic order");
@@ -993,6 +1015,9 @@ function validateContractSemantics(
const browserSteps = job.steps.filter(({ kind }) => kind === "browser-install").length;
const expected = job.browserGateIds.length > 0 ? 1 : 0;
if (browserSteps !== expected) issue(`browser install step drift: ${job.id}`);
// A matrix job's non-browser lanes would run in the browser image too.
const imaged = job.steps.some((step) => step.kind === "browser-install" && step.image !== undefined);
if (imaged && job.kind !== "gate-sequence") issue(`browser job image outside a gate sequence: ${job.id}`);
}
for (const cycle of findCycles(contract.jobs.map((job) => [job.id, job.needs] as const))) {
issue(`job dependency cycle: ${cycle.join(" -> ")}`);
+12 -2
View File
@@ -11,7 +11,10 @@ import {
registrySnapshotArtifactSchema,
supplyChainVerificationArtifactSchema,
} from "./contracts/release-artifacts.ts";
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
import {
type ValidatedJsonArtifactInput,
writeValidatedJsonArtifact,
} from "./lib/validated-json-artifact.ts";
const ARTIFACT_SCHEMA_DEFINITIONS = Object.freeze([
{
@@ -39,6 +42,13 @@ const ARTIFACT_SCHEMA_DEFINITIONS = Object.freeze([
type GenerateArtifactSchemasOptions = Readonly<{
root?: string;
check?: boolean;
/**
* Publishes one schema document. The default writes durably (fsync of the
* file and its directory). A test that only checks the generated bytes in a
* temporary root passes a writer without fsync: four fsync pairs were most
* of its time and grew to seconds under the parallel suite's disk load.
*/
writeArtifact?: (input: ValidatedJsonArtifactInput) => Promise<void>;
}>;
function canonicalize(value: unknown): unknown {
@@ -90,7 +100,7 @@ export async function generateArtifactSchemas(
continue;
}
await mkdir(path.dirname(destination), { recursive: true });
await writeValidatedJsonArtifact({
await (options.writeArtifact ?? writeValidatedJsonArtifact)({
path: destination,
schema: jsonSchemaDocumentArtifactSchema,
value: document,
+58 -9
View File
@@ -77,6 +77,21 @@ const PRODUCT_GATE_JOB = "product_merge_gate";
*/
const PRODUCT_GATES_HOLD = "release_gate";
/**
* A newer run in the same group cancels the older one. Gitea 1.27 cancels the
* older run's waiting and blocked jobs always and its running jobs only when
* cancel-in-progress is true. A pull request run has the ref
* `refs/pull/<number>/head`, so one group per pull request; a branch push is
* one group per branch; a release tag has its own ref. A manual run is one
* group per ref and stage and does not cancel a running run: a later release
* dispatch must not stop an earlier one between verification and promotion.
*/
const CONCURRENCY_LINES = Object.freeze([
"concurrency:",
" group: frontend-quality-gates-${{ gitea.event_name }}-${{ gitea.ref }}-${{ inputs.stage }}",
" cancel-in-progress: ${{ gitea.event_name != 'workflow_dispatch' }}",
]);
export function renderCiWorkflow(
contract: CiGateContract,
productGates: readonly ProductGate[] = [],
@@ -117,6 +132,8 @@ export function renderCiWorkflow(
"permissions:",
" contents: read",
"",
...CONCURRENCY_LINES,
"",
"env:",
' CI: "true"',
' VITE_BUILD_ID: "gitea-${{ gitea.run_id }}-${{ gitea.run_attempt }}"',
@@ -190,6 +207,8 @@ function renderJob(
" runs-on: ubuntu-latest",
` timeout-minutes: ${job.timeoutMinutes}`,
);
const image = jobImage(job);
if (image) lines.push(" container:", ` image: ${yamlScalar(image)}`);
if (job.kind === "immutable") {
const archive = job.steps.find((step) => step.kind === "archive-candidate");
if (!archive || archive.kind !== "archive-candidate") throw new TypeError("immutable job lacks archive step");
@@ -213,12 +232,13 @@ function renderJob(
lines.push(" outputs:", " deployed: ${{ steps.deploy.outputs.deployed }}");
}
const jobEnvironment = job.environment.filter((binding) => !isStepScopedSecret(job, binding));
if (jobEnvironment.length > 0) {
lines.push(" env:");
for (const binding of jobEnvironment) {
lines.push(` ${binding.name}: ${yamlScalar(binding.value)}`);
}
}
// The build records the image it ran in (scripts/lib/build-environment.ts):
// a job in its own image names that one, not the runner label's.
const environmentLines = [
...(image ? [` CI_RUNNER_IMAGE: ${yamlScalar(image)}`] : []),
...jobEnvironment.map((binding) => ` ${binding.name}: ${yamlScalar(binding.value)}`),
];
if (environmentLines.length > 0) lines.push(" env:", ...environmentLines);
if (job.kind === "gate-matrix") {
lines.push(" strategy:", " fail-fast: false", " matrix:", " include:");
const includesBrowser = job.steps.some(({ kind }) => kind === "browser-install");
@@ -254,6 +274,23 @@ function renderHostRequirements(
);
}
/**
* A gate whose host requirements the job container cannot meet runs in the
* environment its contract names (`hostEnvironment`). FE-GATE-013's provider
* sandbox needs systemd and bubblewrap, which the runner's job image lacks.
*/
function gateHostPrefix(gate: Readonly<{ hostEnvironment?: "system-container" | undefined }> | undefined): string {
return gate?.hostEnvironment === "system-container" ? "scripts/run-in-system-container.sh " : "";
}
/** The Playwright image a browser job runs in (`browser-install.image`), if any. */
function jobImage(job: CiWorkflowJob): string | undefined {
for (const step of job.steps) {
if (step.kind === "browser-install" && step.image) return step.image;
}
return undefined;
}
function renderStep(
job: CiWorkflowJob,
step: CiWorkflowStep,
@@ -281,6 +318,16 @@ function renderStep(
" corepack pnpm install --frozen-lockfile --ignore-scripts",
];
case "browser-install":
if (step.image) {
// The job image holds the browsers and their OS libraries; the goldens'
// faces are still OS packages it lacks, and it ships no package lists.
return [
" - name: Install visual-test fonts",
" run: |",
" $(command -v sudo || true) apt-get update",
` $(command -v sudo || true) ${VISUAL_TEST_FONT_INSTALL_ARGUMENTS}`,
];
}
return [
" - name: Install Playwright browsers",
...(job.kind === "gate-matrix" ? [" if: ${{ matrix.browser }}"] : []),
@@ -303,7 +350,7 @@ function renderStep(
return job.gateIds.flatMap((gateId) => [
` - name: ${yamlScalar(`${gateId} / ${index.gates.get(gateId)?.name ?? ""}`)}`,
" if: ${{ !cancelled() }}",
` run: corepack pnpm ci:gate -- ${gateId}`,
` run: ${gateHostPrefix(index.gates.get(gateId))}corepack pnpm ci:gate -- ${gateId}`,
]);
}
// 12-02: every gate the job owns runs, in order. Rendering only the first
@@ -533,9 +580,11 @@ export function workflowGateExecutionFailures(
) {
productFailures.push(`product gates do not hold the release stage: ${PRODUCT_GATES_HOLD} does not need ${PRODUCT_GATE_JOB}`);
}
const hostPrefixes = new Map(contract.gates.map((gate) => [gate.id, gateHostPrefix(gate)]));
for (const job of jobs) {
for (const match of job.matchAll(/^ +run: corepack pnpm ci:gate -- (FE-GATE-\d{3})$/gmu)) {
executed.add(match[1]!);
for (const match of job.matchAll(/^ +run: (\S+ )?corepack pnpm ci:gate -- (FE-GATE-\d{3})$/gmu)) {
// A gate runs through the prefix its contract names, and only that one.
if ((match[1] ?? "") === hostPrefixes.get(match[2]!)) executed.add(match[2]!);
}
if (/^ +run: corepack pnpm ci:gate -- \$\{\{ matrix\.gate \}\}$/mu.test(job)) {
for (const match of job.matchAll(/^ +- \{ gate: (FE-GATE-\d{3}),/gmu)) {
+1 -1
View File
@@ -4,7 +4,7 @@ export const ciContractReportSchema = z
.object({
schemaVersion: z.literal(2),
nodeVersion: z.string().regex(/^\d+\.\d+\.\d+$/u),
gateCount: z.literal(28),
gateCount: z.literal(29),
commandDefinitionCount: z.number().int().positive(),
commandReferenceCount: z.number().int().positive(),
artifactCount: z.number().int().positive(),
+41
View File
@@ -0,0 +1,41 @@
import path from "node:path";
/**
* Vitest matches `coverage.include` and `coverage.exclude` against each
* module's absolute path with picomatch `contains: true`, so a relative
* pattern may match anywhere in that path. `src/**` also matched
* `<checkout>/vite.config.ts` when the checkout sat in a folder whose name
* ends in `src` (`~/work/app-src/`), and risk coverage then failed on rows
* outside the repository inventory. A pattern that starts with the root
* matches only inside it.
*
* The root is escaped with the expression Vitest's glob library (tinyglobby
* 0.2) uses for a cwd, so a root with glob characters still matches itself
* literally and the untested-file glob resolves the pattern back to
* `src/...` under that cwd. A Windows root is turned into forward slashes
* first; for a valid Windows path that escape equals tinyglobby's Windows one.
*/
const UNESCAPED_GLOB_SYMBOLS =
/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/gu;
export function rootAnchoredGlobs(
root: string,
patterns: readonly string[],
): string[] {
const normalizedRoot = path.resolve(root).split(path.sep).join("/");
const escapedRoot = normalizedRoot.replace(UNESCAPED_GLOB_SYMBOLS, "\\$&");
return patterns.map((pattern) => {
if (
pattern.length === 0 ||
pattern.startsWith("/") ||
pattern.startsWith("!") ||
pattern.includes("\\") ||
pattern.split("/").includes("..")
) {
throw new TypeError(
`coverage pattern must be a forward-slash path inside the root: ${pattern}`,
);
}
return `${escapedRoot.replace(/\/$/u, "")}/${pattern}`;
});
}
+33 -4
View File
@@ -22,6 +22,29 @@ const BROWSER =
const DRILL =
"a removal drill copies the repository again. The drill runs the generated " +
"feature's own removal instead (feature-removal).";
/**
* The drill runs FE-GATE-005's test:coverage in the same copy, and its paths
* hold every path of these suites (tests/unit/removal-drill-test-paths.test.ts).
* Running them plain as well found nothing more and cost about 80 s a drill.
*/
const COVERED =
"test:coverage runs the same test files in this copy " +
"(tests/unit/removal-drill-test-paths.test.ts checks the paths).";
export const SCAFFOLD_DRILL_COVERED_SUITES: readonly string[] = Object.freeze([
"test:runtime-schema",
"test:unit",
"test:contract",
"test:component",
"test:integration",
]);
/**
* What a removal drill runs next to test:coverage so that every test:all path
* still runs once in the copy (scripts/test-sample-removal.ts). The rest of
* test:all, check:release-coherence included, is inside coverage's paths.
*/
export const REMOVAL_DRILL_SUITES_OUTSIDE_COVERAGE: readonly string[] = Object.freeze([
"test:recipes",
]);
export const SCAFFOLD_DRILL_EXCLUDED_SCRIPTS: Readonly<Record<string, string>> = Object.freeze({
"verify:lockfile":
@@ -38,11 +61,9 @@ export const SCAFFOLD_DRILL_EXCLUDED_SCRIPTS: Readonly<Record<string, string>> =
"needs the CI runner's bubblewrap, systemd and cgroup v2 " +
"(scripts/check-system-test-prerequisites.ts). It tests the provider " +
"sandbox, which a feature does not reach.",
...Object.fromEntries(SCAFFOLD_DRILL_COVERED_SUITES.map((script) => [script, COVERED])),
"test:sample-removal": DRILL,
"test:feature-scaffold": "is this drill.",
"test:optional-recipe-removal": DRILL,
"test:browser-file-storage-removal": DRILL,
"test:realtime-removal": DRILL,
});
export type ScaffoldDrillCommand = Readonly<{
@@ -65,6 +86,14 @@ export function scaffoldDrillCommands(
const mergeScripts = new Set<string>();
const seen = new Set<string>();
const selected: ScaffoldDrillCommand[] = [];
// A covered suite is left out only while the drill runs test:coverage. A
// copy whose merge stage lost it runs the suites plain again.
const runsCoverage = !Object.hasOwn(excluded, "test:coverage") && merge.gateIds.some((gateId) =>
contract.gates.find(({ id }) => id === gateId)?.commandIds.some((commandId) =>
commands.get(commandId)?.script === "test:coverage"));
const leftOut = (script: string) =>
Object.hasOwn(excluded, script) &&
(runsCoverage || !SCAFFOLD_DRILL_COVERED_SUITES.includes(script) || excluded[script] !== COVERED);
for (const gateId of merge.gateIds) {
const gate = contract.gates.find(({ id }) => id === gateId);
if (!gate) throw new TypeError(`the merge stage names an undefined gate: ${gateId}`);
@@ -72,7 +101,7 @@ export function scaffoldDrillCommands(
const command = commands.get(commandId);
if (!command) throw new TypeError(`${gateId} names an undefined command: ${commandId}`);
mergeScripts.add(command.script);
if (seen.has(commandId) || Object.hasOwn(excluded, command.script)) continue;
if (seen.has(commandId) || leftOut(command.script)) continue;
seen.add(commandId);
selected.push(Object.freeze({
name: `${gateId}:${commandId}`,
+4 -1
View File
@@ -43,7 +43,10 @@ export const PROMOTION_FORMULA = Object.freeze({
// F2 (design-docs repo-structure/03-ci.md 7.3). The checkers' negative
// fixtures and the gating coverage check run after a merge to main. They
// test the checkers, not the change, so they hold no promotion.
MAIN_READY: Object.freeze(["FE-GATE-029"]),
// FE-GATE-030 (owner decision 2026-11-12 p): the optional runtime removal
// drills moved here from FE-GATE-020. A failure turns main red, and the next
// pull request fixes it before it merges.
MAIN_READY: Object.freeze(["FE-GATE-029", "FE-GATE-030"]),
});
export type GateResult = "PASS" | "FAIL" | "UNVERIFIED";
+64 -23
View File
@@ -1,12 +1,17 @@
import { constants, type Dirent, type Stats } from "node:fs";
import {
lstat,
open,
readdir,
realpath,
} from "node:fs/promises";
closeSync,
constants,
type Dirent,
fstatSync,
lstatSync,
openSync,
readdirSync,
readFileSync,
realpathSync,
type Stats,
} from "node:fs";
import path from "node:path";
import babelParser from "@babel/eslint-parser";
import { parseSync } from "@babel/core";
import {
COVERAGE_SUMMARY_METRICS as coverageMetrics,
@@ -422,23 +427,35 @@ function statementIsCoverageCounterBearing(value: unknown): boolean {
return true;
}
function directiveIsCoverageCounterBearing(value: unknown): boolean {
if (!isRecord(value) || !isRecord(value.value) || typeof value.value.value !== "string") {
throw new TypeError("TypeScript parser returned an invalid directive");
}
return value.value.value !== "use strict";
}
export function hasCoverageCounterBearingStatements(
source: string,
relativePath: string,
): boolean {
// Babel's own parser and AST. @babel/eslint-parser ran the same parser and
// then converted the whole tree and its tokens to ESTree, about 2.8 times
// the cost over the repository, and the top-level statement types and
// flags read here are the same in both trees. Every production module is
// parsed once per inventory, and the inventory is built in the gate and in
// its tests.
let parsed: unknown;
try {
parsed = babelParser.parse(source, {
parsed = parseSync(source, {
filename: relativePath,
babelrc: false,
configFile: false,
sourceType: "module",
requireConfigFile: false,
filePath: relativePath,
babelOptions: {
parserOpts: {
plugins: [
"typescript",
...(relativePath.endsWith(".tsx") ? ["jsx"] : []),
],
},
parserOpts: {
plugins: [
"typescript",
...(relativePath.endsWith(".tsx") ? (["jsx"] as const) : []),
],
},
});
} catch (error) {
@@ -446,10 +463,21 @@ export function hasCoverageCounterBearingStatements(
cause: error,
});
}
if (!isRecord(parsed) || !Array.isArray(parsed.body)) {
const program = isRecord(parsed) ? parsed.program : undefined;
if (
!isRecord(program) ||
!Array.isArray(program.body) ||
!Array.isArray(program.directives)
) {
throw new TypeError("TypeScript parser returned an invalid program");
}
return parsed.body.some(statementIsCoverageCounterBearing);
// Babel keeps the directive prologue in `directives`, not `body` (ESTree
// put it in `body`). V8 coverage counts a directive as a statement, all but
// "use strict" (check:v8-coverage-counter-semantics runs both).
return (
program.directives.some(directiveIsCoverageCounterBearing) ||
program.body.some(statementIsCoverageCounterBearing)
);
}
export async function buildProductionModuleInventory(
@@ -457,12 +485,25 @@ export async function buildProductionModuleInventory(
): Promise<ProductionModuleInventory> {
const repositoryRoot = path.resolve(options.repositoryRoot ?? process.cwd());
const sourceRoot = path.join(repositoryRoot, "src");
// The default file system makes the same calls in the same order as the
// fs/promises one, synchronously. The walk awaits about six calls per
// module one after another; through the thread pool each waited for an
// event-loop turn, and on a loaded CI machine that wait, not the work, made
// the inventory take seconds. Injected file systems keep the async shape.
const readDirectory = options.readDirectory ??
((target: string) => readdir(target, { withFileTypes: true }));
const lstatPath = options.lstatPath ?? lstat;
const realpathPath = options.realpathPath ?? realpath;
(async (target: string) => readdirSync(target, { withFileTypes: true }));
const lstatPath = options.lstatPath ?? (async (target: string) => lstatSync(target));
const realpathPath = options.realpathPath ??
(async (target: string) => realpathSync.native(target));
const openFile = options.openFile ??
((target: string, flags: number) => open(target, flags));
(async (target: string, flags: number): Promise<ReadableFileHandle> => {
const descriptor = openSync(target, flags);
return {
stat: async () => fstatSync(descriptor),
readFile: async (encoding) => readFileSync(descriptor, encoding),
close: async () => closeSync(descriptor),
};
});
const generatedPaths = uniquePaths(options.generatedPaths ?? [], "generatedPaths");
const generated = new Set(generatedPaths);
const repositoryRealpath = await realpathPath(repositoryRoot);
+34 -14
View File
@@ -10,6 +10,8 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { promisify } from "node:util";
import { rootAnchoredGlobs } from "./coverage-scope.ts";
const execFileAsync = promisify(execFile);
const coverageMetrics = [
"lines",
@@ -17,8 +19,13 @@ const coverageMetrics = [
"functions",
"branches",
] as const;
const runtimeModule = "src/runtime.ts";
/** Modules V8 gives at least one counter: code, and a directive prologue. */
const counterBearingModules = Object.freeze([
"src/directive-use-client.ts",
"src/runtime.ts",
] as const);
const counterlessModules = Object.freeze([
"src/directive-use-strict.ts",
"src/import-empty.ts",
"src/import-side-effect.ts",
"src/import-type-empty.ts",
@@ -27,15 +34,25 @@ const counterlessModules = Object.freeze([
"src/reexport-star.ts",
"src/type-only.ts",
] as const);
const expectedModules = Object.freeze(
[runtimeModule, ...counterlessModules].sort(),
const expectedModules: readonly string[] = Object.freeze(
[...counterBearingModules, ...counterlessModules].sort(),
);
const childOutputLimit = 1_800;
/**
* The fixture is copied into a folder whose name ends in `src` and has glob
* characters. Vitest matches coverage patterns anywhere in an absolute path,
* so an unanchored `src/**` also counts the fixture's root-level
* `outside-src.ts`, which the row-set check then reports as additional. The
* repository's own coverage patterns are anchored the same way
* (vitest.config.ts, scripts/lib/coverage-scope.ts).
*/
const fixtureCheckoutName = "checkout (copy)-src";
type ChildOutput = Readonly<{ stdout: string; stderr: string }>;
type ChildInput = Readonly<{
repositoryRoot: string;
ownedRoot: string;
fixtureRoot: string;
configPath: string;
}>;
type CheckerOptions = Readonly<{
@@ -144,9 +161,11 @@ export function assertV8CoverageCounterSemantics(
`V8 coverage row set mismatch; missing: ${missing.join(", ") || "none"}; additional: ${additional.join(", ") || "none"}`,
);
}
const runtimeRow = rows.get(runtimeModule)!;
if (!coverageMetrics.some((metric) => runtimeRow[metric].total > 0)) {
throw new Error(`V8 runtime module is not counter-bearing: ${runtimeModule}`);
for (const modulePath of counterBearingModules) {
const row = rows.get(modulePath)!;
if (!coverageMetrics.some((metric) => row[metric].total > 0)) {
throw new Error(`V8 module is not counter-bearing: ${modulePath}`);
}
}
for (const modulePath of counterlessModules) {
const row = rows.get(modulePath)!;
@@ -166,7 +185,7 @@ export function assertV8CoverageCounterSemantics(
}
}
return Object.freeze({
counterBearingModules: Object.freeze([runtimeModule]),
counterBearingModules: Object.freeze([...counterBearingModules]),
counterlessModules: Object.freeze([...counterlessModules]),
});
}
@@ -195,7 +214,7 @@ async function defaultRunVitest(input: ChildInput): Promise<ChildOutput> {
"--no-color",
],
{
cwd: input.ownedRoot,
cwd: input.fixtureRoot,
encoding: "utf8",
timeout: 30_000,
maxBuffer: 256 * 1024,
@@ -232,15 +251,16 @@ export async function checkV8CoverageCounterSemantics(
repositoryRoot,
"tests/fixtures/v8-coverage-counter-semantics",
);
const configPath = path.join(ownedRoot, "vitest.config.mjs");
const fixtureRoot = path.join(ownedRoot, fixtureCheckoutName);
const configPath = path.join(fixtureRoot, "vitest.config.mjs");
const reportsDirectory = path.join(ownedRoot, "coverage");
try {
await cp(fixtureSource, ownedRoot, { recursive: true });
await cp(fixtureSource, fixtureRoot, { recursive: true });
await writeFile(
configPath,
`export default ${JSON.stringify(
{
root: ownedRoot,
root: fixtureRoot,
test: {
globals: true,
include: ["counter-semantics.fixture.ts"],
@@ -249,7 +269,7 @@ export async function checkV8CoverageCounterSemantics(
provider: "v8",
reportsDirectory,
reporter: ["json-summary"],
include: ["src/**/*.ts"],
include: rootAnchoredGlobs(fixtureRoot, ["src/**/*.ts"]),
},
},
},
@@ -259,7 +279,7 @@ export async function checkV8CoverageCounterSemantics(
"utf8",
);
try {
await runVitest({ repositoryRoot, ownedRoot, configPath });
await runVitest({ repositoryRoot, ownedRoot, fixtureRoot, configPath });
} catch (error) {
const record = isRecord(error) ? error : {};
throw new Error(
@@ -287,7 +307,7 @@ export async function checkV8CoverageCounterSemantics(
cause: error,
});
}
return assertV8CoverageCounterSemantics(summary, ownedRoot);
return assertV8CoverageCounterSemantics(summary, fixtureRoot);
} finally {
await rm(ownedRoot, { recursive: true, force: true });
}
+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/env bash
# Runs one command in a disposable systemd container, for a gate whose host requirements a CI job
# container or a developer shell does not meet (config/ci/gates.json `hostEnvironment: "system-container"`,
# FE-GATE-013's provider sandbox: bubblewrap, a systemd user manager, delegated cgroup v2).
#
# scripts/run-in-system-container.sh <command…> e.g. corepack pnpm ci:gate -- FE-GATE-013
#
# The container is privileged with its own cgroup namespace and boots systemd (config/ci/system-container.Dockerfile).
# The command runs as root there, so bubblewrap needs no unprivileged user namespace from the host kernel
# (Ubuntu 23.10+ refuses those to unconfined processes). Node and pnpm come from the caller, copied in with the
# working tree and its git history; artifacts/ is copied back and the container removed, whatever the result.
# Docker: the CI job reaches the runner's own daemon through its Docker proxy
# (platform-core infrastructure/ci/gitea-runner); on desktop it is the host daemon.
# Environment: SYSTEM_CONTAINER_DOCKER (default docker), SYSTEM_CONTAINER_KEEP=1 keeps the container for debugging.
# Exit code: the command's, or 3 when the container could not be prepared.
set -euo pipefail
[ $# -gt 0 ] || { sed -n '2,13p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2; }
docker=${SYSTEM_CONTAINER_DOCKER:-docker}
root=$(git rev-parse --show-toplevel)
cd "$root"
dockerfile=config/ci/system-container.Dockerfile
tag="fe-system-container:$(sha256sum "$dockerfile" | cut -c1-16)"
node_root=$(dirname "$(dirname "$(command -v node)")")
corepack_home=${COREPACK_HOME:-$HOME/.cache/node/corepack}
# The environment the gate reads (scripts/verify.sh ci_env, the workflow's global env).
pass_env=(CI VITE_BUILD_ID VITE_COMMIT_SHA RELEASE_ID CI_RUNNER_IMAGE SOURCE_DATE_EPOCH APP_PROFILE RELEASE_TARGET)
say() { echo "system-container: $*" >&2; }
fail() { say "$*"; exit 3; }
if ! $docker image inspect "$tag" > /dev/null 2>&1; then
say "building $tag"
$docker build -q -t "$tag" -f "$dockerfile" config/ci > /dev/null || fail "image build failed"
fi
cid=$($docker run -d --privileged --cgroupns=private --tmpfs /run --tmpfs /run/lock "$tag") \
|| fail "container did not start"
cleanup() {
if [ "${SYSTEM_CONTAINER_KEEP:-0}" = 1 ]; then say "kept container $cid"; else $docker rm -f "$cid" > /dev/null 2>&1 || :; fi
}
trap cleanup EXIT
# systemd reaches a final state, then root's lingering user manager opens its bus. Until PID 1 has its own
# bus up, systemctl cannot connect and answers nothing, so ask again for up to a minute.
state=""
for _ in $(seq 1 120); do
state=$($docker exec "$cid" systemctl is-system-running --wait 2>/dev/null || :)
case "$state" in running | degraded) break ;; esac
sleep 0.5
done
case "$state" in running | degraded) ;; *) fail "systemd did not start (state: ${state:-none})" ;; esac
$docker exec "$cid" sh -c 'for i in $(seq 1 120); do [ -S /run/user/0/bus ] && exit 0; sleep 0.5; done; exit 1' \
|| fail "the root user manager did not start"
# The working tree as it is (node_modules included) and its history. A linked worktree's .git is a file
# naming a directory outside the tree, so the history goes in as a bundle of HEAD instead.
tar -C "$root" --exclude=./.git --exclude=./.tmp -cf - . | $docker exec -i "$cid" sh -c 'mkdir -p /work && tar -C /work --no-same-owner -xf -' \
|| fail "copying the working tree failed"
if [ -d .git ]; then
tar -C "$root" -cf - .git | $docker exec -i "$cid" tar -C /work --no-same-owner -xf - || fail "copying .git failed"
else
bundle=$(mktemp)
git bundle create -q "$bundle" HEAD
$docker exec -i "$cid" sh -c 'cat > /tmp/head.bundle' < "$bundle"
rm -f "$bundle"
$docker exec -w /work "$cid" sh -c 'git init -q . && git fetch -q /tmp/head.bundle HEAD && git update-ref HEAD FETCH_HEAD && git reset -q' \
|| fail "restoring the git history failed"
fi
tar -C "$node_root" -cf - . | $docker exec -i "$cid" sh -c 'mkdir -p /opt/node && tar -C /opt/node --no-same-owner -xf -' \
|| fail "copying node failed"
if [ -d "$corepack_home" ]; then
tar -C "$corepack_home" -cf - . | $docker exec -i "$cid" sh -c 'mkdir -p /opt/corepack && tar -C /opt/corepack --no-same-owner -xf -' \
|| fail "copying the corepack cache failed"
fi
exec_env=(-e PATH=/opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-e COREPACK_HOME=/opt/corepack -e HOME=/root
-e XDG_RUNTIME_DIR=/run/user/0 -e DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus)
for name in "${pass_env[@]}"; do
[ -z "${!name+x}" ] || exec_env+=(-e "$name=${!name}")
done
rc=0
$docker exec -w /work "${exec_env[@]}" "$cid" "$@" || rc=$?
# The gate's log and evidence come back even when it failed.
mkdir -p artifacts
$docker exec "$cid" sh -c '[ -d /work/artifacts ] && tar -C /work -cf - artifacts' | tar -C "$root" -xf - \
|| say "copying artifacts back failed"
exit "$rc"
+7 -1
View File
@@ -31,6 +31,7 @@ import {
sealRemovalFixtureRepository,
type RemovalCheck,
} from "./lib/removal-fixture.ts";
import { REMOVAL_DRILL_SUITES_OUTSIDE_COVERAGE } from "./lib/feature-scaffold-drill.ts";
import { REMOVABLE_TEMPLATE_FEATURES } from "./lib/removable-template-features.ts";
/**
@@ -476,8 +477,13 @@ try {
check(`${prefix}design-system`, "check:design-system"),
check(`${prefix}architecture`, "check:architecture"),
check(`${prefix}registries`, "check:registries"),
check(`${prefix}unit-integration`, "test:all"),
// test:all ran here before coverage and ran its files twice. coverage
// holds every test:all path but the optional recipes'
// (tests/unit/removal-drill-test-paths.test.ts), so those run on their own.
check(`${prefix}coverage`, "test:coverage"),
...REMOVAL_DRILL_SUITES_OUTSIDE_COVERAGE
.filter((script) => Object.hasOwn(fixturePackage.scripts, script))
.map((script) => check(`${prefix}${script.replace(/^test:/u, "")}`, script)),
check(`${prefix}test-evidence-source`, "check:test-evidence:source"),
check(`${prefix}ci-contract`, "check:ci"),
check(`${prefix}home-smoke`, "exec", [
+41 -2
View File
@@ -45,12 +45,51 @@ class StagePlanTest(unittest.TestCase):
def test_parts_runs_each_command_of_the_gate(self) -> None:
contract = gates()
gate = next(g for g in contract["gates"] if g["id"] == "FE-GATE-013")
gate = next(g for g in contract["gates"] if g["id"] == "FE-GATE-005")
scripts = {c["id"]: c["script"] for c in contract["commands"]}
result = sh([str(VERIFY), "parts", "FE-GATE-013", "--dry-run"], cwd=REPO)
result = sh([str(VERIFY), "parts", "FE-GATE-005", "--dry-run"], cwd=REPO)
self.assertEqual([line.split(": ", 1)[1] for line in result.stdout.splitlines()],
[f"corepack pnpm -s {scripts[c]}" for c in gate["commandIds"]])
def test_a_gate_with_a_host_environment_runs_in_it_as_in_the_workflow(self) -> None:
# FE-GATE-013 needs systemd and bubblewrap; the workflow and verify.sh both run it through
# scripts/run-in-system-container.sh (config/ci/gates.json hostEnvironment).
contract = gates()
hosted = [g for g in contract["gates"] if g.get("hostEnvironment") == "system-container"]
self.assertEqual([g["id"] for g in hosted], ["FE-GATE-013"])
scripts = {c["id"]: c["script"] for c in contract["commands"]}
wrapper = "scripts/run-in-system-container.sh"
result = sh([str(VERIFY), "gate", "FE-GATE-013", "FE-GATE-005", "--dry-run"], cwd=REPO)
self.assertEqual(result.stdout.splitlines(), [f"FE-GATE-013: {wrapper} corepack pnpm -s ci:gate FE-GATE-013",
"FE-GATE-005: corepack pnpm -s ci:gate FE-GATE-005"])
result = sh([str(VERIFY), "parts", "FE-GATE-013", "--dry-run"], cwd=REPO)
self.assertEqual([line.split(": ", 1)[1] for line in result.stdout.splitlines()],
[f"{wrapper} corepack pnpm -s {scripts[c]}" for c in hosted[0]["commandIds"]])
workflow = (REPO / ".gitea/workflows/quality-gates.yml").read_text(encoding="utf-8")
self.assertIn(f"run: {wrapper} corepack pnpm ci:gate -- FE-GATE-013", workflow)
# A host that cannot start the container runs the gate here (gates.md 3절).
result = sh([str(VERIFY), "gate", "FE-GATE-013", "--dry-run"], cwd=REPO, env={"VERIFY_HOST_ENVIRONMENT": "off"})
self.assertEqual(result.stdout.splitlines(), ["FE-GATE-013: corepack pnpm -s ci:gate FE-GATE-013"])
def test_parts_passes_each_command_its_arguments_as_ci_gate_does(self) -> None:
# run-ci-gate.ts runs `pnpm <script> ...args`. Without the args FE-GATE-009's
# `review:a11y-manual -- --format-only` checked the release evidence instead and failed.
contract = gates()
commands = {c["id"]: c for c in contract["commands"]}
with_args = [g for g in contract["gates"]
if any(commands[c].get("args") for c in g["commandIds"])]
self.assertTrue(with_args, "the contract has no command with arguments to check")
for gate in with_args:
with self.subTest(gate=gate["id"]):
result = sh([str(VERIFY), "parts", gate["id"], "--dry-run"], cwd=REPO)
expected = []
prefix = ["scripts/run-in-system-container.sh"] if gate.get("hostEnvironment") else []
for command_id in gate["commandIds"]:
command = commands[command_id]
words = [*prefix, "corepack", "pnpm", "-s", command["script"], *command.get("args", [])]
expected.append(" ".join(words))
self.assertEqual([line.split(": ", 1)[1] for line in result.stdout.splitlines()], expected)
def test_arguments_after_the_separator_go_to_the_one_script_or_command_as_given(self) -> None:
result = sh([str(VERIFY), "script", "test:sample-removal", "--dry-run", "--", "--feature=invoice-feature"],
cwd=REPO)
+33 -9
View File
@@ -22,7 +22,8 @@
# 환경 변수: VERIFY_HOST(desktop 단계의 --on 기본값, 기본 desktop), VERIFY_REMOTE_REPO(원격 checkout, 기본
# workspace/<repo 이름>, 홈 기준), VERIFY_BASE_REF(기본 origin/main), VERIFY_LOCK(기본 /tmp/claude-gates/heavy.lock),
# VERIFY_LOG_ROOT(원격 로그 폴더, 기본 /tmp/claude-gates), VERIFY_SSH(기본 ssh), VERIFY_NODE_BIN(원격 node 폴더,
# 기본 ~/.nvm/versions/node/v<.nvmrc>/bin), VERIFY_INSTALL(0이면 원격 의존성 설치를 건너뛴다).
# 기본 ~/.nvm/versions/node/v<.nvmrc>/bin), VERIFY_INSTALL(0이면 원격 의존성 설치를 건너뛴다),
# VERIFY_HOST_ENVIRONMENT(off면 hostEnvironment 게이트도 시스템 컨테이너 없이 이 호스트에서 돈다).
# 종료 코드: 0 통과, 1 실패, 2 사용법, 4 원격 준비 실패.
set -euo pipefail
@@ -34,7 +35,7 @@ DRY_RUN=0
APPLY_BACK=0
usage() {
sed -n '2,26p' "$0" | sed 's/^# \{0,1\}//' >&2
sed -n '2,27p' "$0" | sed 's/^# \{0,1\}//' >&2
exit 2
}
@@ -55,6 +56,11 @@ elif kind == "stage":
elif kind == "gate":
if not any(gate["id"] == names[0] for gate in contract["gates"]):
sys.exit(1)
elif kind == "host":
gate = next((gate for gate in contract["gates"] if gate["id"] == names[0]), None)
if gate is None:
sys.exit(1)
print(gate.get("hostEnvironment", ""))
elif kind == "scripts":
gate = next((gate for gate in contract["gates"] if gate["id"] == names[0]), None)
if gate is None:
@@ -62,7 +68,9 @@ elif kind == "scripts":
commands = {command["id"]: command for command in contract["commands"]}
for command_id in gate["commandIds"]:
command = commands[command_id]
print(f'{command["script"]}\t{command.get("expect", "pass")}\t{command.get("expectedExitCode", "")}')
# \x1f between fields keeps an empty exit code a field; \x1e between the command's args.
args = "\x1e".join(command.get("args", []))
print(f'{command["script"]}\x1f{command.get("expect", "pass")}\x1f{command.get("expectedExitCode", "")}\x1f{args}')
PY
}
@@ -118,23 +126,39 @@ step() {
return "$rc"
}
# 계약이 hostEnvironment를 정한 게이트(FE-GATE-013)는 workflow와 같이 그 환경에서 돈다.
# VERIFY_HOST_ENVIRONMENT=off면 이 호스트에서 바로 돈다(컨테이너를 띄울 수 없는 호스트, gates.md 3절).
host_prefix() {
[ "${VERIFY_HOST_ENVIRONMENT:-on}" != off ] || return 0
case "$(gates_json host "$1")" in
system-container) echo scripts/run-in-system-container.sh ;;
esac
}
run_gates() {
local failed=0 gate
local failed=0 gate prefix
[ "$DRY_RUN" = 1 ] || ci_env
for gate in "$@"; do
gates_json gate "$gate" || { echo "verify: config/ci/gates.json에 없는 게이트: $gate" >&2; return 2; }
step "$gate" corepack pnpm -s ci:gate "$gate" || failed=1
prefix=$(host_prefix "$gate")
# shellcheck disable=SC2086 # 접두어는 공백 없는 경로 하나이거나 비어 있다
step "$gate" $prefix corepack pnpm -s ci:gate "$gate" || failed=1
done
return "$failed"
}
run_parts() {
local gate=$1 failed=0 script expect code rc
local gate=$1 failed=0 script expect code argtext rc args prefix
[ "$DRY_RUN" = 1 ] || ci_env
gates_json scripts "$gate" > /dev/null || { echo "verify: config/ci/gates.json에 없는 게이트: $gate" >&2; return 2; }
while IFS=$'\t' read -r script expect code; do
prefix=$(host_prefix "$gate")
while IFS=$'\x1f' read -r script expect code argtext; do
rc=0
step "$gate $script" corepack pnpm -s "$script" || rc=$?
args=()
# The command's args, as run-ci-gate.ts passes them (`pnpm <script> ...args`).
[ -z "$argtext" ] || IFS=$'\x1e' read -r -a args <<< "$argtext"
# shellcheck disable=SC2086
step "$gate $script" $prefix corepack pnpm -s "$script" ${args[@]+"${args[@]}"} || rc=$?
# expect=fail인 명령(음성 fixture)은 정해진 종료 코드로 실패해야 통과다.
if [ "$expect" = fail ]; then
[ "$DRY_RUN" = 1 ] || [ "$rc" = "${code:-1}" ] || failed=1
@@ -266,7 +290,7 @@ if [ $install = 1 ]; then
|| CI=true corepack pnpm install --frozen-lockfile >> "\$logs/install.log" 2>&1 \
|| { echo "의존성 설치 실패: \$logs/install.log" >&2; exit 4; }
fi
export VERIFY_SUMMARY="\$logs/summary.txt" VERIFY_STEP_LOGS="\$logs" VERIFY_REF="$ref"
export VERIFY_SUMMARY="\$logs/summary.txt" VERIFY_STEP_LOGS="\$logs" VERIFY_REF="$ref" VERIFY_HOST_ENVIRONMENT="${VERIFY_HOST_ENVIRONMENT:-on}"
flock $lock ./scripts/verify.sh $args 2>&1 | tee "\$logs/run.log"
rc=\${PIPESTATUS[0]}
git status --porcelain > "\$logs/status-after.txt"
+11 -6
View File
@@ -57,6 +57,14 @@ const PLATFORM: ChunkRoute = Object.freeze({
});
/** The generated feature's list, read from build A's copy. */
let featureList: ChunkRoute | undefined;
function readFeatureList(root: string): ChunkRoute {
const { list, messages } = generatedFeature(root);
return Object.freeze({
...list,
navigationLabel: messages["ko-KR"][`route.${list.routeId}.navigation`]!,
title: messages["ko-KR"][`route.${list.routeId}.title`]!,
});
}
function FEATURE(): ChunkRoute {
if (!featureList) throw new Error("Fixture builds were not prepared.");
return featureList;
@@ -110,12 +118,7 @@ test.beforeAll(async () => {
name: "a",
edit: async (root) => {
await addGeneratedFeature(root);
const { list, messages } = generatedFeature(root);
featureList = Object.freeze({
...list,
navigationLabel: messages["ko-KR"][`route.${list.routeId}.navigation`]!,
title: messages["ko-KR"][`route.${list.routeId}.title`]!,
});
featureList = readFeatureList(root);
},
},
{
@@ -131,6 +134,8 @@ test.beforeAll(async () => {
},
},
]);
// A worker that reused another browser project's builds ran no edit.
featureList ??= readFeatureList(builds.root);
});
test.afterAll(async () => {
@@ -35,6 +35,7 @@ let builds: ServiceWorkerBuilds | undefined;
test.beforeAll(async () => {
test.setTimeout(180_000);
builds = await prepareServiceWorkerBuilds({
key: "recovery",
async beforeBuild(name, root) {
if (name === "a") {
await replaceOnce(
+1
View File
@@ -61,6 +61,7 @@ const CHANGED_ROUTE_SOURCE =
test.beforeAll(async () => {
test.setTimeout(180_000);
builds = await prepareServiceWorkerBuilds({
key: "update",
beforeBuild: async (name, root) => {
if (name !== "b") return;
await appendFile(
+10
View File
@@ -0,0 +1,10 @@
import { startSharedFixtureBuilds } from "./shared-fixture-builds.ts";
/**
* The e2e run's global setup: one shared fixture build root for every browser
* project (shared-fixture-builds.ts). The returned function is the global
* teardown that removes it.
*/
export default async function globalSetup(): Promise<() => Promise<void>> {
return startSharedFixtureBuilds();
}
+33 -26
View File
@@ -1,11 +1,11 @@
import { spawnSync } from "node:child_process";
import { cp, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { cp, readFile, rename, rm, writeFile } from "node:fs/promises";
import path from "node:path";
import { localBuildEnvironment } from "../../../scripts/lib/build-environment.ts";
import { linkFixtureNodeModules } from "../../../scripts/lib/fixture-node-modules.ts";
import { selectRepositoryPaths } from "../../../scripts/lib/repository-layout.ts";
import { sharedFixtureBuild } from "./shared-fixture-builds.ts";
/**
* Real production builds of an edited temp copy of the repository, in the
@@ -29,6 +29,8 @@ export type FixtureBuild<Name extends string> = Readonly<{
export type FixtureBuilds<Name extends string> = Readonly<{
root: string;
dist: Readonly<Record<Name, string>>;
/** One copy for the whole e2e run (shared-fixture-builds.ts); the run removes it. */
shared: boolean;
}>;
/** Replaces the one occurrence of `search` in `file` of the copy. */
@@ -67,32 +69,37 @@ export async function prepareFixtureBuilds<Name extends string>(
prefix: string,
builds: readonly FixtureBuild<Name>[],
): Promise<FixtureBuilds<Name>> {
const root = await mkdtemp(path.join(tmpdir(), `${prefix}-`));
try {
await cp(repoRoot, root, {
recursive: true,
filter: (source) =>
!skipped.has(path.relative(repoRoot, source).split(path.sep)[0]!),
});
await linkFixtureNodeModules(root, repoRoot);
const dist = {} as Record<Name, string>;
for (const build of builds) {
await build.edit?.(root);
const buildId = `${prefix}-${build.name}`;
run(root, "scripts/generate-product-feature-index.ts", buildId, build.env);
run(root, "scripts/build-frontend.ts", buildId, build.env);
dist[build.name] = path.join(root, `dist-${build.name}`);
await rename(path.join(root, "dist"), dist[build.name]);
}
return { root, dist };
} catch (error) {
await rm(root, { recursive: true, force: true });
throw error;
}
// An edit's source text names the build (two specs never share a prefix).
const fingerprint = JSON.stringify(
builds.map((build) => [build.name, build.env ?? {}, build.edit?.toString() ?? ""]),
);
const { root, value, shared } = await sharedFixtureBuild(
`fixture-${prefix}`,
fingerprint,
async (root) => {
await cp(repoRoot, root, {
recursive: true,
filter: (source) =>
!skipped.has(path.relative(repoRoot, source).split(path.sep)[0]!),
});
await linkFixtureNodeModules(root, repoRoot);
const dist = {} as Record<Name, string>;
for (const build of builds) {
await build.edit?.(root);
const buildId = `${prefix}-${build.name}`;
run(root, "scripts/generate-product-feature-index.ts", buildId, build.env);
run(root, "scripts/build-frontend.ts", buildId, build.env);
dist[build.name] = path.join(root, `dist-${build.name}`);
await rename(path.join(root, "dist"), dist[build.name]);
}
return dist;
},
);
return { root, dist: value, shared };
}
export async function removeFixtureBuilds(
builds: Readonly<{ root: string }> | undefined,
builds: Readonly<{ root: string; shared: boolean }> | undefined,
): Promise<void> {
if (builds) await rm(builds.root, { recursive: true, force: true });
if (builds && !builds.shared) await rm(builds.root, { recursive: true, force: true });
}
+39 -37
View File
@@ -2,7 +2,6 @@ import { spawnSync } from "node:child_process";
import { existsSync } from "node:fs";
import {
cp,
mkdtemp,
readFile,
rename,
rm,
@@ -10,7 +9,6 @@ import {
} from "node:fs/promises";
import { createServer, type Server } from "node:http";
import type { AddressInfo } from "node:net";
import { tmpdir } from "node:os";
import path from "node:path";
import { pathToFileURL } from "node:url";
import { gzipSync } from "node:zlib";
@@ -20,6 +18,7 @@ import { localBuildEnvironment } from "../../../scripts/lib/build-environment.ts
import { linkFixtureNodeModules } from "../../../scripts/lib/fixture-node-modules.ts";
import { selectRepositoryPaths } from "../../../scripts/lib/repository-layout.ts";
import type { StaticAssetManifestV1 } from "../../../src/contracts/service-worker.ts";
import { sharedFixtureBuild } from "./shared-fixture-builds.ts";
/**
* R3-6 test helper: two real production builds with the Service Worker on,
@@ -66,6 +65,8 @@ export type ServiceWorkerBuilds = Readonly<{
dist: Readonly<Record<BuildName, string>>;
/** Sorted URLs of each build's generated precache list (premise 3). */
precached: Readonly<Record<BuildName, readonly string[]>>;
/** One copy for the whole e2e run (shared-fixture-builds.ts); the run removes it. */
shared: boolean;
}>;
const SELECTION_FILE = "src/features/product-capabilities.ts";
@@ -183,52 +184,53 @@ function run(cwd: string, script: string, buildId: string): void {
/**
* `beforeBuild` edits the temp copy right before build `name` (06-03: a
* broken worker A, then a `REMOVE_REGISTRATION` release B). Edits persist
* into the later build.
* into the later build. `key` names this pair of builds in the e2e run
* (shared-fixture-builds.ts); each spec passes its own.
*/
export async function prepareServiceWorkerBuilds(
options: Readonly<{
key: string;
beforeBuild?: (name: BuildName, root: string) => Promise<void>;
}> = {},
}>,
): Promise<ServiceWorkerBuilds> {
const root = await mkdtemp(path.join(tmpdir(), "ca-sw-builds-"));
try {
await cp(repoRoot, root, {
recursive: true,
filter: (source) =>
!skipped.has(path.relative(repoRoot, source).split(path.sep)[0]!),
});
await linkFixtureNodeModules(root, repoRoot);
await turnOnServiceWorker(root);
const hostFile = path.join(root, "src/bootstrap/register-service-worker.ts");
await replaceOnce(
hostFile,
"export function createServiceWorkerRuntimeHost(",
"function createServiceWorkerRuntimeHostUnobserved(",
);
await writeFile(hostFile, (await readFile(hostFile, "utf8")) + HOST_PROBE);
const { root, value, shared } = await sharedFixtureBuild(
`sw-${options.key}`,
options.beforeBuild?.toString() ?? "",
async (root) => {
await cp(repoRoot, root, {
recursive: true,
filter: (source) =>
!skipped.has(path.relative(repoRoot, source).split(path.sep)[0]!),
});
await linkFixtureNodeModules(root, repoRoot);
await turnOnServiceWorker(root);
const hostFile = path.join(root, "src/bootstrap/register-service-worker.ts");
await replaceOnce(
hostFile,
"export function createServiceWorkerRuntimeHost(",
"function createServiceWorkerRuntimeHostUnobserved(",
);
await writeFile(hostFile, (await readFile(hostFile, "utf8")) + HOST_PROBE);
const dist = { a: path.join(root, "dist-a"), b: path.join(root, "dist-b") };
const precached: Record<BuildName, readonly string[]> = { a: [], b: [] };
for (const name of ["a", "b"] as const) {
await options.beforeBuild?.(name, root);
run(root, "scripts/generate-product-feature-index.ts", `sw-e2e-${name}`);
run(root, "scripts/build-frontend.ts", `sw-e2e-${name}`);
await rename(path.join(root, "dist"), dist[name]);
precached[name] = await precachedUrls(root, name);
}
return { root, dist, precached };
} catch (error) {
// The spec never receives `root` from a failed setup, so afterAll cannot
// remove it.
await rm(root, { recursive: true, force: true });
throw error;
}
const dist = { a: path.join(root, "dist-a"), b: path.join(root, "dist-b") };
const precached: Record<BuildName, readonly string[]> = { a: [], b: [] };
for (const name of ["a", "b"] as const) {
await options.beforeBuild?.(name, root);
run(root, "scripts/generate-product-feature-index.ts", `sw-e2e-${name}`);
run(root, "scripts/build-frontend.ts", `sw-e2e-${name}`);
await rename(path.join(root, "dist"), dist[name]);
precached[name] = await precachedUrls(root, name);
}
return { dist, precached };
},
);
return { root, ...value, shared };
}
export async function removeServiceWorkerBuilds(
builds: ServiceWorkerBuilds | undefined,
): Promise<void> {
if (builds) await rm(builds.root, { recursive: true, force: true });
if (builds && !builds.shared) await rm(builds.root, { recursive: true, force: true });
}
export type AssetHeaders = Readonly<{
+135
View File
@@ -0,0 +1,135 @@
import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
/**
* One fixture build per Playwright run instead of one per browser project.
*
* The fixture specs build a copy of the repository in `beforeAll`, and every
* browser project runs that hook again: one e2e run made the same builds
* three times, synchronously, while the other workers drove browsers. Those
* builds took the CPU from the browsers next to them, and Firefox's first
* render in a test then missed its 5 s expectation (FE-GATE-008, desktop and
* runner). Builds are the same for every engine and no test writes into them.
*
* With `SHARED_FIXTURE_BUILD_ROOT` set (the e2e config's global setup sets it
* for the run), the first worker that needs `key` builds it under that root and
* the others wait for it and reuse it; the global teardown removes the root.
* Unset (a Vitest test, another config), every call builds its own copy in a
* new temp folder as before.
*/
export const SHARED_FIXTURE_BUILD_ROOT_VARIABLE = "SHARED_FIXTURE_BUILD_ROOT";
const POLL_MS = 200;
const KEY = /^[a-z0-9][a-z0-9-]{0,63}$/u;
export type SharedFixtureBuild<Value> = Readonly<{
/** The folder `create` built into. */
root: string;
value: Value;
/** Owned by the run (not removable by the spec) when true. */
shared: boolean;
}>;
type BuildRecord = Readonly<{ fingerprint: string; value: unknown }>;
function hasCode(error: unknown, code: string): boolean {
return typeof error === "object" && error !== null && "code" in error && error.code === code;
}
async function readRecord(file: string): Promise<BuildRecord | undefined> {
try {
return JSON.parse(await readFile(file, "utf8")) as BuildRecord;
} catch (error) {
if (hasCode(error, "ENOENT")) return undefined;
throw error;
}
}
async function readFailure(file: string): Promise<string | undefined> {
try {
return await readFile(file, "utf8");
} catch (error) {
if (hasCode(error, "ENOENT")) return undefined;
throw error;
}
}
/**
* `create(root)` fills the empty folder `root` and returns a JSON value that
* describes it (paths under `root`). `fingerprint` names what `create` builds;
* a second caller of the same `key` with another fingerprint is refused.
*/
export async function sharedFixtureBuild<Value>(
key: string,
fingerprint: string,
create: (root: string) => Promise<Value>,
environment: NodeJS.ProcessEnv = process.env,
): Promise<SharedFixtureBuild<Value>> {
if (!KEY.test(key)) throw new Error(`Invalid fixture build key: ${key}`);
const sharedRoot = environment[SHARED_FIXTURE_BUILD_ROOT_VARIABLE];
if (!sharedRoot) {
const root = await mkdtemp(path.join(tmpdir(), `${key}-`));
try {
return { root, value: await create(root), shared: false };
} catch (error) {
await rm(root, { recursive: true, force: true });
throw error;
}
}
const root = path.join(sharedRoot, key);
const recordFile = `${root}.json`;
const failureFile = `${root}.failed`;
let owner = true;
try {
await mkdir(root);
} catch (error) {
if (!hasCode(error, "EEXIST")) throw error;
owner = false;
}
if (owner) {
let value: Value;
try {
value = await create(root);
} catch (error) {
await writeFile(failureFile, String(error instanceof Error ? error.stack : error));
throw error;
}
const temporary = `${recordFile}.${process.pid}.tmp`;
await writeFile(temporary, JSON.stringify({ fingerprint, value }));
await rename(temporary, recordFile);
return { root, value, shared: true };
}
// Another worker builds `key`; the spec's own hook timeout bounds this wait.
for (;;) {
const record = await readRecord(recordFile);
if (record) {
if (record.fingerprint !== fingerprint) {
throw new Error(
`Fixture build ${key} was built from another definition in this run.`,
);
}
return { root, value: record.value as Value, shared: true };
}
const failure = await readFailure(failureFile);
if (failure !== undefined) {
throw new Error(`Fixture build ${key} failed in another worker:\n${failure}`);
}
await new Promise((resolve) => setTimeout(resolve, POLL_MS));
}
}
/** The e2e config's global setup: a shared root for this run, and its teardown. */
export async function startSharedFixtureBuilds(
environment: NodeJS.ProcessEnv = process.env,
): Promise<() => Promise<void>> {
const root = await mkdtemp(path.join(tmpdir(), "e2e-fixture-builds-"));
environment[SHARED_FIXTURE_BUILD_ROOT_VARIABLE] = root;
return async () => {
delete environment[SHARED_FIXTURE_BUILD_ROOT_VARIABLE];
await rm(root, { recursive: true, force: true });
};
}
@@ -1,5 +1,7 @@
/// <reference types="vitest/globals" />
import "./src/directive-use-client.ts";
import "./src/directive-use-strict.ts";
import "./src/import-empty.ts";
import "./src/import-side-effect.ts";
import "./src/import-type-empty.ts";
@@ -8,6 +10,7 @@ import { runtimeValue as namedRuntimeValue } from "./src/reexport-named.ts";
import { runtimeValue } from "./src/runtime.ts";
import { runtimeValue as starRuntimeValue } from "./src/reexport-star.ts";
import type {} from "./src/type-only.ts";
import { outsideValue } from "./outside-src.ts";
test("loads every counter semantics module", () => {
expect([
@@ -15,5 +18,6 @@ test("loads every counter semantics module", () => {
importedRuntimeValue,
namedRuntimeValue,
starRuntimeValue,
]).toEqual([1, 1, 1, 1]);
outsideValue,
]).toEqual([1, 1, 1, 1, 1]);
});
@@ -0,0 +1,4 @@
// Outside the fixture's `src/`. The checker copies this fixture into a folder
// whose name ends in `src`; an unanchored `src/**` coverage pattern counts
// this module too and the row-set check reports it as additional.
export const outsideValue = 1;
@@ -0,0 +1,4 @@
"use client";
// A directive prologue and types only. V8 counts the directive as a statement.
export type ClientOnly = 1;
@@ -0,0 +1,4 @@
"use strict";
// "use strict" and types only. V8 does not count "use strict".
export type StrictOnly = 1;
+21 -12
View File
@@ -1,23 +1,32 @@
import "@testing-library/jest-dom/vitest";
import { createRequire, syncBuiltinESMExports } from "node:module";
import { cleanup, configure } from "@testing-library/react";
import { afterEach, beforeEach, vi } from "vitest";
import { DEFAULT_TEST_TIMEOUT_MS } from "./helpers/child-process-timeout.ts";
// findBy*/waitFor settle on the DOM change itself; their deadline only reports
// a hang. Routes render through React.lazy, and React 19 holds every Suspense
// reveal on a real 300ms timer (FALLBACK_THROTTLE_MS). A route entered through
// a context table and then a lazy page spends 600ms of the 1s default before
// any rendering work, so on a loaded host the default turns into a speed
// requirement. Fake timers cannot shorten it: Testing Library advances only
// Jest's fake timers, and MSW and user-event run on the real clock. Half the
// 10s test timeout still reports a real hang with the DOM dump.
configure({ asyncUtilTimeout: 5_000 });
// Testing Library and its matchers need a DOM. Most test files run in Node
// (tests/unit has over 200, three of them with jsdom), and importing React DOM
// and Testing Library into every one of them was the largest part of the
// suite's setup time. They load only where the file's environment has a DOM.
async function loadDomTesting(): Promise<() => void> {
await import("@testing-library/jest-dom/vitest");
const { cleanup, configure } = await import("@testing-library/react");
// findBy*/waitFor settle on the DOM change itself; their deadline only reports
// a hang. Routes render through React.lazy, and React 19 holds every Suspense
// reveal on a real 300ms timer (FALLBACK_THROTTLE_MS). A route entered through
// a context table and then a lazy page spends 600ms of the 1s default before
// any rendering work, so on a loaded host the default turns into a speed
// requirement. Fake timers cannot shorten it: Testing Library advances only
// Jest's fake timers, and MSW and user-event run on the real clock. Half the
// 10s test timeout still reports a real hang with the DOM dump.
configure({ asyncUtilTimeout: 5_000 });
return cleanup;
}
const cleanup = typeof document === "undefined" ? undefined : await loadDomTesting();
afterEach(() => {
cleanup();
cleanup?.();
// A test that fails before its own vi.useRealTimers() must not leave fake
// timers to the next test in the file.
vi.useRealTimers();
@@ -27,6 +27,10 @@ on:
permissions:
contents: read
concurrency:
group: frontend-quality-gates-\${{ gitea.event_name }}-\${{ gitea.ref }}-\${{ inputs.stage }}
cancel-in-progress: \${{ gitea.event_name != 'workflow_dispatch' }}
env:
CI: "true"
VITE_BUILD_ID: "gitea-\${{ gitea.run_id }}-\${{ gitea.run_attempt }}"
@@ -109,7 +113,7 @@ jobs:
run: corepack pnpm ci:gate -- FE-GATE-007
- name: "FE-GATE-013 / security"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-013
run: scripts/run-in-system-container.sh corepack pnpm ci:gate -- FE-GATE-013
- name: "FE-GATE-020 / removability"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-020
@@ -126,6 +130,10 @@ jobs:
if: \${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
container:
image: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07"
env:
CI_RUNNER_IMAGE: "mcr.microsoft.com/playwright:v1.62.0-noble@sha256:baed2032d533817f3dbe6425de795788430ba345e819a1201337009ba17c9d07"
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
@@ -137,9 +145,9 @@ jobs:
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: Install Playwright browsers
- name: Install visual-test fonts
run: |
corepack pnpm exec playwright install --with-deps chromium firefox webkit
$(command -v sudo || true) apt-get update
$(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
- name: "FE-GATE-008 / e2e"
if: \${{ !cancelled() }}
@@ -577,7 +585,7 @@ jobs:
if-no-files-found: error
main_gate:
name: "main / checker self-tests"
name: "main / self-tests and removal drills"
if: \${{ (gitea.event_name == 'push' && startsWith(gitea.ref, 'refs/heads/')) || (gitea.event_name == 'workflow_dispatch' && inputs.stage == 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
@@ -595,6 +603,9 @@ jobs:
- name: "FE-GATE-029 / checker-self-tests"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-029
- name: "FE-GATE-030 / optional-removability"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-030
- name: Upload main gate evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
+52
View File
@@ -0,0 +1,52 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import { loadCiGateContract, PLAYWRIGHT_JOB_IMAGE_PATTERN } from "../../scripts/contracts/ci-gates.ts";
import { renderCiWorkflow } from "../../scripts/generate-ci-workflow.ts";
/**
* merge_browser runs in Playwright's own image so it does not download the
* browsers and their OS libraries in every job (about 900 MB, 200 to 240 s on
* the runner). The image's browsers are the ones @playwright/test of the same
* version expects; a Playwright update without the image left the browsers
* missing (or the image without the version's revisions).
*/
describe("browser job image", () => {
it("is Playwright's image for the pinned @playwright/test version, by digest", async () => {
const pinned = (
JSON.parse(readFileSync("package.json", "utf8")) as { devDependencies: Record<string, string> }
).devDependencies["@playwright/test"];
const contract = await loadCiGateContract(process.cwd());
const images = contract.jobs.flatMap((job) =>
job.steps.flatMap((step) => (step.kind === "browser-install" && step.image ? [[job.id, step.image] as const] : [])),
);
expect(images.map(([jobId]) => jobId)).toEqual(["merge_browser"]);
for (const [, image] of images) {
expect(PLAYWRIGHT_JOB_IMAGE_PATTERN.exec(image)?.[1]).toBe(pinned);
}
});
it("is the job container, and the runner image the build records", async () => {
const contract = await loadCiGateContract(process.cwd());
const image = contract.jobs
.find(({ id }) => id === "merge_browser")!
.steps.find((step) => step.kind === "browser-install");
const workflow = renderCiWorkflow(contract);
const job = workflow.slice(workflow.indexOf(" merge_browser:\n"), workflow.indexOf(" release_gate:\n"));
expect(image?.kind === "browser-install" && image.image).toBeTruthy();
const ref = image?.kind === "browser-install" ? image.image! : "";
expect(job).toContain(` container:\n image: "${ref}"\n`);
expect(job).toContain(` env:\n CI_RUNNER_IMAGE: "${ref}"\n`);
expect(job).not.toContain("playwright install");
});
it("refuses an image outside Playwright's registry or without a digest", async () => {
for (const image of [
"mcr.microsoft.com/playwright:v1.62.0-noble",
"docker.io/library/ubuntu:24.04@sha256:" + "a".repeat(64),
]) {
expect(PLAYWRIGHT_JOB_IMAGE_PATTERN.test(image), image).toBe(false);
}
});
});
+71 -10
View File
@@ -191,7 +191,7 @@ describe("CI gate contract", () => {
const index = indexCiGateContract(contract);
expect(contract.schemaVersion).toBe(2);
expect(contract.gates.map(({ id }) => id)).toEqual(
Array.from({ length: 29 }, (_, index) =>
Array.from({ length: 30 }, (_, index) =>
`FE-GATE-${String(index + 1).padStart(3, "0")}`,
).filter((gateId) => gateId !== "FE-GATE-016"),
);
@@ -202,6 +202,28 @@ describe("CI gate contract", () => {
expect(index.gates.get("FE-GATE-020")?.name).toBe("removability");
});
it("runs the optional runtime removal drills in the main stage, the feature drills in merge", async () => {
// Owner decision 2026-11-12 p: the three optional runtime removal drills
// left the pull request's merge stage; the sample and scaffold drills stay.
const contract = await loadCiGateContract(process.cwd());
const index = indexCiGateContract(contract);
const scriptsOf = (gateId: string) =>
(index.gates.get(gateId)?.commandIds ?? []).map((id) => index.commands.get(id)?.script);
const stageOf = (gateId: string) =>
contract.stages.find(({ gateIds }) => gateIds.includes(gateId))?.id;
const jobOf = (gateId: string) =>
contract.jobs.find(({ gateIds }) => gateIds.includes(gateId))?.id;
expect(scriptsOf("FE-GATE-020")).toEqual(["test:sample-removal", "test:feature-scaffold"]);
expect([stageOf("FE-GATE-020"), jobOf("FE-GATE-020")]).toEqual(["merge", "merge_test"]);
expect(scriptsOf("FE-GATE-030")).toEqual([
"test:optional-recipe-removal",
"test:browser-file-storage-removal",
"test:realtime-removal",
]);
expect([stageOf("FE-GATE-030"), jobOf("FE-GATE-030")]).toEqual(["main", "main_gate"]);
});
it("runs the signed manual accessibility review at release, not merge (08-06)", async () => {
const contract = await loadCiGateContract(process.cwd());
const index = indexCiGateContract(contract);
@@ -1586,6 +1608,15 @@ describe("CI workflow generation", () => {
);
expect(first).not.toContain("process_dist_sha256");
expect(first).toContain("persist-credentials: false");
// A newer push to the same pull request or branch cancels the older run;
// a manual run never cancels a running one.
expect(first).toContain(
[
"concurrency:",
" group: frontend-quality-gates-${{ gitea.event_name }}-${{ gitea.ref }}-${{ inputs.stage }}",
" cancel-in-progress: ${{ gitea.event_name != 'workflow_dispatch' }}",
].join("\n"),
);
expect(
first.match(/corepack pnpm install --frozen-lockfile --ignore-scripts/gu),
).toHaveLength(12);
@@ -1642,17 +1673,25 @@ describe("CI workflow generation", () => {
// them, after `--with-deps` has refreshed the package lists.
it("installs the visual-test font packages in every browser step", async () => {
const workflow = renderCiWorkflow(await loadCiGateContract(process.cwd()));
const browserSteps = workflow
.split(" - name: ")
.filter((step) => step.startsWith("Install Playwright browsers"));
expect(browserSteps).toHaveLength(2);
for (const step of browserSteps) {
const steps = workflow.split(" - name: ");
const fontsInstall = `apt-get install -y ${VISUAL_TEST_FONT_PACKAGES.join(" ")}`;
// A job without its own image downloads the browsers with their OS
// libraries; `--with-deps` refreshes the package lists first.
const downloading = steps.filter((step) => step.startsWith("Install Playwright browsers"));
// merge_browser runs in Playwright's image, which has the browsers but no
// package lists (tests/unit/ci-browser-image.test.ts).
const imaged = steps.filter((step) => step.startsWith("Install visual-test fonts"));
expect([downloading.length, imaged.length]).toEqual([1, 1]);
for (const step of downloading) {
const playwright = step.indexOf("playwright install --with-deps");
const fonts = step.indexOf(
`apt-get install -y ${VISUAL_TEST_FONT_PACKAGES.join(" ")}`,
);
expect(playwright).toBeGreaterThan(0);
expect(fonts).toBeGreaterThan(playwright);
expect(step.indexOf(fontsInstall)).toBeGreaterThan(playwright);
}
for (const step of imaged) {
expect(step).not.toContain("playwright install");
const update = step.indexOf("apt-get update");
expect(update).toBeGreaterThan(0);
expect(step.indexOf(fontsInstall)).toBeGreaterThan(update);
}
expect(VISUAL_TEST_FONT_PACKAGES).toEqual([
"fonts-noto-core",
@@ -1688,6 +1727,28 @@ describe("CI workflow generation", () => {
expect(workflow.match(/ runner requirement: /gu)).toHaveLength(requirements.length);
});
// The job container has neither systemd nor bubblewrap, so FE-GATE-013 runs
// in the system container its contract names (hostEnvironment).
it("runs a gate with a host environment through it, and counts only that run", async () => {
const contract = await loadCiGateContract(process.cwd());
expect(contract.gates.filter((gate) => gate.hostEnvironment).map(({ id }) => id)).toEqual(["FE-GATE-013"]);
const workflow = renderCiWorkflow(contract);
const wrapped = " run: scripts/run-in-system-container.sh corepack pnpm ci:gate -- FE-GATE-013";
expect(workflow.split("\n").filter((line) => line.includes("ci:gate -- FE-GATE-013"))).toEqual([wrapped]);
expect(workflowGateExecutionFailures(contract, workflow)).toEqual([]);
expect(workflowGateExecutionFailures(
contract,
workflow.replace(wrapped, " run: corepack pnpm ci:gate -- FE-GATE-013"),
)).toEqual(["gate is not executed by any workflow run step: FE-GATE-013"]);
expect(workflowGateExecutionFailures(
contract,
workflow.replace(
" run: corepack pnpm ci:gate -- FE-GATE-005",
" run: scripts/run-in-system-container.sh corepack pnpm ci:gate -- FE-GATE-005",
),
)).toEqual(["gate is not executed by any workflow run step: FE-GATE-005"]);
});
it("rejects a runner requirement that would leave its workflow comment (1105/12-01)", async () => {
const contract = JSON.parse(
JSON.stringify(await loadCiGateContract(process.cwd())),
+45
View File
@@ -0,0 +1,45 @@
import path from "node:path";
import { describe, expect, it } from "vitest";
import { rootAnchoredGlobs } from "../../scripts/lib/coverage-scope.ts";
import vitestConfig from "../../vitest.config.ts";
describe("root-anchored coverage patterns", () => {
it("prefixes each pattern with the root", () => {
expect(
rootAnchoredGlobs("/work/app-src", ["src/**/*.{ts,tsx}", "**/*.d.ts"]),
).toEqual(["/work/app-src/src/**/*.{ts,tsx}", "/work/app-src/**/*.d.ts"]);
});
it("escapes glob characters in the root as Vitest's glob library does", () => {
expect(
rootAnchoredGlobs("/work/app (copy) [2] {x} *?|/re+(a)/@(b)/!(c)", ["src/**"]),
).toEqual([
"/work/app \\(copy\\) \\[2\\] \\{x\\} \\*\\?\\|/re\\+\\(a\\)/\\@\\(b\\)/\\!\\(c\\)/src/**",
]);
});
it.each(["", "/src/**", "!src/**", "../src/**", "src/../**", "src\\**"])(
"refuses a pattern that is not a forward-slash path inside the root: %j",
(pattern) => {
expect(() => rootAnchoredGlobs("/work/app", [pattern])).toThrow(
/inside the root/u,
);
},
);
it("anchors every repository coverage pattern at the repository root", () => {
const coverage = vitestConfig.test?.coverage;
if (coverage === undefined || coverage.provider !== "v8") {
throw new TypeError("vitest.config.ts has no V8 coverage options");
}
const prefix = rootAnchoredGlobs(process.cwd(), ["x"])[0]?.slice(0, -1) ?? "";
const patterns = [...(coverage.include ?? []), ...(coverage.exclude ?? [])];
expect(patterns.length).toBeGreaterThan(0);
for (const pattern of patterns) expect(pattern.startsWith(prefix)).toBe(true);
expect(coverage.include).toEqual([`${prefix}src/**/*.{ts,tsx}`]);
expect(path.isAbsolute(prefix)).toBe(true);
});
});
+4 -1
View File
@@ -245,7 +245,10 @@ describe("sample features (R4)", () => {
// It builds and tests the copy; a documents-only check does not prove removal.
const drill = readFileSync("scripts/test-sample-removal.ts", "utf8");
expect(drill).toMatch(/check\(`\$\{prefix\}build`, "build"\)/u);
expect(drill).toMatch(/check\(`\$\{prefix\}unit-integration`, "test:all"\)/u);
// Every test:all path runs once: coverage, then what coverage leaves out
// (tests/unit/removal-drill-test-paths.test.ts).
expect(drill).toMatch(/check\(`\$\{prefix\}coverage`, "test:coverage"\)/u);
expect(drill).toMatch(/\.\.\.REMOVAL_DRILL_SUITES_OUTSIDE_COVERAGE/u);
});
});
+4 -2
View File
@@ -27,9 +27,11 @@ describe("feature scaffold drill commands", () => {
commandId,
).toBe(true);
}
// test:unit, test:contract and the other plain suites run inside
// test:coverage (tests/unit/removal-drill-test-paths.test.ts).
expect(commands.map(({ script }) => script)).toEqual(expect.arrayContaining([
"check:types", "lint", "test:unit", "test:coverage", "build", "check:bundle",
"test:contract", "test:runtime-schema", "check:request-fanout", "build:release-candidate",
"check:types", "lint", "test:coverage", "build", "check:bundle",
"check:request-fanout", "build:release-candidate",
]));
for (const reason of Object.values(SCAFFOLD_DRILL_EXCLUDED_SCRIPTS)) {
expect(reason.length).toBeGreaterThan(10);
+4 -1
View File
@@ -211,7 +211,10 @@ describe("pnpm inside a linked fixture (F-4)", { timeout: childProcessTimeout(94
};
// Installed on a developer machine (no CI); the fixtures then run pnpm
// with CI=true, which pnpm reads as different settings and reinstalls.
const { CI: _ci, ...developer } = environment;
// pnpm also takes GITEA_ACTIONS, GITHUB_ACTIONS and other vendor
// variables for CI, so a runner job without CI still looked like CI and
// nothing was reinstalled. CI=false makes pnpm skip those checks.
const developer: NodeJS.ProcessEnv = { ...environment, CI: "false" };
const install = spawnSync("corepack", ["pnpm", "install", "--offline"], {
cwd: source,
encoding: "utf8",
+33 -6
View File
@@ -972,8 +972,29 @@ describe("terminal owner classification at every wait", () => {
type Owner = "CALLER" | "SCOPE_FENCE" | "DEADLINE";
const hang = () => new Promise<never>(() => {});
/**
* Blocks this thread for `ms` of real time, as a loaded machine does
* between two steps. A fake clock does not move meanwhile.
*/
const stallRealTime = (ms: number) =>
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
async function endWaitAt(phase: Phase, owner: Owner) {
// The deadline fires on a fake clock once the wait under test is reached.
// On the real clock a 30ms deadline raced the machine: a transport failure
// or a 503 handled after 30ms found no time left to back off, and the
// request ended as that failure instead of TIMEOUT (seen at load 31).
// The backoff phases stall 40ms of real time before answering, so a real
// deadline here fails every time.
if (owner === "DEADLINE") vi.useFakeTimers();
try {
return await endWaitAtOnClock(phase, owner);
} finally {
if (owner === "DEADLINE") vi.useRealTimers();
}
}
async function endWaitAtOnClock(phase: Phase, owner: Owner) {
const caller = new AbortController();
const fence = new AbortController();
const fencedScope = Object.freeze({
@@ -1008,6 +1029,7 @@ describe("terminal owner classification at every wait", () => {
? (reach(), hang())
: { kind: "READY", headers: {} },
fetcher: vi.fn(async () => {
if (owner === "DEADLINE" && phase.endsWith("backoff")) stallRealTime(40);
switch (phase) {
case "transport backoff":
throw new TypeError("network down");
@@ -1043,12 +1065,17 @@ describe("terminal owner classification at every wait", () => {
...(execution === undefined ? {} : { execution }),
},
);
if (owner !== "DEADLINE") {
await vi.waitFor(() =>
expect(reached || execution?.traffic.concurrency.queued === 1).toBe(
true,
),
);
const waiting = () =>
reached || execution?.traffic.concurrency.queued === 1;
if (owner === "DEADLINE") {
// vi.waitFor would advance the fake clock on every check.
for (let turn = 0; turn < 100 && !waiting(); turn += 1) {
await flushMicrotasks();
}
expect(waiting()).toBe(true);
await vi.advanceTimersByTimeAsync(30);
} else {
await vi.waitFor(() => expect(waiting()).toBe(true));
(owner === "CALLER" ? caller : fence).abort();
}
const outcome = await pending;
+26 -2
View File
@@ -1,4 +1,4 @@
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { mkdtemp, open, readFile, rename, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
@@ -6,6 +6,30 @@ import { afterEach, describe, expect, it } from "vitest";
import { generateArtifactSchemas } from "../../scripts/generate-artifact-schemas.ts";
import { assertMatchesJsonSchema } from "../../scripts/lib/json-schema.ts";
import { createValidatedJsonArtifactWriter } from "../../scripts/lib/validated-json-artifact.ts";
// The same validated, atomic-rename writer as the generator's default, without
// fsync. This suite checks generated bytes in a temporary root; durability is
// validated-json-artifact.test.ts's subject, and the fsync pairs were most of
// this test's time under the parallel suite's disk load.
const writeArtifactWithoutSync = createValidatedJsonArtifactWriter({
fileSystem: {
open: async (target, flags, mode) => {
const handle = await open(target, flags, mode);
return {
writeFile: async (data, encoding) => handle.writeFile(data, encoding),
sync: async () => undefined,
close: async () => handle.close(),
};
},
openDirectory: async () => ({
sync: async () => undefined,
close: async () => undefined,
}),
rename: async (source, destination) => rename(source, destination),
rm: async (target, options) => rm(target, options),
},
});
const temporaryDirectories: string[] = [];
@@ -77,7 +101,7 @@ describe("checked-in JSON Schema execution", () => {
it("generates deterministic draft 2020-12 artifact schemas and detects drift", async () => {
const root = await temporaryDirectory();
await generateArtifactSchemas({ root });
await generateArtifactSchemas({ root, writeArtifact: writeArtifactWithoutSync });
const generatedPath = path.join(
root,
"config/schemas/artifacts/dependency-inventory.schema.json",
+1
View File
@@ -32,6 +32,7 @@ describe("promotion readiness formula", () => {
["FE-GATE-018", "FIELD_SLO_READY"],
["FE-GATE-017", "DOCUMENTATION_READY"],
["FE-GATE-029", "MAIN_READY"],
["FE-GATE-030", "MAIN_READY"],
] as const)("fails closed when %s fails", (failedGate, readiness) => {
const result = evaluatePromotionReadiness({
...passing,
@@ -0,0 +1,74 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts";
import {
REMOVAL_DRILL_SUITES_OUTSIDE_COVERAGE,
SCAFFOLD_DRILL_COVERED_SUITES,
scaffoldDrillCommands,
} from "../../scripts/lib/feature-scaffold-drill.ts";
import { gatedTestPaths } from "../../scripts/lib/ungated-tests.ts";
/**
* FE-GATE-020's drills ran each test file twice in one copy: the plain suites
* and then test:coverage over the same paths (feature scaffold), test:all and
* then test:coverage (feature removal). Each runs once now. These tests keep
* the claim true: a path added to a plain suite or to test:all that coverage
* does not run fails here instead of silently leaving the drill.
*/
const scripts = (
JSON.parse(readFileSync("package.json", "utf8")) as { scripts: Record<string, string> }
).scripts;
const readConfig = (file: string) => readFileSync(file, "utf8");
const pathsOf = (entries: readonly string[]) => gatedTestPaths(scripts, entries, readConfig);
const within = (target: string, roots: readonly string[]) =>
roots.some((root) => target === root || target.startsWith(`${root}/`));
// A copy that removed the optional recipes has no test:recipes; the drill then
// runs only what the copy's package.json still has (scripts/test-sample-removal.ts).
const outsideCoverage = REMOVAL_DRILL_SUITES_OUTSIDE_COVERAGE.filter((script) =>
Object.hasOwn(scripts, script));
describe("removal drill test paths", () => {
const coverage = pathsOf(["test:coverage"]);
it("leave out of the scaffold drill only suites test:coverage runs whole", () => {
expect(coverage.length).toBeGreaterThan(0);
for (const suite of SCAFFOLD_DRILL_COVERED_SUITES) {
const paths = pathsOf([suite]);
expect(paths.length, suite).toBeGreaterThan(0);
expect(paths.filter((target) => !within(target, coverage)), suite).toEqual([]);
}
});
it("run every test:all path in the feature removal: coverage and what it leaves out", () => {
const run = [...coverage, ...pathsOf(outsideCoverage)];
expect(pathsOf(["test:all"]).filter((target) => !within(target, run))).toEqual([]);
});
it("name as outside coverage only suites coverage does not already run", () => {
for (const suite of outsideCoverage) {
expect(pathsOf([suite]).some((target) => !within(target, coverage)), suite).toBe(true);
}
});
it("run the covered suites plain again when the copy's merge stage has no test:coverage", async () => {
const contract = await loadCiGateContract(process.cwd());
const coverageIds = new Set(
contract.commands.filter(({ script }) => script === "test:coverage").map(({ id }) => id),
);
const withoutCoverage = {
...contract,
gates: contract.gates.map((gate) => ({
...gate,
commandIds: gate.commandIds.filter((id) => !coverageIds.has(id)),
})),
};
const withCoverage = scaffoldDrillCommands(contract).map(({ script }) => script);
const without = scaffoldDrillCommands(withoutCoverage).map(({ script }) => script);
for (const suite of SCAFFOLD_DRILL_COVERED_SUITES) {
expect(withCoverage, suite).not.toContain(suite);
expect(without, suite).toContain(suite);
}
});
});
+10
View File
@@ -699,6 +699,14 @@ describe("repository-aware risk coverage", () => {
path.join(repositoryRoot, "src/reexport-star.ts"),
"export * from './a.ts';\n",
),
writeFile(
path.join(repositoryRoot, "src/directive-use-client.ts"),
"'use client';\nexport type ClientOnly = 1;\n",
),
writeFile(
path.join(repositoryRoot, "src/directive-use-strict.ts"),
'"use strict";\nexport type StrictOnly = 1;\n',
),
]);
const productionInventory = await buildProductionModuleInventory({
@@ -708,6 +716,7 @@ describe("repository-aware risk coverage", () => {
expect(productionInventory.counterlessModules).toEqual([
"src/barrel.ts",
"src/directive-use-strict.ts",
"src/import-side-effect.ts",
"src/import-type-empty.ts",
"src/import-value-empty.ts",
@@ -718,6 +727,7 @@ describe("repository-aware risk coverage", () => {
]);
expect(productionInventory.counterBearingModules).toEqual([
"src/a.ts",
"src/directive-use-client.ts",
"src/nested/b.tsx",
"src/runtime-export.ts",
"src/side-effect.ts",
+115
View File
@@ -0,0 +1,115 @@
import { access, 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 {
SHARED_FIXTURE_BUILD_ROOT_VARIABLE,
sharedFixtureBuild,
startSharedFixtureBuilds,
} from "../e2e/support/shared-fixture-builds.ts";
const roots: string[] = [];
afterEach(async () => {
await Promise.all(
roots.splice(0).map((root) => rm(root, { recursive: true, force: true })),
);
});
async function sharedEnvironment(): Promise<NodeJS.ProcessEnv> {
const root = await mkdtemp(path.join(tmpdir(), "shared-builds-test-"));
roots.push(root);
return { [SHARED_FIXTURE_BUILD_ROOT_VARIABLE]: root };
}
describe("one fixture build per e2e run", () => {
it("builds a key once and hands every caller the same copy", async () => {
const environment = await sharedEnvironment();
let builds = 0;
const create = async (root: string) => {
builds += 1;
await new Promise((resolve) => setTimeout(resolve, 50));
await writeFile(path.join(root, "dist.txt"), "built");
return { dist: path.join(root, "dist.txt") };
};
const results = await Promise.all(
[1, 2, 3].map(() => sharedFixtureBuild("fixture-a", "same", create, environment)),
);
expect(builds).toBe(1);
expect(new Set(results.map((result) => result.root)).size).toBe(1);
for (const result of results) {
expect(result.shared).toBe(true);
expect(result.value).toEqual({ dist: path.join(result.root, "dist.txt") });
}
await access(results[0]!.value.dist);
});
it("refuses a second definition under the same key", async () => {
const environment = await sharedEnvironment();
await sharedFixtureBuild("fixture-b", "first", async () => ({}), environment);
await expect(
sharedFixtureBuild("fixture-b", "second", async () => ({}), environment),
).rejects.toThrow(/fixture-b was built from another definition/u);
});
it("fails the waiting callers with the builder's failure", async () => {
const environment = await sharedEnvironment();
const owner = sharedFixtureBuild(
"fixture-c",
"same",
async () => {
await new Promise((resolve) => setTimeout(resolve, 50));
throw new Error("vite build exited 1");
},
environment,
);
const waiter = sharedFixtureBuild("fixture-c", "same", async () => ({}), environment);
await expect(owner).rejects.toThrow(/vite build exited 1/u);
await expect(waiter).rejects.toThrow(
/fixture-c failed in another worker:[\s\S]*vite build exited 1/u,
);
});
it("builds a private copy and removes it on failure without a shared root", async () => {
const result = await sharedFixtureBuild("fixture-d", "x", async (root) => root, {});
roots.push(result.root);
expect(result).toMatchObject({ shared: false, value: result.root });
expect(path.dirname(result.root)).toBe(tmpdir());
let failedRoot = "";
await expect(
sharedFixtureBuild("fixture-d", "x", async (root) => {
failedRoot = root;
throw new Error("broken copy");
}, {}),
).rejects.toThrow(/broken copy/u);
await expect(access(failedRoot)).rejects.toMatchObject({ code: "ENOENT" });
});
it("refuses a key that is not one lower-case path segment", async () => {
for (const key of ["", "../x", "a/b", "Fixture", `a${"b".repeat(64)}`]) {
await expect(sharedFixtureBuild(key, "x", async () => ({}), {})).rejects.toThrow(
/Invalid fixture build key/u,
);
}
});
it("gives the run a root and removes it with the teardown", async () => {
const environment: NodeJS.ProcessEnv = {};
const teardown = await startSharedFixtureBuilds(environment);
const root = environment[SHARED_FIXTURE_BUILD_ROOT_VARIABLE];
expect(root).toBeTruthy();
await sharedFixtureBuild("fixture-e", "x", async () => ({}), environment);
await teardown();
expect(environment[SHARED_FIXTURE_BUILD_ROOT_VARIABLE]).toBeUndefined();
await expect(access(root!)).rejects.toMatchObject({ code: "ENOENT" });
});
});
@@ -15,6 +15,7 @@ import {
assertV8CoverageCounterSemantics,
checkV8CoverageCounterSemantics,
} from "../../scripts/lib/v8-coverage-counter-semantics.ts";
import { rootAnchoredGlobs } from "../../scripts/lib/coverage-scope.ts";
import { childProcessTimeout } from "../helpers/child-process-timeout.ts";
const roots: string[] = [];
@@ -32,6 +33,7 @@ const zeroMetrics = Object.freeze({
branches: zeroCounter,
});
const counterlessPaths = Object.freeze([
"src/directive-use-strict.ts",
"src/import-empty.ts",
"src/import-side-effect.ts",
"src/import-type-empty.ts",
@@ -52,15 +54,15 @@ function fixtureSummary(root: string): Record<string, unknown> {
branches: zeroCounter,
},
],
[
path.join(root, "src/runtime.ts"),
...["src/directive-use-client.ts", "src/runtime.ts"].map((modulePath) => [
path.join(root, modulePath),
{
lines: { total: 1, covered: 1, skipped: 0, pct: 100 },
statements: { total: 1, covered: 1, skipped: 0, pct: 100 },
functions: zeroCounter,
branches: zeroCounter,
},
],
]),
...counterlessPaths.map((modulePath) => [path.join(root, modulePath), zeroMetrics]),
]);
}
@@ -86,7 +88,7 @@ describe("V8 coverage counter semantics", () => {
const root = "/owned-fixture";
expect(assertV8CoverageCounterSemantics(fixtureSummary(root), root)).toEqual({
counterBearingModules: ["src/runtime.ts"],
counterBearingModules: ["src/directive-use-client.ts", "src/runtime.ts"],
counterlessModules: counterlessPaths,
});
});
@@ -120,7 +122,13 @@ describe("V8 coverage counter semantics", () => {
const runtimeDrift = fixtureSummary(root);
runtimeDrift[path.join(root, "src/runtime.ts")] = zeroMetrics;
expect(() => assertV8CoverageCounterSemantics(runtimeDrift, root)).toThrow(
/runtime.*counter-bearing/u,
/not counter-bearing: src\/runtime\.ts/u,
);
const directiveDrift = fixtureSummary(root);
directiveDrift[path.join(root, "src/directive-use-client.ts")] = zeroMetrics;
expect(() => assertV8CoverageCounterSemantics(directiveDrift, root)).toThrow(
/not counter-bearing: src\/directive-use-client\.ts/u,
);
});
@@ -184,6 +192,36 @@ describe("V8 coverage counter semantics", () => {
await expect(access(ownedRoot)).rejects.toMatchObject({ code: "ENOENT" });
});
it("copies the fixture under a src-suffixed folder with root-anchored patterns", async () => {
const ownedRoot = await mkdtemp(path.join(tmpdir(), "v8-counter-scope-"));
roots.push(ownedRoot);
let child: { fixtureRoot: string; config: string } | undefined;
await expect(
checkV8CoverageCounterSemantics({
repositoryRoot: process.cwd(),
createOwnedRoot: async () => ownedRoot,
runVitest: async (input) => {
child = {
fixtureRoot: input.fixtureRoot,
config: await readFile(input.configPath, "utf8"),
};
await access(path.join(input.fixtureRoot, "outside-src.ts"));
return { stdout: "", stderr: "" };
},
}),
).rejects.toThrow(/coverage summary is missing/u);
expect(child?.fixtureRoot.startsWith(`${ownedRoot}${path.sep}`)).toBe(true);
expect(path.basename(child?.fixtureRoot ?? "")).toMatch(/[()].*src$/u);
const config = JSON.parse(
(child?.config ?? "").replace(/^export default /u, "").replace(/;\s*$/u, ""),
) as { test: { coverage: { include: string[] } } };
expect(config.test.coverage.include).toEqual(
rootAnchoredGlobs(child?.fixtureRoot ?? "", ["src/**/*.ts"]),
);
});
it("keeps the child fixture outside main Vitest discovery", async () => {
const outputRoot = await mkdtemp(path.join(tmpdir(), "v8-counter-list-"));
roots.push(outputRoot);
+11 -2
View File
@@ -1,7 +1,13 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import { configDefaults, defineConfig } from "vitest/config";
import { rootAnchoredGlobs } from "./scripts/lib/coverage-scope.ts";
import { isNpmScopeEnvironmentName } from "./scripts/lib/package-script-graph.ts";
const repositoryRoot = path.dirname(fileURLToPath(import.meta.url));
// Tests must not inherit a caller's production React/runtime selection.
// Package scripts also launch Vitest through scripts/run-vitest.ts, which owns
// NODE_ENV before the Vitest process starts. Keeping the config deterministic
@@ -57,8 +63,11 @@ export default defineConfig({
provider: "v8",
reportsDirectory: "artifacts/tests/coverage",
reporter: ["text", "json-summary", "lcov"],
include: ["src/**/*.{ts,tsx}"],
exclude: ["**/*.d.ts", "**/*.stories.*"],
// Vitest matches these against absolute paths anywhere in the path;
// anchoring them at the root keeps a checkout under `…src/` from
// pulling root files into the coverage universe.
include: rootAnchoredGlobs(repositoryRoot, ["src/**/*.{ts,tsx}"]),
exclude: rootAnchoredGlobs(repositoryRoot, ["**/*.d.ts", "**/*.stories.*"]),
},
},
});