Skip to content

Delete the Add synced database dialog and tenant badge from Database settings #3326

Closed as not planned

Description

@mstomar125

Summary

Delete the "Add synced database…" wizard and the remaining tenant badge from core's Database settings.

The Pro package contributes both instead, through ADR-082's settings slots, which #3312 mounts in this file:

  • the button, which owns its dialog, goes to database.actions;
  • the per-database sync badge goes to database.row.

After this PR, database-settings.svelte imports nothing Pro and reads no tenant binding.

Context

The wizard. add-synced-database-dialog.svelte (452 lines) runs these steps:

  1. Sign in, using pro_current_person, pro_initiate_oauth and a listener on the raw sync:status event.
  2. List tenants with pro_list_tenant_memberships.
  3. Name and create a local database with databaseStore.create, then switchTo.
  4. Mint a restricted landing collection with backendAdapter.createNode and collectionsData.loadCollections().
  5. Call pro_bind_tenant.

Its only importer is database-settings.svelte: the import at af8ddb6 line 7, and the mount at 205.

The button. It checks proSync.isPro && labsFlags.syncEnabled directly (af8ddb6: 110-114), bypassing the variant chokepoint.

The badge. After #3324, the row badge renders only for a bound database. It shows "Syncs to tenant · {tenantLabel(schema)}" plus the raw schema name.

The slots. ADR-082 §2.2 (proposed) defines both:

  • database.actions sits beside "New" and "Open existing…" and takes no props;
  • database.row renders once per database row, with { databaseId }.

#3312 already mounts both outlets in this file: the actions outlet after the header buttons, and the row outlet in each row after the badge block. With nothing registered they render nothing. This PR removes only the hard-coded Pro markup beside them.

Binding readers. The badge is core's last Settings reader of DatabaseInfo.boundTenantSchema. ADR-083 §7 requires such readers to leave core before #3341 changes DatabaseInfo.

Line numbers. They are at af8ddb6, before #3324 and #3312 touch this file. Locate code by symbol.

Scope

Delete:

  • packages/desktop-app/src/lib/components/settings/sections/add-synced-database-dialog.svelte (1-452)
  • packages/desktop-app/src/tests/components/add-synced-database-dialog.test.ts (1-455, 14 cases)

