diff --git a/.claude/agents/verify-app.md b/.claude/agents/verify-app.md index f660eeb8..72186bcf 100644 --- a/.claude/agents/verify-app.md +++ b/.claude/agents/verify-app.md @@ -18,7 +18,7 @@ pnpm·브라우저는 desktop에서만 돈다. 실행 위치의 정본은 `docs/ ## 순서 1. 앱이 뜨는지는 desktop의 build 게이트로 먼저 본다: `scripts/verify.sh gate FE-GATE-011 --log <작업 이름>-app`. rc와 로그 경로를 적는다. -2. 화면 확인은 같은 트리의 브라우저 게이트로 한다: `scripts/verify.sh gate FE-GATE-008 --log <작업 이름>-app`(e2e, 세 엔진). 특정 라우트만 보려면 desktop에서 `scripts/verify.sh`가 남긴 방식대로 새 worktree를 만들고 그 안에서 `flock /tmp/claude-gates/heavy.lock` 아래 `corepack pnpm build`와 `corepack pnpm exec playwright test `을 돌린다. 기존 checkout `~/workspace/clean-architecture-frontend-template`의 브랜치와 `stash@{0}`는 건드리지 않는다. +2. 화면 확인은 같은 트리의 브라우저 게이트로 한다: `scripts/verify.sh gate FE-GATE-008 FE-GATE-009 --log <작업 이름>-app`(e2e, 세 엔진. 이름에 `@a11y`가 붙은 시험은 FE-GATE-009에서만 돈다). 특정 라우트만 보려면 desktop에서 `scripts/verify.sh`가 남긴 방식대로 새 worktree를 만들고 그 안에서 `flock /tmp/claude-gates/heavy.lock` 아래 `corepack pnpm build`와 `corepack pnpm exec playwright test `을 돌린다. 기존 checkout `~/workspace/clean-architecture-frontend-template`의 브랜치와 `stash@{0}`는 건드리지 않는다. 3. 받은 라우트마다 화면 텍스트와 콘솔 오류를 확인한다. 브라우저 테스트를 한 checkout에서 둘 이상 돌리면 실행마다 다른 `TEST_RUN_ID`를 준다(`ci:gate`에는 주지 않는다). 4. brief가 탐색 QA를 맡기면 미리 실린 `fe-qa` 스킬의 탐색 차터(목표·범위·상태·기기·조작·기록)를 라우트마다 채워 돌린다. 각본에 없는 조작은 3번의 desktop worktree 안에 임시 spec을 두고 돌린다(커밋·push하지 않고 worktree와 함께 지운다). 발견마다 재현 절차·기대와 실제·콘솔 줄·스크린샷 경로를 남긴다. 5. 끝나면 만든 worktree를 지우고 desktop checkout의 `git status`가 비었는지 본다. diff --git a/.claude/skills/fe-qa/SKILL.md b/.claude/skills/fe-qa/SKILL.md index d85044b6..e25bb503 100644 --- a/.claude/skills/fe-qa/SKILL.md +++ b/.claude/skills/fe-qa/SKILL.md @@ -75,7 +75,7 @@ paths: pnpm·브라우저는 desktop에서만 돈다(`docs/work/operate.md` 4.1절). 노트북에서는 `scripts/verify.sh`로 보낸다. -- 브라우저 흐름: `scripts/verify.sh gate FE-GATE-008`(e2e 세 엔진, browser-capabilities, storybook, visual, 시험 증거). 생성 기능의 성공·빈·오류·상세·폼 오류는 그 안의 `tests/e2e/generated-feature.spec.ts`가 본다. +- 브라우저 흐름: `scripts/verify.sh gate FE-GATE-008`(e2e 세 엔진, browser-capabilities, storybook, visual, 시험 증거). 생성 기능의 성공·상세·폼 오류는 그 안의 `tests/e2e/generated-feature.spec.ts`가 본다. 이름에 `@a11y`가 붙은 시험(axe, 생성 기능 목록의 빈·오류 상태)은 FE-GATE-009에서만 돈다. - 접근성 자동 검사: `scripts/verify.sh gate FE-GATE-009` - 작업 중 spec 하나: `scripts/verify.sh exec -- corepack pnpm exec playwright test tests/e2e/`. 한 checkout에서 브라우저 시험을 둘 이상 돌리면 실행마다 다른 `TEST_RUN_ID`를 준다. - 기능 시험 한 파일: `scripts/verify.sh exec -- node scripts/run-vitest.ts run tests/features//<파일>`. 게이트는 FE-GATE-005(`test:coverage`가 `tests/features`를 돈다). diff --git a/.gitea/workflows/quality-gates.yml b/.gitea/workflows/quality-gates.yml index cadcc500..ebeda803 100644 --- a/.gitea/workflows/quality-gates.yml +++ b/.gitea/workflows/quality-gates.yml @@ -671,6 +671,29 @@ jobs: - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: persist-credentials: false + - name: Choose the dependency cache folder + id: dependency-cache-root + run: bash scripts/ci/dependency-cache-root.sh "$RUNNER_TEMP" "$(dirname "$GITHUB_WORKSPACE")" + - name: Restore and save the dependency cache + if: ${{ gitea.ref == 'refs/heads/main' }} + uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: | + /opt/hostedtoolcache/node + ${{ steps.dependency-cache-root.outputs.root }} + key: fe-dependencies-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.nvmrc', 'pnpm-lock.yaml') }} + restore-keys: | + fe-dependencies-${{ runner.os }}-${{ runner.arch }}- + - name: Restore the dependency cache + if: ${{ gitea.ref != 'refs/heads/main' }} + uses: https://github.com/actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: | + /opt/hostedtoolcache/node + ${{ steps.dependency-cache-root.outputs.root }} + key: fe-dependencies-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.nvmrc', 'pnpm-lock.yaml') }} + restore-keys: | + fe-dependencies-${{ runner.os }}-${{ runner.arch }}- - uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: node-version-file: .nvmrc diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a766e89..3d1b00a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,13 +22,13 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 - 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`을 직접 돌린다. -- merge job 셋이 runner의 actions/cache 저장소에서 Node·corepack·pnpm store와 메타데이터 캐시를 복원하고, main run만 저장한다. runner에 캐시 서버가 없으면 복원 단계가 경고만 내고 설치가 그대로 돈다. 자기 runner의 캐시 크기 상한을 확인한다(항목 하나가 압축 전 약 0.7GB, lockfile이 바뀔 때마다 새 항목). +- merge job 셋과 main job(`main / self-tests and removal drills`)이 runner의 actions/cache 저장소에서 Node·corepack·pnpm store와 메타데이터 캐시를 복원하고, main run만 저장한다. runner에 캐시 서버가 없으면 복원 단계가 경고만 내고 설치가 그대로 돈다. 자기 runner의 캐시 크기 상한을 확인한다(항목 하나가 압축 전 약 0.7GB, lockfile이 바뀔 때마다 새 항목). - 수동 접근성 기록(`docs/accessibility/route-reviews/`)에 WCAG 2.2 칸 둘이 생기고, `Release ID`를 릴리스 태그와 대조한다. - 옮기기 전: 자기 기록에 `M8`·`M9` 줄이 없으면 FE-GATE-009 형식 검사가 그 필드 이름을 대며 실패한다. release 단계를 태그 없이(브랜치에서 수동으로) 돌리면 FE-GATE-028이 `missing required environment: RELEASE_TAG`로 멈춘다. - 옮기는 법: 기록마다 `M8 Focus not obscured: pending`, `M9 Target size: pending` 두 줄을 더한다. 서명하는 기록의 `Release ID`는 다음 release부터 그 릴리스 태그(예 `v1.4.0`)로 적는다. release 단계는 태그 run에서 돈다. - 옮긴 뒤 확인: `scripts/verify.sh gate FE-GATE-009`. - 자동 axe 스캔의 태그에 `wcag22aa`가 더해져 target-size 규칙이 돈다. - - 옮기기 전: 작은 누름 대상이 새로 걸릴 수 있다. 자기 라우트는 FE-GATE-009의 `test:a11y`에서, 자기 story와 생성 기능 화면은 FE-GATE-008의 `test:storybook`·`test:e2e`에서 같은 태그로 스캔한다. + - 옮기기 전: 작은 누름 대상이 새로 걸릴 수 있다. 자기 라우트와 생성 기능 화면은 FE-GATE-009의 `test:a11y`에서, 자기 story는 FE-GATE-008의 `test:storybook`에서 같은 태그로 스캔한다. - 옮기는 법: 누름 대상을 24×24 CSS px 이상으로 키우거나 그만큼 띄운다. 태그 목록은 `tests/support/browser/axe-tags.ts` 한 곳이다. - 옮긴 뒤 확인: `scripts/verify.sh gate FE-GATE-009`, `scripts/verify.sh gate FE-GATE-008`. - `check:design-system`(FE-GATE-010)이 더 많은 곳을 본다. @@ -105,6 +105,8 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 | [계약] | `verify:documentation`(FE-GATE-017)이 `scripts/verify.sh`와 `python3` 명령 안의 경로·script 이름도 대조한다. 자기 문서의 `scripts/verify.sh script <이름>`·`python3 <경로>`가 낡았으면 실패하니 고친다 (1112/08-06) | `scripts/verify-documentation-readiness.ts` | `aebb7c8c` | | [계약] | release의 provider job 둘(vulnerability·provenance)에 FE-GATE-013과 같은 runner 요구(`hostRequirements`)를 적고, 계약이 둘이 같은지 본다. provider 감독 스크립트가 provider를 띄우기 전에 비특권 user namespace를 점검하고, 막혔으면 `test:system` 사전 점검과 같은 문구로 멈춘다 (1101/13-03) | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `scripts/generate-ci-workflow.ts`, `.gitea/workflows/quality-gates.yml`, `scripts/check-system-test-prerequisites.ts`, `scripts/run-and-validate-provider.ts` | `9ebd0856` | | [계약] | 브라우저 job 컨테이너가 `--shm-size=2g`로 뜨고, Firefox 시험 프로필을 RAM 파일시스템(`/dev/shm`)에 둔다. Firefox가 시험 context의 저장소를 디스크 프로필에 두어, 디스크가 붐비면 첫 화면 5초 대기를 넘겼다. 자리가 모자라면 디스크 프로필로 돌고 이유를 한 줄 찍는다 | `scripts/generate-ci-workflow.ts`, `.gitea/workflows/quality-gates.yml`, `tests/support/browser/browser-test.ts`, `docs/operations/ci-quality-gates.md` | `f81dda49`, `c239bdf4` | +| [계약] | FE-GATE-008의 `test:e2e`가 이름에 `@a11y`가 붙은 시험을 빼고 돈다(`playwright test --grep-invert @a11y`). 그 시험은 FE-GATE-009의 `test:a11y`만 돈다. 두 실행은 같은 Playwright 설정이라 project(세 엔진)도 같다. FE-GATE-008만 돌리면 axe 스캔과 생성 기능 목록의 빈·오류 상태 화면은 돌지 않는다. 제품이 e2e spec에 `@a11y`를 붙인 시험도 009에서만 돈다. 시험 둘이 두 script의 짝과 PR 경로표의 008·009 짝을 지킨다. round9 R9-D11을 바꾼다(decisions.md FE-6) | `package.json`, `tests/unit/ci-workflow-generation.test.ts`, `tests/unit/pr-gate-selection.test.ts`, `docs/work/reference/decisions.md`, `docs/testing/taxonomy.md`, `.claude/skills/fe-qa/SKILL.md` | `d254d70a` | +| [계약] | `dependency-cache` 단계를 main job(`main_gate`)에도 둔다. 키·경로·main run만 저장·frozen install은 merge job과 같다. release·promotion·provider job은 그대로 거절한다. 위 `7ed0af3d` 행의 「merge job 셋에만」을 바꾼다(decisions.md FE-7) | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `.gitea/workflows/quality-gates.yml`, `tests/unit/ci-workflow-generation.test.ts`, `docs/operations/ci-quality-gates.md` | `d254d70a` | ### 그 밖의 변경 diff --git a/config/ci/gates.json b/config/ci/gates.json index 76cd626f..38ba4121 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -2939,6 +2939,9 @@ { "kind": "checkout" }, + { + "kind": "dependency-cache" + }, { "kind": "setup-node" }, diff --git a/docs/manual/reference/create-feature.md b/docs/manual/reference/create-feature.md index f38f02ba..2c953514 100644 --- a/docs/manual/reference/create-feature.md +++ b/docs/manual/reference/create-feature.md @@ -164,7 +164,7 @@ node scripts/scale/measure-feature-shape-growth.ts --initial-baseline --write - `test:sample-removal -- --feature=` (`test:feature-scaffold`가 부른다) - 위에서 만든 기본 기능을 복사본에서 지우고 같은 게이트를 다시 돈다. 생성 기능이 지워진다는 증거다. - 인자 없이 돌면(FE-GATE-020) `scripts/lib/removable-template-features.ts`에 적힌 샘플을 하나씩 지우고, 지운 복사본에서 이 명령(`--with-create`)으로 기능을 만들어 게이트를 다시 돈다. 템플릿은 그 목록이 비어 있어 건너뛰었다고(SKIP) 출력한다. -- `tests/e2e/generated-feature.spec.ts` (`test:e2e`, FE-GATE-008) +- `tests/e2e/generated-feature.spec.ts` (`test:e2e`, FE-GATE-008. 접근성 시험은 `test:a11y`, FE-GATE-009) - 저장소 복사본에 `--with-create --keyed` 기능을 만들어 빌드하고, 실제 브라우저에서 로그인 뒤 목록, 폼 검증, 이탈 확인, 저장(멱등 키), 429 뒤 다시 시도, 결과 불명과 같은 키 재전송, 접근성(axe)을 본다. 생성기 출력이 바뀌면 여기서 잡힌다. ## 알려진 한계 diff --git a/docs/operations/ci-quality-gates.md b/docs/operations/ci-quality-gates.md index 4195f60c..0b021f39 100644 --- a/docs/operations/ci-quality-gates.md +++ b/docs/operations/ci-quality-gates.md @@ -22,7 +22,8 @@ scaffold 드릴의 입력이 바뀌면 FE-GATE-020까지 돈다. `global` 파일 돈다. main·release run은 늘 전부 돈다. 판정은 `scripts/lib/pr-gate-selection.ts`, 계약 시험은 `tests/unit/pr-gate-selection.test.ts`다. -merge job 셋만 의존성 캐시를 쓴다(권하는 안으로 정함 2026-11-13, 총괄). setup-node 앞에서 +merge job 셋과 main job(`main_gate`)이 의존성 캐시를 쓴다(merge job 셋은 권하는 안으로 정함 +2026-11-13, main job은 2026-11-20에 더함, 총괄). setup-node 앞에서 Node toolcache, corepack이 받은 pnpm, pnpm store와 메타데이터 캐시를 `.nvmrc`와 `pnpm-lock.yaml` 해시 키로 복원한다. 저장은 main run만 한다. 캐시 항목은 다음 run이 믿는 입력이다. pnpm은 같은 lockfile의 공급망 검증 기록이 캐시에 있으면 검증을 다시 하지 않는다. diff --git a/docs/testing/taxonomy.md b/docs/testing/taxonomy.md index d39b0bbe..bfabfab4 100644 --- a/docs/testing/taxonomy.md +++ b/docs/testing/taxonomy.md @@ -13,8 +13,8 @@ script로 낮추지 않는다. | 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를 만들 수 있어야 한다. 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` | +| end-to-end | `pnpm test:e2e` | 버전을 고정한 브라우저 엔진. 이름에 `@a11y`가 붙은 시험은 빼고 accessibility 층에서 돈다 | `artifacts/tests/e2e/` | +| accessibility | `pnpm test:a11y` | 버전을 고정한 브라우저 엔진. `tests/e2e/`에서 이름에 `@a11y`가 붙은 시험만 돈다 | `artifacts/tests/a11y.json` | `test:all`은 평소 제품 개발 루프다. 다음을 순서대로 돌린다: `test:runtime-schema`, `test:unit`, `test:contract`, `test:component`, diff --git a/docs/work/reference/decisions.md b/docs/work/reference/decisions.md index 23397268..bd24d08c 100644 --- a/docs/work/reference/decisions.md +++ b/docs/work/reference/decisions.md @@ -68,11 +68,13 @@ | round9 R9-D8 시각 골든 허용치 | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). 실험으로 흔들림 없는 값을 재서 낮춘다(검사 강화). 버린 안: 그대로 | 같음, 1112/04-11 | | round9 R9-D9 WCAG 2.2 | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). axe `wcag22aa` 태그를 더하고, 수동 기록 양식에 2.4.11·2.5.8 칸을 더한다(생성 출력이 바뀐다, CHANGELOG 안내). 버린 안: 태그만 | 같음, 1112/05-05 | | round9 R9-D10 예산과 advisory | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). D1을 먼저 정한다: zod·react-router 갱신이 지금 초기 JS 예산 안에 들어가므로 갱신하고, 드릴을 다시 재서 D9 규칙으로 예산을 정한다. 버린 안: 예산만 먼저 내림 | 같음, 1106/15-01, 1103/13-03 | -| round9 R9-D11 `@a11y` 두 번 실행 | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). 그대로 둔다. 게이트마다 증거를 새로 만드는 계약이다. 결함 아님으로 닫는다. 버린 안: FE-GATE-009가 FE-GATE-008 결과를 쓰기 | 같음, 1112/03-10 | +| round9 R9-D11 `@a11y` 두 번 실행 | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). 그대로 둔다. 게이트마다 증거를 새로 만드는 계약이다. 결함 아님으로 닫는다. 버린 안: FE-GATE-009가 FE-GATE-008 결과를 쓰기. (2026-11-20 FE-6 행이 바꿈) | 같음, 1112/03-10 | | round9 R9-D12 CSS·라우트 lazy 합 예산 | 2026-11-12 | 권하는 안으로 정함(2026-11-12, 총괄). 지금 값을 기록만 하고 예산은 두지 않는다. 다시 볼 때: 첫 공개 기능 라우트 lab. 버린 안: 예산 신설 | 같음, 1101/15-03 | | 결정 p 선택 runtime 제거 드릴을 main 단계로 | 2026-11-12 | FE-GATE-020의 선택 runtime 제거 드릴 셋(optional recipe, browser file/storage, realtime)을 새 게이트 FE-GATE-030으로 떼어 main 단계(`main_gate`)에서 돌린다. 기능 드릴(샘플 제거, scaffold)은 merge에 남는다. 이유: runner PR 1회 약 30분 가운데 7분쯤이고, worker를 늘리지 않고 merge 25분 목표에 닿는 길이 이것뿐이었다. 대가: 그 셋의 회귀를 병합 뒤 main run에서 본다. main이 빨강이면 다음 PR이 고친다. 짝 백엔드가 무거운 lane을 nightly로 옮긴 것과 같은 모양이다. 재검토: runner가 늘거나 드릴이 빨라져 merge에 다시 넣어도 25분 안이면 되돌린다 | 권하는 안으로 정함(2026-11-12, 총괄): 백엔드 nightly lane과 같은 모양(design-docs `template-program/README.md` 5절 p, w2-fe-2가 올린 O1) | -| 의존성 캐시는 merge job만 | 2026-11-13 | merge job 셋(`merge_static`·`merge_test`·`merge_browser`)만 Node toolcache·corepack·pnpm store와 메타데이터 캐시를 `.nvmrc`·`pnpm-lock.yaml` 해시 키로 복원하고, 저장은 main run만 한다. release·promotion·provider job은 공급망 증거를 만들므로 매번 새로 설치한다. 이유: worker를 늘리지 않고 job마다 되풀이하던 내려받기와 공급망 검증 요청을 없앤다. 캐시가 없거나 깨져도 frozen install이 같은 node_modules를 만든다. 짝 백엔드의 JDK·Gradle·Trivy 캐시와 같은 저장 규칙이다. 버린 안: CI 이미지에 의존성을 굽기(레지스트리 쓰기 토큰이 든다). 규칙의 정본은 `scripts/contracts/ci-gates.ts`의 `DEPENDENCY_CACHE` | 권하는 안으로 정함(2026-11-13, 총괄): 의존성 캐시는 merge job만, 공급망 증거 job은 매번 새로 설치 | +| 의존성 캐시는 merge job만 | 2026-11-13 | merge job 셋(`merge_static`·`merge_test`·`merge_browser`)만 Node toolcache·corepack·pnpm store와 메타데이터 캐시를 `.nvmrc`·`pnpm-lock.yaml` 해시 키로 복원하고, 저장은 main run만 한다. release·promotion·provider job은 공급망 증거를 만들므로 매번 새로 설치한다. 이유: worker를 늘리지 않고 job마다 되풀이하던 내려받기와 공급망 검증 요청을 없앤다. 캐시가 없거나 깨져도 frozen install이 같은 node_modules를 만든다. 짝 백엔드의 JDK·Gradle·Trivy 캐시와 같은 저장 규칙이다. 버린 안: CI 이미지에 의존성을 굽기(레지스트리 쓰기 토큰이 든다). 규칙의 정본은 `scripts/contracts/ci-gates.ts`의 `DEPENDENCY_CACHE`. (2026-11-20 FE-7 행이 바꿈) | 권하는 안으로 정함(2026-11-13, 총괄): 의존성 캐시는 merge job만, 공급망 증거 job은 매번 새로 설치 | | PR은 바뀐 범위의 merge 게이트만 | 2026-11-13 | PR run의 merge job은 `config/ci/pr-gate-selection.json` 경로표로 바뀐 파일이 닿는 게이트만 돌고, 안 도는 게이트는 `건너뜀: <게이트 ID> — <이유>` 한 줄을 남긴다. 전역 파일·표에 없는 파일·빈 diff·diff를 못 읽음이면 전부 돈다. main·release run은 늘 전부 돈다. 판정은 `scripts/lib/pr-gate-selection.ts`, 계약 시험은 `tests/unit/pr-gate-selection.test.ts`다 | 소유자 결정(2026-11-13 18:3x, design-docs `ci/manual.md` 4절). PR 경로표가 놓친 것은 main이 잡는다. main push에서 선택 때문에 놓친 실패가 나오면 경로표를 고친다 | +| FE-6 `@a11y` 시험은 FE-GATE-009에서만 | 2026-11-20 | round9 R9-D11을 바꾼다. FE-GATE-008의 `test:e2e`는 이름에 `@a11y`가 붙은 시험을 빼고(`--grep-invert @a11y`) 돈다. 그 시험은 FE-GATE-009의 `test:a11y`가 자기 실행으로 돈다. 두 실행은 같은 Playwright 설정을 써서, 그 시험이 도는 project(chromium·firefox·webkit)도 같다. 전제(게이트마다 증거를 새로 만든다)는 그대로다. 버린 안(FE-GATE-009가 FE-GATE-008 결과를 읽기)도 계속 버린다. 이유: merge browser job이 같은 `@a11y` 시험 33개를 두 번 돌았다. 대가: FE-GATE-008만 돌리면 `@a11y` 시험(axe 스캔, 생성 기능 목록의 빈·오류 상태 화면)은 돌지 않는다 | 총괄(2026-11-20): 소유자 2026-11-19 CI 속도 지시, design-docs `ci/06-frontend-ci-speed-handoff.md` 4.1절 | +| FE-7 main job도 의존성 캐시 | 2026-11-20 | 2026-11-13 「의존성 캐시는 merge job만」을 바꾼다. main job(`main_gate`, FE-GATE-029·030)도 merge job 셋과 같은 키·경로로 캐시를 복원한다. 저장은 그대로 main run만 하고, 설치는 그대로 `--frozen-lockfile`이다. release·promotion·provider job은 그대로 매번 새로 설치한다. 이유: main job만 install이 15~24초였다(merge job은 1~2초). main job은 공급망 증거를 만들지 않는다 | 총괄(2026-11-20): design-docs `ci/06-frontend-ci-speed-handoff.md` 4.2절 | | 구조·기술 결정 기록 | 2026-07-26~ | `VD-01`~(빈 번호 있음) | `docs/adr/` | ## 3. 결정 대기 쓰는 법 diff --git a/package.json b/package.json index 779fcc40..0e3efab8 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "test:http-scenario-catalog": "node scripts/run-vitest.ts run tests/integration/http-scenario-catalog.test.ts --reporter=default --maxWorkers=1", "test:http-scenario-evidence": "node scripts/run-http-scenario-evidence.ts", "test:recipes": "node scripts/run-vitest.ts run tests/recipes --reporter=default --reporter=junit --outputFile.junit=artifacts/tests/optional-recipes.xml --passWithNoTests", - "test:e2e": "playwright test", + "test:e2e": "playwright test --grep-invert @a11y", "test:e2e:dev": "playwright test --config playwright.dev.config.ts", "test:browser-capabilities": "playwright test --config playwright.capabilities.config.ts", "verify:browser-capability-evidence": "node scripts/verify-browser-capability-evidence.ts", diff --git a/scripts/ci/dependency-cache-root.sh b/scripts/ci/dependency-cache-root.sh index 4f76bc5d..c73fefd0 100755 --- a/scripts/ci/dependency-cache-root.sh +++ b/scripts/ci/dependency-cache-root.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Chooses where a merge job keeps its dependency cache (scripts/contracts/ci-gates.ts DEPENDENCY_CACHE): the first +# Chooses where a job keeps its dependency cache (scripts/contracts/ci-gates.ts DEPENDENCY_CACHE): the first # candidate folder on the checkout's filesystem, so pnpm hardlinks node_modules from the restored store. A store on # another filesystem is copied file by file, and a warm install took longer than a cold one (desktop: 2.1 s on the # same filesystem, 58.8 s across filesystems, 2026-11-13). A folder inside the checkout is never chosen: a cache diff --git a/scripts/contracts/ci-gates.ts b/scripts/contracts/ci-gates.ts index bcc1b5a5..854fce82 100644 --- a/scripts/contracts/ci-gates.ts +++ b/scripts/contracts/ci-gates.ts @@ -111,9 +111,10 @@ export function resolveCiSubActionUses(actionId: CiActionId, subpath: "restore") } /** - * Decision (2026-11-13, lead): the dependency cache is for the merge jobs - * only; the jobs that produce supply-chain evidence install fresh every time - * (docs/work/reference/decisions.md). A merge job restores the Node toolcache, the corepack + * Decision (2026-11-13, lead; the main job added 2026-11-20): the dependency + * cache is for the merge jobs and the main job; the jobs that produce + * supply-chain evidence install fresh every time + * (docs/work/reference/decisions.md). Such a job restores the Node toolcache, the corepack * download and pnpm's store and metadata cache (with its record of the * lockfile's supply-chain verification) before setup-node, keyed by * `.nvmrc` and the lockfile. Only a run on main saves an entry, the paired @@ -147,8 +148,11 @@ export const DEPENDENCY_CACHE = Object.freeze({ ] as const), /** What the script writes to `$GITHUB_ENV`. */ environmentNames: Object.freeze(["COREPACK_HOME", "PNPM_CONFIG_STORE_DIR", "PNPM_CONFIG_CACHE_DIR"] as const), - /** The jobs that may hold the step: the three merge jobs. */ - jobIds: Object.freeze(["merge_static", "merge_test", "merge_browser"] as const), + /** + * The jobs that may hold the step: the three merge jobs and the main job + * (FE-GATE-029, FE-GATE-030). None of them produces supply-chain evidence. + */ + jobIds: Object.freeze(["merge_static", "merge_test", "merge_browser", "main_gate"] as const), }); export function resolveCiStepActionUses(stepKind: string): string | null { @@ -895,7 +899,7 @@ function validateContractSemantics( validateJobStepKinds(job, issue); if (job.steps.some(({ kind }) => kind === "dependency-cache")) { if (!(DEPENDENCY_CACHE.jobIds as readonly string[]).includes(job.id)) { - issue(`the dependency cache is for the merge jobs only: ${job.id}`); + issue(`the dependency cache is for the merge jobs and the main job only: ${job.id}`); } for (const name of DEPENDENCY_CACHE.environmentNames) { if (job.environment.some((binding) => binding.name === name)) { @@ -1008,7 +1012,7 @@ function validateContractSemantics( production_gate: ["checkout", "setup-node", "frozen-install", "download", "extract", "run-gate", "upload"], field_gate: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"], documentation_gate: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"], - main_gate: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"], + main_gate: ["checkout", "dependency-cache", "setup-node", "frozen-install", "run-gate", "upload"], }; for (const [jobId, expected] of Object.entries(expectedStepKinds)) { const actual = contract.jobs.find(({ id }) => id === jobId)?.steps.map(({ kind }) => kind); diff --git a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap index a44af252..0a6848dd 100644 --- a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap +++ b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap @@ -674,6 +674,29 @@ jobs: - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: persist-credentials: false + - name: Choose the dependency cache folder + id: dependency-cache-root + run: bash scripts/ci/dependency-cache-root.sh "$RUNNER_TEMP" "$(dirname "$GITHUB_WORKSPACE")" + - name: Restore and save the dependency cache + if: \${{ gitea.ref == 'refs/heads/main' }} + uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: | + /opt/hostedtoolcache/node + \${{ steps.dependency-cache-root.outputs.root }} + key: fe-dependencies-\${{ runner.os }}-\${{ runner.arch }}-\${{ hashFiles('.nvmrc', 'pnpm-lock.yaml') }} + restore-keys: | + fe-dependencies-\${{ runner.os }}-\${{ runner.arch }}- + - name: Restore the dependency cache + if: \${{ gitea.ref != 'refs/heads/main' }} + uses: https://github.com/actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: | + /opt/hostedtoolcache/node + \${{ steps.dependency-cache-root.outputs.root }} + key: fe-dependencies-\${{ runner.os }}-\${{ runner.arch }}-\${{ hashFiles('.nvmrc', 'pnpm-lock.yaml') }} + restore-keys: | + fe-dependencies-\${{ runner.os }}-\${{ runner.arch }}- - uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: node-version-file: .nvmrc diff --git a/tests/unit/ci-workflow-generation.test.ts b/tests/unit/ci-workflow-generation.test.ts index b1524792..c26403af 100644 --- a/tests/unit/ci-workflow-generation.test.ts +++ b/tests/unit/ci-workflow-generation.test.ts @@ -586,6 +586,22 @@ describe("CI gate contract", () => { expect(() => parseCiGateContract(candidate)).toThrow(diagnostic); }); + // FE-6 (decisions.md): every @a11y browser test runs once, in FE-GATE-009. + // Both runs use playwright.config.ts (no --config), so the projects are the same. + it("leaves the @a11y browser tests to FE-GATE-009 and every other browser test to FE-GATE-008", async () => { + const scripts = (JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record }).scripts; + const playwrightRuns = (script: string) => + script.split("&&").map((part) => part.trim()).filter((part) => part.startsWith("playwright test")); + expect(playwrightRuns(scripts["test:e2e"]!)).toEqual(["playwright test --grep-invert @a11y"]); + expect(playwrightRuns(scripts["test:a11y"]!)).toEqual(["playwright test --grep @a11y"]); + const contract = await loadCiGateContract(process.cwd()); + const commandsOf = (gateId: string) => contract.gates.find(({ id }) => id === gateId)!.commandIds; + expect(commandsOf("FE-GATE-008")).toContain("test-e2e"); + expect(commandsOf("FE-GATE-009")).toContain("test-a11y"); + const browserJob = contract.jobs.find(({ id }) => id === "merge_browser")!; + expect(browserJob.gateIds).toEqual(expect.arrayContaining(["FE-GATE-008", "FE-GATE-009"])); + }); + it("rejects package scripts missing from the shared command registry", async () => { const root = await mkdtemp(path.join(tmpdir(), "ci-contract-package-")); temporaryRoots.push(root); @@ -1702,7 +1718,7 @@ describe("CI workflow generation", () => { 'if [ -n "$PROMOTION_STAGING_ROOT" ] && [ -n "$PROMOTION_CLEANUP_TOKEN" ] && [ -n "$PROMOTION_RUNNER_TEMP_DEV" ] && [ -n "$PROMOTION_RUNNER_TEMP_INO" ] && [ -n "$PROMOTION_STAGING_DEV" ] && [ -n "$PROMOTION_STAGING_INO" ]; then', ); const actionUses = [...first.matchAll(/^\s+-?\s*uses: (.+)$/gmu)].map((match) => match[1]); - expect(actionUses).toHaveLength(49); + expect(actionUses).toHaveLength(51); expect(new Set(actionUses)).toEqual( new Set([ "https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5", @@ -1813,8 +1829,9 @@ describe("CI workflow generation", () => { ); }); - // Decision 2026-11-13 (lead): the dependency cache is for the merge jobs - // only, and the jobs that produce supply-chain evidence install fresh. + // Decision 2026-11-13 (lead), the main job added 2026-11-20: the dependency + // cache is for the merge jobs and the main job, and the jobs that produce + // supply-chain evidence install fresh. describe("dependency cache", () => { const jobSection = (workflow: string, jobId: string) => { const start = workflow.indexOf(`\n ${jobId}:\n`); @@ -1825,7 +1842,7 @@ describe("CI workflow generation", () => { const save = "https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830"; const restore = "https://github.com/actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830"; - it("restores it in each merge job before setup-node, saves it only on main, and installs either way", async () => { + it("restores it in each merge job and the main job before setup-node, saves it only on main, and installs either way", async () => { const workflow = renderCiWorkflow(await loadCiGateContract(process.cwd())); for (const jobId of DEPENDENCY_CACHE.jobIds) { const job = jobSection(workflow, jobId); @@ -1890,7 +1907,8 @@ describe("CI workflow generation", () => { (id) => !(DEPENDENCY_CACHE.jobIds as readonly string[]).includes(id), ); expect(others).toEqual(expect.arrayContaining([ - "release_gate", "immutable_build", "vulnerability_provider", "provenance_provider", "promotion", "main_gate", + "release_gate", "immutable_build", "vulnerability_provider", "provenance_provider", "promotion", + "production_gate", "field_gate", "documentation_gate", ])); for (const jobId of others) { const job = jobSection(workflow, jobId); @@ -1902,7 +1920,7 @@ describe("CI workflow generation", () => { it.each([ ["a release job", "release_gate", 1, /step kind dependency-cache is forbidden for gate-matrix job release_gate/u], - ["the main job", "main_gate", 1, /the dependency cache is for the merge jobs only: main_gate/u], + ["a documentation job", "documentation_gate", 1, /step kind dependency-cache is forbidden for gate-single job documentation_gate/u], ["a provider job", "vulnerability_provider", 1, /step kind dependency-cache is forbidden for provider job vulnerability_provider/u], ])("refuses the cache in %s", async (_name, jobId, at, diagnostic) => { const contract = JSON.parse(JSON.stringify(await loadCiGateContract(process.cwd()))) as Record; @@ -1910,12 +1928,29 @@ describe("CI workflow generation", () => { expect(() => parseCiGateContract(contract)).toThrow(diagnostic); }); - it("refuses a merge job that drops the cache or binds its directories itself", async () => { + // Every gate-sequence job holds the cache now; a job of that kind outside + // DEPENDENCY_CACHE.jobIds is still refused by its id, not by its kind. + it("refuses the cache in a gate-sequence job it does not name", async () => { + const contract = JSON.parse(JSON.stringify(await loadCiGateContract(process.cwd()))) as Record; + const job = contract.jobs.find((candidate: Record) => candidate.id === "documentation_gate"); + job.kind = "gate-sequence"; + job.steps.splice(1, 0, { kind: "dependency-cache" }); + expect(() => parseCiGateContract(contract)).toThrow( + /the dependency cache is for the merge jobs and the main job only: documentation_gate/u, + ); + }); + + it("refuses a merge job or the main job that drops the cache, and a merge job that binds its directories itself", async () => { const dropped = JSON.parse(JSON.stringify(await loadCiGateContract(process.cwd()))) as Record; const test = dropped.jobs.find((job: Record) => job.id === "merge_test"); test.steps = test.steps.filter((step: Record) => step.kind !== "dependency-cache"); expect(() => parseCiGateContract(dropped)).toThrow(/canonical job step sequence drift: merge_test/u); + const mainDropped = JSON.parse(JSON.stringify(await loadCiGateContract(process.cwd()))) as Record; + const main = mainDropped.jobs.find((job: Record) => job.id === "main_gate"); + main.steps = main.steps.filter((step: Record) => step.kind !== "dependency-cache"); + expect(() => parseCiGateContract(mainDropped)).toThrow(/canonical job step sequence drift: main_gate/u); + const bound = JSON.parse(JSON.stringify(await loadCiGateContract(process.cwd()))) as Record; bound.jobs.find((job: Record) => job.id === "merge_static").environment.push( { name: "COREPACK_HOME", value: "/somewhere" }, diff --git a/tests/unit/pr-gate-selection.test.ts b/tests/unit/pr-gate-selection.test.ts index 2d83f561..51c76780 100644 --- a/tests/unit/pr-gate-selection.test.ts +++ b/tests/unit/pr-gate-selection.test.ts @@ -56,6 +56,15 @@ describe("PR path table (contract)", () => { expect([...listed].filter((gate) => !merge.includes(gate))).toEqual([]); }); + // FE-6 (decisions.md): FE-GATE-008 leaves the @a11y browser tests to + // FE-GATE-009, so a PR that runs 008 without 009 would run them nowhere. + it("runs FE-GATE-009 wherever it runs FE-GATE-008", () => { + expect(table.always.includes("FE-GATE-008")).toBe(table.always.includes("FE-GATE-009")); + const with008 = table.rules.filter((rule) => rule.gates.includes("FE-GATE-008")); + expect(with008.length).toBeGreaterThan(0); + for (const rule of with008) expect(rule.gates, rule.id).toContain("FE-GATE-009"); + }); + it("matches every tracked file with a row or the global list", () => { const tracked = spawnSync("git", ["ls-files"], { encoding: "utf8" }).stdout.split("\n").filter(Boolean); expect(tracked.length).toBeGreaterThan(100);