Commit Graph
7 Commits
Author SHA1 Message Date
DongHyeonka f4d5761a2a fix(test-run): 실행마다 빌드·Playwright 출력 폴더를 따로 쓴다
문제: 빌드는 `dist`, `.generated/frontend-runtime`, `artifacts/release`·
`artifacts/quality`에 고정으로 쓰고, 다섯 Playwright 설정은 결과·report·
JUnit을 `artifacts/tests/<이름>/`에 고정으로 쓴다. 한 checkout에서 두
번째 e2e 실행이 시작하면 빌드 1단계가 첫 실행의 preview가 서빙 중인
`dist`를 지우고, Playwright가 `outputDir`을 비워 첫 실행의 trace를 지운다.
증거 파일도 늦게 끝난 쪽 것으로 섞인다(1105/12-04).

고른 방법: 변수 두 개로 나눈다(`scripts/lib/run-isolation.ts`).
- `TEST_RUN_ID`: Playwright 설정이 읽는다. 값이 있으면 그 실행의 결과·
  report·JUnit과 서빙할 빌드를 `.tmp/runs/<id>/` 아래 같은 상대 경로에
  둔다. 없으면 지금 경로 그대로라 게이트, CI upload, 증거 검사가 읽는
  곳이 바뀌지 않는다.
- `RUN_OUTPUT_ROOT`: 설정이 web server에만 넘긴다. 빌드 단계 전부
  (`build-frontend`, contract set, runtime config, SW asset 목록, SW 빌드,
  build manifest)와 `vite.config.ts`가 읽어 `dist`·생성 모듈·증거·Vite
  캐시를 그 아래에 쓴다. preview는 `--outDir`로 같은 `dist`를 서빙한다.
빌드 코드는 `TEST_RUN_ID`를 읽지 않는다. e2e worker가 저장소 복사본을
빌드할 때(fixture-builds, service-worker-builds) runner 환경을 물려받는데,
그 빌드는 복사본 자기 `dist`에 써야 하기 때문이다.
두 루트는 `.` 또는 `.tmp/` 아래만 받는다. git, Tailwind 소스 스캔(report
안 문자열이 CSS에 들어가지 않게), Vite watcher, vitest, 저장소 복사
helper가 모두 `.tmp`를 건너뛴다. service-worker-builds의 복사 제외 목록에
`.tmp`를 더했다(fixture-builds와 같아짐). build manifest의 경로는 빌드가
쓴 폴더 기준 상대 경로로 둔다.
`vite.config.ts`가 새로 가져오는 `scripts/lib/run-isolation.ts`는 저장소
일부를 임시 루트에 복사해 빌드하는 두 목록(초기 JS 측정
`scripts/scale/measure-feature-shape-growth.ts`,
`tests/unit/product-feature-selection-build.test.ts`)에도 더한다.
Storybook은 run ID가 있으면 `build:storybook`의 두 단계를 다른 `-o`로
돌린다. 같은 단계인지는 단위 테스트가 package script와 대조한다.
버린 대안: 운영 증거 경로(54개 스크립트, `config/ci/gates.json`)까지 run
ID로 옮기기. 게이트와 workflow upload가 고정 경로를 읽으므로 이번 범위
밖이다(아래 한계). 실행마다 저장소를 임시 폴더로 복사하기: 매번 수십
MB 복사와 node_modules 링크가 들고, 개발자가 보는 결과 위치가 사라진다.

위험·한계: 포트는 아직 고정이라 이 커밋만으로는 두 실행이 함께 돌지
못한다(다음 커밋). `ci:gate`와 증거 검사(`check:test-evidence`,
`verify:browser-capability-evidence`)는 기본 경로만 읽는다. run ID를 준
채 게이트를 돌리면 증거가 기본 경로에 새로 생기지 않아 게이트가 "not
freshly produced"로 실패한다(통과로 새지 않는다). Storybook 내부 캐시
(`node_modules/.cache`)는 여전히 공유한다. capability 설정
(`playwright.capabilities.config.ts`)은 test:browser-file-storage-removal이
capability와 함께 지운다. 설정 테스트는 그 파일이 있을 때만 그 설정을 읽고,
경로를 변수로 두어 타입 검사가 그 파일을 요구하지 않는다.

검증: desktop batch에서 확인.
node scripts/run-vitest.ts run tests/unit/run-isolation.test.ts tests/unit/playwright-run-isolation.test.ts tests/unit/run-output-root-build.test.ts
node scripts/run-vitest.ts run tests/unit/feature-shape-growth.test.ts tests/unit/product-feature-selection-build.test.ts
corepack pnpm test:browser-file-storage-removal

Refs: 1105/12-04
2026-11-06 02:11:17 +09:00
DongHyeonka e440ece9fe build(vite): 폐기 예정 build.rollupOptions를 rolldownOptions로 바꾼다
문제: 앱·Service Worker·선택 레시피 번들의 청크 설정이 Vite 8에서
@deprecated인 build.rollupOptions 별칭에 있었다(0929/13-07, 세 라운드
남음). 별칭이 지워지는 Vite 버전으로 올리면 청크 그룹과 treeshake 설정이
조용히 빠질 수 있다.

