Repository navigation
Re-target Pro cloud-sync when switching the active database (ADR-053) - #1714
Merged
mstomar125 merged 1 commit intoJul 23, 2026
Merged
mstomar125 merged 1 commit into
mstomar125 merged 1 commit into
Conversation
…#1711) `databaseStore.switchTo(id)` re-points the routed gRPC clients via `set_active_database` (the data plane) but never told the Pro daemon to move its cloud-sync session, so switching database in the app changed which database is read/written while the daemon kept syncing the boot tenant. Wire the switch to the daemon's single-active `ActivateDatabase` RPC (shipped in nodespace-sync). - Mirror the `ActivateDatabase` RPC + messages into the desktop's pro proto copy. - Add a `pro_activate_database(database_id)` Tauri command that forwards to `CloudSyncService.ActivateDatabase`; no-ops in community mode (no `ProClient`), matching the other `pro_*` commands' side-effect-free contract, so the community database switcher is unaffected. - `switchTo` calls it after `set_active_database`, best-effort: a re-target failure is logged and does not abort the already-committed routing switch. Desktop-only. Frontend tests assert the switch re-targets sync and still completes when the re-target fails. The tenant/database picker UI + per-DB sync pill (builds on the tray DB menu / registry-driven Pro UI) are separate. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
Author
|
APPROVE Independent adversarial review — all 5 verification points pass, nothing merge-blocking:
One low-severity, non-blocking note: the new |
mstomar125
added a commit
that referenced
this pull request
Jul 23, 2026
…d-persist (closes #1722) (#1725) - Settings entry below Favorites in the sidebar (layout nav item + navigation-sidebar handler → shared open-settings.ts). - The top-left database switcher becomes a read-only indicator that opens Settings → Database (no inline tenant switching); the Database settings section explains a database is a local store syncing to one cloud tenant, shows per row "Syncs to tenant · X" / "Local only", and switches via an explicit Open button. - Per-row bound tenant is full-stack: DatabaseInfo.bound_tenant_schema (proto), populated by the daemon's database_service.rs, surfaced through the Tauri commands/database.rs DTO and the database.svelte.ts store, rendered per row — so a database and its tenant are never confused. - Reload-persist: the active database is remembered in localStorage and restored on load, so a refresh no longer snaps back to the default database. Builds on Slice C (#1714). Follow-ups: #1720 (multi-DB-per-tenant design), #1721 (invitations popup gating). Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1711. Part of the per-database cloud-sync epic (#1535). The daemon-side single-active sync +
ActivateDatabaseRPC are done in nodespace-sync (#350–#358, merged).What
databaseStore.switchTo(id)re-points the routed gRPC clients viaset_active_database(the data plane) but never told the Pro daemon to move its cloud-sync session — so switching database in the app changed which database is read/written while the daemon kept syncing the boot tenant. This wires the switch to the daemon's single-activeActivateDatabaseRPC.ActivateDatabaseRPC + messages into the desktop's pro proto copy.pro_activate_database(database_id)Tauri command →CloudSyncService.ActivateDatabase; no-ops in community mode (noProClient), matching the otherpro_*commands, so the community DB switcher is unaffected.switchTocalls it afterset_active_database, best-effort: a re-target failure is logged and does not abort the already-committed routing switch.Desktop-only.
Test plan
bun run test— the database-store tests assert the switch re-targets sync (pro_activate_databaseinvoked with{ databaseId }) and still completes when the re-target fails.nodespace-appcompiles (proto regenerates). Pre-push gate (test:all+cargo build+test:e2e) green.Review
Independently reviewed (adversarial): proto parity byte-for-byte vs the daemon; command no-ops in community;
switchTowiring is genuinely best-effort; snake/camel arg convention correct; frontend tests cover both paths. No defects found.Scope
The tenant/database picker UI + per-DB sync pill (builds on #1536/#1537) are separate — this is only the switch→sync wiring.