Skip to content

feat(sync): wire ChangeType::Delete / sync_model for tag deletion, unapply, and apply paths #3045

@coderabbitai

Description

@coderabbitai

Overview

Several tag mutation code paths skip cross-device sync propagation even though the sync infrastructure already supports ChangeType::Delete and sync_model. Until these are wired, peers will diverge silently: deleted/unapplied tags remain on other devices; applied tags may never be broadcast.

Raised from PR #3044 (discussion: #3044 (comment)).


Affected locations

1. Tag deletion — core/src/ops/tags/delete/action.rs (line 101)

// TODO(sync): Tag deletion is not synced to other devices.
// The sync infrastructure supports ChangeType::Delete but the tag deletion
// path does not yet call library.sync_model() with it.

Call library.sync_model(..., ChangeType::Delete) after a successful delete_tag and handle / log errors.


2. Tag unapply — core/src/ops/tags/unapply/action.rs (line 110)

// TODO(sync): Tag unapply is not synced to other devices.
// The sync infrastructure supports ChangeType::Delete but tag removal
// does not yet call library.sync_model().

Call library.sync_model(..., ChangeType::Delete) for each removed user_metadata_tag row after the bulk delete and handle / log errors.


3. Tag apply (metadata manager) — core/src/ops/metadata/manager.rs (lines 530, 547, 568)

Three call sites that map the result of apply_semantic_tags silently discard the returned models instead of looking up the actual UUID and calling sync_model:

.map(|_| ()) // TODO: Look up actual UUID and sync models

These should retrieve the inserted / updated user_metadata_tag rows, then call library.sync_model(..., ChangeType::Insert) (or Update) for each.


Acceptance criteria

  • tags.delete propagates the deletion to peers via sync_model with ChangeType::Delete.
  • tags.unapply propagates removed tag associations to peers via sync_model with ChangeType::Delete.
  • The three apply_semantic_tags call sites in metadata/manager.rs sync inserted/updated rows to peers.
  • All inline TODO(sync) and // TODO: Look up actual UUID and sync models comments in the above files are removed and replaced with a reference to this issue (e.g. // tracked in #<issue>) until resolved, then removed entirely on completion.
  • No new silent divergence paths are introduced for tag mutations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions