fix(hosting): live probe가 redirect된 워커 스크립트를 거절한다
문제 워커를 싣는 빌드에서 live probe는 `/service-worker.js`를 기본 fetcher `redirect: "follow"`로 받고, 최종 응답의 status와 origin만 본다 (`scripts/lib/hosting-probe.ts` `probeLiveRelease`). 같은 origin 안 redirect 뒤에 200·`no-cache`·JS MIME이 오면 FE-GATE-019가 PASS다. 브라우저는 워커 스크립트를 redirect mode "error"로 받는다(Service Worker Update 알고리즘). 그런 호스트에서는 첫 등록, update 검사, `REMOVE_REGISTRATION` kill switch가 모두 실패한다. 고른 방법과 버린 대안 - `serviceWorker` surface에만 `redirect` 행을 더한다. `response.redirected`이거나 `opaqueredirect`이면 FAIL이다. 자산 probe(1105/06-02)와 같은 판정식이라 fetcher가 redirect를 따라가든 manual이든 잡는다. 3xx 응답은 지금처럼 `http-status` 행이 FAIL로 본다. - redirect가 없으면 이 행은 PASS로 남는다. 산출물에 이 검사를 했다는 기록이 된다. - 버린 대안: 모든 surface에서 redirect를 FAIL로 보기(리뷰 (b)). `index`·`appRoute`의 정상 redirect(끝 슬래시 정규화 등)까지 막는다. 문서에만 적기(리뷰 (c))는 게이트가 그대로 PASS다. - 운영 문서 두 곳에 "redirect 없이"를 적었다. release-cache-rollback.md의 live probe 설명과 browser-file-storage-recovery.md의 kill switch 전제다. 위험·한계 - 워커 스크립트를 redirect하던 호스트는 이제 FE-GATE-019에서 FAIL이다. 그런 호스트에서는 지금도 워커가 동작하지 않는다. - 브라우저 거절은 명세와 Chromium 오류 문구에 기댄 것이다. redirect하는 호스트로 실제 등록을 돌려 보지 않았고, live 모드도 실제 호스트로 돌리지 않았다(리뷰 §5 미검증 그대로). 검증 - desktop batch에서 확인: node scripts/run-vitest.ts run tests/unit/hosting-probe.test.ts - RED: "live hosting probe (1105/06-02) > fails a worker script the host answers only after a same-origin redirect"가 실패한다. 옛 probe에는 redirect 행이 없어 실패 행이 비어 있다. - 함께: check:types, lint, verify:documentation Refs: 1106/06-01
This commit is contained in:
@@ -125,6 +125,12 @@ export function releaseIdentity(manifest: string | null): ReleaseIdentity | null
|
||||
*
|
||||
* 1103/13-02. The host must negotiate a declared protocol (HTTP/2): the
|
||||
* template splits its initial chunks on that premise.
|
||||
*
|
||||
* 1106/06-01. The worker script alone must also answer without any redirect.
|
||||
* Browsers fetch it with redirect mode "error" (the Service Worker Update
|
||||
* algorithm), so a same-origin redirect breaks registration, every update
|
||||
* check and the REMOVE_REGISTRATION kill switch, although the followed answer
|
||||
* is a 200 with the right headers. Pages may still follow a redirect.
|
||||
*/
|
||||
export async function probeLiveRelease(
|
||||
base: URL,
|
||||
@@ -156,6 +162,17 @@ export async function probeLiveRelease(
|
||||
passed: finalOrigin === base.origin,
|
||||
},
|
||||
);
|
||||
if (surface === "serviceWorker") {
|
||||
const redirected = response.redirected || response.type === "opaqueredirect";
|
||||
results.push({
|
||||
surface,
|
||||
header: "redirect",
|
||||
expected: false,
|
||||
observed: redirected,
|
||||
...(redirected ? { reason: "browsers refuse a redirected worker script" } : {}),
|
||||
passed: !redirected,
|
||||
});
|
||||
}
|
||||
responses[surface] = Object.fromEntries(
|
||||
[...response.headers.entries()].map(([name, value]) => [name.toLowerCase(), value]),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user