Skip to content

[ADR-053] Wire in-app database switch to re-target Pro cloud-sync (ActivateDatabase) #1711

Closed

Description

@mstomar125

Part of the per-database cloud-sync epic (#1535). The daemon-side single-active sync + ActivateDatabase RPC are done in nodespace-sync (#350–#358, merged). This is the remaining desktop wiring — the one core-repo change — so switching databases in the app also switches which tenant syncs, not just which one is read/written.

Problem

databaseStore.switchTo(id) calls invoke('set_active_database', {id}) (re-points the routed gRPC clients — the data plane) but never tells the Pro daemon to re-target its cloud-sync session. So an in-app switch changes which database is read/written but the daemon keeps syncing the boot tenant.

Change (desktop-only)

  • Mirror the daemon's ActivateDatabase RPC into the desktop's pro proto copy (src-tauri/proto/nodespace_pro.proto).
  • Add a pro_activate_database(database_id) Tauri command (commands/pro_sync.rs) that forwards to CloudSyncService.ActivateDatabase; no-ops in community mode, matching the other pro_* commands' side-effect-free contract.
  • switchTo calls it after set_active_database (best-effort — a re-target failure must not abort the committed routing switch; community stays unaffected via the no-op).

Validation

Device testing (interactive): with a Pro daemon + ≥2 bound databases, switching database in the app re-targets sync to the new tenant (the pill/Realtime follows). Backend RPC already headless-validated in nodespace-sync.

Note: the full tenant/database picker UI + per-DB sync pill (builds on #1536/#1537) is separate; this issue is only the switch→sync wiring.

Activity

  1. self-assigned this
    on Jul 22, 2026
  2. mstomar125 commented on Jul 22, 2026

    @mstomar125
    ContributorAuthor

    PR #1714 opened — held for on-device validation, not merged (per request). Wires databaseStore.switchTo → the daemon's ActivateDatabase RPC via a new no-op-in-community pro_activate_database Tauri command, best-effort so a re-target failure never aborts the routing switch. Unit-tested (switch re-targets sync + completes on failure) + adversarially reviewed (proto parity byte-for-byte vs daemon). Remaining: interactive check that switching database in the running Tauri app re-targets sync + updates the pill, with a Pro daemon + ≥2 bound databases. Branch pushed to mstomar125:worktree-issue-1711-switch-activate-sync; the worktree .claude/worktrees/issue-1711-switch-activate-sync is ready for device testing (sidecars in place).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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