Offline Packaging Risks
"/home/yossef/notes/git/projects/maplibra/risks/Offline Packaging Risks.md"
path: maplibra/risks/Offline Packaging Risks.md
- **fileName**: Offline Packaging Risks
- **Created on**: 2026-06-16 00:48:42
Offline Packaging Risks
Purpose: Offline-specific bugs and drift points for packaged maps.
Related: ../Home.md, ./Risk Map.md, ../modules/Service Worker and Offline.md, ../modules/Android Bridge.md, ../decisions/Caching Strategy.md
Migrated from: obs_vault
Key Risks
- Incomplete precache — offline-assets.json can drift from the actual build output, causing missing files offline
- Manifest drift — service worker manifest not updated after build changes
- sw.js alignment — service worker file and registration version can diverge
- Opportunistic cache writes — runtime cache entries may conflict with manifest entries; write-back failures can go unnoticed
- Host rule alignment —
src/app/service-worker.jsandpublic/sw.jsmust stay aligned on host rules or Android app-assets behavior becomes confusing - Manifest identity — the service worker cache is versioned, but the manifest content itself has no visible package identity, so drift can be subtle
- Packaged map routing failure — a package can open but still fail to route if derived assets are incomplete
Common Failure Modes
- Package opens but routing fails → derived assets missing or stale
- Offline basemap blank → PMTiles URL wrong or tiles not cached
- Theme drift in offline → static JSON style vs dynamic style mismatch (see ./Offline Basemap Theme Drift.md)
- Cache clear doesn't fully reset → service worker still serves stale data
Debugging
- Check
offline-assets.jsonmatches the build output - Verify
sw.jsinstall handler caches the right files - Test with
?clearto force a clean state - Check IndexedDB for stale derived asset entries
- Verify
CACHED_MVF_SCHEMA_VERSIONmatches current app version
Important Files
-
src/app/offline-config.js -
src/app/service-worker.js -
public/sw.js -
docs/offline-packaging.mdcontinue:[[]]
before:[[]]