Review of PR #185: the Sync rule said writeOutboxEntry writes only while
sync is on. Fixed at the top of the stack so the reviewed links keep their
heads.
Refs #165
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decision of Max at /pr-brief 185 (2026-11-03): a change made during the few
seconds of « Fusionner » (or « Charger ce compte ») must reach the server.
initialMerge and initialReset run while sync is still off, so writeOutboxEntry
dropped such a write. The outbox now also queues while a first sync runs, and
the merge points the pending entries that name the fixed local Inbox at the
server Inbox (remapInboxEntry), otherwise the server refuses them.
Refs #165
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of PR #187: the regex did not allow the line break between
.delete(taskTags) and .where(...), so the guard could never fail.
Refs #180
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of PR #186: both behaviour changes of the shared task query were
untested; removing either condition left the suite green.
Refs #179
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of PR #183: the socket was dropped from the client set but left open,
outside the heartbeat, so its page was never notified again. terminate()
closes it and the page reconnects through onclose.
Refs #177
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A single free place with a queued backlog starts no run until a second
place frees up; the condition alone was not pinned by the latency test.
Refs #178
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of PR #184: when the budget freed up one place at a time (requests
spread by network latency), every place went to a pull-only run with
pushBatches = 0, so a queued backlog was never sent while the device spent
6 GETs a minute. The scheduler now waits for two free places.
Tests: a fake server with 300 ms per request (9-batch queue empties within
4 min, no run without a POST place), the 600 s Retry-After bound, and source
guards for the `more` signal of pushChanges and the budget of initialMerge.
Refs #178
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sidebar's Tags section gets a "Manage tags" mode, on par with the
app's Settings: create a tag (name + color from the app palette),
rename it, change its color, delete it after a confirmation. A deleted
tag leaves the sidebar at once; when it was the active filter, ?tags=
leaves the URL. router.refresh() reloads the server data so the task
detail view offers new tags without a reload.
The logic (palette, name check, list after deletion, URL after the
active filter's tag is deleted) lives in the pure helper
web/src/lib/tagEditing.ts, covered by vitest; the JSX is not tested.
No API route and no dependency change.
Refs #182
Refs #168
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migration 0003 adds sl_tags.updated_at (default now(), backfilled from
created_at). Every tag write moves it (PUT/DELETE /api/tags/[id], tag
update/delete in POST /api/sync), and GET /api/sync pulls tags on
updatedAt >= since. Deleting a tag removes its links and moves the
touched tasks' updatedAt in the same transaction, so the app realigns
their links on the next pull.
The user_id ALTERs drizzle-kit re-emitted from the stale 0000 snapshot
are dropped from 0003 (0001 applied them); the new snapshot is current.
Refs #181
Refs #168
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
App: setTagsForTask diffs with the local links and writes one taskTag
delete per removed link and one create per added link; addTagToTask and
removeTagFromTask write their entry and request a sync. The pull aligns
the links of every pulled task on the set the server sent, by direct
writes on task_tags in one transaction, sparing links with an unsent
taskTag entry (pure rule alignedTagIds in syncRules.ts).
Server: every link add or removal (REST routes and the taskTag case of
POST /api/sync) moves sl_tasks.updatedAt, so GET /api/sync sends the task
with its whole set of links. Task and tag creates in POST /api/sync refuse
an id taken by another account (assertIdNotTaken) instead of answering
applied without writing.
Refs #180
Refs #168
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A link joins two owned rows: REVIEW.md asks for the ownership check on both
sides, so loadTaskTags also joins sl_tasks on the account (still one query).
Refs #179
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- web/src/lib/taskQueries.ts: list task query (existing filters + tags),
subtasks, loadTaskTags (one query, live tags of the account only) and the
account tags, shared by the list page and GET /api/lists/[id]/tasks.
- ?tags= validated by zod (at most 20 UUIDs, count checked first); the tag
filter joins sl_tags on the account and deleted_at IS NULL; 400 on a
malformed value.
- TaskItem: tag pills on tasks and subtasks; the detail view adds an
existing tag and removes one through the task-tag API.
- Sidebar: a click on a tag filters the current view by ?tags=<id>, a second
click removes it; FilterBar shows the active tag filter.
- FR/EN strings.
Refs #179
Refs #168
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #165
A device holding another account's data (dataOwnerId, persisted, kept at
sign-out) only offers « Charger ce compte » (initialReset) or « Annuler »
(sign-out, data untouched), at sign-in and on « Synchroniser ». The rule
lives in syncRules.ts (firstSyncChoice).
Sync stays off until initialMerge or initialReset has succeeded, and the
scheduler refuses every sync while the local data belong to another account
(canSync): the outbox of the old account is never pushed under the new one.
The sync's own outbox writes (kept rows, the Inbox of initialReset) no
longer depend on syncEnabled, and the token getter follows the session, so
that the first sync runs with sync still off.
Sign-out pushes the outbox first (10 s at most, in the first-sync state of
the scheduler, one request reserved outside its budget) and warns with the
number of changes still unsent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every sync now goes through one scheduler (src/services/syncSchedule.ts,
pure and import-free): one sync at a time, a request during a sync gives a
single relaunch, a sliding budget of 6 real HTTP requests per 60 s (each
POST batch and each GET counted, initialMerge and initialReset included),
pushChanges sends the batches the budget allows (MAX_PUSH_BATCHES becomes a
ceiling) and the rest of the queue follows once the window frees, a 429
suspends the scheduler until Retry-After, and no sync starts during
initialMerge / initialReset.
The repositories call requestSync() (src/services/syncTrigger.ts, 2 s
debounce, single subscriber registered by _layout.tsx) after each outbox
write and after the Inbox repair transaction; outbox.ts and syncClient.ts
never do. _layout.tsx syncs on launch, every 30 s in the foreground, on
return to the foreground and on write through scheduleSync(); the Settings
button too. REVIEW.md and scripts/review-levels.py list the two new files
in the Sync row.
test: reproduces #178 (tests/syncSchedule.test.mjs, smoke guards)
Refs #178
Refs #167
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The companion never told an open page that its data changed:
broadcastToUser() had no caller, and the client set existed twice
because server.ts is bundled apart from the Next routes, so the routes
(and /api/health) saw an empty set.
- Keep the client set on globalThis.__wsClients, like the ticket store.
- WsMessage sync variant is now { type: 'sync' } with no detail.
- notifyUserChanged(userId) coalesces per account with a 1 s trailing
debounce; a send that throws drops the socket instead of crashing.
- POST /api/sync notifies once per batch when at least one operation
is applied; every REST mutation handler of lists, tasks and tags
notifies after success.
- useSync refreshes only on a sync message, debounced 500 ms;
auth_expired no longer triggers a refresh.
Tests: ws.test.ts (payload, coalescing, shared set across module
instances, source guard on mutation handlers) and sync route tests
(one notification per applied batch, none for refused or duplicate
batches, never another account).
Refs #177
Refs #167
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>