Stage 3: offline/PWA foundation — SW registration + minimal shell SW

- Normalize branch to main
- public/sw.js: hand-written, tiny (install precache + activate cleanup + fetch navigation/assets cache-first + package passthrough /latest.json /editions/** C-21 + message SKIP_WAITING). Safe population: open+addAll atomically, delete partial on failure; versioned cache lumen-shell-<version>-<gitHash> deterministic per build (injected via Vite plugin, not static); no skipWaiting in install (next full start per ARCH §8), no IDB/sync/dataset/B-5
- public/fallback.html: Ring-0 last-resort, no IDB, preserves future emergency baseline (src/emergency-baseline remains empty until Stage 10)
- src/platform/sw/register.ts: offline-safe bridge, never blocks boot, scope /, handles unsupported/failed, skipWaitingForUpdate
- src/app/main.ts: import + void registerSW().catch (non-blocking)
- vite.config.ts: lumenShellPlugin closeBundle injects CACHE_NAME + PRECACHE_URLS (core /, index.html, fallback.html, manifest, icons + hashed assets/*) + precache-manifest.json; hashed immutable assets via rollup output
- Build: dist/index.html 0.92kB, style 3.06kB/1.18gz, js 8.15kB/2.74gz (shell <1MB/150kB budgets)
- Tests: tests/unit/sw.test.ts (16 tests: file minimal, B-5, install/activate/fetch/message, package passthrough, fallback last-resort, registration unsupported/registered/failed, skipWaiting, versioning)
- CI: typecheck + lint + format + test (34 tests) + build — desktop automation; iOS lifecycle/persistence/eviction/jetsam/install still physical-device validation per ARCHITECTURE-VALIDATION.md §4
This commit is contained in:
Lumen Stage1 2026-08-30 23:36:23 -05:00
commit 615ae2565c
7 changed files with 418 additions and 10 deletions

View file

@ -6,7 +6,7 @@ import globals from "globals";
// eslint-disable-next-line @typescript-eslint/no-deprecated
export default tseslint.config(
{
ignores: ["dist/**", "node_modules/**", "coverage/**", "experiments/**"],
ignores: ["dist/**", "node_modules/**", "coverage/**", "experiments/**", "public/sw.js"],
},
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
@ -15,7 +15,12 @@ export default tseslint.config(
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ["eslint.config.js", "vitest.config.ts", "vite.config.ts"],
allowDefaultProject: [
"eslint.config.js",
"vitest.config.ts",
"vite.config.ts",
"public/sw.js",
],
},
tsconfigRootDir: import.meta.dirname,
},