Commit Graph
9 Commits
Author SHA1 Message Date
DongHyeonka af312deeca fix(ci): 테스트와 dev server가 CI의 빌드 식별값을 물려받지 않는다
문제
.gitea/workflows/quality-gates.yml은 workflow 전체 env에
VITE_BUILD_ID=gitea-<run>-<attempt>와 VITE_COMMIT_SHA를 넣는다. Vite는 이
값을 import.meta.env로 번들에 넣는다. 그래서 CI와 같은 env로 돌리면:
- vitest: 앱을 local-build fixture release로 조립하는 테스트가
  CONFIG_BUILD_MISMATCH로 실패한다(runtime-application,
  boot-unexpected-failure, runtime-composition-service-worker-telemetry,
  reference-production-vertical, 생성 기능 페이지 테스트). FE-GATE-005·006·
  007과 제거 드릴(FE-GATE-020)이 떨어진다.
- capability e2e: dev server는 public/config.json(BUILD_ID local-build)을
  내주는데 번들은 gitea-1-1이라, 페이지마다 rolling-release 불일치로 한 번
  다시 불러오고 그다음 실패 화면이 된다. page.evaluate가 "Execution context
  was destroyed"로 30건 실패한다(FE-GATE-008).
깨끗한 clone에서 merge 단계 14개를 CI env로 돌려(리뷰 조치 X4) 찾았다.
로컬에서는 이 값이 없어서 늘 통과한다. 1103/11-06과 같은 원인이다.

고른 방법
- vitest.config.ts가 npm scope 변수를 지우는 것과 같은 자리에서
  VITE_BUILD_ID·VITE_COMMIT_SHA를 지운다. 테스트는 로컬 빌드 식별값으로
  시작한다.
- dev server를 띄우는 Playwright 설정(capabilities, dev)은 webServer env로
  VITE_BUILD_ID=local-build, VITE_COMMIT_SHA=local을 준다. 그 dev server가
  내주는 config.json과 같은 값이다.
- build·preview를 쓰는 e2e·visual은 바꾸지 않았다. 빌드가 같은 값으로
  config.json을 만들므로 맞는다.
- 버린 대안: 테스트마다 기대값을 env에서 읽기(11-06 방식). 같은 모양의
  fixture가 여러 파일에 있고, 다음 테스트가 또 같은 실수를 한다.

위험·한계
- vitest 안에서 CI 빌드 식별값을 읽는 것을 검사하려는 테스트는 값을 직접
  넣어야 한다(지금은 없다).
- CI=true와 러너 이미지 조건은 재현하지 않았다.

검증
- VITE_BUILD_ID=gitea-1-1, VITE_COMMIT_SHA=<HEAD>로: test:unit 2,878,
  test:component 270, test:integration 189, test:reference-feature 97,
  test:recipes 77 통과. browser-files capability spec chromium 3건 통과
  (수정 전 3건 실패, env 없으면 통과).

Refs: docs/reviews/2026-11-03-maturity-review/README.md 13절 11-06
2026-11-05 00:13:49 +09:00
DongHyeonka 95e7d1107c test(vitest): skip·todo·only가 남은 실행을 실패시킨다 (10-04)
문제: Vitest는 skip·todo 테스트를 통과로 센다. `it.skip`이나
`it.todo`가 든 파일은 CI=true에서도 종료 코드 0으로 끝난다.
`context.skip()`도 같다. `.only`는 Vitest 기본값 때문에 CI에서만 막히고,
로컬에서는 같은 파일의 나머지 테스트를 조용히 건너뛴다.
check:test-evidence의 소스 검사가 quarantine 주석 없는 `.skip(`·`.only(`
글자를 잡지만, `it.todo`, `context.skip()`, `skipIf`는 보지 못한다.

고른 방법:
- vitest.config.ts에 allowOnly: false를 둬 `.only`를 어디서나 막는다.
- scripts/lib/no-skipped-tests-reporter.ts reporter가 실행 끝에
  state가 skipped인 테스트를 찾으면 이름을 출력하고 exitCode를 1로 둔다.
  -t, 태그 필터, file:line처럼 호출자가 일부러 좁힌 실행은 예외다.
  게이트는 실행을 좁히지 않는다.
