Merge pull request 'ci(gates): merge job을 셋으로 합치고 검사기 자기 시험을 main 단계로 내린다' (#16) from chore/ci-merge-jobs into main
frontend-quality-gates / merge / static checks (push) Successful in 2m26s
frontend-quality-gates / merge / browser tests (push) Successful in 8m38s
frontend-quality-gates / FE-GATE-017 / diagram-review (push) Skipped
frontend-quality-gates / merge / tests (push) Failing after 12m16s
frontend-quality-gates / FE-GATE-014 / config-compatibility (push) Skipped
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (push) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (push) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (push) Skipped
frontend-quality-gates / external-vulnerability-provider (push) Skipped
frontend-quality-gates / external-provenance-provider (push) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (push) Skipped
frontend-quality-gates / deploy-promoted-release (push) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (push) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (push) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (push) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (push) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (push) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (push) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (push) Skipped
frontend-quality-gates / main / checker self-tests (push) Successful in 1m32s

This commit was merged in pull request #16.
This commit is contained in:
2026-11-11 13:36:13 +00:00
30 changed files with 742 additions and 507 deletions
+124 -27
View File
@@ -15,6 +15,7 @@ on:
type: choice type: choice
options: options:
- merge - merge
- main
- release - release
- production - production
- field - field
@@ -31,31 +32,97 @@ env:
CI_RUNNER_IMAGE: "${{ vars.RUNNER_IMAGE_DIGEST }}" CI_RUNNER_IMAGE: "${{ vars.RUNNER_IMAGE_DIGEST }}"
jobs: jobs:
merge_gate: merge_static:
name: "${{ matrix.gate }} / ${{ matrix.name }}" name: "merge / static checks"
if: ${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }} if: ${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-001 / manifest-lockfile"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-001
- name: "FE-GATE-002 / lint"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-002
- name: "FE-GATE-003 / typecheck"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-003
- name: "FE-GATE-010 / architecture"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-010
- name: "FE-GATE-011 / build"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-011
- name: "FE-GATE-012 / bundle"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-012
- name: Upload merge static evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-static-${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_test:
name: "merge / tests"
if: ${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
# FE-GATE-013 runner requirement: 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 # FE-GATE-013 runner requirement: 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
# FE-GATE-013 runner requirement: 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 # FE-GATE-013 runner requirement: 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
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 45 timeout-minutes: 45
strategy: steps:
fail-fast: false - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
matrix: with:
include: persist-credentials: false
- { gate: FE-GATE-001, name: manifest-lockfile, browser: false } - uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
- { gate: FE-GATE-002, name: lint, browser: false } with:
- { gate: FE-GATE-003, name: typecheck, browser: false } node-version-file: .nvmrc
- { gate: FE-GATE-004, name: runtime-schema, browser: false } - name: Frozen install
- { gate: FE-GATE-005, name: unit, browser: false } run: |
- { gate: FE-GATE-006, name: component, browser: false } corepack enable
- { gate: FE-GATE-007, name: integration, browser: false } corepack pnpm install --frozen-lockfile --ignore-scripts
- { gate: FE-GATE-008, name: e2e, browser: true } - name: "FE-GATE-004 / runtime-schema"
- { gate: FE-GATE-009, name: accessibility, browser: true } if: ${{ !cancelled() }}
- { gate: FE-GATE-010, name: architecture, browser: false } run: corepack pnpm ci:gate -- FE-GATE-004
- { gate: FE-GATE-011, name: build, browser: false } - name: "FE-GATE-005 / unit"
- { gate: FE-GATE-012, name: bundle, browser: false } if: ${{ !cancelled() }}
- { gate: FE-GATE-013, name: security, browser: false } run: corepack pnpm ci:gate -- FE-GATE-005
- { gate: FE-GATE-020, name: removability, browser: false } - name: "FE-GATE-006 / component"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-006
- name: "FE-GATE-007 / integration"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-007
- name: "FE-GATE-013 / security"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-013
- name: "FE-GATE-020 / removability"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-020
- name: Upload merge test evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-test-${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_browser:
name: "merge / browser tests"
if: ${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps: steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with: with:
@@ -68,23 +135,26 @@ jobs:
corepack enable corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts corepack pnpm install --frozen-lockfile --ignore-scripts
- name: Install Playwright browsers - name: Install Playwright browsers
if: ${{ matrix.browser }}
run: | run: |
corepack pnpm exec playwright install --with-deps chromium firefox webkit corepack pnpm exec playwright install --with-deps chromium firefox webkit
$(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation $(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
- name: Run blocking gate - name: "FE-GATE-008 / e2e"
run: corepack pnpm ci:gate -- ${{ matrix.gate }} if: ${{ !cancelled() }}
- name: Upload merge gate evidence run: corepack pnpm ci:gate -- FE-GATE-008
- name: "FE-GATE-009 / accessibility"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-009
- name: Upload merge browser evidence
if: always() if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with: with:
name: "${{ matrix.gate }}-${{ gitea.run_id }}" name: "merge-browser-${{ gitea.run_id }}"
path: artifacts/ path: artifacts/
if-no-files-found: error if-no-files-found: error
release_gate: release_gate:
name: "${{ matrix.gate }} / ${{ matrix.name }}" name: "${{ matrix.gate }} / ${{ matrix.name }}"
needs: merge_gate needs: [merge_static, merge_test, merge_browser]
if: ${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }} if: ${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 45 timeout-minutes: 45
@@ -502,3 +572,30 @@ jobs:
name: "FE-GATE-017-${{ gitea.run_id }}" name: "FE-GATE-017-${{ gitea.run_id }}"
path: artifacts/ path: artifacts/
if-no-files-found: error if-no-files-found: error
main_gate:
name: "main / checker self-tests"
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
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-029 / checker-self-tests"
if: ${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-029
- name: Upload main gate evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "main-gate-${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
+8 -1
View File
@@ -43,7 +43,7 @@
## 미출시 — `48c7695b` → 정리 단계 ## 미출시 — `48c7695b` → 정리 단계
2026-11-07 소유자가 지시한 저장소 정리다(design-docs `repo-structure/04-frontend-layout.md` 9.2절, 결정은 `repo-structure/README.md` 3.4절). 범위는 `main` `48c7695b`(PR #9 병합) 다음부터다. 1단계(PR #11, `85f941c4`~`121e1125`, `main` `f33e4778`에 합침), 2단계(브랜치 `chore/layout-2-sample-removal`, `c7e80f2f`~`ad3a071f`), 3단계(합치기)와 4단계(배치 규칙 검사)(브랜치 `chore/layout-3-merge`, `bf485f44`부터 브랜치 끝까지)를 담는다. 기준점 `48c7695b`를 빼면 이 절의 해시는 모두 이 범위에 있다. 2026-11-07 소유자가 지시한 저장소 정리다(design-docs `repo-structure/04-frontend-layout.md` 9.2절, 결정은 `repo-structure/README.md` 3.4절). 범위는 `main` `48c7695b`(PR #9 병합) 다음부터다. 1단계(PR #11, `85f941c4`~`121e1125`, `main` `f33e4778`에 합침), 2단계(브랜치 `chore/layout-2-sample-removal`, `c7e80f2f`~`ad3a071f`), 3단계(합치기)와 4단계(배치 규칙 검사)(브랜치 `chore/layout-3-merge`, `bf485f44`~`c54c3813`), CI 재편(브랜치 `chore/ci-merge-jobs`, `0739f26b`부터 브랜치 끝까지)을 담는다. 기준점 `48c7695b`를 빼면 이 절의 해시는 모두 이 범위에 있다.
### 먼저 할 일 (BREAKING) ### 먼저 할 일 (BREAKING)
@@ -68,10 +68,13 @@
10. **루트 `schemas/`를 `config/schemas/`로 옮긴다.** 산출물 스키마는 `config/schemas/artifacts/`, recipe 카탈로그 스키마는 `config/schemas/recipes/`다. 자기 스키마를 `schemas/`에 두었으면 같은 곳으로 옮기고 `$schema` 상대 경로를 고친다. hosting 응답 fixture는 `config/hosting/response-headers.fixture.json` → `tests/fixtures/hosting/response-headers.json` (`79dc945a`) 10. **루트 `schemas/`를 `config/schemas/`로 옮긴다.** 산출물 스키마는 `config/schemas/artifacts/`, recipe 카탈로그 스키마는 `config/schemas/recipes/`다. 자기 스키마를 `schemas/`에 두었으면 같은 곳으로 옮기고 `$schema` 상대 경로를 고친다. hosting 응답 fixture는 `config/hosting/response-headers.fixture.json` → `tests/fixtures/hosting/response-headers.json` (`79dc945a`)
11. **자기 루트 항목을 등록부에 더한다.** 루트 항목마다 `config/repository-layout.json`에 종류·역할·읽는 곳을 적는다. 제품이 더한 루트 항목(예: `Dockerfile`, `compose.yaml`, `deploy/`)이 없으면 `tests/unit/repository-layout.test.ts`가 `add an entry with its role to config/repository-layout.json`으로 실패한다. 비밀값 검사 범위에 넣을 항목은 `sets`에 `secret-scan`을 적고 `config/security/secret-scan-policy.json`의 `trackedRoots`에도 같은 이름을 더한다. 둘이 다르면 같은 시험이 실패한다. 루트 경로 목록을 코드에 새로 적지 말고 `selectRepositoryPaths(<집합>)`으로 고른다(매뉴얼 03 E절 R2) (`79dc945a`) 11. **자기 루트 항목을 등록부에 더한다.** 루트 항목마다 `config/repository-layout.json`에 종류·역할·읽는 곳을 적는다. 제품이 더한 루트 항목(예: `Dockerfile`, `compose.yaml`, `deploy/`)이 없으면 `tests/unit/repository-layout.test.ts`가 `add an entry with its role to config/repository-layout.json`으로 실패한다. 비밀값 검사 범위에 넣을 항목은 `sets`에 `secret-scan`을 적고 `config/security/secret-scan-policy.json`의 `trackedRoots`에도 같은 이름을 더한다. 둘이 다르면 같은 시험이 실패한다. 루트 경로 목록을 코드에 새로 적지 말고 `selectRepositoryPaths(<집합>)`으로 고른다(매뉴얼 03 E절 R2) (`79dc945a`)
12. **CI 계약 기준선을 자기 값으로 다시 기록한 프로젝트는 다시 기록한다.** FE-GATE-003 명령이 25개에서 2개로, FE-GATE-009·028의 수동 a11y 기록 산출물 경로와 id가 바뀌었다. 4단계와 같은 명령이다 (`bf485f44`, `79dc945a`) 12. **CI 계약 기준선을 자기 값으로 다시 기록한 프로젝트는 다시 기록한다.** FE-GATE-003 명령이 25개에서 2개로, FE-GATE-009·028의 수동 a11y 기록 산출물 경로와 id가 바뀌었다. 4단계와 같은 명령이다 (`bf485f44`, `79dc945a`)
13. **CI 계약 기준선 파일이 없어졌다.** `config/ci/contract-baseline.json`, `scripts/update-ci-contract-baseline.ts`, `update:ci-contract-baseline` script를 지웠다(소유자 결정). 위 12단계와 이 절 4단계, 아래 절들의 "기준선을 다시 기록한다"는 이 절까지 받으면 할 일이 없다. 병합에서 자기 기준선 파일이 수정/삭제 충돌이 되면 삭제 쪽을 고른다. 자기 script나 문서가 `update:ci-contract-baseline`을 부르면 지운다 (`f6b2b96c`)
14. **merge 단계 job 이름이 바뀌었다.** 게이트마다 하나이던 행렬 job(`FE-GATE-NNN / <이름>`)이 `merge / static checks`(`merge_static`), `merge / tests`(`merge_test`), `merge / browser tests`(`merge_browser`) 셋이 됐다. 게이트는 job 안의 단계 이름(`FE-GATE-NNN / <이름>`)으로 남는다. Gitea 브랜치 보호의 필수 검사를 옛 job 이름으로 걸었으면 새 job 셋으로 바꾼다. 증거 업로드 이름도 `FE-GATE-NNN-<run>`에서 `merge-static-<run>`·`merge-test-<run>`·`merge-browser-<run>`으로 바뀌었다 (`0739f26b`)
#### 옮긴 뒤 확인 #### 옮긴 뒤 확인
1. 로컬 merge 게이트 14개를 돈다. 이 절 때문에 먼저 볼 것: `check:registries`(3단계), `check:ci`(4·12단계), `test:unit`(5·9·11단계), `generate:feature-index`(6단계), `check:types`·`check:types:fixtures`(7·8단계), `verify:documentation`(지운 샘플 경로를 적은 자기 문서, 9단계, 매뉴얼 03 E절 R6·R7), `test:sample-removal`(인자 없이 돌면 목록이 빈 템플릿에서는 `SKIP`을 출력한다). 1. 로컬 merge 게이트 14개를 돈다. 이 절 때문에 먼저 볼 것: `check:registries`(3단계), `check:ci`(4·12단계), `test:unit`(5·9·11단계), `generate:feature-index`(6단계), `check:types`·`check:types:fixtures`(7·8단계), `verify:documentation`(지운 샘플 경로를 적은 자기 문서, 9단계, 매뉴얼 03 E절 R6·R7), `test:sample-removal`(인자 없이 돌면 목록이 빈 템플릿에서는 `SKIP`을 출력한다).
- 검사기의 음성 fixture 명령 15개와 ungated 검사(`check:ci:gating`)는 PR이 아니라 브랜치 push의 FE-GATE-029(`main_gate`)에서 돈다. 새 시험 파일이나 검증 script를 게이트에 걸지 않으면 PR은 통과하고 main push가 실패한다. 로컬에서는 `corepack pnpm ci:gate FE-GATE-029`로 미리 본다 (`f6b2b96c`).
2. 시각 골든: 갤러리 두 장(`design-system-gallery-dark`, `state-surfaces-light`)은 이제 Storybook 정적 빌드의 story를 찍는다. 자기 골든을 다시 찍은 프로젝트는 `corepack pnpm test:visual:update`로 그 둘을 다시 찍는다. 2. 시각 골든: 갤러리 두 장(`design-system-gallery-dark`, `state-surfaces-light`)은 이제 Storybook 정적 빌드의 story를 찍는다. 자기 골든을 다시 찍은 프로젝트는 `corepack pnpm test:visual:update`로 그 둘을 다시 찍는다.
3. `/examples/ui`·`/examples/states`·`/examples/auth`를 열던 자기 e2e는 플랫폼 라우트나 자기 화면으로 옮긴다. 템플릿의 그런 spec은 옮겼다(아래 표). 3. `/examples/ui`·`/examples/states`·`/examples/auth`를 열던 자기 e2e는 플랫폼 라우트나 자기 화면으로 옮긴다. 템플릿의 그런 spec은 옮겼다(아래 표).
@@ -89,9 +92,12 @@
| [계약] **BREAKING** | 음성 타입 fixture 23개를 실행기 하나로 돈다. fixture 첫 줄의 `// expect:`가 기대이고, 판정은 전과 같다(tsc exit 1과 `error TS<code>:`). fixture별 결과와 맞은 진단 줄을 출력한다. `TelemetryPort.emit` 인자를 넓히는 변이(0925/07-05)에서 실패하는 것을 확인했다. recipes tsconfig는 test에 합쳤고 web-worker tsconfig(0파일 검사)는 지웠다(결정 D4). 위 "먼저 할 일" 7·8 | `scripts/check-type-fixtures.ts`, `scripts/check-typecheck-inputs.ts`, `tests/fixtures/typecheck/`, `package.json`, `config/ci/gates.json` | `bf485f44` | | [계약] **BREAKING** | 음성 타입 fixture 23개를 실행기 하나로 돈다. fixture 첫 줄의 `// expect:`가 기대이고, 판정은 전과 같다(tsc exit 1과 `error TS<code>:`). fixture별 결과와 맞은 진단 줄을 출력한다. `TelemetryPort.emit` 인자를 넓히는 변이(0925/07-05)에서 실패하는 것을 확인했다. recipes tsconfig는 test에 합쳤고 web-worker tsconfig(0파일 검사)는 지웠다(결정 D4). 위 "먼저 할 일" 7·8 | `scripts/check-type-fixtures.ts`, `scripts/check-typecheck-inputs.ts`, `tests/fixtures/typecheck/`, `package.json`, `config/ci/gates.json` | `bf485f44` |
| [계약] **BREAKING** | 루트 등록부 `config/repository-layout.json`이 생겼다. 루트 경로 목록을 쓰던 7곳(복사 대상, 비밀값 검사 범위, 공급망 시험, 이력 문서 검사, 규모 입력, vite 입력, TS 전용 규칙)이 등록부의 집합을 고른다. `schemas/`·수동 a11y 기록·hosting 응답 fixture를 옮겼다. 위 "먼저 할 일" 9~11 | `config/repository-layout.json`, `scripts/lib/repository-layout.ts`, `config/schemas/`, `docs/accessibility/route-reviews/`, `tests/fixtures/hosting/` | `79dc945a` | | [계약] **BREAKING** | 루트 등록부 `config/repository-layout.json`이 생겼다. 루트 경로 목록을 쓰던 7곳(복사 대상, 비밀값 검사 범위, 공급망 시험, 이력 문서 검사, 규모 입력, vite 입력, TS 전용 규칙)이 등록부의 집합을 고른다. `schemas/`·수동 a11y 기록·hosting 응답 fixture를 옮겼다. 위 "먼저 할 일" 9~11 | `config/repository-layout.json`, `scripts/lib/repository-layout.ts`, `config/schemas/`, `docs/accessibility/route-reviews/`, `tests/fixtures/hosting/` | `79dc945a` |
| [계약] | 저장소 배치 규칙 R1~R10을 매뉴얼 03 E절에 적고, 기계로 볼 수 있는 것을 게이트에 넣었다: R1·R2·R7(파일)·R9 `tests/unit/repository-layout.test.ts`, R3 `tests/unit/tracked-artifacts.test.ts`, R4·R5 `tests/unit/example-feature-rules.test.ts`(이상 FE-GATE-005), R6·R7(문서) `verify:documentation`(FE-GATE-017, 산출물에 `layoutRuleViolations`), R8 FE-GATE-003 | `docs/manual/03-outside-feature-folder.md`, `scripts/verify-documentation-readiness.ts`, `scripts/contracts/release-artifacts.ts` | `e902e657` | | [계약] | 저장소 배치 규칙 R1~R10을 매뉴얼 03 E절에 적고, 기계로 볼 수 있는 것을 게이트에 넣었다: R1·R2·R7(파일)·R9 `tests/unit/repository-layout.test.ts`, R3 `tests/unit/tracked-artifacts.test.ts`, R4·R5 `tests/unit/example-feature-rules.test.ts`(이상 FE-GATE-005), R6·R7(문서) `verify:documentation`(FE-GATE-017, 산출물에 `layoutRuleViolations`), R8 FE-GATE-003 | `docs/manual/03-outside-feature-folder.md`, `scripts/verify-documentation-readiness.ts`, `scripts/contracts/release-artifacts.ts` | `e902e657` |
| [계약] **BREAKING** | merge 단계 job 14개(게이트마다 행렬 하나)를 셋으로 합쳤다. job마다 설치를 한 번 하고 게이트를 차례로 돈다. 앞 게이트가 실패해도 다음 게이트가 돈다(`if: ${{ !cancelled() }}`). release 단계는 세 job을 모두 기다린다. 위 "먼저 할 일" 14 | `config/ci/gates.json` `jobs`, `scripts/contracts/ci-gates.ts`, `scripts/generate-ci-workflow.ts`, `.gitea/workflows/quality-gates.yml` | `0739f26b` |
| [계약] **BREAKING** | 새 단계 `main`(`MAIN_READY`, 승격을 막지 않음)과 게이트 FE-GATE-029 `checker-self-tests`. FE-GATE-001·005·008·010·013의 `*:fixture` 명령 15개와 그 증거, `check:ci`의 ungated 검사(`check:ci:gating`으로 뗌)를 옮겼다. merge 단계 명령 참조 64 → 49. 음성 타입 fixture(`check:types:fixtures`)는 src 타입 계약 시험이라 merge에 남겼다. CI 계약 기준선 파일은 지웠다. 위 "먼저 할 일" 13 | `config/ci/gates.json`, `scripts/check-ci-gating.ts`, `scripts/lib/promotion-readiness.ts` | `f6b2b96c` |
### 그 밖의 수정 ### 그 밖의 수정
- `scripts/check-*.ts` 30개를 ESLint 규칙·의존 규칙·시험으로 옮길 수 있는지 판정한 표를 `docs/operations/ci-script-assessment.md`에 남겼다. 코드는 바꾸지 않았다 (`3ce77d9e`).
- 정리 3단계에서 문서가 가리키던 옛 명령·경로(`check:types:fixture:*`, `check:types:recipes`, a11y 기록과 스키마 경로)를 새 이름으로 바꿨다 (`bf485f44`, `79dc945a`). - 정리 3단계에서 문서가 가리키던 옛 명령·경로(`check:types:fixture:*`, `check:types:recipes`, a11y 기록과 스키마 경로)를 새 이름으로 바꿨다 (`bf485f44`, `79dc945a`).
- 정리 1단계: 읽는 곳 없는 산출물 13개를 지우고 `artifacts/`를 폴더째 무시한다(`85f941c4`). 아무도 읽지 않는 `config/schemas/` JSON Schema 4개를 지웠다(`0805910c`). 루트 `tasks/`와 `.superpowers/` 기록을 `docs/history/`로 옮겼다(`429b8d88`). nginx 설정 예시를 지우고 호스트가 지킬 조건만 남겼다(`121e1125`). - 정리 1단계: 읽는 곳 없는 산출물 13개를 지우고 `artifacts/`를 폴더째 무시한다(`85f941c4`). 아무도 읽지 않는 `config/schemas/` JSON Schema 4개를 지웠다(`0805910c`). 루트 `tasks/`와 `.superpowers/` 기록을 `docs/history/`로 옮겼다(`429b8d88`). nginx 설정 예시를 지우고 호스트가 지킬 조건만 남겼다(`121e1125`).
- `/examples/ui`·`/examples/states`를 열던 e2e(반응형, 스크롤 복원, 타이포그래피, 건너뛰기 링크)는 홈과 `/examples/platform`으로 옮겼다 (`e7210c71`). - `/examples/ui`·`/examples/states`를 열던 e2e(반응형, 스크롤 복원, 타이포그래피, 건너뛰기 링크)는 홈과 `/examples/platform`으로 옮겼다 (`e7210c71`).
@@ -104,6 +110,7 @@
- 두 다운스트림에 시험 병합을 하지 않아 충돌 수를 모른다(S4 가정 F4). - 두 다운스트림에 시험 병합을 하지 않아 충돌 수를 모른다(S4 가정 F4).
- R2 검사는 등록부를 쓰는 7곳만 본다. 그 밖에 루트 이름 둘 이상을 담은 문자열 배열이 약 20곳 남았다(예: `tests/e2e/support/fixture-builds.ts`의 복사 제외 목록, `scripts/check-test-evidence.ts`의 playwright 설정 목록). 뜻이 다른 목록이라 이번에 옮기지 않았다. - R2 검사는 등록부를 쓰는 7곳만 본다. 그 밖에 루트 이름 둘 이상을 담은 문자열 배열이 약 20곳 남았다(예: `tests/e2e/support/fixture-builds.ts`의 복사 제외 목록, `scripts/check-test-evidence.ts`의 playwright 설정 목록). 뜻이 다른 목록이라 이번에 옮기지 않았다.
- R5는 문자열 검색이라 샘플 ID나 라우트 경로를 조립해 쓰는 시험은 놓친다. - R5는 문자열 검색이라 샘플 ID나 라우트 경로를 조립해 쓰는 시험은 놓친다.
- CI 재편(merge job 셋, main 단계)은 desktop에서 게이트 명령으로 확인했다. Gitea runner에서 새 workflow가 도는지는 Actions를 켠 뒤 확인한다.
- 성능 lab(FE-GATE-026)의 기능 라우트 측정(`featureRouteInteractionMs`)은 템플릿에 공개 기능 라우트가 없어 `measured: false`다. 제품 기능이 생기면 잰다. - 성능 lab(FE-GATE-026)의 기능 라우트 측정(`featureRouteInteractionMs`)은 템플릿에 공개 기능 라우트가 없어 `measured: false`다. 제품 기능이 생기면 잰다.
- `TEMPLATE_FIXTURE` 출처와 `REFERENCE_EXTERNAL_BEARER` 별칭이 플랫폼 코드에 남았다. 쓰는 기능이 없다. - `TEMPLATE_FIXTURE` 출처와 `REFERENCE_EXTERNAL_BEARER` 별칭이 플랫폼 코드에 남았다. 쓰는 기능이 없다.
- visual 골든의 픽셀 비교는 색 허용치(`threshold` 0.2)를 넘지 않는 미세한 토큰 변경(예: 어두운 테마 `--color-danger` red-500 → red-600)을 잡지 못한다. 옛 골든도 같았다. - visual 골든의 픽셀 비교는 색 허용치(`threshold` 0.2)를 넘지 않는 미세한 토큰 변경(예: 어두운 테마 `--color-danger` red-500 → red-600)을 잡지 못한다. 옛 골든도 같았다.
-11
View File
@@ -1,11 +0,0 @@
{
"schemaVersion": 1,
"owner": "DongHyeonka",
"reason": "2026-11-07 소유자 결정: 정리 3단계(design-docs repo-structure/README.md 3.4절). 음성 타입 fixture 명령 23개를 실행기 하나로 합치고, 수동 a11y 기록을 docs/accessibility/route-reviews로, JSON Schema를 config/schemas로 옮긴다",
"gates": 27,
"commands": 76,
"commandReferences": 80,
"artifacts": 105,
"stages": 5,
"gateShapeSha256": "5b2ded190e5c1cbfc31f0d8c90fa358defe87850d99dc4db5439426b9ed72a90"
}
+181 -43
View File
@@ -427,6 +427,11 @@
"script": "check:ci", "script": "check:ci",
"expect": "pass" "expect": "pass"
}, },
{
"id": "check-ci-gating",
"script": "check:ci:gating",
"expect": "pass"
},
{ {
"id": "check-release-admission", "id": "check-release-admission",
"script": "check:release-admission", "script": "check:release-admission",
@@ -1563,6 +1568,12 @@
"path": "artifacts/quality/gates/FE-GATE-028.txt", "path": "artifacts/quality/gates/FE-GATE-028.txt",
"schemaId": "text", "schemaId": "text",
"production": "runner-generated" "production": "runner-generated"
},
{
"id": "artifact-artifacts-quality-gates-FE-GATE-029-txt",
"path": "artifacts/quality/gates/FE-GATE-029.txt",
"schemaId": "text",
"production": "runner-generated"
} }
], ],
"gates": [ "gates": [
@@ -1570,8 +1581,7 @@
"id": "FE-GATE-001", "id": "FE-GATE-001",
"name": "manifest-lockfile", "name": "manifest-lockfile",
"commandIds": [ "commandIds": [
"verify-lockfile", "verify-lockfile"
"check-frozen-lockfile-fixture"
], ],
"logArtifactId": "artifact-artifacts-quality-install-txt", "logArtifactId": "artifact-artifacts-quality-install-txt",
"evidenceArtifactIds": [ "evidenceArtifactIds": [
@@ -1623,7 +1633,6 @@
"test-unit", "test-unit",
"test-contract", "test-contract",
"test-coverage", "test-coverage",
"check-coverage-fixture",
"check-scale-pr" "check-scale-pr"
], ],
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-005-txt", "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-005-txt",
@@ -1632,8 +1641,7 @@
"artifact-artifacts-tests-contract-xml", "artifact-artifacts-tests-contract-xml",
"artifact-artifacts-tests-coverage-xml", "artifact-artifacts-tests-coverage-xml",
"artifact-artifacts-tests-coverage-coverage-summary-json", "artifact-artifacts-tests-coverage-coverage-summary-json",
"artifact-artifacts-quality-risk-coverage-json", "artifact-artifacts-quality-risk-coverage-json"
"artifact-artifacts-quality-risk-coverage-fixture-json"
], ],
"retentionClassId": "merge-cycle" "retentionClassId": "merge-cycle"
}, },
@@ -1676,8 +1684,7 @@
"verify-browser-capability-evidence", "verify-browser-capability-evidence",
"test-storybook", "test-storybook",
"test-visual", "test-visual",
"check-test-evidence-browser", "check-test-evidence-browser"
"check-test-evidence-fixture"
], ],
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-008-txt", "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-008-txt",
"evidenceArtifactIds": [ "evidenceArtifactIds": [
@@ -1689,8 +1696,7 @@
"artifact-artifacts-tests-storybook-results-xml", "artifact-artifacts-tests-storybook-results-xml",
"artifact-artifacts-tests-visual-report-index-html", "artifact-artifacts-tests-visual-report-index-html",
"artifact-artifacts-tests-visual-results-xml", "artifact-artifacts-tests-visual-results-xml",
"artifact-artifacts-quality-test-evidence-json", "artifact-artifacts-quality-test-evidence-json"
"artifact-artifacts-quality-test-evidence-fixture-json"
], ],
"retentionClassId": "merge-cycle" "retentionClassId": "merge-cycle"
}, },
@@ -1715,21 +1721,12 @@
"check-request-fanout", "check-request-fanout",
"check-app-build-input", "check-app-build-input",
"check-design-system", "check-design-system",
"check-design-system-fixture",
"check-i18n", "check-i18n",
"check-i18n-fixture",
"check-diagnostics", "check-diagnostics",
"check-diagnostics-fixture",
"check-browser-file-storage-boundaries", "check-browser-file-storage-boundaries",
"check-realtime-boundaries", "check-realtime-boundaries",
"check-realtime-boundaries-fixture",
"check-optional-recipes-source", "check-optional-recipes-source",
"check-optional-recipe-fixtures",
"check-registries", "check-registries",
"check-registries-compatibility-fixtures",
"check-registries-baseline-fixture",
"check-registries-fixture",
"check-routes-fixture",
"check-adapter-inventory", "check-adapter-inventory",
"check-ci" "check-ci"
], ],
@@ -1737,19 +1734,11 @@
"evidenceArtifactIds": [ "evidenceArtifactIds": [
"artifact-artifacts-quality-dependency-report-json", "artifact-artifacts-quality-dependency-report-json",
"artifact-artifacts-quality-design-system-json", "artifact-artifacts-quality-design-system-json",
"artifact-artifacts-quality-design-system-fixture-json",
"artifact-artifacts-quality-i18n-json", "artifact-artifacts-quality-i18n-json",
"artifact-artifacts-quality-i18n-fixture-json",
"artifact-artifacts-quality-diagnostics-json", "artifact-artifacts-quality-diagnostics-json",
"artifact-artifacts-quality-diagnostics-fixture-json",
"artifact-artifacts-quality-realtime-boundaries-json", "artifact-artifacts-quality-realtime-boundaries-json",
"artifact-artifacts-quality-optional-recipes-json", "artifact-artifacts-quality-optional-recipes-json",
"artifact-artifacts-quality-optional-recipe-fixtures-json",
"artifact-artifacts-quality-registries-json", "artifact-artifacts-quality-registries-json",
"artifact-artifacts-quality-registry-compatibility-fixtures-json",
"artifact-artifacts-quality-registry-baseline-fixture-json",
"artifact-artifacts-quality-registry-fixture-json",
"artifact-artifacts-quality-route-registry-fixture-json",
"artifact-artifacts-quality-ci-contract-json" "artifact-artifacts-quality-ci-contract-json"
], ],
"retentionClassId": "merge-cycle" "retentionClassId": "merge-cycle"
@@ -1793,9 +1782,6 @@
"verify-reproducible-build", "verify-reproducible-build",
"build-release-candidate", "build-release-candidate",
"verify-local-evidence", "verify-local-evidence",
"check-supply-chain-fixtures",
"check-supply-chain-provider-fixtures",
"check-security-fixtures",
"check-browser-security" "check-browser-security"
], ],
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-013-txt", "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-013-txt",
@@ -1810,9 +1796,7 @@
"artifact-artifacts-security-license-report-json", "artifact-artifacts-security-license-report-json",
"artifact-artifacts-security-vulnerability-report-json", "artifact-artifacts-security-vulnerability-report-json",
"artifact-artifacts-security-supply-chain-verification-json", "artifact-artifacts-security-supply-chain-verification-json",
"artifact-artifacts-security-supply-chain-coherence-json", "artifact-artifacts-security-supply-chain-coherence-json"
"artifact-artifacts-security-supply-chain-fixtures-json",
"artifact-artifacts-security-supply-chain-provider-fixtures-json"
], ],
"retentionClassId": "release-coherence", "retentionClassId": "release-coherence",
"hostRequirements": [ "hostRequirements": [
@@ -2009,6 +1993,44 @@
"artifact-artifacts-tests-a11y-manual-report-json" "artifact-artifacts-tests-a11y-manual-report-json"
], ],
"retentionClassId": "release-coherence" "retentionClassId": "release-coherence"
},
{
"id": "FE-GATE-029",
"name": "checker-self-tests",
"commandIds": [
"check-frozen-lockfile-fixture",
"check-coverage-fixture",
"check-test-evidence-fixture",
"check-design-system-fixture",
"check-i18n-fixture",
"check-diagnostics-fixture",
"check-realtime-boundaries-fixture",
"check-optional-recipe-fixtures",
"check-registries-compatibility-fixtures",
"check-registries-baseline-fixture",
"check-registries-fixture",
"check-routes-fixture",
"check-supply-chain-fixtures",
"check-supply-chain-provider-fixtures",
"check-security-fixtures",
"check-ci-gating"
],
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-029-txt",
"evidenceArtifactIds": [
"artifact-artifacts-quality-risk-coverage-fixture-json",
"artifact-artifacts-quality-test-evidence-fixture-json",
"artifact-artifacts-quality-design-system-fixture-json",
"artifact-artifacts-quality-i18n-fixture-json",
"artifact-artifacts-quality-diagnostics-fixture-json",
"artifact-artifacts-quality-optional-recipe-fixtures-json",
"artifact-artifacts-quality-registry-compatibility-fixtures-json",
"artifact-artifacts-quality-registry-baseline-fixture-json",
"artifact-artifacts-quality-registry-fixture-json",
"artifact-artifacts-quality-route-registry-fixture-json",
"artifact-artifacts-security-supply-chain-fixtures-json",
"artifact-artifacts-security-supply-chain-provider-fixtures-json"
],
"retentionClassId": "merge-cycle"
} }
], ],
"stages": [ "stages": [
@@ -2079,13 +2101,21 @@
"gateIds": [ "gateIds": [
"FE-GATE-017" "FE-GATE-017"
] ]
},
{
"id": "main",
"readiness": "MAIN_READY",
"needs": [],
"gateIds": [
"FE-GATE-029"
]
} }
], ],
"jobs": [ "jobs": [
{ {
"id": "merge_gate", "id": "merge_static",
"displayName": "${{ matrix.gate }} / ${{ matrix.name }}", "displayName": "merge / static checks",
"kind": "gate-matrix", "kind": "gate-sequence",
"needs": [], "needs": [],
"condition": "merge", "condition": "merge",
"timeoutMinutes": 45, "timeoutMinutes": 45,
@@ -2093,18 +2123,88 @@
"FE-GATE-001", "FE-GATE-001",
"FE-GATE-002", "FE-GATE-002",
"FE-GATE-003", "FE-GATE-003",
"FE-GATE-010",
"FE-GATE-011",
"FE-GATE-012"
],
"browserGateIds": [],
"environment": [],
"steps": [
{
"kind": "checkout"
},
{
"kind": "setup-node"
},
{
"kind": "frozen-install"
},
{
"kind": "run-gate"
},
{
"kind": "upload",
"transferId": "merge-static-evidence",
"name": "merge-static-${{ gitea.run_id }}",
"paths": [
"artifacts/"
],
"always": true
}
]
},
{
"id": "merge_test",
"displayName": "merge / tests",
"kind": "gate-sequence",
"needs": [],
"condition": "merge",
"timeoutMinutes": 45,
"gateIds": [
"FE-GATE-004", "FE-GATE-004",
"FE-GATE-005", "FE-GATE-005",
"FE-GATE-006", "FE-GATE-006",
"FE-GATE-007", "FE-GATE-007",
"FE-GATE-008",
"FE-GATE-009",
"FE-GATE-010",
"FE-GATE-011",
"FE-GATE-012",
"FE-GATE-013", "FE-GATE-013",
"FE-GATE-020" "FE-GATE-020"
], ],
"browserGateIds": [],
"environment": [],
"steps": [
{
"kind": "checkout"
},
{
"kind": "setup-node"
},
{
"kind": "frozen-install"
},
{
"kind": "run-gate"
},
{
"kind": "upload",
"transferId": "merge-test-evidence",
"name": "merge-test-${{ gitea.run_id }}",
"paths": [
"artifacts/"
],
"always": true
}
]
},
{
"id": "merge_browser",
"displayName": "merge / browser tests",
"kind": "gate-sequence",
"needs": [],
"condition": "merge",
"timeoutMinutes": 45,
"gateIds": [
"FE-GATE-008",
"FE-GATE-009"
],
"browserGateIds": [ "browserGateIds": [
"FE-GATE-008", "FE-GATE-008",
"FE-GATE-009" "FE-GATE-009"
@@ -2128,8 +2228,8 @@
}, },
{ {
"kind": "upload", "kind": "upload",
"transferId": "merge-gate-evidence", "transferId": "merge-browser-evidence",
"name": "${{ matrix.gate }}-${{ gitea.run_id }}", "name": "merge-browser-${{ gitea.run_id }}",
"paths": [ "paths": [
"artifacts/" "artifacts/"
], ],
@@ -2142,7 +2242,9 @@
"displayName": "${{ matrix.gate }} / ${{ matrix.name }}", "displayName": "${{ matrix.gate }} / ${{ matrix.name }}",
"kind": "gate-matrix", "kind": "gate-matrix",
"needs": [ "needs": [
"merge_gate" "merge_static",
"merge_test",
"merge_browser"
], ],
"condition": "release", "condition": "release",
"timeoutMinutes": 45, "timeoutMinutes": 45,
@@ -2753,6 +2855,42 @@
"always": true "always": true
} }
] ]
},
{
"id": "main_gate",
"displayName": "main / checker self-tests",
"kind": "gate-sequence",
"needs": [],
"condition": "main",
"timeoutMinutes": 45,
"gateIds": [
"FE-GATE-029"
],
"browserGateIds": [],
"environment": [],
"steps": [
{
"kind": "checkout"
},
{
"kind": "setup-node"
},
{
"kind": "frozen-install"
},
{
"kind": "run-gate"
},
{
"kind": "upload",
"transferId": "main-gate-evidence",
"name": "main-gate-${{ gitea.run_id }}",
"paths": [
"artifacts/"
],
"always": true
}
]
} }
], ],
"retention": { "retention": {
+17 -27
View File
@@ -6,34 +6,25 @@ strict v2 contract; it is not an independent configuration authority. Update
the registry, run `corepack pnpm generate:ci-workflow`, and commit the generated the registry, run `corepack pnpm generate:ci-workflow`, and commit the generated
bytes together. `corepack pnpm check:ci-workflow` rejects missing, stale, CRLF, bytes together. `corepack pnpm check:ci-workflow` rejects missing, stale, CRLF,
or otherwise byte-different output. `corepack pnpm check:ci` runs artifact-schema or otherwise byte-different output. `corepack pnpm check:ci` runs artifact-schema
checking, the typed contract checker, and this workflow drift check. The Gitea checking, the typed contract checker, and this workflow drift check. The merge
adapter runs each gate as an independent matrix check with full fan-out and no stage runs as three jobs (`merge_static`, `merge_test`, `merge_browser`), one
soft-fail wiring. install each; every gate is a step named by its ID, and a failed gate does not
skip the next. The checkers' own negative fixtures and the gating check run in
the main stage (`main_gate`, FE-GATE-029) after a push to a branch. Release and
production gates stay matrix checks. There is no soft-fail wiring.
## 기준선 갱신과 새 프로젝트 시작 시 초기화할 기준선 ## 기준선 갱신과 새 프로젝트 시작 시 초기화할 기준선
게이트 계약의 크기와 모양은 코드 상수가 아니라 `config/ci/contract-baseline.json`에 게이트·명령·산출물 수와 게이트 모양 해시를 따로 기록하던 기준선 파일은 2026-11-08에
있다. 이 파일에는 게이트 수, 명령 정의 수, 명령 참조 수, 산출물 수, stage 수, 지웠다(소유자 결정, design-docs `repo-structure/README.md` 3.3절). 계약의 모양은
게이트 모양 SHA-256과 함께 `owner`·`reason`이 들어 있다. 계약을 불러올 때 현재 `scripts/contracts/ci-gates.ts`의 의미 검사(게이트·job·stage 소유와 순서)가 지킨다.
`gates.json`과 이 파일이 다르면 실패한다(`scripts/contracts/ci-gates.ts`의 게이트·명령·산출물을 바꾼 뒤에는 `corepack pnpm generate:ci-workflow`와
`assertCiContractBaseline`). 그래서 게이트·명령·산출물을 추가하거나 지운 뒤에는 `corepack pnpm check:ci`를 돌리고 생성된 workflow를 함께 커밋한다. 제거 검증
다음 순서로 커밋한다. (`test:*-removal`)은 줄인 계약을 그대로 불러 canonical `check:ci`를 돌린다
(`scripts/lib/removal-fixture.ts`의 `pruneRemovalFixtureCiContract`).
``` `check:ci:gating`(main 단계 FE-GATE-029)은 `tests/` 아래 테스트 파일(`tests/fixtures` 제외)이 모두 CI 게이트
# 1. config/ci/gates.json 수정 명령에서 실행되는지 확인한다. 게이트 명령이 닿는 package script의 Vitest 경로와
CI_CONTRACT_BASELINE_OWNER=<팀> CI_CONTRACT_BASELINE_REASON=<이유> corepack pnpm update:ci-contract-baseline
corepack pnpm generate:ci-workflow
corepack pnpm check:ci
```
`update:ci-contract-baseline`은 `scripts/update-ci-contract-baseline.ts`를 실행한다.
리뷰는 `contract-baseline.json`의 diff로 변경을 승인한다. 샘플·recipe·런타임 제거
검증(`test:*-removal`)도 같은 절차를 쓴다. 줄인 계약을 기준선으로 기록한 뒤
canonical `check:ci`를 돌린다(`scripts/lib/removal-fixture.ts`의
`pruneRemovalFixtureCiContract`). 완화 모드는 없다.
`check:ci`는 `tests/` 아래 테스트 파일(`tests/fixtures` 제외)이 모두 CI 게이트
명령에서 실행되는지도 확인한다. 게이트 명령이 닿는 package script의 Vitest 경로와
Playwright 설정의 `testDir`를 모아 비교한다(`scripts/lib/ungated-tests.ts`). Playwright 설정의 `testDir`를 모아 비교한다(`scripts/lib/ungated-tests.ts`).
`run-scale-profile.ts <tier>`를 부르는 명령은 그 tier의 Vitest 경로로 센다. `run-scale-profile.ts <tier>`를 부르는 명령은 그 tier의 Vitest 경로로 센다.
게이트가 돌리지 않는 테스트는 `config/ci/ungated-tests.json`에 이유와 함께 적어야 게이트가 돌리지 않는 테스트는 `config/ci/ungated-tests.json`에 이유와 함께 적어야
@@ -63,7 +54,6 @@ package script 그래프로 닿거나, 게이트가 이미 돌리는 Vitest 경
| 기준선 | 파일 | 갱신 방법 | 검사 위치 | | 기준선 | 파일 | 갱신 방법 | 검사 위치 |
|---|---|---|---| |---|---|---|---|
| CI 계약 크기·게이트 모양 | `config/ci/contract-baseline.json` | `update:ci-contract-baseline` (`CI_CONTRACT_BASELINE_OWNER`·`_REASON` 필수) | `scripts/contracts/ci-gates.ts` `assertCiContractBaseline` |
| registry 스냅샷과 승인 | `config/contracts/registry-baseline.json`, `registry-baseline.approval.json` | `update:registry-baseline` (`REGISTRY_BASELINE_OWNER`·`_REASON` 필수). 기준선을 새로 찍지 않고 breaking 변경을 유지하려면 `config/contracts/registry-change-evidence.json`에 항목을 추가(`changeId`, 그 변경 뒤 값 `after`(삭제는 생략, 값은 JSON 그대로이고 키·원시값 배열 순서는 상관없다), `versionBump`·`migration`·`compatibilityWindow`·`rollback`·`owner`). 같은 칸을 다시 바꾸면 `after`가 달라 새 항목이 필요하다. 지금 diff의 breaking 변경과 changeId가 맞지 않는 항목이 있으면 게이트가 그 항목을 나열하며 실패한다. `update:registry-baseline`은 새 기준선이 설명하는 항목을 모두 지운다(지운 항목은 git 이력에 남는다) | `scripts/check-registries.ts`의 baseline 비교 | | registry 스냅샷과 승인 | `config/contracts/registry-baseline.json`, `registry-baseline.approval.json` | `update:registry-baseline` (`REGISTRY_BASELINE_OWNER`·`_REASON` 필수). 기준선을 새로 찍지 않고 breaking 변경을 유지하려면 `config/contracts/registry-change-evidence.json`에 항목을 추가(`changeId`, 그 변경 뒤 값 `after`(삭제는 생략, 값은 JSON 그대로이고 키·원시값 배열 순서는 상관없다), `versionBump`·`migration`·`compatibilityWindow`·`rollback`·`owner`). 같은 칸을 다시 바꾸면 `after`가 달라 새 항목이 필요하다. 지금 diff의 breaking 변경과 changeId가 맞지 않는 항목이 있으면 게이트가 그 항목을 나열하며 실패한다. `update:registry-baseline`은 새 기준선이 설명하는 항목을 모두 지운다(지운 항목은 git 이력에 남는다) | `scripts/check-registries.ts`의 baseline 비교 |
| 커버리지 모듈 수 하한 | `config/testing/risk-coverage.json`의 `repositoryBaseline` | 직접 수정. 지운 production 모듈 수만큼 줄인다(`scripts/test-sample-removal.ts`가 같은 계산을 한다) | `scripts/lib/risk-coverage.ts` "repository module baseline" | | 커버리지 모듈 수 하한 | `config/testing/risk-coverage.json`의 `repositoryBaseline` | 직접 수정. 지운 production 모듈 수만큼 줄인다(`scripts/test-sample-removal.ts`가 같은 계산을 한다) | `scripts/lib/risk-coverage.ts` "repository module baseline" |
| 기능 끄기 설정 | `config/runtime/<profile>.json`의 `FEATURE_OVERRIDES` | 직접 수정. 지운 기능의 키를 뺀다(`scripts/test-sample-removal.ts`가 같은 일을 한다) | 실패하는 검사는 없다. 남은 키는 아무것도 끄지 않고, `check:release-admission`(FE-GATE-027)이 `release admission warning: FEATURE_OVERRIDES.<id> … the override does nothing`을, 부팅이 진단 `feature.override.unknown`(warn)을 남긴다(리뷰 09-09) | | 기능 끄기 설정 | `config/runtime/<profile>.json`의 `FEATURE_OVERRIDES` | 직접 수정. 지운 기능의 키를 뺀다(`scripts/test-sample-removal.ts`가 같은 일을 한다) | 실패하는 검사는 없다. 남은 키는 아무것도 끄지 않고, `check:release-admission`(FE-GATE-027)이 `release admission warning: FEATURE_OVERRIDES.<id> … the override does nothing`을, 부팅이 진단 `feature.override.unknown`(warn)을 남긴다(리뷰 09-09) |
@@ -407,9 +397,9 @@ the paired backend: `{ "id": "PRODUCT-GATE-001", "name": "backend-contract",
"script": "check:backend-contract" }`. Ids are `PRODUCT-GATE-NNN`; the "script": "check:backend-contract" }`. Ids are `PRODUCT-GATE-NNN`; the
`FE-GATE-NNN` ids, their commands, artifacts and readiness formula stay the `FE-GATE-NNN` ids, their commands, artifacts and readiness formula stay the
template's. Each runs as `corepack pnpm <script>` in the `product_merge_gate` template's. Each runs as `corepack pnpm <script>` in the `product_merge_gate`
job, on the same condition as `merge_gate`, without browsers and without the job, on the same condition as the merge jobs, without browsers and without the
gate log and evidence artifacts of `ci:gate`. `release_gate` waits for that job gate log and evidence artifacts of `ci:gate`. `release_gate` waits for that job
as it waits for `merge_gate`, so a failing product gate also stops the release as it waits for the merge jobs, so a failing product gate also stops the release
build, promotion and deployment of the same run (1105/13-02); with no product build, promotion and deployment of the same run (1105/13-02); with no product
gates the workflow is the template's own. A required check of the branch is gates the workflow is the template's own. A required check of the branch is
what blocks a pull request merge, so make the job one where it has to. `check:ci` what blocks a pull request merge, so make the job one where it has to. `check:ci`
+92
View File
@@ -0,0 +1,92 @@
# check-*.ts 이전 판정 (F3)
- 작성일: 2026-11-08, 기준 커밋 `ad3a071f`(정리 2단계 끝)
- 정본 설계: design-docs `repo-structure/03-ci.md` 7.3절 F3. 이 문서는 판정만 남긴다. 코드는 바꾸지 않았다.
- 상태: 판정 표. 옮기는 작업은 이 표를 근거로 따로 한다.
- 판정 뒤 바뀐 것(2026-11-08): check-optional-recipe-types.ts는 정리 3단계에서 지웠다. `*:fixture` 자기 시험 명령은 merge 게이트에서 main 단계 FE-GATE-029로 옮겼고, CI 계약 기준선 파일은 지웠다. 아래 표의 게이트 칸은 판정 시점(`ad3a071f`) 값이다.
대상: `scripts/check-*.ts` 30개, 6,351줄. 코드를 읽고 판정했다. pnpm·tsc·테스트는 돌리지 않았다.
줄 번호는 모두 `git show ad3a071f:<파일>` 기준이다.
## 요약
**판정별 개수**
- ESLint 규칙: 1개 (check-realtime-boundaries)
- dependency-cruiser 규칙: 단독으로 옮길 스크립트 0개. 다만 다른 스크립트 안의 import 검사 일부를 옮길 수 있다(design-system, optional-recipes).
- 테스트: 8개 (adapter-inventory, browser-file-storage-boundaries, optional-recipe-fixtures, realtime-boundary-fixtures, registry-compatibility-fixtures, request-fanout, security-fixtures, supply-chain-fixtures). 합계 1,135줄.
- 일부 이전: 9개 (app-build-input, architecture, browser-security, design-system, diagnostics, i18n, optional-recipes, registries, test-evidence). 이 중 diagnostics와 i18n은 나눠서 전부 옮길 수 있어 스크립트를 지울 수 있다.
- 스크립트 유지: 11개 (backend-contract-drift, bundle, ci-contract, compatibility, frozen-lockfile-fixture, release-admission, remediation-ledger, risk-coverage, supply-chain-provider-fixtures, system-test-prerequisites, v8-coverage-counter-semantics)
- 삭제함(정리 3단계): 1개 (optional-recipe-types)
**위험이 낮고 효과가 큰 후보 5개**
1. **check-request-fanout**: 같은 검사가 `tests/architecture/request-fanout.test.ts:11-24`에 이미 있고, fixture 확인은 테스트 쪽이 더 엄격하다. CLI(`:157-185`), package script, gate 명령 1개만 지우면 된다. 증거 artifact가 없다.
2. **check-app-build-input 기본 모드**: 더 강한 같은 검사가 `tests/architecture/app-build-input.test.ts:87-92`에 이미 있다. FE-GATE-010의 `check-app-build-input` 명령만 지우고 `:bundle`은 남긴다.
3. **check-browser-file-storage-boundaries**: 이미 있는 ESLint 규칙을 검증하는 207줄짜리 메타 테스트다. `pnpm exec eslint`를 약 19번 띄우는데, vitest에서 ESLint API로 옮기면 프로세스 하나로 끝난다. 증거 artifact가 없다.
4. **check-realtime-boundaries + check-realtime-boundary-fixtures + lib**(합계 219줄): 소스 정규식 검사라 ESLint 로컬 규칙과 fixture 테스트로 옮기기 좋다. 대신 증거 1개(FE-GATE-010)와 실시간 삭제 드릴(FE-GATE-020)을 함께 고쳐야 한다.
5. **check-supply-chain-fixtures, check-registry-compatibility-fixtures**(217줄): 메모리 안의 값으로 lib 함수만 부르므로 unit test로 그대로 옮길 수 있다. 코드 쪽 위험은 거의 없다. 대신 증거 2개(FE-GATE-013·010)의 계약이 바뀌므로 contract-baseline 재승인이 필요하다.
덤으로 할 수 있는 작은 정리가 둘 있다. check-i18n의 카탈로그 비교는 이미 `tests/unit/i18n-contract.test.ts:27-38`과 겹친다. check-diagnostics의 `console.` 검사는 ESLint 기본 규칙 `no-console`로 바로 바꿀 수 있다(지금 src에 console 사용 0건).
**옮기기 전에 알아둘 공통 제약**
- **"dependency-cruiser 규칙"의 실제 범위**: 이 말은 `.dependency-cruiser.json`에 forbidden 규칙을 추가한다는 뜻이다. 실제 dependency-cruiser는 돌지 않는다. `check-architecture.ts`의 자체 Babel 그래프가 이 파일을 규칙 파일로 읽는다(`check-architecture.ts:103-106`). 지원하는 것은 forbidden(from/to path, circular)뿐이다. `allowed`·`required`를 넣으면 바로 throw한다(`:93-99`). 그래서 "이 파일은 반드시 X를 import해야 한다" 같은 검사는 이 경로로 옮길 수 없다.
- **이미 막히는 import**: 설치되지 않은 패키지 import와 src 밖으로 나가는 상대 import는 check:architecture가 이미 unresolved로 실패시킨다(`check-architecture.ts:250,310,508`).
- **증거 artifact 계약**: gates.json에 `command-generated` 증거로 등록된 파일을 만드는 스크립트를 지우면, `run-ci-gate.ts:198-205`가 "freshly produced 아님"으로 게이트를 실패시킨다. 그래서 다음을 같이 고쳐야 한다.
- gates.json의 `artifacts`·`artifactSchemas`·`evidenceArtifactIds`
- `scripts/contracts/ci-gates.ts:209-240`의 스키마 id 목록
- `scripts/contracts/release-artifacts.ts`의 스키마
- 생성 workflow와 ci-workflow-generation 스냅샷
- CI 계약 기준선(승인자·사유). 2026-11-08에 지웠다
- **실패를 보고하는 게이트가 바뀐다**: `tests/unit`은 test:unit과 test:coverage(FE-GATE-005)에서 돈다. `tests/architecture`는 test:coverage에서만 돈다(package.json:51,82). 따라서 FE-GATE-010·013에 있던 확인을 테스트로 옮기면 그 게이트 로그에서 빠지고 FE-GATE-005로 간다.
- **ESLint 설정**: flat config는 같은 규칙 이름의 옵션을 합치지 않고 덮어쓴다(`eslint.config.ts:909-910` 주석). 새 금지 규칙을 레이어별 `no-restricted-*` 옵션에 끼워 넣으면 서로 덮어쓴다. `build-env/*`, `browser-data-boundary/*`처럼 로컬 규칙 이름으로 따로 둔다. 또 금지 fixture는 ignores(`:500-511`)에 걸린다. 테스트에서는 `new ESLint({ ignore: false })`를 쓰거나 `lintText(source, { filePath })`에 가상 경로를 줘서 돌린다.
- **script 이름을 부르는 곳**: 삭제 드릴과 스케일 검증이 package script를 이름으로 부른다. 옮길 때 이 목록도 같이 고친다.
- `test-sample-removal.ts:475-482`
- `test-realtime-runtime-removal.ts:39-40,95-97`
- `test-browser-file-storage-runtime-removal.ts:55,145`
- `test-optional-recipe-removal.ts:47-48`
- `verify-extreme-scale.ts:28-31`
## 판정표
| 스크립트 | 줄 | 게이트·script | 검사 내용 | 판정 | 근거 | 위치 | 크기 |
|---|---|---|---|---|---|---|---|
| check-adapter-inventory.ts | 259 | `check:adapter-inventory` → FE-GATE-010 | 다섯 가지를 확인한다: ① `git ls-files src/adapters`와 INVENTORY.md 표·합계가 같은지 ② SW 에셋 생성기가 공용 확장자 표를 쓰는지 ③ node_modules를 symlink로 직접 잇지 않는지 ④ 지정한 4개 파일이 `platform/abortable-operation.ts`를 import하는지 ⑤ 손으로 짠 abort 리스너 파일이 13개 이하인지 | 테스트 | git ls-files·git grep과 저장소 파일만 읽는다. 빌드와 증거 artifact가 없어 vitest로 그대로 옮길 수 있다. ④는 required 규칙이어서 `.dependency-cruiser.json`으로는 못 옮긴다(엔진이 거부). 잃는 것: 실패 위치가 FE-GATE-010에서 FE-GATE-005로 바뀐다. 주석 두 곳이 이 스크립트 이름을 가리키므로 같이 고친다. | check-adapter-inventory.ts:24,58-74,77-94,100-126,139-189,215-237; check-architecture.ts:93-99; src/adapters/platform/index.ts:5; .dependency-cruiser.json:266; gates.json:410 | 작음 |
| check-app-build-input.ts | 143 | `check:app-build-input` → FE-GATE-010<br>`check:app-build-input:bundle`(`--require-bundle`) → FE-GATE-012 | 생성된 feature·context 인덱스가 현재 앱이 소유한 feature·context만 가져오는지 본다. `--require-bundle`이면 빌드 모듈 목록에 다른 앱의 feature가 섞였는지도 본다 | 일부 이전 | 기본 모드: `tests/architecture/app-build-input.test.ts:87-92`가 같은 함수로 이미 검사한다. 생성된 import가 소유 목록과 같은지까지 보므로 더 강하다. FE-GATE-010 명령만 지우면 된다. `--require-bundle`: 빌드 산출물(`artifacts/quality/vite-module-inventory.json`)이 필요해 스크립트로 남긴다. 증거 artifact 없음. 고칠 곳: ungated-scripts.test.ts:57, verify-extreme-scale.ts:28 | check-app-build-input.ts:85-108,121-130; tests/architecture/app-build-input.test.ts:87-92; package.json:149-150; gates.json:313,430 | 작음 |
| check-architecture.ts | 1188 | `check:architecture` → FE-GATE-010 | src import 그래프를 직접 만들어 `.dependency-cruiser.json`의 forbidden 규칙, 순환, 해석 안 되는 import를 검사한다. 이 밖에 그래프 엔진 자기검사(fixture 그래프 7개), JS 파일 금지, 레이어별 ESLint fixture 검사를 한다 | 일부 이전 (우선순위 낮음) | 그래프와 규칙 판정은 남긴다. 이 파일이 곧 이 repo의 "dependency-cruiser"다. 진짜 dependency-cruiser는 TS 7을 못 읽어서 쓰지 않는다. 엔진 자기검사(runGraphFixtureChecks 약 290줄), JS 금지 정책, lint fixture는 결정적이라 테스트로 옮길 수는 있다. 걸리는 점 두 가지: 그래프 함수가 export되지 않아 lib로 먼저 빼야 한다. 그리고 `dependency-report.json`(FE-GATE-010 증거)의 `fixtureChecks`·`typeScriptOnlySourcePolicy` 필드가 빠져 스키마가 바뀐다. 줄어드는 양에 비해 손이 많이 간다 | check-architecture.ts:93-99,103-106,135-136,205-218,754,1046; gates.json:303,1175 | 큼 |
| check-backend-contract-drift.ts | 198 | `check:backend-contract-drift` (게이트 없음, 일부러 제외) | 옆에 있는 백엔드 checkout을 본다. 고정 커밋 문서와 발췌표·답변표가 같은지, 고정 커밋 이후 문서와 scaffold 파일이 바뀌었는지 확인한다 | 스크립트 유지 | 다른 저장소 checkout과 git(rev-parse, show, diff)이 필요하다. 비교하지 못하면 exit 2를 낸다. CI는 이 저장소만 checkout하므로 게이트에서 돌 수 없다. 답변표와 발췌표 비교는 이미 test:unit(backend-contract-pin.test.ts)에 있다 | check-backend-contract-drift.ts:72-90,106-123,152-180; config/ci/ungated-scripts.json:5-6 | — |
| check-browser-file-storage-boundaries.ts | 207 | `check:browser-file-storage-boundaries` → FE-GATE-010 | 브라우저 저장소·파일 API ESLint 규칙이 허용 fixture는 통과시키는지 본다. 금지 fixture와 다른 어댑터 경로에 놓인 코드(가상 경로 14개)는 막는지도 본다 | 테스트 | 규칙 자체는 이미 eslint.config.ts에 있다. 이 파일은 그 규칙의 메타 테스트다. 지금은 `pnpm exec eslint`를 약 19번 따로 띄운다. vitest에서 ESLint API(`lintFiles`, `lintText({ filePath })`)를 쓰면 같은 판정을 프로세스 하나로 할 수 있다. 증거 artifact가 없고 `npm_execpath` 의존도 사라진다. 고칠 곳: 삭제 드릴이 이 스크립트 대신 테스트 파일을 지우도록 바꾼다 | check-browser-file-storage-boundaries.ts:15-45,47-60,102-171; eslint.config.ts:416-418,940-962; test-browser-file-storage-runtime-removal.ts:55,145; gates.json:354 | 작음 |
| check-browser-security.ts | 49 | `check:browser-security` → FE-GATE-013 | 보안 ESLint 규칙(eval, dangerouslySetInnerHTML, script 생성)이 허용 fixture는 통과시키고 금지 fixture는 실패시키는지 본다. dist에 `.map` 파일이 없는지도 본다 | 일부 이전 | ESLint fixture 부분은 vitest(ESLint API)로 옮긴다. 지금은 금지 폴더 전체를 한 번 lint해서 실패하는지만 본다. 그래서 4개 파일 중 하나만 걸려도 통과한다. 테스트로 옮기면서 파일별로 확인하면 더 단단해진다. dist `.map` 검사는 빌드 결과가 필요해 남는다. 다만 같은 검사가 check-test-evidence(FE-GATE-008)와 verify-hosting-headers에 이미 있으므로 여기서는 지우거나 한 곳으로 모은다. 증거 artifact 없음 | check-browser-security.ts:20-38; check-test-evidence.ts:442-447; verify-hosting-headers.ts:82; gates.json:470 | 작음 |
| check-bundle.ts | 159 | `check:bundle` → FE-GATE-012 | 빌드된 dist의 초기 JS·지연 chunk gzip 크기와 파일 수가 예산 안인지 본다. manifest와 산출물 목록이 맞는지, 예산 검사 자체가 초과 값을 실패시키는지도 본다 | 스크립트 유지 | `dist/.vite/manifest.json`과 `artifacts/performance/bundle.json`(빌드 산출물)을 읽는다. bundle.json은 FE-GATE-012 증거다. release-candidate·local-release-evidence·workflow도 이 파일을 읽는다. 안에 있는 예산 자기검사 3개는 unit test로 뺄 수 있다. 그러면 bundle.json의 `fixtures` 필드가 빠져 스키마가 바뀐다 | check-bundle.ts:29-43,67-109,126-130; gates.json:425,1350 | — |
| check-ci-contract.ts | 199 | `check:ci`(check:artifact-schemas·check:ci-workflow와 함께) → FE-GATE-010 | gates.json·package.json·workflow가 서로 맞는지 본다. 모든 테스트 파일과 검증 script가 게이트에 걸렸는지, 승격 공식이 한 게이트만 실패해도 막는지, 생성 workflow가 커밋본과 같은지도 본다 | 스크립트 유지 | 저장소 파일만 읽으므로 기술적으로는 테스트가 가능하다. 하지만 CI 계약의 뿌리다. 자기가 쓰는 ci-contract.json을 FE-GATE-010이 반드시 게시해야 한다고 스스로 검사한다. ci-workflow-generation.test.ts:1607이 이 스크립트를 직접 실행하고, 삭제 드릴도 check:ci를 부른다. 옮기면 증거 계약을 다시 짜야 해서 얻는 것이 없다 | check-ci-contract.ts:85-120,127-133,190-194; gates.json:585,1698; test-sample-removal.ts:482 | — |
| check-compatibility.ts | 87 | `verify:compatibility`(`--update-baseline` 갱신 모드 있음) → FE-GATE-014 | runtime config 스키마 변경 분류 fixture가 기대값과 같은지 본다. 현재 스키마가 커밋된 baseline보다 breaking이 아닌지도 본다 | 스크립트 유지 | 계산은 결정적이다. 하지만 FE-GATE-014의 유일한 명령이고 compatibility.json이 유일한 증거다(release_gate, 승격 공식에 포함). 옮기면 게이트가 빈다. baseline 비교는 이미 compatibility.test.ts:94-109가 "none"으로 더 엄격하게 한다. `--update-baseline` 갱신 도구 역할도 한다 | check-compatibility.ts:29-33,38-51,53-71; tests/unit/compatibility.test.ts:94-109; gates.json:475,1479,2006-2016 | — |
| check-design-system.ts | 183 | `check:design-system` → FE-GATE-010<br>`check:design-system:fixture`(`--fixture`, 실패 기대) → FE-GATE-010 | 토큰 CSS를 본다: 필수·다크 토큰, 정의 안 된 `var()`, hue 혼합, 포커스 대비, 읽히지 않는 토큰, 폰트, forced-colors. src TS에서는 react-aria·radix 직접 import와 원시 색값(#hex, `oklch(`, `rgb(`)을 찾는다 | 일부 이전 | 부분별로 나눈다: ① headless vendor import → `.dependency-cruiser.json` forbidden 규칙(외부 패키지 규칙 선례 `:326`). 지금은 설치도 안 된 패키지라 import하면 check:architecture가 이미 막는다 ② 원시 색값 → ESLint 로컬 규칙. 문자열 리터럴을 검사하고 `tokens/`는 뺀다. 주석에서 생기던 오탐이 사라진다 ③ CSS 검사 → vitest. ESLint는 CSS를 못 본다. design-system-rules.test.ts가 이미 규칙 함수와 이 스크립트 실행을 테스트한다 ④ 툴팁 검사 → 버린다. fixture에만 있는 표식 문자열을 찾는 가짜 검사라 잃는 게 없다. 잃는 것: design-system.json·-fixture.json 증거, 실패 기대 명령. 삭제 드릴 test-sample-removal.ts:476 | check-design-system.ts:34-119,139-149,150-155,168-175; .dependency-cruiser.json:326; gates.json:318,323,1184,1193 | 중간 |
| check-diagnostics.ts | 142 | `check:diagnostics` → FE-GATE-010<br>`check:diagnostics:fixture`(`--fixture`, 실패 기대) → FE-GATE-010 | 진단 context 키마다 카디널리티가 있는지, telemetry 속성에 request 카디널리티가 없는지 본다. 이벤트마다 생산자 파일에 이벤트 이름이 있는지, src에 `console.`이 없는지, `record()`·`emit()` 호출에 민감한 키가 없는지도 본다 | 일부 이전 (나누면 스크립트 삭제 가능) | 부분별로 나눈다: ① `console.` → ESLint 기본 `no-console`(src 전체). 지금 src의 console 사용은 0건 ② 민감 키 → ESLint 로컬 규칙(호출 인자 객체의 키와 문자열 검사). 지금 정규식은 호출 텍스트 700자 안에 그 단어가 어디든 있으면 걸리므로 판정이 조금 달라진다 ③ 레지스트리·생산자 검사 → unit test. src/contracts 상수 import와 고정 파일 읽기뿐이다 ④ `UNKNOWN_DIAGNOSTIC_EVENT` 검사 → 버린다. fixture 표식만 찾는 가짜 검사다. 고칠 곳: registry-governance.json:522(이 파일을 TELEMETRY_REGISTRY 소비자로 등록), second-api-feature-registries.test.ts:204-209(이 파일을 복사), verify-extreme-scale.ts:31. 잃는 것: diagnostics.json·-fixture.json 증거 | check-diagnostics.ts:54-90,95-108,109-114,126-133; config/contracts/registry-governance.json:522; gates.json:342,347,1220,1229 | 중간 |
| check-frozen-lockfile-fixture.ts | 39 | `check:frozen-lockfile:fixture` → FE-GATE-001 | package.json을 바꾼 임시 폴더에서 `pnpm install --frozen-lockfile`이 실제로 실패하는지 본다 | 스크립트 유지 | pnpm 자식 프로세스와 임시 폴더로 도구 동작을 확인하는 검사다. vitest에 넣어도 같은 spawn이라 줄어드는 게 없다. 오히려 lockfile 게이트(FE-GATE-001)에서 빠진다. 증거는 runner 로그뿐이다 | check-frozen-lockfile-fixture.ts:6-30; gates.json:11 | — |
| check-i18n.ts | 180 | `check:i18n` → FE-GATE-010<br>`check:i18n:fixture`(`--fixture`, 실패 기대) → FE-GATE-010 | 언어별 메시지 카탈로그의 키와 자리표시자가 ko-KR과 같은지 본다. 화면 코드가 `{error.message}`처럼 백엔드 메시지를 그대로 그리는지도 본다. fixture 모드는 ESLint 화면 문구 규칙도 fixture에 돌려 금지 파일마다 걸리는지 확인한다 | 일부 이전 (나누면 스크립트 삭제 가능) | 부분별로 나눈다: ① 카탈로그 비교 → 지운다. i18n-contract.test.ts:27-38에 이미 있다 ② 백엔드 메시지 출력 → ESLint `no-restricted-syntax`. 화면 문구 블록(eslint.config.ts:911)에 넣고 `.ts`도 포함하게 한다. 스크립트 주석(`:54-61`)은 selector로 못 가린다고 하지만, 지금 정규식도 변수 이름(failure·error·response·backend)과 `.message`만 본다(`:12-13`). selector로 같은 판정이 된다 ③ fixture 검사 → vitest에서 ESLint API(`ignore: false`). 잃는 것: i18n.json·-fixture.json 증거, 실패 기대 명령. 삭제 드릴 test-sample-removal.ts:475 | check-i18n.ts:12-13,31-52,54-61,103-111,113-172; tests/unit/i18n-contract.test.ts:27-38; eslint.config.ts:464-474,909-925; gates.json:330,335,1202,1211 | 중간 |
| check-optional-recipe-fixtures.ts | 211 | `check:optional-recipe-fixtures` → FE-GATE-010 | 선택 레시피 검사기 자체가 금지 사례 11개를 잡는지 본다: 카탈로그 변조, vendor import, 자격증명 누출, 서버 상태 복제, 레시피 import, 런타임 조합, 번들 표식, 모듈 목록, 예산 1바이트 초과 등 | 테스트 | 전부 lib 함수(validateRecipeCatalog, scanOptionalRecipeSources, scanProductionBundle, measureOptionalRecipeBundle)를 fixture에 돌리는 자기검사다. unit test 모양 그대로다. 지금 이 lib 전용 unit test는 없다. 예산 사례는 레시피마다 vite build를 돌려 느리다. 그 사례만 느린 테스트로 나누거나 스크립트에 남긴다. 잃는 것: optional-recipe-fixtures.json 증거 | check-optional-recipe-fixtures.ts:43-57,59-113,118-187,194-199; gates.json:374,1257 | 중간 |
| check-optional-recipe-types.ts | 62 | check:types:recipes(지움) → FE-GATE-003(check:types 안에서도 실행) | recipes/에 TS 파일이 있으면 `tsconfig.recipes.json`으로 tsc를 돌린다 | 삭제 예정(PR A) | tsconfig.test.json으로 합쳐지면서 지워진다. 판정 대상이 아니다 | check-optional-recipe-types.ts:8-21; package.json:29,33; gates.json:26 | — |
| check-optional-recipes.ts | 271 | `check:optional-recipes:source` → FE-GATE-010<br>`check:optional-recipes`(`--require-dist`) → FE-GATE-012 | 다섯 가지를 본다: ① 레시피 카탈로그의 JSON Schema와 규칙 ② 참조 런타임 소스가 있는지 ③ 레시피별 번들 예산(vite build) ④ src 소스 규칙 5개(레시피 import, 선택 안 된 런타임 조합, vendor 직접 import, 자격증명 누출, 서버 상태 복제) ⑤ dist에 선택 안 된 레시피 코드가 없는지 | 일부 이전 | import 규칙만 `.dependency-cruiser.json` forbidden 규칙으로 옮긴다: vendor 직접 import는 관측 vendor 규칙(`:326`)처럼 to 경로로 막고, bootstrap·installed-feature-*에서 참조 런타임 어댑터를 import하는 것도 막는다. src에서 recipes/로 가는 import는 check:architecture가 "src 밖" unresolved로 이미 막는다. 정규식 일부는 남는다: `new URL` 같은 문자열 경로는 그래프가 못 보기 때문이다. 자격증명·서버 상태 정규식은 의미가 느슨해 ESLint로 옮기면 판정이 바뀐다 → 유지를 권한다. 카탈로그, vite build 예산, dist 검사는 빌드가 필요해 유지한다. optional-recipes.json은 FE-GATE-010·012 증거로 그대로 남는다. 삭제 드릴 test-optional-recipe-removal.ts:47-48 | scripts/lib/optional-recipes.ts:241-338,341; check-optional-recipes.ts:53-70,100-128; check-architecture.ts:508; gates.json:369,435,1247 | 중간 |
| check-realtime-boundaries.ts | 43 (+lib 130) | `check:realtime-boundaries` → FE-GATE-010 (`--source-root`·`--artifact`로 fixture에도 쓴다) | realtime·web-push 어댑터 밖에서 다음이 없는지 본다: WebSocket·EventSource·Notification 생성, `requestPermission`, `showNotification`, `pushManager` 호출, `Reflect.get` 우회. presentation에 `setInterval`이 없는지도 본다 | ESLint 규칙 | lib는 소스 텍스트 정규식 검사뿐이라 AST 규칙에 잘 맞는다. lib 주석(`:4-6`)도 "그래프가 못 보는 네이티브 호출"을 맡는다고 하는데, ESLint는 이것을 본다. 로컬 규칙 하나로 만든다: files는 `src/**`, ignores는 두 어댑터 폴더, presentation에는 `setInterval` 금지. 주석과 문자열에서 생기던 오탐도 사라진다. 잃는 것: realtime-boundaries.json 증거(FE-GATE-010). 실시간 삭제 드릴(FE-GATE-020)은 이 스크립트 2개와 lib를 지우는 방식이라, ESLint 블록을 지우는 방식으로 바꿔야 한다 | scripts/lib/realtime-boundaries.ts:4-6,17-29,54-92; check-realtime-boundaries.ts:12-25; test-realtime-runtime-removal.ts:39-40,95-97; gates.json:359,1238 | 중간 |
| check-realtime-boundary-fixtures.ts | 46 | `check:realtime-boundaries:fixture` → FE-GATE-010 | 위 검사를 자식 프로세스로 돌려, 허용 fixture는 통과하고 금지 fixture는 규칙 2개로 실패하는지 본다 | 테스트 | 위 스크립트가 ESLint로 가면 이 파일은 vitest에서 ESLint API(또는 RuleTester)로 fixture를 lint하는 테스트가 된다. 위 스크립트를 그대로 두더라도 `scanRealtimeBoundaries`를 직접 부르는 unit test로 바로 옮길 수 있다. 증거 artifact 없음(`.tmp`에 쓴다) | check-realtime-boundary-fixtures.ts:3-11,18-28,34-46; gates.json:364 | 작음 |
| check-registries.ts | 777 | `check:registries` → FE-GATE-010<br>`--governance`·`--approval` fixture 3개(baseline·registry·routes, 실패 기대) → FE-GATE-010<br>`update:registry-baseline`(`--no-baseline`) | 레지스트리 모듈을 import해 필수 필드, 타입, 유일성, 참조, 소비자 토큰, 고아 행을 본다. baseline 승인 digest와 breaking 증거를 확인하고 스냅샷을 기록한다. application·presentation·domain에서 fetch·localStorage·`import.meta.env`·`"/api/"`를 직접 쓰는지도 본다 | 일부 이전 | 직접 사용 검사(`:666-690`)만 ESLint로 옮긴다. fetch·localStorage는 이미 레이어별 `no-restricted-globals`와 겹친다. `import.meta.env` 읽기와 `"/api/"` 문자열은 로컬 규칙으로 추가한다. governance fixture는 sourceDirectories가 비어 있어 이 변경의 영향을 받지 않는다. 나머지는 유지한다: registries.json 스냅샷은 update:registry-baseline의 입력이자 FE-GATE-010 증거이고, 실패 기대 fixture 명령 3개가 진단 문구로 걸려 있다 | check-registries.ts:666-690,700-735,763-770; eslint.config.ts:629-697; package.json:105-110; gates.json:379,389,396,403,1266 | 작음 (ESLint 부분) |
| check-registry-compatibility-fixtures.ts | 66 | `check:registries:compatibility-fixtures` → FE-GATE-010 | 레지스트리 스냅샷 diff 분류 fixture가 맞는지 본다. breaking 변경에 증거가 없으면 실패하는지, 변조된 baseline digest를 거부하는지도 본다 | 테스트 | JSON fixture 하나를 읽어 lib 함수만 부른다. 파일 시스템 작업이나 빌드가 없다. registry-compatibility.test.ts가 lib는 이미 테스트하지만 이 fixture 파일은 읽지 않는다 → 그 테스트에 케이스를 추가한다. package script는 쓰지도 않는 인덱스 생성기를 먼저 돈다. 잃는 것: registry-compatibility-fixtures.json 증거(FE-GATE-010, 다른 소비자 없음) | check-registry-compatibility-fixtures.ts:11-52,54-59; package.json:107; gates.json:384,1275 | 작음 |
| check-release-admission.ts | 199 | `check:release-admission` → FE-GATE-027<br>운영자용 `--config`·`--original` 모드 | 빌드된 `dist/config.json`이 RELEASE_TARGET(과 APP_PROFILE) 환경에 맞는지 본다. 수정본은 비상 스위치 말고 빌드 필드를 바꾸지 않았는지 본다 | 스크립트 유지 | 입력이 빌드 산출물과 환경 변수이고, 운영자가 직접 쓰는 CLI다. deployment-admission.json은 FE-GATE-027 증거이고 workflow도 읽는다. 판정 로직은 이미 src/contracts/deployment-admission.ts와 그 unit test에 있다 | check-release-admission.ts:35-37,72-94,98-120,161-181; gates.json:590,1707 | — |
| check-remediation-ledger.ts | 165 | `check:remediation-ledger` (게이트 없음, 일부러 제외) | 재검토 처분 JSON과 원장 문서의 판정 칸이 같은지 본다. 증거 파일이 있고 finding id를 언급하는지, 열린 항목이 있을 때 "모두 FIXED" 문장이 없는지, file-transfer 예산 숫자가 같은지도 본다 | 스크립트 유지 | 저장소 파일만 읽어 테스트로 옮기기는 쉽다. 그러나 ungated-scripts.json:21-22가 "손으로 돌리는 이력 기록이고 merge를 막으면 안 된다"며 일부러 게이트에서 뺐다. tests/unit에 넣으면 그 결정과 반대로 merge를 막게 된다. 더 필요 없다면 삭제는 따로 판단한다 | check-remediation-ledger.ts:29-42,66-120,139-152; config/ci/ungated-scripts.json:21-22 | — |
| check-request-fanout.ts | 185 | `check:request-fanout`(같은 명령에서 `--fixture`도 실행) → FE-GATE-010 | src/features·src/application에서 루프나 map·forEach 콜백 안에서 fetch나 transport를 호출하는지(N+1) 본다. `// fanout-reviewed:` 주석은 예외로 허용한다 | 테스트 (이미 있음) | `tests/architecture/request-fanout.test.ts:11-24`가 같은 전체 검사를 이미 한다. fixture 검사는 테스트 쪽이 더 엄격하다(금지 파일마다 걸리는지, 정확히 3개인지). CLI(`:157-185`), package script, gate 명령만 지우고 스캐너는 lib로 옮기면 된다. 증거 artifact 없음. Babel AST 순회라 ESLint 로컬 규칙으로도 옮길 수 있다(에디터 경고가 생기지만 크기 중간). 주의: tests/architecture는 test:coverage(FE-GATE-005)에서만 돈다. 고칠 곳: ungated-scripts.test.ts:57, feature-scaffold-drill.test.ts:32, verify-extreme-scale.ts:29 | check-request-fanout.ts:80-125,157-185; tests/architecture/request-fanout.test.ts:11-24; package.json:82,148; gates.json:308 | 작음 |
| check-risk-coverage.ts | 78 | `test:coverage` 마지막 단계 → FE-GATE-005<br>`check:coverage:fixture`(`--summary` fixture, 실패 기대) → FE-GATE-005 | 커버리지 결과가 위험 정책(config/testing/risk-coverage.json)의 모듈별 기준을 넘는지 본다 | 스크립트 유지 | 입력이 coverage 실행 결과(`artifacts/tests/coverage/coverage-summary.json`)라 테스트 실행 뒤에만 돌 수 있다. risk-coverage.json·-fixture.json이 FE-GATE-005 증거다. 판정 로직은 lib와 unit test에 이미 있다 | check-risk-coverage.ts:35-46,60-70; package.json:82-83; gates.json:205,210,944,953 | — |
| check-security-fixtures.ts | 10 (+lib 170) | `check:security:fixtures` → FE-GATE-013 | 비밀값 스캐너 CLI가 금지 fixture에서 정확히 3건으로 실패하는지 본다. include 경로가 맞지 않으면 artifact 없이 실패하는지도 본다 | 테스트 | lib가 이미 의존성 주입을 받고, 실패 경로 unit test도 있다. 실제 CLI 실행도 vitest에서 같은 spawn으로 하면 된다. 증거 artifact 없음(임시 폴더에 쓴다). 잃는 것: 이 확인이 보안 게이트(FE-GATE-013) 로그에서 빠지고 FE-GATE-005로 간다. supply-chain.test.ts:458-483이 "FE-GATE-013이 이 script를 돈다"를 검사하므로 같이 고친다 | scripts/lib/security-fixture-check.ts:30-49,85-118,120-170; tests/unit/supply-chain.test.ts:417,458-483; gates.json:465 | 작음 |
| check-supply-chain-fixtures.ts | 151 | `check:supply-chain:fixtures` → FE-GATE-013 | 공급망 lib가 다음 9가지를 거부하는지 본다: 의존성 diff, 무결성 값, 자기 승인, 금지 라이선스, 만료된 예외, SBOM·provenance 불일치, 정렬, baseline 변조, 스캐너 증거 오류 | 테스트 | 메모리 안의 값으로 lib 함수만 부른다. 파일 읽기와 빌드가 없어 unit test로 그대로 옮길 수 있다. package script는 쓰지도 않는 인덱스 생성기를 먼저 돈다. 잃는 것: supply-chain-fixtures.json(FE-GATE-013 증거, 다른 소비자 없음) → 증거 계약이 바뀐다 | check-supply-chain-fixtures.ts:15-140,141-146; package.json:93; gates.json:455,1455 | 작음 |
| check-supply-chain-provider-fixtures.ts | 417 | `check:supply-chain:provider-fixtures` → FE-GATE-013 | 저장소를 임시 폴더로 복사해 release candidate를 실제로 빌드하고, 묶고, 서명한다. 그 뒤 정확한 5개 파일 승격 검증과 서명 검증이 제대로 동작하는지 본다 | 스크립트 유지 | 저장소 복사, `pnpm build:release-candidate`, tar, git, 키 생성이 모두 필요한 끝단 검사다. supply-chain-provider-fixtures.json이 FE-GATE-013 증거다 | check-supply-chain-provider-fixtures.ts:50-64,66-80,101; gates.json:460,1464 | — |
| check-system-test-prerequisites.ts | 154 | `test:system` 첫 단계 → FE-GATE-013 | 호스트에 bwrap·systemctl·tar가 있는지, cgroup v2와 systemd 버스가 동작하는지, 비특권 user namespace가 허용되는지 본다 | 스크립트 유지 | 실제 호스트를 확인하는 사전 점검이다. 판정 로직은 이미 의존성 주입 방식으로 unit test(system-test-prerequisites.test.ts)가 있다. workflow와 gates.json도 이 파일을 이름으로 참조한다 | check-system-test-prerequisites.ts:55-97,146-154; package.json:53; gates.json:232 | — |
| check-test-evidence.ts | 471 | `check:test-evidence:browser`(`--skip-scenario-executions`) → FE-GATE-008<br>`check:test-evidence:fixture`(`--source-root`, 실패 기대) → FE-GATE-008<br>`check:http-scenario-evidence`(+`:fixture`) → run-http-scenario-evidence.ts를 거쳐 FE-GATE-007<br>`check:test-evidence`·`:source`는 로컬용 | 소스 쪽: tests/의 `.only`, 기한 없는 `.skip`, 화면 전체 mask, 정책의 필수 토큰, playwright 설정 토큰과 forbidOnly, e2e가 strict fixture를 쓰는지, visual baseline 4개 이상. 실행 결과 쪽: HTTP 시나리오 실행 영수증이 카탈로그와 같은지, results.xml과 dist 산출물이 있는지, dist에 `.map`이 없는지 | 일부 이전 | 소스만 보는 부분(`:280-311`, `:326-340`, `:366-418`)은 unit test로 옮긴다. `.only`와 mask는 ESLint로도 되지만, fixture 트리에 `.fixture`·`.txt` 파일이 있어 ESLint가 읽지 못한다 → 테스트가 맞다. 영수증, results.xml, dist 검사(`:420-447`)는 실행·빌드 산출물이 필요해 남는다. 잃는 것: test-evidence.json의 일부 사실과 실패 항목(스키마·증거 변경). 삭제 드릴의 check:test-evidence:source 호출(test-sample-removal.ts:481)도 고쳐야 한다. 모드가 많아 손이 많이 간다 | check-test-evidence.ts:130-278,280-311,326-340,345-360,366-418,420-447; gates.json:272,277,1115,1124 | 큼 |
| check-v8-coverage-counter-semantics.ts | 12 (+lib 294) | `check:v8-coverage-counter-semantics` → `test:coverage` 첫 단계, FE-GATE-005 | 임시 폴더에서 vitest coverage를 돌려, import만 있는 모듈의 V8 카운터가 0/0으로 나오는지 본다(위험 커버리지 판정의 전제) | 스크립트 유지 | vitest를 자식 프로세스로 돌려 도구 동작을 확인하는 점검이다. coverage 실행 직전에 돌아야 의미가 있다. lib에는 unit test가 이미 있다 | scripts/lib/v8-coverage-counter-semantics.ts:186-205; package.json:81-82; gates.json:205 | — |
## 조사 중 확인한 것 (판정과 별개)
- **가짜 검사 2개**: `check-design-system.ts:150-155`와 `check-diagnostics.ts:109-114`는 fixture 파일에만 들어 있는 표식 문자열(`TOOLTIP_ONLY_REQUIRED_INFORMATION`, `UNKNOWN_DIAGNOSTIC_EVENT`)을 찾아 실패를 만든다. 실제 규칙은 검사하지 않는다.
- **dist `.map` 검사 중복**: 같은 검사가 세 곳에 있다(`check-browser-security.ts:35-36`, `check-test-evidence.ts:442-447`, `verify-hosting-headers.ts:82`).
- **약한 fixture 확인**: `check-browser-security.ts:27-38`은 금지 fixture 폴더 전체가 한 번 실패하는지만 본다. 그래서 4개 파일 중 하나만 걸려도 통과한다.
- **불필요한 생성기 실행**: `check:supply-chain:fixtures`와 `check:registries:compatibility-fixtures`는 쓰지도 않는 인덱스 생성기를 먼저 돈다(package.json:93,107).
- **생성기 없이 읽는 스크립트**: 반대로 `check:app-build-input`은 생성기를 돌리지 않고 `src/.generated`를 읽는다(package.json:149). 그래서 앞 단계가 남긴 인덱스에 기대고, 혼자 돌리면 오래된 인덱스를 볼 수 있다. CI에서는 FE-GATE-010의 check:architecture가 먼저 생성해 줘서 문제가 드러나지 않는다.
+1 -1
View File
@@ -110,4 +110,4 @@ release 단계 게이트는 merge 단계에 없다. 그래서 lab 게이트 회
- 새 게이트·명령은 `config/ci/gates.json`에 더하고 workflow는 생성기로 다시 만든다(`check:ci`가 대조한다). 손으로 workflow만 고치지 않는다. - 새 게이트·명령은 `config/ci/gates.json`에 더하고 workflow는 생성기로 다시 만든다(`check:ci`가 대조한다). 손으로 workflow만 고치지 않는다.
- 새 검사에는 통과 fixture와 거절 fixture를 함께 둔다. 실패 메시지는 넘은 항목·잰 값·고칠 파일을 말한다. - 새 검사에는 통과 fixture와 거절 fixture를 함께 둔다. 실패 메시지는 넘은 항목·잰 값·고칠 파일을 말한다.
- 새 package script가 어느 게이트에서도 돌지 않으면 `check:ci`가 실패한다. 예외는 이유와 함께 `config/ci/ungated-scripts.json`·`config/ci/ungated-tests.json`에 둔다. 이 목록을 늘리는 것은 게이트 기준을 낮추는 일이다(꼭 지킬 것 4). - 새 package script가 어느 게이트에서도 돌지 않으면 `check:ci:gating`(main 단계 FE-GATE-029)이 실패한다. PR에서는 돌지 않고 main에 push한 뒤 돈다. 예외는 이유와 함께 `config/ci/ungated-scripts.json`·`config/ci/ungated-tests.json`에 둔다. 이 목록을 늘리는 것은 게이트 기준을 낮추는 일이다(꼭 지킬 것 4).
+1 -1
View File
@@ -19,7 +19,7 @@
| Vitest 실행 runner(Node 버전, `NODE_ENV`, 생성물) | `scripts/run-vitest.ts` | | Vitest 실행 runner(Node 버전, `NODE_ENV`, 생성물) | `scripts/run-vitest.ts` |
| Playwright skip·fixme의 quarantine 조건, `forbidOnly` | `scripts/check-test-evidence.ts` | | Playwright skip·fixme의 quarantine 조건, `forbidOnly` | `scripts/check-test-evidence.ts` |
| 테스트 공통 대기 기한 | `tests/setup.ts` | | 테스트 공통 대기 기한 | `tests/setup.ts` |
| 모든 테스트 파일이 어떤 게이트에서 도는가 | `check:ci`, 예외 목록 `config/ci/ungated-tests.json` | | 모든 테스트 파일이 어떤 게이트에서 도는가 | `check:ci:gating`(main 단계 FE-GATE-029), 예외 목록 `config/ci/ungated-tests.json` |
| 지워도 되는 문서를 테스트가 읽지 않는다 | `tests/unit/deletable-history-documents.test.ts` | | 지워도 되는 문서를 테스트가 읽지 않는다 | `tests/unit/deletable-history-documents.test.ts` |
## 2. 테스트를 어디에 둘까 ## 2. 테스트를 어디에 둘까
+1 -1
View File
@@ -104,7 +104,7 @@
"generate:ci-workflow": "node scripts/generate-ci-workflow.ts", "generate:ci-workflow": "node scripts/generate-ci-workflow.ts",
"check:ci-workflow": "node scripts/generate-ci-workflow.ts --check", "check:ci-workflow": "node scripts/generate-ci-workflow.ts --check",
"check:ci": "corepack pnpm check:artifact-schemas && node scripts/check-ci-contract.ts && corepack pnpm check:ci-workflow", "check:ci": "corepack pnpm check:artifact-schemas && node scripts/check-ci-contract.ts && corepack pnpm check:ci-workflow",
"update:ci-contract-baseline": "node scripts/update-ci-contract-baseline.ts", "check:ci:gating": "node scripts/check-ci-gating.ts",
"verify:documentation": "node scripts/generate-product-feature-index.ts && node scripts/verify-documentation-readiness.ts", "verify:documentation": "node scripts/generate-product-feature-index.ts && node scripts/verify-documentation-readiness.ts",
"check:types:service-worker": "tsc --project tsconfig.service-worker.json", "check:types:service-worker": "tsc --project tsconfig.service-worker.json",
"generate:feature-index": "node scripts/generate-product-feature-index.ts", "generate:feature-index": "node scripts/generate-product-feature-index.ts",
+5 -51
View File
@@ -1,5 +1,4 @@
import { createHash } from "node:crypto"; import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
import { readFile } from "node:fs/promises"; import { readFile } from "node:fs/promises";
import { import {
@@ -25,25 +24,12 @@ import {
validateInstallScriptPolicy, validateInstallScriptPolicy,
validatePackageScriptGraph, validatePackageScriptGraph,
} from "./lib/package-script-graph.ts"; } from "./lib/package-script-graph.ts";
import {
gatedTestPaths,
listTestFiles,
parseUngatedTestExclusions,
ungatedTestFailures,
UNGATED_TESTS_PATH,
} from "./lib/ungated-tests.ts";
import {
parseUngatedScriptExclusions,
ungatedScriptFailures,
UNGATED_SCRIPTS_PATH,
} from "./lib/ungated-scripts.ts";
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts"; import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
const contract = await loadCiGateContract(process.cwd()); const contract = await loadCiGateContract(process.cwd());
const index = indexCiGateContract(contract); const index = indexCiGateContract(contract);
// 1103/12-07. The product's merge gates are entry scripts of CI as well. // 1103/12-07. The product's merge gates run in the generated workflow too.
const { mergeGates: productGates } = await loadProductCiOverlay(process.cwd()); const { mergeGates: productGates } = await loadProductCiOverlay(process.cwd());
const productGateScripts = productGates.map(({ script }) => script);
const [packageDocument, nodeVersion] = await Promise.all([ const [packageDocument, nodeVersion] = await Promise.all([
readFile("package.json", "utf8").then((value) => JSON.parse(value) as { scripts?: Record<string, string> }), readFile("package.json", "utf8").then((value) => JSON.parse(value) as { scripts?: Record<string, string> }),
readFile(".nvmrc", "utf8").then((value) => value.trim()), readFile(".nvmrc", "utf8").then((value) => value.trim()),
@@ -82,42 +68,10 @@ failures.push(
), ),
); );
// 12-04: every test file runs in a gate, or config/ci/ungated-tests.json says why not. // 12-04. Whether every test file and verification script is reached by a
try { // gate is checked by check:ci:gating (scripts/check-ci-gating.ts) in the main
failures.push( // stage (FE-GATE-029), not on every pull request (design-docs
...ungatedTestFailures({ // repo-structure/03-ci.md F2).
testFiles: await listTestFiles(process.cwd()),
gatedPaths: gatedTestPaths(
packageScripts,
[...contract.commands.map(({ script }) => script), ...productGateScripts],
(file) => readFileSync(file, "utf8"),
),
exclusions: parseUngatedTestExclusions(
JSON.parse(await readFile(UNGATED_TESTS_PATH, "utf8")),
),
}),
);
} catch (error) {
failures.push(`ungated test check could not run: ${error instanceof Error ? error.message : String(error)}`);
}
// 12-04: every verification package script is reached by a gate, or
// config/ci/ungated-scripts.json says why not.
try {
const entryScripts = [...contract.commands.map(({ script }) => script), ...productGateScripts];
failures.push(
...ungatedScriptFailures({
scripts: packageScripts,
entryScripts,
gatedTestPaths: gatedTestPaths(packageScripts, entryScripts, (file) => readFileSync(file, "utf8")),
exclusions: parseUngatedScriptExclusions(
JSON.parse(await readFile(UNGATED_SCRIPTS_PATH, "utf8")),
),
}),
);
} catch (error) {
failures.push(`ungated script check could not run: ${error instanceof Error ? error.message : String(error)}`);
}
const immutable = index.gates.get("FE-GATE-015"); const immutable = index.gates.get("FE-GATE-015");
const immutableCommands = immutable?.commandIds.map((id) => index.commands.get(id)?.script); const immutableCommands = immutable?.commandIds.map((id) => index.commands.get(id)?.script);
+77
View File
@@ -0,0 +1,77 @@
import { readFileSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { loadCiGateContract } from "./contracts/ci-gates.ts";
import { loadProductCiOverlay } from "./contracts/product-ci-overlay.ts";
import {
gatedTestPaths,
listTestFiles,
parseUngatedTestExclusions,
ungatedTestFailures,
UNGATED_TESTS_PATH,
} from "./lib/ungated-tests.ts";
import {
parseUngatedScriptExclusions,
ungatedScriptFailures,
UNGATED_SCRIPTS_PATH,
} from "./lib/ungated-scripts.ts";
/**
* 12-04. Every test file and every verification package script is reached by
* a gate command of any stage, or config/ci/ungated-tests.json and
* config/ci/ungated-scripts.json say why not. It checks how the gates are
* wired, not the change, so it runs in the main stage (FE-GATE-029) after a
* merge (design-docs repo-structure/03-ci.md F2); check:ci keeps the contract
* and workflow checks on every pull request.
*/
const contract = await loadCiGateContract(process.cwd());
// 1103/12-07. The product's merge gates are entry scripts of CI as well.
const { mergeGates: productGates } = await loadProductCiOverlay(process.cwd());
const productGateScripts = productGates.map(({ script }) => script);
const packageScripts =
(JSON.parse(await readFile("package.json", "utf8")) as { scripts?: Record<string, string> }).scripts ?? {};
const failures: string[] = [];
// 12-04: every test file runs in a gate, or config/ci/ungated-tests.json says why not.
try {
failures.push(
...ungatedTestFailures({
testFiles: await listTestFiles(process.cwd()),
gatedPaths: gatedTestPaths(
packageScripts,
[...contract.commands.map(({ script }) => script), ...productGateScripts],
(file) => readFileSync(file, "utf8"),
),
exclusions: parseUngatedTestExclusions(
JSON.parse(await readFile(UNGATED_TESTS_PATH, "utf8")),
),
}),
);
} catch (error) {
failures.push(`ungated test check could not run: ${error instanceof Error ? error.message : String(error)}`);
}
// 12-04: every verification package script is reached by a gate, or
// config/ci/ungated-scripts.json says why not.
try {
const entryScripts = [...contract.commands.map(({ script }) => script), ...productGateScripts];
failures.push(
...ungatedScriptFailures({
scripts: packageScripts,
entryScripts,
gatedTestPaths: gatedTestPaths(packageScripts, entryScripts, (file) => readFileSync(file, "utf8")),
exclusions: parseUngatedScriptExclusions(
JSON.parse(await readFile(UNGATED_SCRIPTS_PATH, "utf8")),
),
}),
);
} catch (error) {
failures.push(`ungated script check could not run: ${error instanceof Error ? error.message : String(error)}`);
}
if (failures.length > 0) {
process.stderr.write(`CI gating failed:\n${failures.join("\n")}\n`);
process.exit(1);
}
process.stdout.write("CI gating: every test file and verification script is gated or excluded with a reason PASS\n");
+31 -109
View File
@@ -1,5 +1,4 @@
import { readFile } from "node:fs/promises"; import { readFile } from "node:fs/promises";
import { createHash } from "node:crypto";
import path from "node:path"; import path from "node:path";
import { z } from "zod"; import { z } from "zod";
@@ -312,6 +311,7 @@ const stageSchema = z
"PROD_PROMOTION_READY", "PROD_PROMOTION_READY",
"FIELD_SLO_READY", "FIELD_SLO_READY",
"DOCUMENTATION_READY", "DOCUMENTATION_READY",
"MAIN_READY",
]), ]),
needs: z.array(id).max(16), needs: z.array(id).max(16),
gateIds: z.array(id).min(1).max(64), gateIds: z.array(id).min(1).max(64),
@@ -405,9 +405,9 @@ const jobSchema = z
.object({ .object({
id, id,
displayName: workflowValue, displayName: workflowValue,
kind: z.enum(["gate-matrix", "gate-single", "immutable", "provider", "promotion", "deployment"]), kind: z.enum(["gate-matrix", "gate-sequence", "gate-single", "immutable", "provider", "promotion", "deployment"]),
needs: z.array(id).max(32), needs: z.array(id).max(32),
condition: z.enum(["always", "needs-success", "merge", "release", "production", "field", "documentation"]), condition: z.enum(["always", "needs-success", "merge", "main", "release", "production", "field", "documentation"]),
timeoutMinutes: z.number().int().positive(), timeoutMinutes: z.number().int().positive(),
gateIds: z.array(id).max(64), gateIds: z.array(id).max(64),
browserGateIds: z.array(id).max(64), browserGateIds: z.array(id).max(64),
@@ -467,106 +467,10 @@ export type CiGateContractIndex = Readonly<{
export const RETIRED_GATE_IDS: readonly string[] = Object.freeze(["FE-GATE-016"]); export const RETIRED_GATE_IDS: readonly string[] = Object.freeze(["FE-GATE-016"]);
export const CANONICAL_GATE_IDS: readonly string[] = Object.freeze( export const CANONICAL_GATE_IDS: readonly string[] = Object.freeze(
Array.from({ length: 28 }, (_, index) => `FE-GATE-${String(index + 1).padStart(3, "0")}`) Array.from({ length: 29 }, (_, index) => `FE-GATE-${String(index + 1).padStart(3, "0")}`)
.filter((gateId) => !RETIRED_GATE_IDS.includes(gateId)), .filter((gateId) => !RETIRED_GATE_IDS.includes(gateId)),
); );
/**
* D-13. The contract's size and gate shape are a reviewed baseline, not code
* constants: a project that removes a sample or adds a gate records the new
* shape with `update:ci-contract-baseline` (owner and reason required) and the
* diff of this file is what review sees.
*/
export const CI_CONTRACT_BASELINE_PATH = "config/ci/contract-baseline.json";
const ciContractBaselineSchema = z
.object({
schemaVersion: z.literal(1),
owner: nonEmpty,
reason: nonEmpty,
gates: z.number().int().nonnegative(),
commands: z.number().int().nonnegative(),
commandReferences: z.number().int().nonnegative(),
artifacts: z.number().int().nonnegative(),
stages: z.number().int().nonnegative(),
gateShapeSha256: z.string().regex(/^[0-9a-f]{64}$/u),
})
.strict();
export type CiContractBaseline = z.infer<typeof ciContractBaselineSchema>;
function canonicalGateShapeSha256(gates: CiGateContract["gates"]): string {
const normalized = gates.map(
({
id,
name,
commandIds,
logArtifactId,
evidenceArtifactIds,
retentionClassId,
requiresEnvironment,
hostRequirements,
}) => ({
id,
name,
commandIds,
logArtifactId,
evidenceArtifactIds,
retentionClassId,
requiresEnvironment: requiresEnvironment ?? [],
// Only gates that declare runner requirements carry the key, so the
// digest of every other gate stays what it was.
...(hostRequirements === undefined ? {} : { hostRequirements }),
}),
);
return createHash("sha256").update(JSON.stringify(normalized)).digest("hex");
}
export function measureCiContractBaseline(
contract: CiGateContract,
): Omit<CiContractBaseline, "schemaVersion" | "owner" | "reason"> {
return {
gates: contract.gates.length,
commands: contract.commands.length,
commandReferences: contract.gates.reduce(
(total, gate) => total + gate.commandIds.length,
0,
),
artifacts: contract.artifacts.length,
stages: contract.stages.length,
gateShapeSha256: canonicalGateShapeSha256(contract.gates),
};
}
async function assertCiContractBaseline(
root: string,
contract: CiGateContract,
): Promise<void> {
const parsed = ciContractBaselineSchema.safeParse(
JSON.parse(await readFile(path.join(root, CI_CONTRACT_BASELINE_PATH), "utf8")),
);
if (!parsed.success) {
throw new TypeError(
`${CI_CONTRACT_BASELINE_PATH} invalid:\n${parsed.error.issues
.map((issue) => `${issue.path.join(".") || "root"}: ${issue.message}`)
.join("\n")}`,
);
}
const baseline = parsed.data;
const drift = Object.entries(measureCiContractBaseline(contract))
.filter(([key, value]) => baseline[key as keyof CiContractBaseline] !== value)
.map(([key, value]) =>
`${key}: baseline ${String(baseline[key as keyof CiContractBaseline])}, contract ${String(value)}`
);
if (drift.length > 0) {
throw new TypeError(
`CI gate contract does not match ${CI_CONTRACT_BASELINE_PATH}:\n${drift.join("\n")}\n` +
"If the change is intended, review it and run " +
"CI_CONTRACT_BASELINE_OWNER=<team> CI_CONTRACT_BASELINE_REASON=<why> corepack pnpm update:ci-contract-baseline",
);
}
}
function retentionRegistryFailures(contract: CiGateContract): string[] { function retentionRegistryFailures(contract: CiGateContract): string[] {
const expectedRetentionClasses = [ const expectedRetentionClasses = [
{ id: "merge-cycle", policy: "at least through pull-request readiness decision" }, { id: "merge-cycle", policy: "at least through pull-request readiness decision" },
@@ -668,8 +572,6 @@ export async function loadCiGateContract(
`CI package script install policy invalid:\n${installPolicyFailures.join("\n")}`, `CI package script install policy invalid:\n${installPolicyFailures.join("\n")}`,
); );
} }
// The baseline describes the template contract; the overlay is the product's.
await assertCiContractBaseline(root, template);
return contract; return contract;
} }
@@ -843,7 +745,7 @@ function validateContractSemantics(
const expectedGateIds = CANONICAL_GATE_IDS; const expectedGateIds = CANONICAL_GATE_IDS;
if (JSON.stringify(contract.gates.map(({ id }) => id)) !== JSON.stringify(expectedGateIds)) { if (JSON.stringify(contract.gates.map(({ id }) => id)) !== JSON.stringify(expectedGateIds)) {
issue(`gate registry must contain FE-GATE-001..028 without retired ${RETIRED_GATE_IDS.join(", ")} in canonical order`); issue(`gate registry must contain FE-GATE-001..029 without retired ${RETIRED_GATE_IDS.join(", ")} in canonical order`);
} }
const expectedStages: ReadonlyArray<readonly [string, string, readonly string[], readonly string[]]> = [ const expectedStages: ReadonlyArray<readonly [string, string, readonly string[], readonly string[]]> = [
["merge", "MERGE_READY", [], PROMOTION_FORMULA.MERGE_READY], ["merge", "MERGE_READY", [], PROMOTION_FORMULA.MERGE_READY],
@@ -851,6 +753,7 @@ function validateContractSemantics(
["production", "PROD_PROMOTION_READY", ["release"], PROMOTION_FORMULA.PROD_PROMOTION_READY], ["production", "PROD_PROMOTION_READY", ["release"], PROMOTION_FORMULA.PROD_PROMOTION_READY],
["field", "FIELD_SLO_READY", ["production"], PROMOTION_FORMULA.FIELD_SLO_READY], ["field", "FIELD_SLO_READY", ["production"], PROMOTION_FORMULA.FIELD_SLO_READY],
["documentation", "DOCUMENTATION_READY", [], PROMOTION_FORMULA.DOCUMENTATION_READY], ["documentation", "DOCUMENTATION_READY", [], PROMOTION_FORMULA.DOCUMENTATION_READY],
["main", "MAIN_READY", [], PROMOTION_FORMULA.MAIN_READY],
]; ];
const stageShape = contract.stages.map(({ id, readiness, needs, gateIds }) => [id, readiness, needs, gateIds]); const stageShape = contract.stages.map(({ id, readiness, needs, gateIds }) => [id, readiness, needs, gateIds]);
if (JSON.stringify(stageShape) !== JSON.stringify(expectedStages)) { if (JSON.stringify(stageShape) !== JSON.stringify(expectedStages)) {
@@ -912,10 +815,16 @@ function validateContractSemantics(
if (gateOwners.length > 1) issue(`multiply owned gate: ${gate.id} by ${gateOwners.join(", ")}`); if (gateOwners.length > 1) issue(`multiply owned gate: ${gate.id} by ${gateOwners.join(", ")}`);
} }
const expectedJobOwnership: Readonly<Record<string, readonly string[]>> = { const expectedJobOwnership: Readonly<Record<string, readonly string[]>> = {
// The merge stage runs as three jobs, one install each (design-docs
// repo-structure/03-ci.md F1): checks that read the source and build it,
// tests, and the gates that need browsers. Each runs its gates one after
// another in this order; a failed gate does not skip the next.
// 15-01. The bundle budget (FE-GATE-012) runs on every PR: a feature that // 15-01. The bundle budget (FE-GATE-012) runs on every PR: a feature that
// pushes initial JavaScript over budget fails before it merges, not at the // pushes initial JavaScript over budget fails before it merges, not at the
// next tagged release. // next tagged release.
merge_gate: ["FE-GATE-001", "FE-GATE-002", "FE-GATE-003", "FE-GATE-004", "FE-GATE-005", "FE-GATE-006", "FE-GATE-007", "FE-GATE-008", "FE-GATE-009", "FE-GATE-010", "FE-GATE-011", "FE-GATE-012", "FE-GATE-013", "FE-GATE-020"], merge_static: ["FE-GATE-001", "FE-GATE-002", "FE-GATE-003", "FE-GATE-010", "FE-GATE-011", "FE-GATE-012"],
merge_test: ["FE-GATE-004", "FE-GATE-005", "FE-GATE-006", "FE-GATE-007", "FE-GATE-013", "FE-GATE-020"],
merge_browser: ["FE-GATE-008", "FE-GATE-009"],
release_gate: ["FE-GATE-014", "FE-GATE-026", "FE-GATE-028"], release_gate: ["FE-GATE-014", "FE-GATE-026", "FE-GATE-028"],
immutable_build: ["FE-GATE-015", "FE-GATE-027"], immutable_build: ["FE-GATE-015", "FE-GATE-027"],
vulnerability_provider: [], vulnerability_provider: [],
@@ -927,9 +836,12 @@ function validateContractSemantics(
production_gate: ["FE-GATE-019", "FE-GATE-021", "FE-GATE-022", "FE-GATE-023", "FE-GATE-024", "FE-GATE-025"], production_gate: ["FE-GATE-019", "FE-GATE-021", "FE-GATE-022", "FE-GATE-023", "FE-GATE-024", "FE-GATE-025"],
field_gate: ["FE-GATE-018"], field_gate: ["FE-GATE-018"],
documentation_gate: ["FE-GATE-017"], 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"],
}; };
if (JSON.stringify(contract.jobs.map(({ id }) => id)) !== JSON.stringify(Object.keys(expectedJobOwnership))) { if (JSON.stringify(contract.jobs.map(({ id }) => id)) !== JSON.stringify(Object.keys(expectedJobOwnership))) {
issue("job registry must contain the exact ten canonical jobs in semantic order"); issue("job registry must contain the exact thirteen canonical jobs in semantic order");
} }
for (const [jobId, gateIds] of Object.entries(expectedJobOwnership)) { for (const [jobId, gateIds] of Object.entries(expectedJobOwnership)) {
const job = contract.jobs.find(({ id }) => id === jobId); const job = contract.jobs.find(({ id }) => id === jobId);
@@ -938,8 +850,10 @@ function validateContractSemantics(
} }
} }
const expectedJobGraph: Readonly<Record<string, readonly [CiWorkflowJob["kind"], readonly string[], CiWorkflowJob["condition"]]>> = { const expectedJobGraph: Readonly<Record<string, readonly [CiWorkflowJob["kind"], readonly string[], CiWorkflowJob["condition"]]>> = {
merge_gate: ["gate-matrix", [], "merge"], merge_static: ["gate-sequence", [], "merge"],
release_gate: ["gate-matrix", ["merge_gate"], "release"], merge_test: ["gate-sequence", [], "merge"],
merge_browser: ["gate-sequence", [], "merge"],
release_gate: ["gate-matrix", ["merge_static", "merge_test", "merge_browser"], "release"],
immutable_build: ["immutable", ["release_gate"], "release"], immutable_build: ["immutable", ["release_gate"], "release"],
vulnerability_provider: ["provider", ["immutable_build"], "always"], vulnerability_provider: ["provider", ["immutable_build"], "always"],
provenance_provider: ["provider", ["immutable_build"], "always"], provenance_provider: ["provider", ["immutable_build"], "always"],
@@ -948,6 +862,7 @@ function validateContractSemantics(
production_gate: ["gate-matrix", ["immutable_build", "promotion", "deployment"], "production"], production_gate: ["gate-matrix", ["immutable_build", "promotion", "deployment"], "production"],
field_gate: ["gate-single", ["production_gate"], "field"], field_gate: ["gate-single", ["production_gate"], "field"],
documentation_gate: ["gate-single", [], "documentation"], documentation_gate: ["gate-single", [], "documentation"],
main_gate: ["gate-sequence", [], "main"],
}; };
for (const [jobId, [kind, needs, condition]] of Object.entries(expectedJobGraph)) { for (const [jobId, [kind, needs, condition]] of Object.entries(expectedJobGraph)) {
const job = contract.jobs.find(({ id }) => id === jobId); const job = contract.jobs.find(({ id }) => id === jobId);
@@ -956,7 +871,9 @@ function validateContractSemantics(
} }
} }
const expectedStepKinds: Readonly<Record<string, readonly CiWorkflowStep["kind"][]>> = { const expectedStepKinds: Readonly<Record<string, readonly CiWorkflowStep["kind"][]>> = {
merge_gate: ["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"], merge_static: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"],
merge_test: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"],
merge_browser: ["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"],
release_gate: ["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"], release_gate: ["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"],
immutable_build: ["checkout", "setup-node", "frozen-install", "run-gate", "archive-candidate", "upload", "upload"], immutable_build: ["checkout", "setup-node", "frozen-install", "run-gate", "archive-candidate", "upload", "upload"],
vulnerability_provider: ["checkout", "setup-node", "frozen-install", "download", "run-provider", "validate-provider-evidence", "upload"], vulnerability_provider: ["checkout", "setup-node", "frozen-install", "download", "run-provider", "validate-provider-evidence", "upload"],
@@ -966,6 +883,7 @@ function validateContractSemantics(
production_gate: ["checkout", "setup-node", "frozen-install", "download", "extract", "run-gate", "upload"], production_gate: ["checkout", "setup-node", "frozen-install", "download", "extract", "run-gate", "upload"],
field_gate: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"], field_gate: ["checkout", "setup-node", "frozen-install", "run-gate", "upload"],
documentation_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"],
}; };
for (const [jobId, expected] of Object.entries(expectedStepKinds)) { for (const [jobId, expected] of Object.entries(expectedStepKinds)) {
const actual = contract.jobs.find(({ id }) => id === jobId)?.steps.map(({ kind }) => kind); const actual = contract.jobs.find(({ id }) => id === jobId)?.steps.map(({ kind }) => kind);
@@ -974,7 +892,9 @@ function validateContractSemantics(
} }
} }
const expectedEnvironmentBindings: Readonly<Record<string, readonly Readonly<{ name: string; value: string }> []>> = { const expectedEnvironmentBindings: Readonly<Record<string, readonly Readonly<{ name: string; value: string }> []>> = {
merge_gate: [], merge_static: [],
merge_test: [],
merge_browser: [],
release_gate: [], release_gate: [],
immutable_build: [ immutable_build: [
// FE-GATE-027 admits the built artifact to a named environment, so both // FE-GATE-027 admits the built artifact to a named environment, so both
@@ -1037,6 +957,7 @@ function validateContractSemantics(
{ name: "MIN_ELIGIBLE_SAMPLES", value: "${{ vars.MIN_ELIGIBLE_SAMPLES }}" }, { name: "MIN_ELIGIBLE_SAMPLES", value: "${{ vars.MIN_ELIGIBLE_SAMPLES }}" },
], ],
documentation_gate: [], documentation_gate: [],
main_gate: [],
}; };
for (const job of contract.jobs) { for (const job of contract.jobs) {
const environmentNames = job.environment.map(({ name }) => name); const environmentNames = job.environment.map(({ name }) => name);
@@ -1361,6 +1282,7 @@ function validateJobStepKinds(
): void { ): void {
const allowed: Readonly<Record<z.infer<typeof jobSchema>["kind"], ReadonlySet<string>>> = { const allowed: Readonly<Record<z.infer<typeof jobSchema>["kind"], ReadonlySet<string>>> = {
"gate-matrix": new Set(["checkout", "setup-node", "frozen-install", "browser-install", "download", "extract", "run-gate", "upload"]), "gate-matrix": new Set(["checkout", "setup-node", "frozen-install", "browser-install", "download", "extract", "run-gate", "upload"]),
"gate-sequence": new Set(["checkout", "setup-node", "frozen-install", "browser-install", "run-gate", "upload"]),
"gate-single": new Set(["checkout", "setup-node", "frozen-install", "run-gate", "upload"]), "gate-single": new Set(["checkout", "setup-node", "frozen-install", "run-gate", "upload"]),
immutable: new Set(["checkout", "setup-node", "frozen-install", "run-gate", "archive-candidate", "upload"]), immutable: new Set(["checkout", "setup-node", "frozen-install", "run-gate", "archive-candidate", "upload"]),
provider: new Set(["checkout", "setup-node", "frozen-install", "download", "extract", "run-provider", "validate-provider-evidence", "upload"]), provider: new Set(["checkout", "setup-node", "frozen-install", "download", "extract", "run-provider", "validate-provider-evidence", "upload"]),
+18 -3
View File
@@ -71,7 +71,7 @@ const PRODUCT_GATE_JOB = "product_merge_gate";
* gate stopped nothing but a PR merge: the same run went on to release, build, * gate stopped nothing but a PR merge: the same run went on to release, build,
* promote and deploy, and the fixed job graph left a product no way to link * promote and deploy, and the fixed job graph left a product no way to link
* them. release_gate is the first release-stage job, and every later one * them. release_gate is the first release-stage job, and every later one
* depends on it as it depends on merge_gate. The link is rendered from the * depends on it as it depends on the merge jobs. The link is rendered from the
* overlay, so the template contract's job graph (and its check) stays the * overlay, so the template contract's job graph (and its check) stays the
* template's, and without product gates the workflow bytes do not change. * template's, and without product gates the workflow bytes do not change.
*/ */
@@ -108,6 +108,7 @@ export function renderCiWorkflow(
" type: choice", " type: choice",
" options:", " options:",
" - merge", " - merge",
" - main",
" - release", " - release",
" - production", " - production",
" - field", " - field",
@@ -231,7 +232,7 @@ function renderJob(
} }
} }
lines.push(" steps:"); lines.push(" steps:");
for (const step of job.steps) lines.push(...renderStep(job, step, transfers)); for (const step of job.steps) lines.push(...renderStep(job, step, transfers, index));
return lines; return lines;
} }
@@ -257,6 +258,7 @@ function renderStep(
job: CiWorkflowJob, job: CiWorkflowJob,
step: CiWorkflowStep, step: CiWorkflowStep,
transfers: ReadonlyMap<string, Readonly<{ name: string }>>, transfers: ReadonlyMap<string, Readonly<{ name: string }>>,
index: ReturnType<typeof indexCiGateContract>,
): string[] { ): string[] {
switch (step.kind) { switch (step.kind) {
case "checkout": case "checkout":
@@ -294,6 +296,16 @@ function renderStep(
return [" - name: Run blocking gate", " run: corepack pnpm ci:gate -- ${{ matrix.gate }}"]; return [" - name: Run blocking gate", " run: corepack pnpm ci:gate -- ${{ matrix.gate }}"];
} }
if (job.gateIds.length === 0) throw new TypeError(`run-gate step lacks ownership: ${job.id}`); if (job.gateIds.length === 0) throw new TypeError(`run-gate step lacks ownership: ${job.id}`);
// F2·F1 (design-docs repo-structure/03-ci.md). A job of several gates
// shares one install; each gate is a step named by its id, and a failed
// gate does not skip the ones after it, as the matrix entries did not.
if (job.kind === "gate-sequence") {
return job.gateIds.flatMap((gateId) => [
` - name: ${yamlScalar(`${gateId} / ${index.gates.get(gateId)?.name ?? ""}`)}`,
" if: ${{ !cancelled() }}",
` run: corepack pnpm ci:gate -- ${gateId}`,
]);
}
// 12-02: every gate the job owns runs, in order. Rendering only the first // 12-02: every gate the job owns runs, in order. Rendering only the first
// left FE-GATE-027 (release admission) out of the workflow. // left FE-GATE-027 (release admission) out of the workflow.
return job.gateIds.flatMap((gateId) => [ return job.gateIds.flatMap((gateId) => [
@@ -426,7 +438,10 @@ function renderCondition(condition: CiWorkflowJob["condition"]): string | null {
const expressions: Record<CiWorkflowJob["condition"], string | null> = { const expressions: Record<CiWorkflowJob["condition"], string | null> = {
always: null, always: null,
"needs-success": null, "needs-success": null,
merge: "${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}", merge: "${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}",
// A push to a branch (main, develop) or a dispatch that asks for it; never
// a pull request or a tag.
main: "${{ (gitea.event_name == 'push' && startsWith(gitea.ref, 'refs/heads/')) || (gitea.event_name == 'workflow_dispatch' && inputs.stage == 'main') }}",
release: "${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }}", release: "${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }}",
production: "${{ gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'production' || inputs.stage == 'field') }}", production: "${{ gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'production' || inputs.stage == 'field') }}",
field: "${{ gitea.event_name == 'workflow_dispatch' && inputs.stage == 'field' }}", field: "${{ gitea.event_name == 'workflow_dispatch' && inputs.stage == 'field' }}",
+4 -3
View File
@@ -4,11 +4,11 @@ export const ciContractReportSchema = z
.object({ .object({
schemaVersion: z.literal(2), schemaVersion: z.literal(2),
nodeVersion: z.string().regex(/^\d+\.\d+\.\d+$/u), nodeVersion: z.string().regex(/^\d+\.\d+\.\d+$/u),
gateCount: z.literal(27), gateCount: z.literal(28),
commandDefinitionCount: z.number().int().positive(), commandDefinitionCount: z.number().int().positive(),
commandReferenceCount: z.number().int().positive(), commandReferenceCount: z.number().int().positive(),
artifactCount: z.number().int().positive(), artifactCount: z.number().int().positive(),
jobCount: z.literal(10), jobCount: z.literal(13),
workflowSha256: z.string().regex(/^[a-f0-9]{64}$/u), workflowSha256: z.string().regex(/^[a-f0-9]{64}$/u),
durationStatus: z.string().min(1), durationStatus: z.string().min(1),
negativeFixtures: z.array( negativeFixtures: z.array(
@@ -20,6 +20,7 @@ export const ciContractReportSchema = z
"PROD_PROMOTION_READY", "PROD_PROMOTION_READY",
"FIELD_SLO_READY", "FIELD_SLO_READY",
"DOCUMENTATION_READY", "DOCUMENTATION_READY",
"MAIN_READY",
]), ]),
failedGate: z.string().regex(/^FE-GATE-\d{3}$/u), failedGate: z.string().regex(/^FE-GATE-\d{3}$/u),
passed: z.boolean(), passed: z.boolean(),
@@ -37,7 +38,7 @@ export const ciContractReportSchema = z
fail(["passed"], "passed must agree with failures"); fail(["passed"], "passed must agree with failures");
} }
if ( if (
report.negativeFixtures.length !== 5 || report.negativeFixtures.length !== 6 ||
report.negativeFixtures.some((fixture) => !fixture.passed) report.negativeFixtures.some((fixture) => !fixture.passed)
) { ) {
fail(["negativeFixtures"], "every readiness negative fixture must pass"); fail(["negativeFixtures"], "every readiness negative fixture must pass");
+1 -1
View File
@@ -17,7 +17,7 @@ import type { RemovalCheck } from "./removal-fixture.ts";
*/ */
const BROWSER = const BROWSER =
"needs Playwright browsers. FE-GATE-020 runs in a merge job without them " + "needs Playwright browsers. FE-GATE-020 runs in a merge job without them " +
"(merge_gate matrix browser: false). The generated routes in the browser " + "(merge_test installs none). The generated routes in the browser " +
"gates are reviewed as 1103/12-01 and 12-03."; "gates are reviewed as 1103/12-01 and 12-03.";
const DRILL = const DRILL =
"a removal drill copies the repository again. The drill runs the generated " + "a removal drill copies the repository again. The drill runs the generated " +
+6
View File
@@ -40,6 +40,10 @@ export const PROMOTION_FORMULA = Object.freeze({
]), ]),
FIELD_SLO_READY: Object.freeze(["FE-GATE-018"]), FIELD_SLO_READY: Object.freeze(["FE-GATE-018"]),
DOCUMENTATION_READY: Object.freeze(["FE-GATE-017"]), DOCUMENTATION_READY: Object.freeze(["FE-GATE-017"]),
// 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"]),
}); });
export type GateResult = "PASS" | "FAIL" | "UNVERIFIED"; export type GateResult = "PASS" | "FAIL" | "UNVERIFIED";
@@ -58,6 +62,7 @@ export function evaluatePromotionReadiness(
const fieldReady = const fieldReady =
productionReady && allPass(PROMOTION_FORMULA.FIELD_SLO_READY); productionReady && allPass(PROMOTION_FORMULA.FIELD_SLO_READY);
const documentationReady = allPass(PROMOTION_FORMULA.DOCUMENTATION_READY); const documentationReady = allPass(PROMOTION_FORMULA.DOCUMENTATION_READY);
const mainReady = allPass(PROMOTION_FORMULA.MAIN_READY);
return Object.freeze({ return Object.freeze({
MERGE_READY: mergeReady, MERGE_READY: mergeReady,
@@ -65,5 +70,6 @@ export function evaluatePromotionReadiness(
PROD_PROMOTION_READY: productionReady, PROD_PROMOTION_READY: productionReady,
FIELD_SLO_READY: fieldReady, FIELD_SLO_READY: fieldReady,
DOCUMENTATION_READY: documentationReady, DOCUMENTATION_READY: documentationReady,
MAIN_READY: mainReady,
}); });
} }
-13
View File
@@ -21,7 +21,6 @@ import {
} from "./fixture-node-modules.ts"; } from "./fixture-node-modules.ts";
import { generateCiWorkflow } from "../generate-ci-workflow.ts"; import { generateCiWorkflow } from "../generate-ci-workflow.ts";
import { selectRepositoryPaths } from "./repository-layout.ts"; import { selectRepositoryPaths } from "./repository-layout.ts";
import { updateCiContractBaseline } from "../update-ci-contract-baseline.ts";
/** /**
* The fixture-copy set of config/repository-layout.json (R2). It includes the * The fixture-copy set of config/repository-layout.json (R2). It includes the
@@ -512,16 +511,4 @@ export async function pruneRemovalFixtureCiContract(options: Readonly<{
writeFile(packagePath, `${JSON.stringify(packageDocument, null, 2)}\n`), writeFile(packagePath, `${JSON.stringify(packageDocument, null, 2)}\n`),
writeFile(gatesPath, `${JSON.stringify(validated, null, 2)}\n`), writeFile(gatesPath, `${JSON.stringify(validated, null, 2)}\n`),
]); ]);
// D-13: the reduced contract is a new baseline, recorded the way a project
// that removes the capability records it; canonical check:ci then applies.
// 1103/16-02. A product feature owns no CI script; an empty list used to
// leave a trailing blank that the baseline schema refuses.
await updateCiContractBaseline(options.root, {
owner: "removal-fixture",
reason: `removal fixture pruned ${
options.removedScripts.size === 0
? "no CI scripts"
: [...options.removedScripts].join(", ")
}`,
});
} }
-52
View File
@@ -1,52 +0,0 @@
import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import {
CI_CONTRACT_BASELINE_PATH,
measureCiContractBaseline,
parseCiGateContract,
type CiContractBaseline,
} from "./contracts/ci-gates.ts";
/**
* D-13. Records the current `config/ci/gates.json` size and gate shape as the
* reviewed baseline. Run it after an intended contract change; the diff of
* `config/ci/contract-baseline.json` is what review approves.
*/
export async function updateCiContractBaseline(
root: string,
approval: Readonly<{ owner: string; reason: string }>,
): Promise<CiContractBaseline> {
const contract = parseCiGateContract(
JSON.parse(await readFile(path.join(root, "config/ci/gates.json"), "utf8")),
);
const baseline: CiContractBaseline = {
schemaVersion: 1,
owner: approval.owner,
reason: approval.reason,
...measureCiContractBaseline(contract),
};
await writeFile(
path.join(root, CI_CONTRACT_BASELINE_PATH),
`${JSON.stringify(baseline, null, 2)}\n`,
);
return baseline;
}
const isCli = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
if (isCli) {
const owner = process.env.CI_CONTRACT_BASELINE_OWNER;
const reason = process.env.CI_CONTRACT_BASELINE_REASON;
if (!owner || !reason) {
process.stderr.write(
"CI_CONTRACT_BASELINE_OWNER and CI_CONTRACT_BASELINE_REASON are required.\n",
);
process.exit(1);
}
const baseline = await updateCiContractBaseline(process.cwd(), { owner, reason });
process.stdout.write(
`CI contract baseline updated: ${baseline.gates} gates, ${baseline.commands} commands, ` +
`${baseline.commandReferences} command references, ${baseline.artifacts} artifacts\n`,
);
}
+1 -1
View File
@@ -1,4 +1,4 @@
{ {
"jobId": "merge_gate", "jobId": "merge_static",
"needs": ["release_gate"] "needs": ["release_gate"]
} }
+1 -1
View File
@@ -1,4 +1,4 @@
{ {
"jobId": "merge_gate", "jobId": "merge_static",
"needs": ["missing"] "needs": ["missing"]
} }
+1 -1
View File
@@ -1,4 +1,4 @@
{ {
"jobId": "merge_gate", "jobId": "merge_static",
"removeGateId": "FE-GATE-001" "removeGateId": "FE-GATE-001"
} }
@@ -49,10 +49,6 @@ describe("CI-runner command-generated evidence freshness", () => {
path.join(root, "config/ci/gates.json"), path.join(root, "config/ci/gates.json"),
`${JSON.stringify(contract)}\n`, `${JSON.stringify(contract)}\n`,
); );
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
await writeFile( await writeFile(
path.join(root, "package.json"), path.join(root, "package.json"),
`${JSON.stringify(packageDocument)}\n`, `${JSON.stringify(packageDocument)}\n`,
@@ -106,10 +102,6 @@ describe("CI-runner command-generated evidence freshness", () => {
path.join(root, "config/ci/gates.json"), path.join(root, "config/ci/gates.json"),
`${JSON.stringify(contract)}\n`, `${JSON.stringify(contract)}\n`,
); );
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
await writeFile( await writeFile(
path.join(root, "package.json"), path.join(root, "package.json"),
`${JSON.stringify(packageDocument)}\n`, `${JSON.stringify(packageDocument)}\n`,
@@ -158,10 +150,6 @@ describe("CI-runner gate output budget", () => {
path.join(root, "config/ci/gates.json"), path.join(root, "config/ci/gates.json"),
`${JSON.stringify(contract)}\n`, `${JSON.stringify(contract)}\n`,
); );
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
await writeFile( await writeFile(
path.join(root, "package.json"), path.join(root, "package.json"),
`${JSON.stringify(packageDocument)}\n`, `${JSON.stringify(packageDocument)}\n`,
@@ -218,10 +206,6 @@ describe("CI-runner FE-GATE-027 advisory record", () => {
path.join(root, "config/ci/gates.json"), path.join(root, "config/ci/gates.json"),
`${JSON.stringify(contract)}\n`, `${JSON.stringify(contract)}\n`,
); );
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
await writeFile( await writeFile(
path.join(root, "package.json"), path.join(root, "package.json"),
`${JSON.stringify(packageDocument)}\n`, `${JSON.stringify(packageDocument)}\n`,
@@ -18,6 +18,7 @@ on:
type: choice type: choice
options: options:
- merge - merge
- main
- release - release
- production - production
- field - field
@@ -34,31 +35,97 @@ env:
CI_RUNNER_IMAGE: "\${{ vars.RUNNER_IMAGE_DIGEST }}" CI_RUNNER_IMAGE: "\${{ vars.RUNNER_IMAGE_DIGEST }}"
jobs: jobs:
merge_gate: merge_static:
name: "\${{ matrix.gate }} / \${{ matrix.name }}" name: "merge / static checks"
if: \${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }} if: \${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-001 / manifest-lockfile"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-001
- name: "FE-GATE-002 / lint"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-002
- name: "FE-GATE-003 / typecheck"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-003
- name: "FE-GATE-010 / architecture"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-010
- name: "FE-GATE-011 / build"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-011
- name: "FE-GATE-012 / bundle"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-012
- name: Upload merge static evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-static-\${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_test:
name: "merge / tests"
if: \${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
# FE-GATE-013 runner requirement: 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 # FE-GATE-013 runner requirement: 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
# FE-GATE-013 runner requirement: 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 # FE-GATE-013 runner requirement: 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
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 45 timeout-minutes: 45
strategy: steps:
fail-fast: false - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
matrix: with:
include: persist-credentials: false
- { gate: FE-GATE-001, name: manifest-lockfile, browser: false } - uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
- { gate: FE-GATE-002, name: lint, browser: false } with:
- { gate: FE-GATE-003, name: typecheck, browser: false } node-version-file: .nvmrc
- { gate: FE-GATE-004, name: runtime-schema, browser: false } - name: Frozen install
- { gate: FE-GATE-005, name: unit, browser: false } run: |
- { gate: FE-GATE-006, name: component, browser: false } corepack enable
- { gate: FE-GATE-007, name: integration, browser: false } corepack pnpm install --frozen-lockfile --ignore-scripts
- { gate: FE-GATE-008, name: e2e, browser: true } - name: "FE-GATE-004 / runtime-schema"
- { gate: FE-GATE-009, name: accessibility, browser: true } if: \${{ !cancelled() }}
- { gate: FE-GATE-010, name: architecture, browser: false } run: corepack pnpm ci:gate -- FE-GATE-004
- { gate: FE-GATE-011, name: build, browser: false } - name: "FE-GATE-005 / unit"
- { gate: FE-GATE-012, name: bundle, browser: false } if: \${{ !cancelled() }}
- { gate: FE-GATE-013, name: security, browser: false } run: corepack pnpm ci:gate -- FE-GATE-005
- { gate: FE-GATE-020, name: removability, browser: false } - name: "FE-GATE-006 / component"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-006
- name: "FE-GATE-007 / integration"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-007
- name: "FE-GATE-013 / security"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-013
- name: "FE-GATE-020 / removability"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-020
- name: Upload merge test evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "merge-test-\${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
merge_browser:
name: "merge / browser tests"
if: \${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps: steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with: with:
@@ -71,23 +138,26 @@ jobs:
corepack enable corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts corepack pnpm install --frozen-lockfile --ignore-scripts
- name: Install Playwright browsers - name: Install Playwright browsers
if: \${{ matrix.browser }}
run: | run: |
corepack pnpm exec playwright install --with-deps chromium firefox webkit corepack pnpm exec playwright install --with-deps chromium firefox webkit
$(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation $(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
- name: Run blocking gate - name: "FE-GATE-008 / e2e"
run: corepack pnpm ci:gate -- \${{ matrix.gate }} if: \${{ !cancelled() }}
- name: Upload merge gate evidence run: corepack pnpm ci:gate -- FE-GATE-008
- name: "FE-GATE-009 / accessibility"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-009
- name: Upload merge browser evidence
if: always() if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with: with:
name: "\${{ matrix.gate }}-\${{ gitea.run_id }}" name: "merge-browser-\${{ gitea.run_id }}"
path: artifacts/ path: artifacts/
if-no-files-found: error if-no-files-found: error
release_gate: release_gate:
name: "\${{ matrix.gate }} / \${{ matrix.name }}" name: "\${{ matrix.gate }} / \${{ matrix.name }}"
needs: merge_gate needs: [merge_static, merge_test, merge_browser]
if: \${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }} if: \${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 45 timeout-minutes: 45
@@ -505,5 +575,32 @@ jobs:
name: "FE-GATE-017-\${{ gitea.run_id }}" name: "FE-GATE-017-\${{ gitea.run_id }}"
path: artifacts/ path: artifacts/
if-no-files-found: error if-no-files-found: error
main_gate:
name: "main / checker self-tests"
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
steps:
- uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
- name: Frozen install
run: |
corepack enable
corepack pnpm install --frozen-lockfile --ignore-scripts
- name: "FE-GATE-029 / checker-self-tests"
if: \${{ !cancelled() }}
run: corepack pnpm ci:gate -- FE-GATE-029
- name: Upload main gate evidence
if: always()
uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
with:
name: "main-gate-\${{ gitea.run_id }}"
path: artifacts/
if-no-files-found: error
" "
`; `;
+15 -67
View File
@@ -138,10 +138,6 @@ async function createUnsafeCiGateFixture(
Object.assign(packageDocument.scripts, additionalScripts); Object.assign(packageDocument.scripts, additionalScripts);
await writeFile(path.join(root, "config/ci/gates.json"), `${JSON.stringify(contract)}\n`); await writeFile(path.join(root, "config/ci/gates.json"), `${JSON.stringify(contract)}\n`);
await writeFile(path.join(root, "package.json"), `${JSON.stringify(packageDocument)}\n`); await writeFile(path.join(root, "package.json"), `${JSON.stringify(packageDocument)}\n`);
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
return root; return root;
} }
@@ -186,22 +182,20 @@ describe("CI gate contract", () => {
expect(() => parseCiGateContract(candidate)).toThrow(diagnostic); expect(() => parseCiGateContract(candidate)).toThrow(diagnostic);
}); });
it("loads the strict v2 registry and preserves the reviewed baseline", async () => { // The command and artifact counts are not pinned here: the count and shape
// baseline was deleted on 2026-11-08 (design-docs repo-structure/README.md
// 3.3), and the contract's semantic checks hold gate, job and stage shape.
it("loads the strict v2 registry", async () => {
const contract = await loadCiGateContract(process.cwd()); const contract = await loadCiGateContract(process.cwd());
const index = indexCiGateContract(contract); const index = indexCiGateContract(contract);
expect(contract.schemaVersion).toBe(2); expect(contract.schemaVersion).toBe(2);
expect(contract.gates.map(({ id }) => id)).toEqual( expect(contract.gates.map(({ id }) => id)).toEqual(
Array.from({ length: 28 }, (_, index) => Array.from({ length: 29 }, (_, index) =>
`FE-GATE-${String(index + 1).padStart(3, "0")}`, `FE-GATE-${String(index + 1).padStart(3, "0")}`,
).filter((gateId) => gateId !== "FE-GATE-016"), ).filter((gateId) => gateId !== "FE-GATE-016"),
); );
expect(contract.jobs).toHaveLength(10); expect(contract.jobs).toHaveLength(13);
expect(contract.commands).toHaveLength(76); expect(contract.stages).toHaveLength(6);
expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(80);
expect(contract.commands.filter(({ expect }) => expect === "fail")).toHaveLength(8);
expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(83);
expect(contract.artifacts).toHaveLength(105);
expect(contract.stages).toHaveLength(5);
expect(contract.retention.classes).toHaveLength(5); expect(contract.retention.classes).toHaveLength(5);
expect(index.gates.get("FE-GATE-015")?.commandIds).toHaveLength(2); expect(index.gates.get("FE-GATE-015")?.commandIds).toHaveLength(2);
expect(index.gates.get("FE-GATE-020")?.name).toBe("removability"); expect(index.gates.get("FE-GATE-020")?.name).toBe("removability");
@@ -492,16 +486,16 @@ describe("CI gate contract", () => {
["empty gate evidence refs", (value: Record<string, any>) => (value.gates[0].evidenceArtifactIds = []), /too small|at least 1/i], ["empty gate evidence refs", (value: Record<string, any>) => (value.gates[0].evidenceArtifactIds = []), /too small|at least 1/i],
["unowned gate", (value: Record<string, any>) => (value.jobs[0].gateIds = value.jobs[0].gateIds.filter((id: string) => id !== "FE-GATE-001")), /unowned gate: FE-GATE-001/i], ["unowned gate", (value: Record<string, any>) => (value.jobs[0].gateIds = value.jobs[0].gateIds.filter((id: string) => id !== "FE-GATE-001")), /unowned gate: FE-GATE-001/i],
["multiply owned gate", (value: Record<string, any>) => value.jobs[1].gateIds.push("FE-GATE-001"), /multiply owned gate: FE-GATE-001/i], ["multiply owned gate", (value: Record<string, any>) => value.jobs[1].gateIds.push("FE-GATE-001"), /multiply owned gate: FE-GATE-001/i],
["duplicated immutable gate", (value: Record<string, any>) => value.jobs[1].gateIds.push("FE-GATE-015"), /release matrix duplicates FE-GATE-015/i], ["duplicated immutable gate", (value: Record<string, any>) => value.jobs.find((job: any) => job.id === "release_gate").gateIds.push("FE-GATE-015"), /release matrix duplicates FE-GATE-015/i],
["unreachable producer", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "promotion").needs = ["immutable_build", "provenance_provider"]), /download producer vulnerability_provider is unreachable/i], ["unreachable producer", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "promotion").needs = ["immutable_build", "provenance_provider"]), /download producer vulnerability_provider is unreachable/i],
["missing producer", (value: Record<string, any>) => { const producer = value.jobs.find((job: any) => job.id === "immutable_build"); producer.steps = producer.steps.filter((step: any) => step.kind !== "upload"); }, /unknown download transfer release-candidate|job step sequence drift/i], ["missing producer", (value: Record<string, any>) => { const producer = value.jobs.find((job: any) => job.id === "immutable_build"); producer.steps = producer.steps.filter((step: any) => step.kind !== "upload"); }, /unknown download transfer release-candidate|job step sequence drift/i],
["promotion rebuild authority", (value: Record<string, any>) => value.jobs.find((job: any) => job.id === "promotion").steps.splice(3, 0, { kind: "archive-candidate", stepId: "bad", archivePath: ".release/bad.tar.gz", members: ["dist"], archiveOutputName: "bad", distOutputName: "bad-dist" }), /promotion job must not build|step kind archive-candidate is forbidden/i], ["promotion rebuild authority", (value: Record<string, any>) => value.jobs.find((job: any) => job.id === "promotion").steps.splice(3, 0, { kind: "archive-candidate", stepId: "bad", archivePath: ".release/bad.tar.gz", members: ["dist"], archiveOutputName: "bad", distOutputName: "bad-dist" }), /promotion job must not build|step kind archive-candidate is forbidden/i],
["browser gate drift", (value: Record<string, any>) => (value.jobs[0].browserGateIds = ["FE-GATE-008"]), /browser gate set drift/i], ["browser gate drift", (value: Record<string, any>) => (value.jobs[0].browserGateIds = ["FE-GATE-008"]), /browser gate set drift/i],
["missing gate execution step", (value: Record<string, any>) => (value.jobs[0].steps = value.jobs[0].steps.filter((step: any) => step.kind !== "run-gate")), /canonical job step sequence drift/i], ["missing gate execution step", (value: Record<string, any>) => (value.jobs[0].steps = value.jobs[0].steps.filter((step: any) => step.kind !== "run-gate")), /canonical job step sequence drift/i],
["browser install drift", (value: Record<string, any>) => (value.jobs[0].steps = value.jobs[0].steps.filter((step: any) => step.kind !== "browser-install")), /browser install step drift|job step sequence drift/i], ["browser install drift", (value: Record<string, any>) => { const job = value.jobs.find((candidate: any) => candidate.id === "merge_browser"); job.steps = job.steps.filter((step: any) => step.kind !== "browser-install"); }, /browser install step drift|job step sequence drift/i],
["job environment drift", (value: Record<string, any>) => value.jobs[0].environment.push({ name: "UNOWNED", value: "x" }), /job environment binding drift/i], ["job environment drift", (value: Record<string, any>) => value.jobs[0].environment.push({ name: "UNOWNED", value: "x" }), /job environment binding drift/i],
["job kind drift", (value: Record<string, any>) => (value.jobs[0].kind = "gate-single"), /job graph drift/i], ["job kind drift", (value: Record<string, any>) => (value.jobs[0].kind = "gate-single"), /job graph drift/i],
["job needs drift", (value: Record<string, any>) => (value.jobs[1].needs = []), /job graph drift/i], ["job needs drift", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "release_gate").needs = []), /job graph drift/i],
["job condition drift", (value: Record<string, any>) => (value.jobs[1].condition = "always"), /job graph drift/i], ["job condition drift", (value: Record<string, any>) => (value.jobs[1].condition = "always"), /job graph drift/i],
["promotion success condition drift", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "promotion").condition = "always"), /job graph drift|promotion.*condition/i], ["promotion success condition drift", (value: Record<string, any>) => (value.jobs.find((job: any) => job.id === "promotion").condition = "always"), /job graph drift|promotion.*condition/i],
["candidate output identity drift", (value: Record<string, any>) => { const job = value.jobs.find((candidate: any) => candidate.id === "immutable_build"); job.steps.find((step: any) => step.kind === "archive-candidate").archiveOutputName = "renamed"; }, /candidate output identity drift/i], ["candidate output identity drift", (value: Record<string, any>) => { const job = value.jobs.find((candidate: any) => candidate.id === "immutable_build"); job.steps.find((step: any) => step.kind === "archive-candidate").archiveOutputName = "renamed"; }, /candidate output identity drift/i],
@@ -558,49 +552,6 @@ describe("CI gate contract", () => {
); );
}); });
it("rejects canonical gate name drift through the semantic-shape digest", async () => {
const root = await mkdtemp(path.join(tmpdir(), "ci-contract-gate-name-shape-"));
temporaryRoots.push(root);
await mkdir(path.join(root, "config/ci"), { recursive: true });
const contract = JSON.parse(
JSON.stringify(await loadCiGateContract(process.cwd())),
) as Record<string, any>;
const gate = contract.gates.find(
(candidate: Record<string, any>) => candidate.id === "FE-GATE-013",
);
gate.name = `${gate.name}-renamed`;
await writeFile(path.join(root, "config/ci/gates.json"), `${JSON.stringify(contract)}\n`);
await writeFile(path.join(root, "package.json"), await readFile("package.json"));
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
await expect(loadCiGateContract(root)).rejects.toThrow(/gateShapeSha256: baseline/i);
});
it("rejects runner requirement drift through the semantic-shape digest (1105/12-01)", async () => {
const root = await mkdtemp(path.join(tmpdir(), "ci-contract-host-shape-"));
temporaryRoots.push(root);
await mkdir(path.join(root, "config/ci"), { recursive: true });
const contract = JSON.parse(
JSON.stringify(await loadCiGateContract(process.cwd())),
) as Record<string, any>;
const gate = contract.gates.find(
(candidate: Record<string, any>) => candidate.id === "FE-GATE-013",
);
expect(gate.hostRequirements?.length).toBeGreaterThan(0);
gate.hostRequirements = gate.hostRequirements.slice(1);
await writeFile(path.join(root, "config/ci/gates.json"), `${JSON.stringify(contract)}\n`);
await writeFile(path.join(root, "package.json"), await readFile("package.json"));
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
await expect(loadCiGateContract(root)).rejects.toThrow(/gateShapeSha256: baseline/i);
});
it.each(["check:artifact-schemas", "check:ci-workflow"])( it.each(["check:artifact-schemas", "check:ci-workflow"])(
"rejects a missing nested check:ci dependency: %s", "rejects a missing nested check:ci dependency: %s",
async (removedScript) => { async (removedScript) => {
@@ -1598,10 +1549,6 @@ describe("CI gate contract", () => {
await writeFile(path.join(root, "config/ci/gates.json"), `${JSON.stringify(contract)}\n`); await writeFile(path.join(root, "config/ci/gates.json"), `${JSON.stringify(contract)}\n`);
await writeFile(path.join(root, "package.json"), await readFile("package.json")); await writeFile(path.join(root, "package.json"), await readFile("package.json"));
await writeFile(path.join(root, ".nvmrc"), await readFile(".nvmrc")); await writeFile(path.join(root, ".nvmrc"), await readFile(".nvmrc"));
await writeFile(
path.join(root, "config/ci/contract-baseline.json"),
await readFile("config/ci/contract-baseline.json"),
);
const drift = Buffer.from("drifted workflow\n", "utf8"); const drift = Buffer.from("drifted workflow\n", "utf8");
await writeFile(path.join(root, ".gitea/workflows/quality-gates.yml"), drift); await writeFile(path.join(root, ".gitea/workflows/quality-gates.yml"), drift);
const result = spawnSync(process.execPath, [path.resolve("scripts/check-ci-contract.ts")], { const result = spawnSync(process.execPath, [path.resolve("scripts/check-ci-contract.ts")], {
@@ -1640,7 +1587,7 @@ describe("CI workflow generation", () => {
expect(first).toContain("persist-credentials: false"); expect(first).toContain("persist-credentials: false");
expect( expect(
first.match(/corepack pnpm install --frozen-lockfile --ignore-scripts/gu), first.match(/corepack pnpm install --frozen-lockfile --ignore-scripts/gu),
).toHaveLength(9); ).toHaveLength(12);
expect(first).not.toMatch(/corepack pnpm install --frozen-lockfile$/mu); expect(first).not.toMatch(/corepack pnpm install --frozen-lockfile$/mu);
expect(first).toContain("verify-ci-candidate-archive.ts --archive"); expect(first).toContain("verify-ci-candidate-archive.ts --archive");
// Providers and promotion read the archive without extracting it; only the // Providers and promotion read the archive without extracting it; only the
@@ -1676,7 +1623,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', '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]); const actionUses = [...first.matchAll(/^\s+-?\s*uses: (.+)$/gmu)].map((match) => match[1]);
expect(actionUses).toHaveLength(34); expect(actionUses).toHaveLength(43);
expect(new Set(actionUses)).toEqual( expect(new Set(actionUses)).toEqual(
new Set([ new Set([
"https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5", "https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5",
@@ -1732,7 +1679,7 @@ describe("CI workflow generation", () => {
expect(requirements.join("\n")).toContain("scripts/check-system-test-prerequisites.ts"); expect(requirements.join("\n")).toContain("scripts/check-system-test-prerequisites.ts");
const workflow = renderCiWorkflow(contract); const workflow = renderCiWorkflow(contract);
const merge = workflow.slice(workflow.indexOf(" merge_gate:\n"), workflow.indexOf(" release_gate:\n")); const merge = workflow.slice(workflow.indexOf(" merge_test:\n"), workflow.indexOf(" merge_browser:\n"));
const header = merge.slice(0, merge.indexOf(" runs-on: ubuntu-latest\n")); const header = merge.slice(0, merge.indexOf(" runs-on: ubuntu-latest\n"));
expect(header.split("\n").filter((line) => line.startsWith(" # "))).toEqual( expect(header.split("\n").filter((line) => line.startsWith(" # "))).toEqual(
requirements.map((requirement) => ` # FE-GATE-013 runner requirement: ${requirement}`), requirements.map((requirement) => ` # FE-GATE-013 runner requirement: ${requirement}`),
@@ -1866,7 +1813,8 @@ describe("CI workflow generation", () => {
it.each([ it.each([
["a non-matrix gate step", " run: corepack pnpm ci:gate -- FE-GATE-027\n", "FE-GATE-027"], ["a non-matrix gate step", " run: corepack pnpm ci:gate -- FE-GATE-027\n", "FE-GATE-027"],
["a matrix entry", " - { gate: FE-GATE-020, name: removability, browser: false }\n", "FE-GATE-020"], ["a matrix entry", " - { gate: FE-GATE-028, name: manual-accessibility-review, browser: false }\n", "FE-GATE-028"],
["a gate step of a merge job", " run: corepack pnpm ci:gate -- FE-GATE-020\n", "FE-GATE-020"],
])("rejects a workflow that drops %s", async (_name, line, gateId) => { ])("rejects a workflow that drops %s", async (_name, line, gateId) => {
const contract = await loadCiGateContract(process.cwd()); const contract = await loadCiGateContract(process.cwd());
const workflow = renderCiWorkflow(contract); const workflow = renderCiWorkflow(contract);
+13 -3
View File
@@ -36,10 +36,20 @@ describe("feature scaffold drill commands", () => {
} }
}); });
// The checkers' negative fixtures moved to the main stage (FE-GATE-029) on
// 2026-11-08, so the merge stage has none; a probe stands in for one.
it("keeps a negative fixture's registered exit and diagnostic", async () => { it("keeps a negative fixture's registered exit and diagnostic", async () => {
const contract = await loadCiGateContract(process.cwd()); const contract = structuredClone(await loadCiGateContract(process.cwd()));
expect(scaffoldDrillCommands(contract).find(({ script }) => script === "check:coverage:fixture")) contract.commands.push({
.toMatchObject({ expectation: { kind: "fail", expectedExitCode: 1, expectedDiagnosticId: "Risk coverage failed:" } }); id: "check-probe-fixture",
script: "check:probe:fixture",
expect: "fail",
expectedExitCode: 1,
expectedDiagnosticId: "probe failed:",
} as never);
contract.gates.find(({ id }) => id === "FE-GATE-010")!.commandIds.push("check-probe-fixture");
expect(scaffoldDrillCommands(contract).find(({ script }) => script === "check:probe:fixture"))
.toMatchObject({ expectation: { kind: "fail", expectedExitCode: 1, expectedDiagnosticId: "probe failed:" } });
}); });
it("runs a command added to the merge stage without an edit to the drill", async () => { it("runs a command added to the merge stage without an edit to the drill", async () => {
+6 -7
View File
@@ -32,9 +32,7 @@ async function productRoot(
const root = await mkdtemp(path.join(tmpdir(), "product-ci-overlay-")); const root = await mkdtemp(path.join(tmpdir(), "product-ci-overlay-"));
roots.push(root); roots.push(root);
await mkdir(path.join(root, "config/ci"), { recursive: true }); await mkdir(path.join(root, "config/ci"), { recursive: true });
for (const file of ["config/ci/gates.json", "config/ci/contract-baseline.json"]) { await writeFile(path.join(root, "config/ci/gates.json"), await readFile("config/ci/gates.json"));
await writeFile(path.join(root, file), await readFile(file));
}
const packageDocument = JSON.parse(await readFile("package.json", "utf8")) as { const packageDocument = JSON.parse(await readFile("package.json", "utf8")) as {
scripts: Record<string, string>; scripts: Record<string, string>;
}; };
@@ -54,8 +52,8 @@ const DEPLOYMENT = {
const DEPLOY_SCRIPTS = { "deploy:desktop": "node scripts/deploy-desktop.ts" }; const DEPLOY_SCRIPTS = { "deploy:desktop": "node scripts/deploy-desktop.ts" };
const GATE = { id: "PRODUCT-GATE-001", name: "backend-contract", script: "check:backend-contract" }; const GATE = { id: "PRODUCT-GATE-001", name: "backend-contract", script: "check:backend-contract" };
const GATE_SCRIPTS = { "check:backend-contract": "node scripts/check-backend-contract.ts" }; const GATE_SCRIPTS = { "check:backend-contract": "node scripts/check-backend-contract.ts" };
const RELEASE_HELD_BY_TEMPLATE = " needs: merge_gate\n"; const RELEASE_HELD_BY_TEMPLATE = " needs: [merge_static, merge_test, merge_browser]\n";
const RELEASE_HELD_BY_PRODUCT = " needs: [merge_gate, product_merge_gate]\n"; const RELEASE_HELD_BY_PRODUCT = " needs: [merge_static, merge_test, merge_browser, product_merge_gate]\n";
describe("product CI overlay (1103/12-07)", () => { describe("product CI overlay (1103/12-07)", () => {
it("ships empty, so the template's own workflow is unchanged", async () => { it("ships empty, so the template's own workflow is unchanged", async () => {
@@ -72,7 +70,6 @@ describe("product CI overlay (1103/12-07)", () => {
DEPLOY_SCRIPTS, DEPLOY_SCRIPTS,
); );
// The template baseline (config/ci/contract-baseline.json) is unchanged.
const contract = await loadCiGateContract(root); const contract = await loadCiGateContract(root);
const slot = contract.jobs.find(({ id }) => id === "deployment"); const slot = contract.jobs.find(({ id }) => id === "deployment");
expect(slot?.steps.map(({ kind }) => kind)).toEqual([ expect(slot?.steps.map(({ kind }) => kind)).toEqual([
@@ -143,7 +140,9 @@ describe("product CI overlay (1103/12-07)", () => {
const job = workflow.slice(workflow.indexOf(" product_merge_gate:\n")); const job = workflow.slice(workflow.indexOf(" product_merge_gate:\n"));
expect(job).toContain(' - { gate: PRODUCT-GATE-001, name: backend-contract, script: "check:backend-contract" }'); expect(job).toContain(' - { gate: PRODUCT-GATE-001, name: backend-contract, script: "check:backend-contract" }');
expect(job).toContain(" run: corepack pnpm ${{ matrix.script }}"); expect(job).toContain(" run: corepack pnpm ${{ matrix.script }}");
expect(job).toContain(` if: ${"${{ gitea.event_name != 'workflow_dispatch' || inputs.stage != 'documentation' }}"}`); expect(job).toContain(
` if: ${"${{ gitea.event_name != 'workflow_dispatch' || (inputs.stage != 'documentation' && inputs.stage != 'main') }}"}`,
);
expect(workflowGateExecutionFailures(contract, workflow, mergeGates)).toEqual([]); expect(workflowGateExecutionFailures(contract, workflow, mergeGates)).toEqual([]);
// The template part of the workflow is the same bytes with or without the // The template part of the workflow is the same bytes with or without the
// overlay, except that the release stage waits for the product job (1105/13-02). // overlay, except that the release stage waits for the product job (1105/13-02).
+2
View File
@@ -19,6 +19,7 @@ describe("promotion readiness formula", () => {
PROD_PROMOTION_READY: true, PROD_PROMOTION_READY: true,
FIELD_SLO_READY: true, FIELD_SLO_READY: true,
DOCUMENTATION_READY: true, DOCUMENTATION_READY: true,
MAIN_READY: true,
}); });
}); });
@@ -30,6 +31,7 @@ describe("promotion readiness formula", () => {
["FE-GATE-021", "PROD_PROMOTION_READY"], ["FE-GATE-021", "PROD_PROMOTION_READY"],
["FE-GATE-018", "FIELD_SLO_READY"], ["FE-GATE-018", "FIELD_SLO_READY"],
["FE-GATE-017", "DOCUMENTATION_READY"], ["FE-GATE-017", "DOCUMENTATION_READY"],
["FE-GATE-029", "MAIN_READY"],
] as const)("fails closed when %s fails", (failedGate, readiness) => { ] as const)("fails closed when %s fails", (failedGate, readiness) => {
const result = evaluatePromotionReadiness({ const result = evaluatePromotionReadiness({
...passing, ...passing,
+4 -26
View File
@@ -64,15 +64,13 @@ async function copyCiContract(prefix: string): Promise<string> {
const root = await mkdtemp(path.join(tmpdir(), prefix)); const root = await mkdtemp(path.join(tmpdir(), prefix));
temporaryRoots.push(root); temporaryRoots.push(root);
await mkdir(path.join(root, "config/ci"), { recursive: true }); await mkdir(path.join(root, "config/ci"), { recursive: true });
for (const file of ["config/ci/gates.json", "config/ci/contract-baseline.json", "package.json"]) { for (const file of ["config/ci/gates.json", "package.json"]) {
await writeFile(path.join(root, file), await readFile(file)); await writeFile(path.join(root, file), await readFile(file));
} }
return root; return root;
} }
// D-13: a removal takes the same step a downstream project takes — it records it("prunes removed command and evidence references and loads the reduced contract", async () => {
// the reduced contract as the new baseline — and then loads canonically.
it("prunes removed command and evidence references and re-baselines the contract", async () => {
const root = await copyCiContract("removal-fixture-contract-"); const root = await copyCiContract("removal-fixture-contract-");
// A command with evidence of its own, as a removed sample's tests had. Not // A command with evidence of its own, as a removed sample's tests had. Not
@@ -91,10 +89,6 @@ it("prunes removed command and evidence references and re-baselines the contract
expect(contract.gates.some(({ evidenceArtifactIds }) => expect(contract.gates.some(({ evidenceArtifactIds }) =>
evidenceArtifactIds.includes("artifact-artifacts-tests-integration-xml") evidenceArtifactIds.includes("artifact-artifacts-tests-integration-xml")
)).toBe(false); )).toBe(false);
const baseline = JSON.parse(
await readFile(path.join(root, "config/ci/contract-baseline.json"), "utf8"),
) as Record<string, unknown>;
expect(baseline).toMatchObject({ commands: contract.commands.length, owner: "removal-fixture" });
const packageDocument = JSON.parse(await readFile(path.join(root, "package.json"), "utf8")) as { const packageDocument = JSON.parse(await readFile(path.join(root, "package.json"), "utf8")) as {
scripts: Record<string, string>; scripts: Record<string, string>;
}; };
@@ -102,9 +96,8 @@ it("prunes removed command and evidence references and re-baselines the contract
}); });
// 1103/16-02. A product feature owns no CI script, so its removal prunes // 1103/16-02. A product feature owns no CI script, so its removal prunes
// nothing. The baseline reason then ended in a blank ("removal fixture pruned // nothing, and the contract still loads.
// ") and the baseline schema refused it before any gate ran. it("loads a removal that prunes no CI script", async () => {
it("re-baselines a removal that prunes no CI script", async () => {
const root = await copyCiContract("removal-fixture-no-scripts-"); const root = await copyCiContract("removal-fixture-no-scripts-");
await pruneRemovalFixtureCiContract({ await pruneRemovalFixtureCiContract({
@@ -113,24 +106,9 @@ it("re-baselines a removal that prunes no CI script", async () => {
removedEvidencePathFragments: [], removedEvidencePathFragments: [],
}); });
const baseline = JSON.parse(
await readFile(path.join(root, "config/ci/contract-baseline.json"), "utf8"),
) as Record<string, unknown>;
expect(baseline["reason"]).toBe("removal fixture pruned no CI scripts");
await expect(loadCiGateContract(root)).resolves.toBeDefined(); await expect(loadCiGateContract(root)).resolves.toBeDefined();
}); });
it("rejects a contract that no longer matches its committed baseline", async () => {
const root = await copyCiContract("removal-fixture-baseline-drift-");
const baselinePath = path.join(root, "config/ci/contract-baseline.json");
const baseline = JSON.parse(await readFile(baselinePath, "utf8")) as Record<string, number>;
await writeFile(baselinePath, JSON.stringify({ ...baseline, commands: baseline.commands! + 1 }));
await expect(loadCiGateContract(root)).rejects.toThrow(
/contract-baseline\.json[\s\S]*commands[\s\S]*update:ci-contract-baseline/u,
);
});
it("rejects pruning that leaves a reduced gate without commands", async () => { it("rejects pruning that leaves a reduced gate without commands", async () => {
const root = await copyCiContract("removal-fixture-empty-gate-"); const root = await copyCiContract("removal-fixture-empty-gate-");
+3 -1
View File
@@ -454,10 +454,12 @@ describe("supply-chain policy", () => {
).rejects.toThrow(/did not fail exactly/u); ).rejects.toThrow(/did not fail exactly/u);
}); });
// The checkers' own negative fixtures run in the main stage (FE-GATE-029)
// since 2026-11-08 (design-docs repo-structure/03-ci.md F2).
it("wires the exact security fixture checker as a passing CI gate", async () => { it("wires the exact security fixture checker as a passing CI gate", async () => {
const contract = await loadCiGateContract(process.cwd()); const contract = await loadCiGateContract(process.cwd());
const index = indexCiGateContract(contract); const index = indexCiGateContract(contract);
const securityGate = index.gates.get("FE-GATE-013"); const securityGate = index.gates.get("FE-GATE-029");
expect(securityGate).toBeDefined(); expect(securityGate).toBeDefined();
const commands = securityGate!.commandIds.map((commandId) => const commands = securityGate!.commandIds.map((commandId) =>
index.commands.get(commandId), index.commands.get(commandId),
+5 -13
View File
@@ -7,12 +7,7 @@ import { pathToFileURL } from "node:url";
import { afterEach, describe, expect, it } from "vitest"; import { afterEach, describe, expect, it } from "vitest";
import { import { loadCiGateContract, parseCiGateContract } from "../../scripts/contracts/ci-gates.ts";
CI_CONTRACT_BASELINE_PATH,
loadCiGateContract,
measureCiContractBaseline,
parseCiGateContract,
} from "../../scripts/contracts/ci-gates.ts";
import { generateCiWorkflow } from "../../scripts/generate-ci-workflow.ts"; import { generateCiWorkflow } from "../../scripts/generate-ci-workflow.ts";
import { validatePackageScriptGraph } from "../../scripts/lib/package-script-graph.ts"; import { validatePackageScriptGraph } from "../../scripts/lib/package-script-graph.ts";
@@ -188,14 +183,11 @@ describe("selective Task 3 contract closure", () => {
.toContain("package script missing: root -> missing"); .toContain("package script missing: root -> missing");
}); });
// D-13: the counts and gate shape come from the reviewed baseline file, so a // The count and gate-shape baseline (D-13, config/ci/contract-baseline.json)
// removal fixture that re-baselines its reduced contract passes here too. // was deleted on 2026-11-08 (owner decision, design-docs repo-structure/
it("matches the owned contract baseline and rejects orphan retention", async () => { // README.md 3.3): the contract's own semantic checks hold its shape.
it("rejects orphan retention", async () => {
const canonical = await loadCiGateContract(process.cwd()); const canonical = await loadCiGateContract(process.cwd());
const baseline = JSON.parse(await readFile(CI_CONTRACT_BASELINE_PATH, "utf8")) as Record<string, unknown>;
expect(baseline).toMatchObject(measureCiContractBaseline(canonical));
expect(baseline["owner"]).toEqual(expect.any(String));
expect(baseline["reason"]).toEqual(expect.any(String));
expect(canonical.retention.classes).toHaveLength(5); expect(canonical.retention.classes).toHaveLength(5);
const orphan = JSON.parse(JSON.stringify(canonical)) as Record<string, any>; const orphan = JSON.parse(JSON.stringify(canonical)) as Record<string, any>;