fix(sync): propagate tag link removals both ways and refuse foreign ids #187

Closed
maximus wants to merge 4 commits from issue-180-tag-link-sync into issue-179-web-task-tags

4 commits

Author SHA1 Message Date
le king fu
26928a498b Merge branch 'issue-179-web-task-tags' into issue-180-tag-link-sync
# Conflicts:
#	src/services/syncClient.ts
#	src/services/syncRules.ts
#	tests/syncRules.test.mjs
2026-11-03 21:13:20 -05:00
le king fu
706f91d234 test(sync): let the setTagsForTask wipe guard match across lines
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>
2026-11-03 20:42:41 -05:00
le king fu
3f444d7725 Merge branch 'issue-179-web-task-tags' into issue-180-tag-link-sync 2026-11-03 20:42:15 -05:00
le king fu
55d05046ee fix(sync): propagate tag link removals both ways and refuse foreign ids
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>
2026-11-02 21:26:08 -05:00