SW e2e는 템플릿의 `= null;` 줄만 바꿔 worker를 켰다. 제품이 이미 ACTIVE로
켠 트리에서는 2건이 실패하고 4건이 실행되지 않았다. 사전 캐시 목록도
템플릿 기준으로 고정돼 있어 해시 파일을 더하면 2건이 실패했다.
선택을 지금 값과 상관없이 고치되, 이미 ACTIVE면 제품의 handler를 그대로
두는 `turnOnServiceWorker` 하나로 모았다. 빌드가 만든 사전 캐시 목록을
`precached`로 돌려주고 spec이 그 목록과 비교한다. 같은 문제를 고친
0929/06-04(`96a4f68`)의 `selectActiveServiceWorker`는 ACTIVE 선택을
템플릿 값으로 덮어써 제품 handler가 빠지므로 이 함수로 바꿨고, 실패한
준비 단계에서 임시 복사본을 지우는 처리는 유지했다(두 브랜치 병합 때
오케스트레이터가 충돌을 풀었다).
위험: 테스트 도우미만 바뀐다. 0929/06-04 단위 테스트의 기대값이 "ACTIVE
선택도 템플릿 값으로 덮어쓴다"에서 "ACTIVE 선택은 그대로 둔다"로 바뀐다.
검증: ACTIVE 선택과 해시 파일 추가 트리 모두 6 passed(에이전트).
병합 뒤 service-worker-build-output 단위 테스트 5/5, SW e2e chromium·webkit
12/12, tsc(test), eslint 통과.
문제: SW e2e 도우미(prepareServiceWorkerBuilds)는 사본의
`const SERVICE_WORKER: InstalledServiceWorkerSelection | null = null;`
줄을 글자 그대로 찾아 ACTIVE로 바꿨다. 이미 SW를 켠 제품 트리에는 이
줄이 없어서 beforeAll이 throw하고 update·recovery spec이 모두 멈춘다.
이 spec이 실제로 필요한 곳이 바로 SW를 켠 제품이다. setup이 실패하면
spec이 root를 받지 못해 /tmp/ca-sw-builds-* 사본도 남았다.
service-worker-build-output.test.ts도 같은 치환을 했다.
고른 방법: selectActiveServiceWorker(root)를 도우미에 두고, SERVICE_WORKER
선언 전체를 값과 무관하게(정규식, 정확히 1개) ACTIVE_SELECTION으로
바꾼다. 두 픽스처가 이 함수를 쓴다. recovery spec이 ACTIVE_SELECTION을
다시 찾는 방식은 그대로 동작한다. setup 실패 때는 fixture-builds.ts처럼
사본을 지우고 다시 throw한다.
버린 대안: 리뷰가 함께 적은 "install spec 기대값을 dist/assets 전체 대신
생성된 service-worker-assets.ts 목록과 비교". ACTIVE 트리에서도 두 값이
같아 이번 결함과 무관하다. 제품이 사전 캐시 대상을 바꿀 때(0929/06-03)
다시 본다.
위험·한계:
- 선택 선언의 값에 `;`가 들어가면 정규식이 짧게 끊겨 "정확히 1개"
검사나 이후 타입 검사에서 실패한다(조용히 틀리지는 않는다).
- e2e는 chromium만 돌렸다. webkit·firefox는 미실행.
검증:
- RED: 작업 트리 선택을 ACTIVE로 바꾸고 SW e2e 2 spec(chromium,
webServer 없는 임시 설정)을 돌림 -> `Expected exactly one "const
SERVICE_WORKER: ... = null;"`로 2 failed, 4 did not run, 사본 2개
잔류.
- GREEN: 같은 ACTIVE 트리에서 6 passed. 선택을 null로 되돌린 템플릿
트리에서도 6 passed. 잔류 사본 0.
- 새 단위 테스트(null·ACTIVE·REMOVE_REGISTRATION 선택 -> ACTIVE) 포함
`node scripts/run-vitest.ts run
tests/unit/service-worker-build-output.test.ts` -> 5 passed(ACTIVE
트리와 null 트리 모두).
- `npx tsc --project tsconfig.test.json --noEmit` -> 오류 0.
- `npx eslint <바꾼 파일 2개> --max-warnings=0` -> 통과.
Refs: docs/reviews/2026-09-29-maturity-review/06-adapters-service-worker-push.md 06-04, docs/reviews/2026-11-01-maturity-review/06-adapters-service-worker-push.md 2.1절
문제: 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
Old-tab chunk recovery in the default configuration only had jsdom tests, and
the old-asset test checked its own hosting fixture. A spec now serves two real
builds: the old tab reloads once into the new one and not a second time. The
fixture test and the acceptance row now say what they cover.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A worker that stops the page from booting had no exit: every off switch was
page code. A REMOVE_REGISTRATION release now writes a service-worker.js that
skips waiting and unregisters itself (D-5), checked end to end in the browser.
The runbook and rollback doc now name only paths that exist in code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check:adapter-inventory forbids a raw node_modules symlink in fixtures; use
linkFixtureNodeModules like the other fixture builders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Builds the app twice with the ACTIVE selection in a temp copy and serves
either dist from a per-test static server. Covers install with
application/javascript and gzip bodies, update-waiting/reload-required
through the host, and the previous-cache fallback for a removed chunk.
The unmodified ACTIVE build fails (vite.service-worker.config.ts resolves
.generated/ from node_modules/.vite-temp); that case is test.fixme and the
helper builds with --configLoader native.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>