Edit packages/desktop-app/src/lib/components/settings/sections/database-settings.svelte:

  • import AddSyncedDatabaseDialog (7)
  • import { proSync } (10) and import { labsFlags } (11). Both are used only by the button.
  • let addSyncedDialogOpen (20)
  • tenantLabel() and its doc comment (43-47)
  • the {#if proSync.isPro && labsFlags.syncEnabled} "Add synced database…" button block (110-114)
  • the {#if db.boundTenantSchema} badge block, as Remove tenant and sync wording shown to free users in Database settings #3324 left it (was 160-171)
  • <AddSyncedDatabaseDialog bind:open={addSyncedDialogOpen} /> (205)

Keep #3312's database.actions and database.row outlets.

Rewrite packages/desktop-app/src/tests/components/settings/database-settings.test.ts: all of it, meaning lines 1-78 plus the test #3324 added.

scripts/check-pro-boundary.ts: lower BASELINES.

Out of scope

Steps

  1. Startup sequence (CLAUDE.md), with the worktree named issue-<N>-remove-add-synced-db:
    • On the primary checkout: git status, then git fetch origin && git pull origin main.
    • Create the worktree with EnterWorktree.
    • Inside it: bun install, bun run test for the baseline, then bun run gh:comment. Self-assign with bun run gh:assign <N> "@me", then bun run gh:status <N> "In Progress".
  2. Check the gates:
  3. Delete the two files.
  4. Edit database-settings.svelte as listed under Scope.
  5. Verify the slot outlets. No code change.
    • The database.actions outlet is still inside the header button group, after "Open existing…".
    • The database.row outlet is still in each row's left column. With the badge gone, it now sits directly under the status line.
    • Run Add settings-section and database settings-slot extension points #3312's database-settings-extensions.test.ts unchanged. It covers the nothing-registered case and the per-row databaseId prop.
  6. Rewrite database-settings.test.ts as described under Tests.
  7. Check for leftovers:
    git grep -n -E "add-synced-database-dialog|AddSyncedDatabaseDialog|addSyncedDialogOpen|tenantLabel|Syncs to tenant|boundTenantSchema" -- packages/desktop-app/src/lib/components/settings packages/desktop-app/src/tests/components/settings
    
    Expect no matches, except in account-settings.svelte and its test if Delete the Pro Account section, workspace-members card and tenant-admission calls #3325 has not merged yet. Delete the Pro Account section, workspace-members card and tenant-admission calls #3325 deletes both.
  8. Lower the ratchet. Run bun run scripts/check-pro-boundary.ts and paste the printed BASELINES block into scripts/check-pro-boundary.ts. Every change must be a decrease.
  9. Finish as in CLAUDE.md:
    • bun run test:changed;
    • bun run quality:fix, then commit;
    • git push origin HEAD:issue-<N>-remove-add-synced-db;
    • gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-remove-add-synced-db, then bun run gh:status <N> "In Review";
    • /pragmatic-code-review, then /address-review;
    • merge only after the user approves, with bun run merge <PR#> in the background, then ExitWorktree({action: "remove", discard_changes: true}).

Standards:

  • No GitHub issue numbers in code comments.
  • Use createLogger, never console.*.
  • Use bun run test, never bun test.
  • No lint suppression.

Acceptance criteria

  • add-synced-database-dialog.svelte and its test are deleted, and nothing imports them.
  • database-settings.svelte imports neither $lib/stores/pro-sync.svelte nor $lib/stores/labs-flags.svelte, and doesn't reference boundTenantSchema, tenantLabel or addSyncedDialogOpen.
  • With nothing registered:
    • the header shows exactly "New" and "Open existing…";
    • each row shows only the name, the default and active badges, the path and the status;
    • the page has no "tenant" or "synced" wording.
  • Add settings-section and database settings-slot extension points #3312's database-settings-extensions.test.ts passes unchanged.
  • New, Open existing…, Rename, Remove and Set as default behave as before.
  • bun run --cwd packages/desktop-app quality:design-tokens passes with no re-record. The deleted files have no baseline entries.
  • bun run scripts/check-pro-boundary.ts exits 0, BASELINES is lowered in this PR, and no marker count rose.
  • bun run quality:fix is clean and bun run test:changed passes.
  • The PR links sync's replacement PR, built against this branch.

Tests and verification

Rewrite database-settings.test.ts:

  • Header comment, with no Pro wording: "DatabaseSettings — Settings → Database. Core renders only its own database controls; anything else arrives through the database.actions and database.row extension slots, which database-settings-extensions.test.ts covers." Keep the existing note about running without a Tauri bridge.
  • Keep the $lib/utils/logger and @tauri-apps/plugin-dialog mocks. Drop the proSync and labsFlags imports and the beforeEach and afterEach that reset them.
  • it('renders only core database controls without an extension'): render, then await findByText('Default'). Assert that no button has the text "Add synced database…", and that the removed wording is absent:
    // Built from fragments so this absence check adds no line to the boundary ratchet.
    const removedWording = new RegExp([['ten', 'ant'].join(''), 'synced', 'local only'].join('|'), 'i');
    expect(container.textContent).not.toMatch(removedWording);
    This replaces Remove tenant and sync wording shown to free users in Database settings #3324's test and follows Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299's absence-test convention.
  • it('shows exactly the core header actions'): take the parent element of getByRole('heading', { name: 'Databases' }), and assert that its buttons' trimmed labels equal ['New', 'Open existing…']. Add the "Share / Sync this database" entry point that opens nodespace.ai #3362 later adds its action here and updates this test.
  • Delete the three proSync.tier × labsFlags.syncEnabled tests.
  • Mutation checks:
    • re-add the button unconditionally, and confirm both tests fail;
    • re-add the "Local only · not synced" badge, and confirm the first test fails.

Commands:

bun run --cwd packages/desktop-app test src/tests/components/settings/
bun run --cwd packages/desktop-app quality:design-tokens
bun run scripts/check-pro-boundary.ts
bun run test:changed
bun run quality:fix

Manual check: run bun run dev:browser and open Settings → Database. The header and row layout should match a screenshot taken before the change, minus the Pro markup.

Notes for sync's replacement (what the SYNC gate must cover)

These use the ADR-082 (proposed) contract.

  • database.actions contribution. settingsSlots: [{ id: 'add-synced-database', slot: 'database.actions', when: …, load }].
    • The component renders the "Add synced database…" button and owns the dialog's open state.
    • Its when() replaces proSync.isPro && labsFlags.syncEnabled. labsFlags is not in the host API (ADR-082 §2.3).
  • What the dialog uses from core, and where each comes from:
    • databaseStore.create, switchTo and error come from the host API's databases. Gap: ADR-082 §2.6 lists only the active id, the active database, the list and refreshDatabaseSettings() for databases. Publish the extension host API: services, ui and testing entries, version policy #3315 must add create(), switchTo() and the last error, or ADR-082 must list them, before this gate can be met.
    • backendAdapter.createNode comes from nodes.createNode.
    • collectionsData.loadCollections() comes from collections.reload().
    • Dialog, Button and Input come from the ui entry.
    • createLogger and toError come from the host API.
    • invoke and listen come from @tauri-apps/api.
  • database.row contribution. { id: 'sync-badge', slot: 'database.row', load }.
  • Explainer. If the Pro app wants the paragraph Remove tenant and sync wording shown to free users in Database settings #3324 removed, it renders it in one of these contributions (ADR-082 §2.2).
  • Tests. Carry over the 14 dialog cases, on the host API's testing entry.

Dependencies

Risks and rollback


Plan key: C5.3 (pro-boundary DAG).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

pro-boundaryPro/core boundary: Pro code moves to nodespace-sync (ADR-081..085)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions