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
@@ -13,33 +13,33 @@ requirements:
- QUICK-i4x
must_haves:
truths:
- "The three background workers schedule their callbacks with setInterval, not node-cron schedule()"
- "No worker file imports node-cron"
- "runPoll / runOutboxDrain / runReminderCheck callback bodies are unchanged (still .catch-wrapped)"
- "Interval timings are preserved: poller 5 min, outbox 15 s, reminder 1 min"
- "apps/api typechecks clean and the broker unit tests still pass"
- 'The three background workers schedule their callbacks with setInterval, not node-cron schedule()'
- 'No worker file imports node-cron'
- 'runPoll / runOutboxDrain / runReminderCheck callback bodies are unchanged (still .catch-wrapped)'
- 'Interval timings are preserved: poller 5 min, outbox 15 s, reminder 1 min'
- 'apps/api typechecks clean and the broker unit tests still pass'
artifacts:
- path: "apps/api/src/broker/poller.ts"
provides: "startBrokerPoller scheduling runPoll via setInterval(5min)"
contains: "setInterval"
- path: "apps/api/src/broker/outboxWorker.ts"
provides: "startOutboxWorker scheduling runOutboxDrain via setInterval(15s)"
contains: "setInterval"
- path: "apps/api/src/broker/reminderScheduler.ts"
provides: "startReminderScheduler scheduling runReminderCheck via setInterval(1min)"
contains: "setInterval"
- path: 'apps/api/src/broker/poller.ts'
provides: 'startBrokerPoller scheduling runPoll via setInterval(5min)'
contains: 'setInterval'
- path: 'apps/api/src/broker/outboxWorker.ts'
provides: 'startOutboxWorker scheduling runOutboxDrain via setInterval(15s)'
contains: 'setInterval'
- path: 'apps/api/src/broker/reminderScheduler.ts'
provides: 'startReminderScheduler scheduling runReminderCheck via setInterval(1min)'
contains: 'setInterval'
key_links:
- from: "apps/api/src/broker/poller.ts"
to: "runPoll"
via: "setInterval(cb, 5 * 60 * 1000)"
- from: 'apps/api/src/broker/poller.ts'
to: 'runPoll'
via: 'setInterval(cb, 5 * 60 * 1000)'
pattern: "setInterval\\("
- from: "apps/api/src/broker/outboxWorker.ts"
to: "runOutboxDrain"
via: "setInterval(cb, 15 * 1000)"
- from: 'apps/api/src/broker/outboxWorker.ts'
to: 'runOutboxDrain'
via: 'setInterval(cb, 15 * 1000)'
pattern: "setInterval\\("
- from: "apps/api/src/broker/reminderScheduler.ts"
to: "runReminderCheck"
via: "setInterval(cb, 60 * 1000)"
- from: 'apps/api/src/broker/reminderScheduler.ts'
to: 'runReminderCheck'
via: 'setInterval(cb, 60 * 1000)'
pattern: "setInterval\\("
---
@@ -68,8 +68,10 @@ intervals, with the now-unused `node-cron` import removed and stale doc comments
<context>
@./CLAUDE.md
# The three worker files — only the start* functions and their doc comments change.
# The three worker files — only the start\* functions and their doc comments change.
# Do NOT modify runPoll / runOutboxDrain / runReminderCheck logic.
@apps/api/src/broker/poller.ts
@apps/api/src/broker/outboxWorker.ts
@apps/api/src/broker/reminderScheduler.ts
@@ -108,35 +110,36 @@ current pattern (the workers run for the process lifetime).
Update the now-stale doc comments that reference node-cron so they describe setInterval, keeping
the WHY. Specifically:
- poller.ts: the file-header line "runs every 5 minutes via node-cron", the
"startBrokerPoller wraps it in node-cron's 5-minute schedule." line, the
"Source: https://github.com/node-cron/node-cron ..." source line, and the
"Starts the 5-minute background polling schedule." block.
- outboxWorker.ts: "startOutboxWorker wraps it in a 15-second node-cron schedule." and the
"Source: https://github.com/node-cron/node-cron (v4 stable)" line, plus the
"Starts the 15-second background outbox drain schedule." block.
- reminderScheduler.ts: the file-header "Fires every minute via node-cron." line and the
"Start the 1-minute reminder scan schedule." block comment ("keeps the cron out of the test
process" → setInterval phrasing).
Each updated comment must briefly state the WHY (node-cron 4.2.1 skipped scheduled executions
in the long-running server process, so scheduling uses setInterval instead). Keep edits brief —
do not rewrite the surrounding decision/threat-mitigation prose. Leave the `node-cron` dependency
in package.json (now unused, harmless); it is removable later but removing it now risks lockfile
drift and is out of scope for this tight change.
- poller.ts: the file-header line "runs every 5 minutes via node-cron", the
"startBrokerPoller wraps it in node-cron's 5-minute schedule." line, the
"Source: https://github.com/node-cron/node-cron ..." source line, and the
"Starts the 5-minute background polling schedule." block.
- outboxWorker.ts: "startOutboxWorker wraps it in a 15-second node-cron schedule." and the
"Source: https://github.com/node-cron/node-cron (v4 stable)" line, plus the
"Starts the 15-second background outbox drain schedule." block.
- reminderScheduler.ts: the file-header "Fires every minute via node-cron." line and the
"Start the 1-minute reminder scan schedule." block comment ("keeps the cron out of the test
process" → setInterval phrasing).
Each updated comment must briefly state the WHY (node-cron 4.2.1 skipped scheduled executions
in the long-running server process, so scheduling uses setInterval instead). Keep edits brief —
do not rewrite the surrounding decision/threat-mitigation prose. Leave the `node-cron` dependency
in package.json (now unused, harmless); it is removable later but removing it now risks lockfile
drift and is out of scope for this tight change.
</action>
<verify>
<automated>cd /home/luc/Projects/familysync && ! grep -rn "node-cron" apps/api/src/broker/poller.ts apps/api/src/broker/outboxWorker.ts apps/api/src/broker/reminderScheduler.ts | grep -v '^\s*[0-9]*:.*//' ; grep -c "setInterval" apps/api/src/broker/poller.ts apps/api/src/broker/outboxWorker.ts apps/api/src/broker/reminderScheduler.ts</automated>
<automated>cd /home/luc/Projects/familysync && pnpm --filter @familysync/api typecheck</automated>
<automated>cd /home/luc/Projects/familysync && pnpm --filter @familysync/api exec vitest run tests/broker/</automated>
<automated>cd /home/luc/Projects/familysync && ! grep -rn "node-cron" apps/api/src/broker/poller.ts apps/api/src/broker/outboxWorker.ts apps/api/src/broker/reminderScheduler.ts | grep -v '^\s*[0-9]*:._//' ; grep -c "setInterval" apps/api/src/broker/poller.ts apps/api/src/broker/outboxWorker.ts apps/api/src/broker/reminderScheduler.ts</automated>
<automated>cd /home/luc/Projects/familysync && pnpm --filter @familysync/api typecheck</automated>
<automated>cd /home/luc/Projects/familysync && pnpm --filter @familysync/api exec vitest run tests/broker/</automated>
</verify>
<done>
All three files import setInterval-based scheduling with no remaining `import { schedule } from 'node-cron'`;
each start* function calls setInterval at the correct interval (poller 300000 ms, outbox 15000 ms,
reminder 60000 ms) with its original callback body intact; `pnpm --filter @familysync/api typecheck`
exits 0; and `pnpm --filter @familysync/api exec vitest run tests/broker/` reports all broker tests
green (runPoll / runOutboxDrain / runReminderCheck behavior unchanged).
All three files import setInterval-based scheduling with no remaining `import { schedule } from 'node-cron'`;
each start_ function calls setInterval at the correct interval (poller 300000 ms, outbox 15000 ms,
reminder 60000 ms) with its original callback body intact; `pnpm --filter @familysync/api typecheck`
exits 0; and `pnpm --filter @familysync/api exec vitest run tests/broker/` reports all broker tests
green (runPoll / runOutboxDrain / runReminderCheck behavior unchanged).
</done>
</task>
</task>
</tasks>
@@ -1,6 +1,6 @@
---
phase: quick-260610-i4x
plan: "01"
plan: '01'
subsystem: broker
tags: [scheduler, setInterval, node-cron, fix]
dependency_graph:
@@ -17,9 +17,9 @@ key_files:
- apps/api/src/broker/outboxWorker.ts
- apps/api/src/broker/reminderScheduler.ts
decisions:
- "Use setInterval for broker worker scheduling: node-cron 4.2.1 silently skipped executions in the long-running API process; setInterval is reliable in the same process"
- 'Use setInterval for broker worker scheduling: node-cron 4.2.1 silently skipped executions in the long-running API process; setInterval is reliable in the same process'
metrics:
completed: "2026-06-10"
completed: '2026-06-10'
---
# Quick Task 260610-i4x: Replace node-cron with setInterval in Broker Workers Summary
@@ -28,23 +28,26 @@ metrics:
## Tasks Completed
| Task | Name | Commit | Files |
|------|------|--------|-------|
| 1 | Swap node-cron schedule() for setInterval in the three worker start* functions | d9efbc1 | poller.ts, outboxWorker.ts, reminderScheduler.ts |
| Task | Name | Commit | Files |
| ---- | ------------------------------------------------------------------------------- | ------- | ------------------------------------------------ |
| 1 | Swap node-cron schedule() for setInterval in the three worker start\* functions | d9efbc1 | poller.ts, outboxWorker.ts, reminderScheduler.ts |
## Changes Made
### apps/api/src/broker/poller.ts
- Removed `import { schedule } from 'node-cron'`
- `startBrokerPoller`: `schedule('*/5 * * * *', cb)``setInterval(cb, 5 * 60 * 1000)`
- Updated file-header and JSDoc comments to reference setInterval and document the WHY
### apps/api/src/broker/outboxWorker.ts
- Removed `import { schedule } from 'node-cron'`
- `startOutboxWorker`: `schedule('*/15 * * * * *', cb)``setInterval(cb, 15 * 1000)`
- Updated header comment and scheduler JSDoc
### apps/api/src/broker/reminderScheduler.ts
- Removed `import { schedule } from 'node-cron'`
- `startReminderScheduler`: `schedule('* * * * *', cb)``setInterval(cb, 60 * 1000)`
- Updated file-header "Fires every minute" line and scheduler JSDoc
@@ -16,48 +16,48 @@ score: 5/5 must-haves verified
### Observable Truths
| # | Truth | Status | Evidence |
|---|-------|--------|----------|
| 1 | The three background workers schedule their callbacks with setInterval, not node-cron schedule() | VERIFIED | Each start* function contains `setInterval(()=>{…}, N)` at lines poller.ts:96, outboxWorker.ts:758, reminderScheduler.ts:210. Zero `schedule(` calls remain in any of the three files. |
| 2 | No worker file imports node-cron | VERIFIED | All remaining `node-cron` text is inside JSDoc block comments (WHY context). `grep -n "import.*node-cron"` returns no matches. Commit d9efbc1 stat confirms only 3 files changed. |
| 3 | runPoll / runOutboxDrain / runReminderCheck callback bodies are unchanged (still .catch-wrapped) | VERIFIED | poller.ts:97 `runPoll().catch(...)`, outboxWorker.ts:759 `runOutboxDrain().catch(...)`, reminderScheduler.ts:211 `runReminderCheck().catch(...)` — identical catch wrappers present. |
| 4 | Interval timings are preserved: poller 5 min, outbox 15 s, reminder 1 min | VERIFIED | poller.ts:100 `5 * 60 * 1000` (300000 ms), outboxWorker.ts:762 `15 * 1000` (15000 ms), reminderScheduler.ts:214 `60 * 1000` (60000 ms). |
| 5 | apps/api typechecks clean and the broker unit tests still pass | VERIFIED | `pnpm --filter @familysync/api typecheck` exited 0 (no output). `pnpm --filter @familysync/api exec vitest run tests/broker/` reported 8 test files passed, 91 tests passed. |
| # | Truth | Status | Evidence |
| --- | ------------------------------------------------------------------------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | The three background workers schedule their callbacks with setInterval, not node-cron schedule() | VERIFIED | Each start\* function contains `setInterval(()=>{…}, N)` at lines poller.ts:96, outboxWorker.ts:758, reminderScheduler.ts:210. Zero `schedule(` calls remain in any of the three files. |
| 2 | No worker file imports node-cron | VERIFIED | All remaining `node-cron` text is inside JSDoc block comments (WHY context). `grep -n "import.*node-cron"` returns no matches. Commit d9efbc1 stat confirms only 3 files changed. |
| 3 | runPoll / runOutboxDrain / runReminderCheck callback bodies are unchanged (still .catch-wrapped) | VERIFIED | poller.ts:97 `runPoll().catch(...)`, outboxWorker.ts:759 `runOutboxDrain().catch(...)`, reminderScheduler.ts:211 `runReminderCheck().catch(...)` — identical catch wrappers present. |
| 4 | Interval timings are preserved: poller 5 min, outbox 15 s, reminder 1 min | VERIFIED | poller.ts:100 `5 * 60 * 1000` (300000 ms), outboxWorker.ts:762 `15 * 1000` (15000 ms), reminderScheduler.ts:214 `60 * 1000` (60000 ms). |
| 5 | apps/api typechecks clean and the broker unit tests still pass | VERIFIED | `pnpm --filter @familysync/api typecheck` exited 0 (no output). `pnpm --filter @familysync/api exec vitest run tests/broker/` reported 8 test files passed, 91 tests passed. |
**Score:** 5/5 truths verified
### Required Artifacts
| Artifact | Expected | Status | Details |
|----------|----------|--------|---------|
| `apps/api/src/broker/poller.ts` | startBrokerPoller scheduling runPoll via setInterval(5min) | VERIFIED | setInterval at line 96, `5 * 60 * 1000` at line 100, `runPoll().catch(...)` callback |
| `apps/api/src/broker/outboxWorker.ts` | startOutboxWorker scheduling runOutboxDrain via setInterval(15s) | VERIFIED | setInterval at line 758, `15 * 1000` at line 762, `runOutboxDrain().catch(...)` callback |
| Artifact | Expected | Status | Details |
| ------------------------------------------ | ------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------ |
| `apps/api/src/broker/poller.ts` | startBrokerPoller scheduling runPoll via setInterval(5min) | VERIFIED | setInterval at line 96, `5 * 60 * 1000` at line 100, `runPoll().catch(...)` callback |
| `apps/api/src/broker/outboxWorker.ts` | startOutboxWorker scheduling runOutboxDrain via setInterval(15s) | VERIFIED | setInterval at line 758, `15 * 1000` at line 762, `runOutboxDrain().catch(...)` callback |
| `apps/api/src/broker/reminderScheduler.ts` | startReminderScheduler scheduling runReminderCheck via setInterval(1min) | VERIFIED | setInterval at line 210, `60 * 1000` at line 214, `runReminderCheck().catch(...)` callback |
### Key Link Verification
| From | To | Via | Status | Details |
|------|----|-----|--------|---------|
| `apps/api/src/broker/poller.ts` | runPoll | `setInterval(cb, 5 * 60 * 1000)` | VERIFIED | Line 96-100 in startBrokerPoller |
| `apps/api/src/broker/outboxWorker.ts` | runOutboxDrain | `setInterval(cb, 15 * 1000)` | VERIFIED | Line 758-762 in startOutboxWorker |
| `apps/api/src/broker/reminderScheduler.ts` | runReminderCheck | `setInterval(cb, 60 * 1000)` | VERIFIED | Line 210-214 in startReminderScheduler |
| From | To | Via | Status | Details |
| ------------------------------------------ | ---------------- | -------------------------------- | -------- | -------------------------------------- |
| `apps/api/src/broker/poller.ts` | runPoll | `setInterval(cb, 5 * 60 * 1000)` | VERIFIED | Line 96-100 in startBrokerPoller |
| `apps/api/src/broker/outboxWorker.ts` | runOutboxDrain | `setInterval(cb, 15 * 1000)` | VERIFIED | Line 758-762 in startOutboxWorker |
| `apps/api/src/broker/reminderScheduler.ts` | runReminderCheck | `setInterval(cb, 60 * 1000)` | VERIFIED | Line 210-214 in startReminderScheduler |
### Behavioral Spot-Checks
| Behavior | Command | Result | Status |
|----------|---------|--------|--------|
| TypeScript compiles clean | `pnpm --filter @familysync/api typecheck` | exit 0, no output | PASS |
| Broker unit tests pass | `pnpm --filter @familysync/api exec vitest run tests/broker/` | 8 files / 91 tests passed | PASS |
| Behavior | Command | Result | Status |
| ------------------------- | ------------------------------------------------------------- | ------------------------- | ------ |
| TypeScript compiles clean | `pnpm --filter @familysync/api typecheck` | exit 0, no output | PASS |
| Broker unit tests pass | `pnpm --filter @familysync/api exec vitest run tests/broker/` | 8 files / 91 tests passed | PASS |
### Scope Containment
| Check | Result |
|-------|--------|
| Check | Result |
| ----------------------------------- | ------------------------------------------------------------------------------- |
| Commit d9efbc1 touches only 3 files | VERIFIED — git show stat: outboxWorker.ts, poller.ts, reminderScheduler.ts only |
| index.ts not modified | VERIFIED — not in commit stat |
| package.json not modified | VERIFIED — not in commit stat |
| pnpm-lock.yaml not modified | VERIFIED — not in commit stat |
| No `.unref()` added | VERIFIED — grep returns no matches in any of the three files |
| index.ts not modified | VERIFIED — not in commit stat |
| package.json not modified | VERIFIED — not in commit stat |
| pnpm-lock.yaml not modified | VERIFIED — not in commit stat |
| No `.unref()` added | VERIFIED — grep returns no matches in any of the three files |
### Anti-Patterns Found