style(13-03): apply Prettier formatting across repo

Mechanical reformat — no logic changes. 398 files changed, 19125
insertions(+), 16457 deletions(-). Prettier 3.8.4 with .prettierrc
(singleQuote:true, semi:true, tabWidth:2, trailingComma:all,
printWidth:100). Isolated per D-13-08 for reviewability.
This commit is contained in:
Lucas Berger
2026-06-11 20:35:18 -04:00
parent 4bc0445173
commit 982438dc10
398 changed files with 19050 additions and 16382 deletions
@@ -5,24 +5,29 @@ subsystem: api/push-coalescer
tags: [web-push, coalescer, debounce, tdd, red-green, D-01, D-03]
dependency_graph:
requires: [05-01, 05-02]
provides: [coalesceListPush — per-(list,actor) sliding debounce]
provides: [coalesceListPush — per-(list, actor) sliding debounce]
affects: [apps/api/src/lib/pushCoalescer.ts]
tech_stack:
added: []
patterns: [module-level Map singleton (listEmitter.ts idiom), sliding debounce setTimeout, injected dispatch for testability]
patterns:
[
module-level Map singleton (listEmitter.ts idiom),
sliding debounce setTimeout,
injected dispatch for testability,
]
key_files:
created:
- apps/api/src/lib/pushCoalescer.ts
modified:
- apps/api/tests/lib/pushCoalescer.test.ts
decisions:
- "dispatch signature is (listId, actorId, count) — matches existing RED scaffold; richer payload shape deferred to caller (Plan 05-05)"
- "key is ${listId}:${actorId} — per-(list,actor) matches D-01 intent; allows two members editing same list to coalesce independently"
- "sliding debounce (each call resets timer) — per plan spec; leading debounce not used"
- "dispatch return value is a Promise; errors caught and logged inside fire() so caller loop never breaks"
- 'dispatch signature is (listId, actorId, count) — matches existing RED scaffold; richer payload shape deferred to caller (Plan 05-05)'
- 'key is ${listId}:${actorId} — per-(list,actor) matches D-01 intent; allows two members editing same list to coalesce independently'
- 'sliding debounce (each call resets timer) — per plan spec; leading debounce not used'
- 'dispatch return value is a Promise; errors caught and logged inside fire() so caller loop never breaks'
metrics:
duration: 5
completed_date: "2026-06-10"
completed_date: '2026-06-10'
tasks_completed: 2
files_changed: 2
---
@@ -48,6 +53,7 @@ Tests still fail after this change (RED preserved): `Cannot find module '.../pus
Created `apps/api/src/lib/pushCoalescer.ts`:
**`coalesceListPush(listId, actorId, dispatch, windowMs=45000)`**
- Module-level `Map<string, {count, timer}>` keyed by `${listId}:${actorId}`
- First call in a burst: inserts entry with count=1, starts `setTimeout(windowMs)`
- Subsequent calls within window: `clearTimeout`, increments count, resets timer (sliding debounce)
@@ -75,6 +81,7 @@ pnpm --filter @familysync/api exec vitest run tests/lib/pushCoalescer.test.ts
### Auto-fixed Issues
**1. [Rule 1 - Bug] Lint warning — unused `calledActorId` in burst test**
- **Found during:** Task 1 (RED)
- **Issue:** `calledActorId` was destructured in test 1 but the assertion was missing, producing an unused-variable lint warning.
- **Fix:** Added `expect(calledActorId).toBe(actorId)` — the burst test now also asserts self-suppression, not just the dedicated D-03 test.
@@ -102,10 +109,12 @@ T-05-08 (unbounded map): accepted — entries self-delete on timer fire; two-per
## Self-Check
**Files verified:**
- [x] apps/api/src/lib/pushCoalescer.ts — exists
- [x] apps/api/tests/lib/pushCoalescer.test.ts — modified
**Commits verified:**
- 7af827a: test(05-03): add actorId assertion in burst test — fix unused var lint warning (RED gate)
- c1758de: feat(05-03): implement pushCoalescer — per-(list,actor) sliding debounce (D-01/D-03) (GREEN gate)