고른 방법: 세 곳의 키 이름만 rolldownOptions로 바꾼다. 내용은 그대로다.

위험·한계: 없음에 가깝다. 같은 설정의 정식 이름이다.

검증: 바꾸기 전후 빌드의 dist/assets 파일 이름이 모두 같다(해시가 같아
출력이 같다). service-worker-build-output 7건 통과,
check:optional-recipes PASS(레시피 예산 4개 그대로).

Refs: docs/reviews/2026-11-03-maturity-review/13-build-release-supply-chain.md 0929/13-07
2026-11-04 20:28:52 +09:00
DongHyeonka 85d55e0cd3 fix(service-worker): 사전 캐시와 설정 URL이 router base path를 따른다 (0929/06-02)
문제: SW 자산 생성기(scripts/generate-service-worker-assets.ts)가 사전
캐시 URL을 `/${relative}`로 만들어 VITE_ROUTER_BASE_PATH를 무시했다.
워커는 root-relative URL을 scope 기준으로 풀지만 base가 사라지므로
/app/ 배포에서 install이 /assets/...를 요청해 404를 받고, 워커가
설치되지 않았다. 같은 빌드의 SW 설정도 runtime config URL 기본값을
"/config.json"으로 고정해, 페이지가 쓰는 /app/config.json을 워커가
network-only로 알아보지 못했다. 앱 빌드·runtime config·06-08
fallback은 이미 base를 따르는데 이 두 곳만 빠져 있었다.

고른 방법: 리뷰가 적은 최소 방향. collectStaticAssets에 basePath
인자(기본 "/")를 더하고, 생성기 main과 SW Vite 설정이 페이지와 같은
getBuildConfig(src/contracts/env.ts)로 base와 runtime config URL을
계산한다. 결과 URL은 그대로 root-relative라 isCanonicalStaticAssetUrl
검사를 통과한다. base가 "/"이면 manifest와 digest가 전과 같다.

버린 대안: 워커가 manifest URL을 scope 상대로 풀게 바꾸기. 계약 차이는
없지만 워커 코드와 manifest 계약(root-relative)을 함께 바꿔야 해서
생성기 수정보다 크다.

위험·한계:
- base마다 manifest digest가 달라진다(의도된 결과).
- VITE_RUNTIME_CONFIG_URL이 빈 문자열이면 이제 base 기본값을 쓴다.
  페이지(getBuildConfig)와 같은 규칙이다.
- 리뷰 완료 기준의 "e2e 도우미를 base 옵션으로 돌린 첫 설치가
  RELOAD_TO_ENABLE"은 하지 않았다. e2e 도우미에 base 옵션과 /app/
  서빙이 필요하고, 실제 브라우저 install은 이번에 확인하지 않았다.

검증:
- RED: collectStaticAssets 단위 테스트(basePath "/app/")가 수정 전
  `/assets/index-abcdefgh.js`를 받아 실패(1 failed | 9 passed).
  service-worker-build-output.test.ts의 새 테스트(SW ACTIVE·
  production·/app/ 실제 빌드)가 생성기만 되돌리면 URL 목록에서,
  SW 설정만 되돌리면 `Received: "/config.json"`으로 각각 실패.
- GREEN: 두 테스트 통과. `node scripts/run-vitest.ts run
  tests/unit/service-worker tests/unit/sub-path-deployment.test.ts
  tests/unit/hosting-probe.test.ts tests/unit/web-push` -> 12파일
  171건 통과(빌드 테스트는 flock 안에서).
- `npx tsc` node·test·app·service-worker -> 오류 0.
- `npx eslint <바꾼 파일 4개> --max-warnings=0` -> 통과.
- `node scripts/check-adapter-inventory.ts` -> PASS.
- 미실행: SW e2e(Playwright).

