Skip to content

DB/tenant Settings UI: switcher→Settings, per-row bound tenant, reload-persist - #1725

Merged
mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:issue-1722-db-tenant-settings-ui
Jul 23, 2026
Merged

mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:issue-1722-db-tenant-settings-ui

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

What

The Database/Tenant management UI (ADR-053), plus fixes so switching is clear and sticky. Closes #1722.

Changes

  • Settings entry below Favorites in the sidebar (layout.svelte.ts nav item + navigation-sidebar.svelte handler → shared open-settings.ts).
  • Database ≠ Tenant, made explicit. The top-left database switcher is now a read-only indicator that opens Settings → Database (no inline tenant switching); the Database settings section explains a database is a local store that syncs to one cloud tenant, and shows per row whether it "Syncs to tenant · X" or is "Local only". Switching databases happens here, via an explicit Open button.
  • Per-row bound tenant is full-stack: DatabaseInfo.bound_tenant_schema added to the proto, populated by the daemon's database_service.rs, surfaced through the Tauri commands/database.rs DTO and the database.svelte.ts store, and rendered in the settings row — so a database and its tenant are never confused.
  • Reload-persist fix: the active database is remembered in localStorage and restored on load, so a refresh no longer snaps back to the default database.

Testing

bun run test (frontend) green, incl. updated layout.test.ts (nav now has the Settings item). Daemon/proto compile; per-row tenant verified live (registry rows show their bound tenant).

Notes / follow-ups

Multiple-databases-per-tenant (design) is tracked in NodeSpaceAI/nodespace-sync#522; the local-storage invitations popup gating in #1721. Builds on Slice C (#1714, merged).

🤖 Generated with Claude Code

…d-persist (closes #1722)

- 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]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE (after fixing 2 type-gate blockers an independent review caught)

  • Blocker (fixed): adding boundTenantSchema as a required DatabaseInfo field left it missing from IMPLICIT_BROWSER_DATABASE (database.svelte.ts) and the test factory db() (database.test.ts) → 2 svelte-check type errors (the pre-push gate runs vitest, which doesn't type-check, so it missed them). Added boundTenantSchema: null to both. bunx svelte-check now: 0 errors, 0 warnings. (database.test.ts joins the PR as the necessary type fix.)

Everything else verified correct by the review:

  • bound_tenant_schema end-to-end: proto field 8 unique; daemon listing_to_info reads the registry Option<String> (set on bind); Tauri DTO #[serde(rename_all = "camelCase")] → boundTenantSchema; frontend type + rendering match.
  • Reload-persist restores the remembered id only if still registered (else default→first→null); switchTo persists; localStorage helpers try/catch-guarded.
  • database-switcher rewrite has no dangling refs; open-settings.ts dedups the Settings tab; layout.test nav = 4 items ending in settings. No any/{@html}/console.*.

Non-blocking notes: openSettings(category) doesn't re-navigate an already-open Settings tab to the requested section (pre-existing pattern, works when opened fresh); the open-settings docstring's "File menu shares this" is stale (app-shell keeps its own copy) — cosmetic.

@mstomar125
mstomar125 merged commit a51bd5b into NodeSpaceAI:main Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show each database's bound tenant in Settings → Database (expose bound_tenant via list_databases)

1 participant