문제: 선택 파일은 "Adding an entry here is what installs a capability"라고
적지만 optional host가 실제로 시작하는 것은 Service Worker뿐이다.
realtime·webWorkers·offlineCommands에 항목을 넣으면 아무것도 시작되지
않고 health는 UNAVAILABLE로 남는데, 플랫폼 개요가 읽는 스냅샷은 그
선택을 active로 세어 "활성 (1)"을 보인다. 경고도 실패도 없다.
고른 방법:
- `createOptionalRuntimeHost`가 시작 수단이 없는 capability(realtime,
webWorkers, offlineCommands)가 선택돼 있으면 그 이름을 모두 담아
throw한다. 런타임 설정으로 끈 선택은 resolve 단계에서 빠지므로 막지
않는다. host는 부트 조립에서 만들어지므로 부트 실패 화면으로 드러난다.
- 선택 파일 주석을 "Service Worker만 여기서 설치된다. 나머지는
composition에 런타임을 먼저 연결해야 한다"로 고쳤다.
버린 대안: 주석만 고치기. 스냅샷이 계속 active로 세고, 선택한 제품은
여전히 아무 신호도 받지 못한다.
위험·한계:
- 런타임을 연결하는 제품은 host의 시작 순서와 이 검사를 함께 바꿔야
한다(09-02 확장 지점과 같은 자리). 검사 주석에 적었다.
- health 계산의 세 capability `UNAVAILABLE` 분기는 이제 닿지 않지만,
런타임을 연결할 때 쓸 자리라 남겼다.
- 리뷰 09-05(선택 파일에서 템플릿 상태 설명 분리)는 하지 않았다.
- 초기 JS +127 B gzip(202,995 → 203,122 B, 여유 1,678 B).
검증:
- RED: tests/unit/optional-runtime-host.test.ts의 새 테스트 3건(capability별
하나)이 "expected [Function] to throw an error"로 실패.
- GREEN: 같은 파일 9건 통과.
- 회귀: tests/unit(pnpm을 띄우는 5개 제외) 1,933건, tests/integration
(프로세스를 띄우는 3개 제외) 131건, tests/{component,platform,
architecture,features,contract} 570건 통과. 그중
app-build-input.test.ts 1건이 부하 25에서 10초 시간 초과로 실패했고,
heavy lock 아래 단독 재실행에서 4건 통과. tsc app·test 통과. 바꾼 파일
eslint 통과.
54 lines
2.2 KiB
TypeScript
54 lines
2.2 KiB
TypeScript
import type { InstalledOfflineCommandContribution } from "../contracts/offline-command.ts";
|
|
import type {
|
|
InstalledRealtimeContribution,
|
|
InstalledRuntimeCapabilities,
|
|
} from "../contracts/runtime-capabilities.ts";
|
|
import {
|
|
validateRealtimeContributions,
|
|
} from "../contracts/runtime-capabilities.ts";
|
|
import type { InstalledServiceWorkerSelection } from "../contracts/service-worker.ts";
|
|
import {
|
|
validateWebWorkerContributions,
|
|
type InstalledWebWorkerContribution,
|
|
} from "../contracts/web-worker.ts";
|
|
|
|
/**
|
|
* §3.5. Static optional capability selection SSOT.
|
|
*
|
|
* Runtime Config can only disable what this file already selected, and no
|
|
* dynamic import path is ever built from a configuration string.
|
|
*
|
|
* Only the Service Worker is installed by an entry here alone. Realtime, Web
|
|
* Workers and offline commands have no runtime in the composition yet: a
|
|
* selection without one makes `createOptionalRuntimeHost` refuse to compose
|
|
* (09-07). Connect the runtime there first.
|
|
*
|
|
* Current template state, matching the §25 stop conditions:
|
|
*
|
|
* - realtime: `NOT_SELECTED`. The RT-01..RT-04 common runtime exists and is
|
|
* independently verified, but no product contribution supplies an exact
|
|
* endpoint, event descriptor and recovery mode (§13.6).
|
|
* - webWorkers: `NOT_SELECTED`. No profiled CPU-bound task with an owner
|
|
* exists, so no production worker entry is created (§16.2).
|
|
* - serviceWorker: `null`. Switching to `ACTIVE` also enables the two-pass
|
|
* build in `scripts/build-frontend.ts`.
|
|
* - offlineCommands: `NOT_SELECTED`. No external package declares a `KEYED`
|
|
* operation with a recovery descriptor (§19.3).
|
|
*/
|
|
|
|
const REALTIME: readonly InstalledRealtimeContribution[] = Object.freeze([]);
|
|
|
|
const WEB_WORKERS: readonly InstalledWebWorkerContribution[] = Object.freeze([]);
|
|
|
|
const SERVICE_WORKER: InstalledServiceWorkerSelection | null = null;
|
|
|
|
const OFFLINE_COMMANDS: InstalledOfflineCommandContribution | null = null;
|
|
|
|
export const INSTALLED_RUNTIME_CAPABILITIES: InstalledRuntimeCapabilities =
|
|
Object.freeze({
|
|
realtime: validateRealtimeContributions(REALTIME),
|
|
webWorkers: validateWebWorkerContributions(WEB_WORKERS),
|
|
serviceWorker: SERVICE_WORKER,
|
|
offlineCommands: OFFLINE_COMMANDS,
|
|
});
|