diff --git a/.claude/skills/desktop-gates/SKILL.md b/.claude/skills/desktop-gates/SKILL.md index f2f74502..cbcc76da 100644 --- a/.claude/skills/desktop-gates/SKILL.md +++ b/.claude/skills/desktop-gates/SKILL.md @@ -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절 표). diff --git a/.claude/skills/fe-structure/SKILL.md b/.claude/skills/fe-structure/SKILL.md index 77a755a4..c7ce06b0 100644 --- a/.claude/skills/fe-structure/SKILL.md +++ b/.claude/skills/fe-structure/SKILL.md @@ -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`만 본다. diff --git a/.claude/skills/fe-testing/SKILL.md b/.claude/skills/fe-testing/SKILL.md index b46bb488..e53977c7 100644 --- a/.claude/skills/fe-testing/SKILL.md +++ b/.claude/skills/fe-testing/SKILL.md @@ -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 ` - 층별 게이트: 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절 diff --git a/.gitea/workflows/quality-gates.yml b/.gitea/workflows/quality-gates.yml index a2b9c247..57025662 100644 --- a/.gitea/workflows/quality-gates.yml +++ b/.gitea/workflows/quality-gates.yml @@ -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 diff --git a/AGENTS.md b/AGENTS.md index 37898d01..8fe3f183 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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`(노트북). ## 일하는 방식 diff --git a/CHANGELOG.md b/CHANGELOG.md index 19965034..3e351cce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/`다. 제품 코드와 게이트 동작은 바뀌지 않는다. diff --git a/README.md b/README.md index 28124130..c79142ab 100644 --- a/README.md +++ b/README.md @@ -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`는 게이트의 첫 실패 명령에서 멈춘다. diff --git a/config/ci/gates.json b/config/ci/gates.json index 1d8fe31c..233bc9d9 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -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": [], diff --git a/config/ci/system-container.Dockerfile b/config/ci/system-container.Dockerfile new file mode 100644 index 00000000..0fc092d4 --- /dev/null +++ b/config/ci/system-container.Dockerfile @@ -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"] diff --git a/config/security/dependency-baseline.approval.json b/config/security/dependency-baseline.approval.json index 0ed6a64c..bdb84502 100644 --- a/config/security/dependency-baseline.approval.json +++ b/config/security/dependency-baseline.approval.json @@ -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" } diff --git a/config/security/dependency-baseline.json b/config/security/dependency-baseline.json index f77c911d..090cb247 100644 --- a/config/security/dependency-baseline.json +++ b/config/security/dependency-baseline.json @@ -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", diff --git a/docs/ledger/estimates.jsonl b/docs/ledger/estimates.jsonl index 05a2478f..04c882b5 100644 --- a/docs/ledger/estimates.jsonl +++ b/docs/ledger/estimates.jsonl @@ -2,3 +2,6 @@ {"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": "r9-fe-review", "recorded_at": "2026-11-12T22:30+09:00", "transcript": "e654030f-a9e7-4a7d-912b-f0e8516c1147", "started_at": "2026-11-12T21:00+09:00", "base": "5250ff95", "task_kind": "improve", "size": "large", "minutes": {"p30": 300, "p50": 480, "p80": 840}, "calls": {"p30": 400, "p50": 650, "p80": 1000}, "output_tokens": {"p30": 300000, "p50": 500000, "p80": 800000}, "basis": "착수 노트(공유 노트 r9-fe-review.md)에 쓴 시간 예측을 옮겼다. 1회차 리뷰는 리뷰어 11개 병렬과 반박 검증 4개로 약 2시간(선례 1106 리뷰 16영역). 착수 때 수정 묶음을 2~6개로 봤으나 1회차 결과가 원인 묶음 14개(약 140건)라, 이 예측은 결정 대기 항목을 빼고 혼자 고치는 경우에 이미 모자랄 가능성이 크다. desktop 공유 잠금 대기(다른 세션과 겹쳐 15~45분)는 시간에서 뺐다"} +{"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분 뒤에 적었다(인계 대기 중 시작)"} diff --git a/docs/operations/ci-quality-gates.md b/docs/operations/ci-quality-gates.md index d90f052b..754b5cff 100644 --- a/docs/operations/ci-quality-gates.md +++ b/docs/operations/ci-quality-gates.md @@ -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이 다음 수동 실행에 끊기지 않게 하려는 것이다. ## 기준선 갱신과 새 프로젝트 시작 시 초기화할 기준선 @@ -208,6 +214,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, @@ -450,7 +471,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는 공통 diff --git a/docs/testing/taxonomy.md b/docs/testing/taxonomy.md index 8349cc95..9ac345b1 100644 --- a/docs/testing/taxonomy.md +++ b/docs/testing/taxonomy.md @@ -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 기능을 갖추지 않으면 전제 조건 보고서 하나를 내고 실패한다. diff --git a/docs/work/evidence.md b/docs/work/evidence.md index 8fc68a4f..2b72cbff 100644 --- a/docs/work/evidence.md +++ b/docs/work/evidence.md @@ -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절 | diff --git a/docs/work/improve.md b/docs/work/improve.md index def94d42..33109057 100644 --- a/docs/work/improve.md +++ b/docs/work/improve.md @@ -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 「각자 유지」). diff --git a/docs/work/new-feature.md b/docs/work/new-feature.md index 3d0124ba..755d11f5 100644 --- a/docs/work/new-feature.md +++ b/docs/work/new-feature.md @@ -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=`). - 다운스트림에 보이는 변경(공개 포트, 생성 명령 출력)이 있으면 `CHANGELOG.md` 미출시 절에 적었다. diff --git a/docs/work/operate.md b/docs/work/operate.md index 7c2aca28..c05bb87d 100644 --- a/docs/work/operate.md +++ b/docs/work/operate.md @@ -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 -- `, `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. 하지 말 것 diff --git a/docs/work/reference/decisions.md b/docs/work/reference/decisions.md index 80e9a1c2..0c380437 100644 --- a/docs/work/reference/decisions.md +++ b/docs/work/reference/decisions.md @@ -57,6 +57,7 @@ | 1105 결정 D7 | 2026-11-05 | 초기 JS 예산을 204,800 B에서 206,848 B로 올린다 | 1105 README 16.2절 | | 1106 결정 D9·D10 | 2026-11-06 | 초기 JS 예산 206,848 B를 그대로 두고 근거·되돌림 규칙을 `docs/operations/performance-evidence.md`에 둔다(D9). 결과 불명 KEYED 재전송이 쓰기 전 거절로 끝나도 훅이 결과 불명과 키를 지킨다. 재전송의 거절이 결과 불명을 푸는 것은 짝 백엔드 표의 code뿐이다(D10과 보완 둘, 판정 `src/contracts/errors.ts` `isRefusedOnEveryAttempt`) | 1106 README 16.2절 | | 결정 D8 FE-GATE-013 판정 | 2026-11-12 | desktop에서 FE-GATE-013의 실패가 사전 점검의 user namespace 제한(bwrap) 하나뿐이고 `scripts/verify.sh parts FE-GATE-013`의 뒤 명령이 모두 rc=0이면, merge 판정에서 그 실패를 호스트 원인으로 빼고 센다. 게이트 「충족」은 조건을 갖춘 runner에서 FE-GATE-013이 통과한 것으로만 센다. 버린 안: runner에서 통과할 때까지 merge 판정을 미충족으로 두기(그 runner가 아직 없어 모든 PR의 merge 판정이 막힌다). 재검토: 조건을 갖춘 runner가 merge 단계를 돌게 되면 desktop 예외가 아직 필요한지 다시 본다. 판정 방법은 `gates.md` 3절 | 소유자 결정 e(2026-11-11, 「그 조건이 되는 실행 환경을 찾아 초록으로」)에 따라 총괄이 권하는 안으로 정함(2026-11-12, repo 밖). 관련 발견 1105/12-01 | +| 결정 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. 결정 대기 쓰는 법 diff --git a/docs/work/reference/gates.md b/docs/work/reference/gates.md index 1db8d0ef..a5b17d32 100644 --- a/docs/work/reference/gates.md +++ b/docs/work/reference/gates.md @@ -68,10 +68,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이 통과한 것으로만 적는다. 시스템 설정은 바꾸지 않는다. diff --git a/docs/work/reference/review-criteria.md b/docs/work/reference/review-criteria.md index 4f9eb108..1238a0f8 100644 --- a/docs/work/reference/review-criteria.md +++ b/docs/work/reference/review-criteria.md @@ -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. 다시 판정할 때 diff --git a/docs/work/reference/structure.md b/docs/work/reference/structure.md index 050e7bac..dcdc7129 100644 --- a/docs/work/reference/structure.md +++ b/docs/work/reference/structure.md @@ -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에서 잠금 아래 돌린다. diff --git a/docs/work/reference/testing.md b/docs/work/reference/testing.md index 3dcff9a1..fe5cd1cc 100644 --- a/docs/work/reference/testing.md +++ b/docs/work/reference/testing.md @@ -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분)과의 여유를 본다. diff --git a/package.json b/package.json index d89f2e13..779fcc40 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/playwright.config.ts b/playwright.config.ts index 1ea46419..67a39b6e 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -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: [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a845a7e0..ea15d3d6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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: {} diff --git a/scripts/check-browser-file-storage-boundaries.ts b/scripts/check-browser-file-storage-boundaries.ts index 1d23ab2f..3a1b981f 100644 --- a/scripts/check-browser-file-storage-boundaries.ts +++ b/scripts/check-browser-file-storage-boundaries.ts @@ -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 { + 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 { + 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 { + 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); } diff --git a/scripts/contracts/ci-gates.ts b/scripts/contracts/ci-gates.ts index 9241c91a..8e9175dd 100644 --- a/scripts/contracts/ci-gates.ts +++ b/scripts/contracts/ci-gates.ts @@ -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 = [ ["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(" -> ")}`); diff --git a/scripts/generate-artifact-schemas.ts b/scripts/generate-artifact-schemas.ts index 333f25e1..ed8d89f6 100644 --- a/scripts/generate-artifact-schemas.ts +++ b/scripts/generate-artifact-schemas.ts @@ -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; }>; 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, diff --git a/scripts/generate-ci-workflow.ts b/scripts/generate-ci-workflow.ts index 1def38b1..f34e0bc1 100644 --- a/scripts/generate-ci-workflow.ts +++ b/scripts/generate-ci-workflow.ts @@ -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//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)) { diff --git a/scripts/lib/ci-contract-report.ts b/scripts/lib/ci-contract-report.ts index 8abcd898..36b72549 100644 --- a/scripts/lib/ci-contract-report.ts +++ b/scripts/lib/ci-contract-report.ts @@ -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(), diff --git a/scripts/lib/coverage-scope.ts b/scripts/lib/coverage-scope.ts new file mode 100644 index 00000000..2d810587 --- /dev/null +++ b/scripts/lib/coverage-scope.ts @@ -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 + * `/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 = + /(? { + 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}`; + }); +} diff --git a/scripts/lib/feature-scaffold-drill.ts b/scripts/lib/feature-scaffold-drill.ts index e499337c..50389869 100644 --- a/scripts/lib/feature-scaffold-drill.ts +++ b/scripts/lib/feature-scaffold-drill.ts @@ -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> = Object.freeze({ "verify:lockfile": @@ -38,11 +61,9 @@ export const SCAFFOLD_DRILL_EXCLUDED_SCRIPTS: Readonly> = "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(); const seen = new Set(); 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}`, diff --git a/scripts/lib/promotion-readiness.ts b/scripts/lib/promotion-readiness.ts index 1f029f76..d5511164 100644 --- a/scripts/lib/promotion-readiness.ts +++ b/scripts/lib/promotion-readiness.ts @@ -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"; diff --git a/scripts/lib/risk-coverage.ts b/scripts/lib/risk-coverage.ts index 9a12908a..65b08ef0 100644 --- a/scripts/lib/risk-coverage.ts +++ b/scripts/lib/risk-coverage.ts @@ -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 { 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 => { + 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); diff --git a/scripts/lib/v8-coverage-counter-semantics.ts b/scripts/lib/v8-coverage-counter-semantics.ts index 1859f130..9abab270 100644 --- a/scripts/lib/v8-coverage-counter-semantics.ts +++ b/scripts/lib/v8-coverage-counter-semantics.ts @@ -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 { "--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 }); } diff --git a/scripts/run-in-system-container.sh b/scripts/run-in-system-container.sh new file mode 100755 index 00000000..3fc7aa58 --- /dev/null +++ b/scripts/run-in-system-container.sh @@ -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 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" diff --git a/scripts/test-sample-removal.ts b/scripts/test-sample-removal.ts index e60d011d..7437e854 100644 --- a/scripts/test-sample-removal.ts +++ b/scripts/test-sample-removal.ts @@ -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", [ diff --git a/scripts/tests/test_verify.py b/scripts/tests/test_verify.py index 25f5d2f8..4395627a 100644 --- a/scripts/tests/test_verify.py +++ b/scripts/tests/test_verify.py @@ -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