- reporter는 scripts/run-vitest.ts가 붙인다. CLI --reporter는 config의
  reporters를 대체하므로 config에 두면 package script에서 빠진다.
  run-vitest.ts는 package script와 scale tier가 모두 거치는 입구다.
  호출자가 reporter를 하나도 주지 않으면 default를 함께 붙인다.

버린 대안:
- 리뷰 최소 개선안의 junit `skipped > 0` 검사: Vitest junit은 mode가
  skip·todo인 테스트만 <skipped/>로 적고 `context.skip()`은 통과처럼
  적는다. junit을 쓰지 않는 실행(scale tier, http-scenario-catalog,
  로컬 단일 파일)은 아예 보지 못한다.
- tests/setup.ts의 afterAll 검사: 모든 테스트가 skip인 파일은 hook이
  돌지 않아 잡지 못한다.
- eslint-plugin-vitest no-disabled-tests: 새 의존성이 생기고
  `context.skip()`을 못 잡는다.

위험·한계:
- run-vitest.ts를 거치지 않는 직접 `vitest` 실행에는 reporter가 붙지
  않는다. allowOnly는 config라서 그때도 적용된다.
- 호출자가 reporter를 주지 않으면 default reporter를 고정해서 붙인다.
  Vitest가 AI 에이전트 환경에서 고르는 agent reporter 대신 default가
  나온다.
- 본문 없는 `describe.todo`처럼 테스트가 없는 묶음은 세지 않는다.
- check:test-evidence는 quarantine 주석이 있는 `.skip(`을 허용하지만
  이 reporter는 Vitest에서 그것도 실패시킨다. 지금 quarantine은
  Playwright spec에만 있어 충돌하는 테스트는 없다. 전략 문서 16.5절에
  "quarantine은 Vitest 테스트를 통과시키지 않는다"고 적었다. Vitest에도
  quarantine이 필요해지면 허용 목록을 따로 둬야 한다.
- 지금 저장소의 Vitest 테스트에는 skip·todo·only가 없다.

