feat(sync): a task received by sync gets its reminder on the phone (#206) #209

Open
maximus wants to merge 3 commits from issue-206-sync-reminder into master

3 commits

Author SHA1 Message Date
le king fu
c9597aa703 docs(review): state the cost of the reminder at the pull exactly (#206)
Self-review of the PR: the Sync bullet said « au moins un appel natif par
tâche reçue ». The pull makes one call to the notifications service per
task it applies; the native calls behind it vary (up to two to schedule,
one to cancel, none for a task to schedule while notifications are off),
so the bullet now counts the service calls only.

Refs #206

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 18:49:21 -05:00
le king fu
d6adcf7133 docs(review): reminder at the pull and ninth sync scenario (#206)
- Sync zone: a task received by the pull gets its reminder through
  reminderPlan, executed by applyTaskChange after its local write; a row
  kept by keepLocal is left alone; cost per received task and known limits.
- Verification commands: the sync harness counts nine scenarios. Its
  notifications stub records the calls, answers at once and never throws,
  so the await and the try/catch of applyTaskChange hold by the smoke check
  alone.

Refs #206

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 18:37:11 -05:00
le king fu
9434cb77ef feat(sync): schedule the reminder of a task received by the pull (#206)
A task created on the companion, or tomorrow by an AI assistant, never rang
on the phone: only src/db/repository/tasks.ts scheduled or cancelled
reminders, and applyTaskChange wrote the pulled row without touching them.
A task completed or deleted elsewhere kept its reminder.

- syncRules.ts: reminderPlan(action, task), pure and import-free, returns
  'schedule' for an open task with a due date, 'cancel' for a completed
  task, a task without a due date or a deletion.
- syncClient.ts: applyTaskChange executes the plan after its local write,
  through scheduleTaskReminder and cancelTaskReminder, awaited and with
  their errors swallowed as in the task repository. A deletion now falls
  through to the reminder instead of returning early; a row kept by
  keepLocal still returns before any call.
- tests/syncRules.test.mjs: the cases of reminderPlan.
- tests/smoke.test.cjs: wiring of applyTaskChange, checked by reading the
  source (syncClient.ts does not load under node).
- web/src/test/sync: the notifications stub records the calls of each
  device, and a ninth scenario covers the reminder scheduled on receipt,
  cancelled once the task is completed or deleted elsewhere, and untouched
  for a row kept by keepLocal.

No dependency added, no new host, version and versionCode unchanged.

Refs #206

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 18:28:30 -05:00