docs: document service worker fix, events sort encoding, and slct account_id pattern
BOOTSTRAP__AI_Agent_Quickstart.md: - Mistake #15 addendum: events/session modules use legacy tmp_sort_1 encoding (priority=true→'1'), not build_tmp_sort — requires descending sort until migrated - Mistake #16 (new): service worker without skipWaiting+clients.claim silently serves stale code to long-lived tabs; explains the "can't reproduce in dev" pattern that likely caused the IDAA recovery meetings issue for months CLIENT__IDAA_and_customized_mods.md: - New "Sort Encoding" section: table of legacy vs build_tmp_sort modules with correct comparator direction for each - New "Search Trigger" section: explains why $slct.account_id not $ae_loc.account_id TODO__Agents.md: - IDB Sort: added ae_events__event migration task + legacy encoding warning - DevOps: marked service worker fix complete; replaced nginx caching item with proxy buffer tuning task Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -460,11 +460,31 @@ These are real incidents — know them before you start.
|
||||
|
||||
**Companion Dexie trap:** `collection.reverse().sortBy('tmp_sort_*')` — Dexie ignores a collection-level `.reverse()` when `.sortBy()` is called. The sort is always ascending. To reverse the result, call `.reverse()` on the returned array after `await`. See `GUIDE__SvelteKit2_Svelte5_DexieJS.md` → `build_tmp_sort` section.
|
||||
|
||||
**Exception — legacy `ae_events__event.ts` encoding:** `ae_events__event.ts` (and `ae_events__event_session.ts`) do NOT use `build_tmp_sort`. They use `priority ? 1 : 0` (priority=true→`'1'`), which requires **descending** sort to put priority items first. `ae_events__event_presentation.ts` DOES use `build_tmp_sort` (it overrides the generic encoding in its `specific_processor`). Do not apply the ascending rule to raw event or session sorts until those modules are migrated to `build_tmp_sort`.
|
||||
|
||||
16. **Service worker without `skipWaiting()` + `clients.claim()` silently serves stale code to long-lived tabs** — The default SvelteKit service worker template does NOT include these calls. Without them, a new SW installs in the background but waits in a **"waiting"** state until every tab running the old version is closed before it activates. Users who leave a page open all day (especially IDAA members in the Novi iframe on idaa.org) run old buggy JS indefinitely after a fix is deployed.
|
||||
|
||||
**Symptom that should trigger this check:** Bug reports from users that developers cannot reproduce. Developers constantly refresh and open/close tabs — the new SW activates immediately for them. End users with persistent tabs never get it.
|
||||
|
||||
**The fix** (already applied to `src/service-worker.js` as of 2026-06-03):
|
||||
```js
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(addFilesToCache());
|
||||
self.skipWaiting(); // activate immediately, don't wait for tabs to close
|
||||
});
|
||||
self.addEventListener('activate', (event) => {
|
||||
event.waitUntil(deleteOldCaches());
|
||||
self.clients.claim(); // take control of all open tabs right away
|
||||
});
|
||||
```
|
||||
|
||||
**Trade-off:** A tab mid-session gets new JS without a page reload. For a read-heavy app like IDAA (browsing meetings) this is harmless. For a form-heavy app the risk is higher — weigh accordingly.
|
||||
|
||||
---
|
||||
|
||||
## 8. Source Layout (Quick Reference)
|
||||
|
||||
```
|
||||
```text
|
||||
src/lib/
|
||||
ae_api/ — API helpers (V3 preferred)
|
||||
ae_core/ — Account, User, Person, Site, hosted files
|
||||
|
||||
Reference in New Issue
Block a user