Refs: docs/reviews/2026-09-29-maturity-review/06-adapters-service-worker-push.md 06-02, docs/reviews/2026-11-01-maturity-review/06-adapters-service-worker-push.md 2.1절
2026-11-01 22:49:38 +09:00
DongHyeonka c7b9cb8818 fix(service-worker): SW 빌드가 public/을 다시 복사하지 않게 한다 (0929/06-01)
문제: SW를 ACTIVE로 켜면 build-frontend 6단계의 SW Vite 빌드가 Vite
기본값대로 public/을 dist에 다시 복사한다. 4단계가 프로필로 만든
dist/config.json이 public/config.json(local, demo 인증,
http://localhost:8080/, 루트 release manifest)으로 덮어써진다. 빌드와
verify-release는 통과하고 release admission만 거절한다. 그래서 SW를 켠
제품은 local이 아닌 릴리스를 만들 수 없다. VITE_ROUTER_BASE_PATH를
쓰면 RELEASE_MANIFEST_URL도 base를 잃는다.

고른 방법: vite.service-worker.config.ts에 publicDir: false를 넣는다.
dist에는 3단계 앱 빌드가 이미 public/을 복사해 두었고, 워커 번들은
public/ 파일을 쓰지 않는다. 같은 repo의 다른 두 번째 Vite 빌드
(scripts/lib/optional-recipe-bundle.ts)도 같은 설정이다.
build-frontend.ts 6단계 주석에 이 조건을 한 줄 적었다.

버린 대안:
- build.copyPublicDir: false. 복사만 끄고 public 디렉터리는 계속
  설정에 남는다. 워커 빌드는 public/을 쓸 일이 없어 publicDir: false가
  의도를 바로 말한다.
- 앱 빌드 plugin의 closeBundle에서 워커를 만들기, 또는 Vite build()를
  configFile: false로 부르는 스크립트. 둘 다 리뷰 5.2절의 대안이다.
  two-pass 구조를 바꾸거나 파일이 늘어 이 결함에 비해 범위가 크다.

테스트: tests/unit/service-worker-build-output.test.ts는 임시 복사본에서
SW ACTIVE + APP_PROFILE=production + VITE_ROUTER_BASE_PATH=/app/로 실제
build-frontend.ts를 돌린다. 그리고 dist/config.json이
generateRuntimeConfig("production", env) 결과와 같은지 본다(리뷰의 완료
기준). 설정 객체에서 publicDir === false를 보는 테스트는 수정을 다시
적을 뿐이고, 설정이 5단계 생성물 없이는 로드되지 않아 버렸다. 빌드
1회가 약 2초라 unit 계층에 둔다(build-environment-bundle.test.ts와 같은
방식, docs/testing/taxonomy.md의 짧은 child process 규칙). 복사와 빌드는
e2e 도우미 prepareFixtureBuilds를 재사용하고, 빌드별 env 옵션만
추가했다(기존 호출은 그대로). 이 테스트로 0925/06-10(SW Vite 설정의
dist/config.json 읽기 테스트 없음)도 닫힌다.

위험·한계: 하위 경로에서 사전 캐시 URL이 base를 잃는 문제(0929/06-02)와
워커의 runtime config URL 기본값은 그대로다. 이 테스트는 /app/ 빌드의
설정 문서만 보고 워커 설치는 보지 않는다. Vite 8.1.5 동작 기준이다.
check:architecture는 pnpm 스크립트로만 돌아서 실행하지 않았다(src는
바꾸지 않았다).

검증:
- RED(수정 전): 새 테스트 실패. APP_ENV local(기대 production),
  AUTH_MODE demo(기대 external), API_BASE_URL http://localhost:8080/,
  RELEASE_MANIFEST_URL /release-manifest.json(기대 /app/...)
- GREEN: 새 테스트 통과(1.9초)
- 수정 전후 production + /app/ 빌드 비교: dist 파일 34개로 같음. 수정 후
  RELEASE_TARGET=production check-release-admission ADMITTED, 수정 전 rc 1
- node scripts/run-vitest.ts run tests/unit(pnpm을 띄우는 2파일 제외):
  164파일 2343건 통과
- tsc tsconfig.test.json, tsconfig.node.json 통과. 바꾼 4파일 eslint 통과

Refs: docs/reviews/2026-11-01-maturity-review/06-adapters-service-worker-push.md 2절, 13-build-release-supply-chain.md 실험 E-B
2026-11-01 19:02:57 +09:00
donghyeon-kaandClaude Opus 5.5 cefb0b2975 fix(service-worker): build the worker from the profile config (06-10)
The worker build read public/config.json, the local profile, even in a
production build (F-8). It now reads dist/config.json and fails when that
document's APP_ENV is not the build's APP_PROFILE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 12:57:41 +09:00
DongHyeonkaandClaude Opus 5.5 19e8decf46 fix(build): resolve worker config generated inputs from the config file (R3-6)
vite.service-worker.config.ts loaded .generated/frontend-runtime/*.ts with a
bare relative import(). Vite's default `bundle` config loader runs the config
from node_modules/.vite-temp/, so with the ACTIVE selection
`corepack pnpm build` stopped at the worker step. Resolve the paths against
import.meta.url, which every loader keeps pointing at the config file.

The e2e helper no longer patches build-frontend.ts with
`--configLoader native`; the quarantined fixme is replaced by a check that
both unmodified ACTIVE builds emitted service-worker.js.

RED (throwaway copy, ACTIVE selection, unmodified scripts/build-frontend.ts):
  TypeError: Required generated module is unavailable:
    ./.generated/frontend-runtime/service-worker-assets.ts
  [cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module
    '.../node_modules/.vite-temp/.generated/frontend-runtime/service-worker-assets.ts'
  build step failed: npx vite build --config vite.service-worker.config.ts
  build-frontend exit=1
GREEN: same copy after the fix -> build-frontend exit=0, dist/service-worker.js
  emitted; `pnpm test:e2e --project=chromium
  tests/e2e/service-worker-update.spec.ts` 5 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 15:42:09 +09:00
DongHyeonka c6da03369c refactor: 리펙토링 2026-08-01 19:39:59 +09:00