검증:
- RED(P-B 재현, run-vitest.ts로 skip+todo, only, context.skip() 파일을
  CI 없음/CI=true로): 수정 전 6경우 중 5경우 exit 0("1 passed | 1
  skipped | 1 todo"). only+CI=true만 exit 1.
- 새 tests/unit/no-skipped-tests-reporter.test.ts는 수정 전 "Cannot find
  module ../../scripts/lib/no-skipped-tests-reporter.ts"로 실패.
- GREEN: 같은 6경우 모두 exit 1. skip·todo·context.skip()은 "N test(s)
  did not run" 목록, only는 "Unexpected .only modifier". junit reporter를
  준 실행도 exit 1. -t로 좁힌 실행과 file:line 실행은 exit 0. 새 테스트
  11 passed.
- 빠른 계층 전체(unit·component·integration·contract·runtime-schema·
  platform·architecture·features·release·scripts·recipes, pnpm 설치를
  하는 fixture-node-modules.test.ts 제외, maxWorkers 4): 3,228 passed,
  1 failed. 실패는 provider-guardian-transaction의 fs.watch ENOSPC(호스트
  inotify 한도)이고 reporter 없이 vitest를 직접 돌려도 같다. skip 목록
  출력은 없었다.
- tsc -p tsconfig.node.json, tsconfig.test.json, eslint(바꾼 4파일),
  check-ci-contract, generate-ci-workflow --check,
  verify-documentation-readiness(PASS_SCOPED) 통과.

Refs: docs/reviews/2026-11-01-maturity-review/10-tests-fast-layers.md 10-04
2026-11-01 23:18:45 +09:00
DongHyeonka e0c2a91d47 test(setup): npx vitest가 npm scope 환경변수 없이 시작한다 (1101/15-05)
문제
`npx vitest run tests/unit/ci-workflow-generation.test.ts`는 79건이
"CI runner npm scope environment invalid"로 실패한다(415건 중). npx와
npm을 거친 IDE 실행기는 npm_config_prefix·_userconfig·_globalconfig를
넣는다. CI 게이트 preflight(withCiGatePreflight)는 실제 runner에서 이
변수들을 거절하는데(옳은 동작), 테스트가 그 preflight를 프로세스 안에서
부르거나 자식으로 띄우면서 실행기의 process.env를 그대로 물려받는다.
scripts/run-vitest.ts만 그중 일부를 지워서 pnpm 경로만 통과한다. 원인은
timeout이 아니라 이 환경변수다.

고른 방법
- vitest.config.ts가 NODE_ENV를 고정하는 자리에서 npm scope 변수를 지운다.
  config는 worker를 띄우기 전에 메인 프로세스에서 평가되므로 worker와 그
  자식 프로세스 모두 깨끗한 환경으로 시작한다. 어느 실행기로 돌리든,
  어느 테스트 파일이든 한 곳에서 막는다.
- 지울 이름은 preflight가 쓰는 것과 같은 판정
  (package-script-graph.ts의 isNpmScopeEnvironmentName, 기존 private 함수를
  export)으로 고른다. 목록이 둘로 갈라지지 않는다.
- ci-workflow-generation.test.ts에 "테스트 프로세스에 npm scope 변수가
  없다"는 테스트를 더했다.

버린 대안
- 해당 테스트 파일의 beforeEach/afterEach에서 지우고 되돌리기(리뷰의 최소
  방향 1): 같은 preflight를 띄우는 다른 파일이 생기면 다시 깨진다.
- 실행 함수가 환경을 인자로 받게 하기: 자식 프로세스는 여전히 process.env를
  물려받아 실패한다.
- run-vitest.ts의 하드코딩 목록 정리: 이번 수정으로 필요 없어지지만, product
  index 생성 자식에도 쓰이고 동작이 같아 건드리지 않았다.

위험·한계
- 실제 게이트 실행기의 npm scope 거절은 그대로다. 테스트 안에서 일부러 변수를
  넣는 기존 테스트 3건도 그대로 통과한다.
- tests/unit 밖(component, integration 등)은 npx로 돌려 보지 않았다.

검증
- RED: npx vitest run tests/unit/ci-workflow-generation.test.ts -t
  "npm-launched runner" 실패 "expected [ 'npm_config_userconfig', …(2) ] to
  deeply equal []". 수정 전 같은 파일 79 failed / 336 passed
- GREEN: npx vitest run tests/unit/ci-workflow-generation.test.ts
  416 passed
- npx vitest run tests/unit: 171파일 2,401 passed
- tsc(node, test), eslint 바뀐 파일 통과

Refs: docs/reviews/2026-11-01-maturity-review/15-performance.md 15-05
2026-11-01 22:49:13 +09:00
DongHyeonkaandClaude Opus 5.5 72e7ae1139 test(vitest): collect only Vitest files and document running one file (10-05)
A bare vitest run collected 26 Playwright specs and the host-bound system
suite. The documented one-file command goes through run-vitest.ts, which
renders the gitignored product index a fresh clone lacks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 00:22:16 +09:00
donghyeon-ka 5cc41467ae refactor: 프론트 템플릿 리펙토링 2026-09-18 15:16:58 +09:00
DongHyeonkaandClaude Opus 5 5434760ddf fix: keep the fixture evidence test about preservation, and stop scanning worktrees
The release-evidence test asserted that every artifact a candidate is assembled
from survives the copy, which quietly assumed the checkout had already run the
release chain. It holds in this repository and fails in a product repository
that has not, where `artifacts/performance/bundle.json` simply does not exist
yet — a fact about the checkout, not about the copier. It now asserts that
whatever release evidence is present is preserved, and that at least one thing
was, so it cannot pass by finding nothing to check.

Vitest also walked `.worktrees/`. A git worktree inside the repository is a
different checkout of a different branch; running its tests against this
checkout's config produces failures that belong to neither and cost real time
to attribute.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 21:30:54 +09:00
DongHyeonka 76bf9f1aa3 test: lock V8 coverage counter semantics 2026-08-02 10:12:34 +09:00
DongHyeonka 5a73f7a1b5 fix: measure repository-wide risk coverage 2026-08-02 07:52:46 +09:00
donghyeon-ka 6c52cdb916 feat: 기능 추가 과정중 2026-07-30 15:58:20 +09:00