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:
@@ -9,19 +9,24 @@ dependency_graph:
|
||||
affects: [apps/api/src/lib/pushDispatcher.ts]
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns: [default-import-cjs (web-push Pitfall 7), dual-format push payload (iOS 18.4+ declarative + legacy), 410/404 DB prune pattern]
|
||||
patterns:
|
||||
[
|
||||
default-import-cjs (web-push Pitfall 7),
|
||||
dual-format push payload (iOS 18.4+ declarative + legacy),
|
||||
410/404 DB prune pattern,
|
||||
]
|
||||
key_files:
|
||||
created:
|
||||
- apps/api/src/lib/pushDispatcher.ts
|
||||
modified: []
|
||||
decisions:
|
||||
- "dispatchPush uses sub.id (not a separate dbRowId argument) — test calls with 2 args; signature matches test"
|
||||
- "buildPushBody emits both web_push:8030+notification{} (iOS 18.4+) and top-level title/body/tag/data (iOS 16.4–18.3 + Android)"
|
||||
- "setVapidDetails is NOT called at module scope — deferred to index.ts startup (Plan 05-04)"
|
||||
- "dispatchPush never throws — resolves after logging transient errors; safe for fan-out loops"
|
||||
- 'dispatchPush uses sub.id (not a separate dbRowId argument) — test calls with 2 args; signature matches test'
|
||||
- 'buildPushBody emits both web_push:8030+notification{} (iOS 18.4+) and top-level title/body/tag/data (iOS 16.4–18.3 + Android)'
|
||||
- 'setVapidDetails is NOT called at module scope — deferred to index.ts startup (Plan 05-04)'
|
||||
- 'dispatchPush never throws — resolves after logging transient errors; safe for fan-out loops'
|
||||
metrics:
|
||||
duration: 5
|
||||
completed_date: "2026-06-10"
|
||||
completed_date: '2026-06-10'
|
||||
tasks_completed: 1
|
||||
files_changed: 1
|
||||
---
|
||||
@@ -41,10 +46,12 @@ The RED test scaffold was already committed in Plan 05-01 (commit ef558b6). This
|
||||
Created `apps/api/src/lib/pushDispatcher.ts` with:
|
||||
|
||||
**`buildPushBody(notification)`** — builds the dual-format JSON payload string:
|
||||
|
||||
- `web_push: 8030` + `notification: { title, body, navigate }` — iOS 18.4+ declarative web push format
|
||||
- Top-level `title`, `body`, `tag`, `data: { url: navigate }` — legacy format for iOS 16.4–18.3 and Android
|
||||
|
||||
**`dispatchPush(sub, notification)`** — VAPID-signed push send + prune:
|
||||
|
||||
- Constructs `webPushSub = { endpoint, keys: { p256dh, auth } }` from subscription row
|
||||
- Calls `webpush.sendNotification(webPushSub, body, { TTL: 300, urgency: 'normal' })`
|
||||
- On thrown error with `statusCode === 410` or `statusCode === 404`: deletes the row via `db.delete(pushSubscriptions).where(eq(pushSubscriptions.id, sub.id))`
|
||||
@@ -54,6 +61,7 @@ Created `apps/api/src/lib/pushDispatcher.ts` with:
|
||||
Uses default import `import webpush from 'web-push'` (CommonJS — Pitfall 7 from RESEARCH.md).
|
||||
|
||||
**TDD Gate Compliance:**
|
||||
|
||||
- RED: `test(05-01): add Wave-0 RED scaffolds + VAPID fixture + setup truncation` — ef558b6 (Plan 05-01)
|
||||
- GREEN: `feat(05-02): implement pushDispatcher — VAPID send + 410/404 prune` — e4170b3
|
||||
|
||||
@@ -87,9 +95,11 @@ No new threat surface introduced. `pushDispatcher.ts` is a pure utility module
|
||||
## Self-Check
|
||||
|
||||
**Files created/verified:**
|
||||
|
||||
- [x] apps/api/src/lib/pushDispatcher.ts — exists
|
||||
|
||||
**Commits verified:**
|
||||
|
||||
- ef558b6: test(05-01): add Wave-0 RED scaffolds + VAPID fixture + setup truncation (RED gate — from Plan 05-01)
|
||||
- e4170b3: feat(05-02): implement pushDispatcher — VAPID send + 410/404 prune (GREEN gate)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user