Commit Graph

3 Commits

Author SHA1 Message Date
Scott Idem
81874ffa5d fix(sw): complete cache-clearing + add controllerchange auto-reload
All cache-clearing buttons and the IDAA clear-caches page previously
cleared IDB/localStorage but left service worker registrations and Cache
Storage intact. On the next reload the SW re-served the old JS bundle,
leaving users stuck on stale code despite appearing to reload. This
caused recurring stale-state reports from IDAA and other clients for
4+ months.

Two gaps closed:
1. Every clear path (root page buttons, sys bar, help tech, idaa/clear-caches)
   now unregisters SW registrations and clears Cache Storage before touching
   IDB and localStorage. Order: SW → Cache Storage → IDB → localStorage.
2. Added controllerchange listener in +layout.svelte effect 4. When the new
   SW activates and calls clients.claim(), this listener reloads the page so
   open tabs run the new JS bundle instead of keeping old code in memory
   indefinitely. Without this, skipWaiting + clients.claim work correctly on
   the SW side but the page side never picks up the update.

Also added thorough code comments and updated REFERENCE__Common_Agent_Mistakes
(#15) and BOOTSTRAP doc (#8) to document the full root cause so this cannot
be silently re-broken by a future agent or refactor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 12:17:51 -04:00
Scott Idem
8f0dbf3d1d docs: capture today's Pres Mgmt config sync lessons for future agents
- BOOTSTRAP__AI_Agent_Quickstart.md: new category 9 under Common Mistakes
  pointing to today's incident (local/remote config sync pitfalls)
- REFERENCE__Common_Agent_Mistakes.md: three new entries —
  16) local "shadow field" silently bypasses an admin-synced master field
  17) SWR await after a write does not mean dependent caches are fresh
  18) conditional/stateful sync gates are effectively undebuggable
- PROJECT__Stores_Svelte5_Migration.md: updated the canonical Migration
  Pattern example to stamp __version in the serializer (the old example
  silently didn't, which is exactly what caused the leads_loc/pres_mgmt_loc
  bugs fixed today); flagged badges_loc/launcher_loc/events_auth_loc as
  not yet fixed (dormant, not harmful) and idaa_loc as the next migration
  that should get this from day one
- TODO__Agents.md: cross-referenced today's Pres Mgmt config sync overhaul
  in the LCI October restoration section for context, without touching
  the open items in that list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 15:12:11 -04:00
Scott Idem
a227c6aaa7 docs: restructure bootstrap, add module references, and normalize docs 2026-06-12 16:48:35 -04:00