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:
parent
902a1ffc22
commit
615ae2565c
7 changed files with 418 additions and 10 deletions
|
|
@ -23,15 +23,16 @@ describe("architectural boundaries — Stage 1 gate (B-1…B-7)", () => {
|
|||
expect(tsFiles).toEqual(
|
||||
expect.arrayContaining(["src/app/layout.ts", "src/app/main.ts", "src/ui/router/router.ts"]),
|
||||
);
|
||||
// Forbidden stores must remain empty in Stage 2
|
||||
// Forbidden stores must remain empty — Stage 3 allows platform/sw/register only
|
||||
const forbidden = tsFiles.filter(
|
||||
(f) =>
|
||||
f.startsWith("src/platform/") ||
|
||||
f.startsWith("src/platform/idb/") ||
|
||||
f.startsWith("src/platform/cache/") ||
|
||||
f.startsWith("src/storage/") ||
|
||||
f.startsWith("src/data/") ||
|
||||
f.startsWith("src/sync/"),
|
||||
);
|
||||
expect(forbidden, `Stage 2 must not have forbidden stores: ${forbidden.join(", ")}`).toEqual(
|
||||
expect(forbidden, `Stage 3 must not have forbidden stores: ${forbidden.join(", ")}`).toEqual(
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue