Skip to content

Delete the Pro Account section, workspace-members card and tenant-admission calls #3325

Closed as not planned

Description

@mstomar125

Summary

Delete core's Pro "Account" settings section, and everything that exists only to serve it:

  • the "NodeSpace Pro" card (account-settings.svelte);
  • the workspace-members card for tenant admission;
  • its Invitations inbox modal, with the inbox's design-token baseline entry;
  • the tenant-admission half of membership-service.ts;
  • databaseStore.proSyncSettled();
  • the core account settings category and its Labs gate;
  • all their tests.

The Pro app gets the section back from the Pro package, which registers it through ADR-082's settingsSections (built in #3312).

Context

Classification. ADR-081 (proposed) puts the Account section in category A: it moves to the Pro package through a settings-section extension point. Its Labs gating is category C, which "goes with the Account section". Both belong to step 4(b) of ADR-081 §7.

What #3312 leaves behind. #3312 lands first and reshapes the settings host:

  • It moves the category list out of settings-sidebar.svelte into a new src/lib/components/settings/settings-categories.ts. Its CORE_SETTINGS_CATEGORIES lists each core category with an optional visible() gate. Account is there, with its Labs gate visible: () => labsFlags.syncEnabled.
  • The sidebar merges those categories with contributed settingsSections. A contributed section whose id equals a core category id is ignored and logged (core wins).
  • The pane's fallback $effect becomes generic: if (!isSettingsCategoryVisible(activeCategory)) activeCategory = 'database'. It covers unknown and unregistered ids.
  • Add settings-section and database settings-slot extension points #3312 keeps the pane's hard-coded {:else if activeCategory === 'account'} → <AccountSettings onNavigateToDatabase={…} /> branch until this issue.

So in this PR the Account code to remove is the entry in settings-categories.ts and the import and dispatch branch in settings-pane.svelte. Nothing in the sidebar's list or the pane's $effect needs to change.

Consequence of core-wins. While core's account entry exists, the Pro package's account section is silently ignored. So sync's replacement can only be seen working on this branch, which is why the SYNC gate reviews it against this branch.

Consumers at main @ af8ddb6, checked with git grep:

Free-app impact. In the community app the Account tab is hidden unless labsFlags.syncEnabled is on, and the Labs switch for that flag is disabled. Default users never see the tab.

Locating code. Line numbers are at af8ddb6. #3309 / #3310 and #3312 edit several of these files first, so find code by symbol.

Scope

Delete (paths under packages/desktop-app/):

  • src/lib/components/settings/sections/account-settings.svelte (1-235)
  • src/lib/components/settings/sections/workspace-members-card.svelte (1-336)
  • src/lib/components/collaboration/invitations-inbox.svelte (1-399)
  • src/tests/components/settings/account-settings.test.ts (1-348, 15 cases)
  • src/tests/components/settings/workspace-members-card.test.ts (1-422, 25 cases)
  • src/tests/components/settings/settings-pane-account-gating.test.ts (1-78, 3 cases)
  • src/tests/components/settings/settings-sidebar-account-gating.test.ts (1-77, 4 cases)
  • src/tests/components/invitations-inbox.test.ts (1-132, 9 cases)

Edit:

  • src/lib/components/settings/settings-categories.ts (created by Add settings-section and database settings-slot extension points #3312):

    • remove the account entry from CORE_SETTINGS_CATEGORIES, including its visible: () => labsFlags.syncEnabled gate;
    • remove any exported position or order value that exists only for Account (Add settings-section and database settings-slot extension points #3312's draft gave Account order 150);
    • reword any comment that names Account, "Team synchronization" or "NodeSpace Pro", so it names only the AI Models and Playbooks gates.
  • src/lib/components/settings/settings-pane.svelte:

  • src/lib/components/settings/settings-sidebar.svelte: no code change is expected. If a comment still mentions the Account tab or "NodeSpace Pro" (af8ddb6: 12-19), reword it.

  • src/lib/services/membership-service.ts: delete these symbols:

    • TenantMember (85-98) and AdmissionResult (100-107);
    • TENANT_ADMIN_ROLES (109-110) and isTenantAdmin (112-119);
    • RawTenantMember (147-152) and RawAdmission (153-157);
    • the methods listTenantMembers (315-328), approveAdmission (330-334), removeFromTenant (336-345) and initiateAdmission (347-356).

    Keep everything else. The collection-membership types and methods, Person, currentPerson() and the module doc belong to Move the Pro sync and collaboration UI out of core #3333.

  • src/lib/stores/database.svelte.ts: delete proSyncSettled() and its doc comment (295-304). Keep proActivateChain and activateProSync, which Stop driving Pro sync lifecycle from the app shell, database store and debug channel #3329 removes.

  • src/tests/free-user-guardrail.test.ts:

    • delete import AccountSettings (52);
    • delete the banner comment and the describe 'Settings > Account renders no interactive Pro controls in community' (163-176);
    • in the Pro-UI registry banner comment (131-137), drop "account access lives in Settings → Account, sign-in in Settings → Database".
  • src/tests/components/settings/database-settings.test.ts: if its header still says "same as account-settings.test.ts covers for the "NodeSpace Pro" card" (4-8), drop that clause.

  • Add settings-section and database settings-slot extension points #3312's settings tests (src/tests/components/settings/settings-extension-sections.test.ts in Add settings-section and database settings-slot extension points #3312's plan): if one uses 'account' as its core-id collision example, or lists Account among the core categories, switch it to 'database' or update the list.

  • packages/desktop-app/design-tokens-baseline.json: re-record it. Deleting invitations-inbox.svelte fixes a recorded violation, and the design-token check that runs at push fails on stale entries.

New: src/tests/components/settings/settings-core-categories.test.ts (see Tests).

Out of scope

Steps

  1. Startup sequence (CLAUDE.md), with the worktree named issue-<N>-remove-pro-account-section:
    • 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 eight files listed under Scope.
  4. Edit membership-service.ts. Run bunx svelte-check from packages/desktop-app and confirm there is no dangling TenantMember or isTenantAdmin import.
  5. Delete proSyncSettled() from database.svelte.ts.
  6. Edit settings-categories.ts as listed under Scope.
  7. Edit settings-pane.svelte, and the sidebar comment if needed.
  8. Verify the fallback. No code change. Add settings-section and database settings-slot extension points #3312 already falls back to Database for any id that is not visible, and with the entry gone 'account' is such an id. Run Add settings-section and database settings-slot extension points #3312's settings tests and the new test file.
  9. Update Add settings-section and database settings-slot extension points #3312's tests if they use 'account' (see Scope).
  10. Edit free-user-guardrail.test.ts, and the database-settings.test.ts header if needed.
  11. Add settings-core-categories.test.ts as described under Tests.
  12. Re-record the design-token baseline: bun run --cwd packages/desktop-app quality:design-tokens --update. The diff must remove only the invitations-inbox.svelte entry.
  13. Check for leftovers:
    git grep -n -w -E "account-settings|AccountSettings|workspace-members-card|WorkspaceMembersCard|invitations-inbox|InvitationsInbox|isTenantAdmin|listTenantMembers|approveAdmission|removeFromTenant|initiateAdmission|proSyncSettled|TenantMember|AdmissionResult|TENANT_ADMIN_ROLES" -- packages/desktop-app/src packages/desktop-app/design-tokens-baseline.json
    
    Expect no matches. -w keeps TenantMember from matching TenantMembership in the dialog, which Delete the Add synced database dialog and tenant badge from Database settings #3326 owns.
  14. 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. Use --list <marker> to confirm that the new test file adds no hit.
  15. Finish as in CLAUDE.md:
    • bun run test:changed;
    • bun run quality:fix, then commit;
    • git push origin HEAD:issue-<N>-remove-pro-account-section;
    • gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-remove-pro-account-section, 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#> running in the background, then ExitWorktree({action: "remove", discard_changes: true}).

Standards:

  • No GitHub issue numbers in code comments.
  • Mock Tauri with vi.mock('@tauri-apps/api/core', () => mockTauriCore({...})) where a test needs it, as the existing tests do.
  • Use bun run test, never bun test.
  • No lint suppression.

Acceptance criteria

  • The eight files are deleted, and no source or test file imports them.
  • membership-service.ts has none of TenantMember, AdmissionResult, TENANT_ADMIN_ROLES, isTenantAdmin, RawTenantMember, RawAdmission, listTenantMembers, approveAdmission, removeFromTenant or initiateAdmission.
  • Its collection-membership API is unchanged, and membership-service.test.ts passes untouched.
  • database.svelte.ts has no proSyncSettled, and database.test.ts passes untouched.
  • git grep -n -i -E "account|syncEnabled|Team synchronization|NodeSpace Pro" -- packages/desktop-app/src/lib/components/settings/settings-sidebar.svelte packages/desktop-app/src/lib/components/settings/settings-pane.svelte packages/desktop-app/src/lib/components/settings/settings-categories.ts finds nothing.
  • With nothing registered, the sidebar shows exactly Database, Display, Import Sources, Integrations, Labs and About while the AI Chat and Playbooks flags are off.
  • With nothing registered, opening Settings with settingsStore.initialCategory = 'account' shows Database.
  • settings-pane-labs-gating.test.ts, settings-sidebar-labs-gating.test.ts and Add settings-section and database settings-slot extension points #3312's settings and database-extension tests pass.
  • bun run --cwd packages/desktop-app test:free-users passes.
  • The only change to design-tokens-baseline.json is the removed invitations-inbox.svelte entry.
  • 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

Deleted tests. Delete the five test files listed under Scope. Their cases move to the Pro package with the components, as part of sync's replacement.

New src/tests/components/settings/settings-core-categories.test.ts. This is a lasting core test. It is not added to free-user-guardrail.test.ts, which #3332 retires.

  • Use the harness of settings-pane-account-gating.test.ts: mock $lib/utils/logger and @tauri-apps/plugin-dialog, with no Tauri bridge.
  • Before and after each test, clear localStorage, set labsFlags.aiChatEnabled and labsFlags.playbooksEnabled to false, and set settingsStore.initialCategory = null. Don't touch syncEnabled: Add the "Share / Sync this database" entry point that opens nodespace.ai #3362 owns it, and it is a ratchet marker.
  • lists only core categories when no extension is registered: render SettingsSidebar with { activeCategory: 'database', onCategoryChange: vi.fn() }, collect the trimmed labels of nav button, and assert they equal ['Database', 'Display', 'Import Sources', 'Integrations', 'Labs', 'About'].
  • opens Database for a category id that nothing provides: set settingsStore.initialCategory = 'account', render SettingsPane, wait for getByText('Databases'), and assert that queryByText('Account') is null.
  • Keep the file free of ratchet markers, per Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299's absence-test convention: no "Pro", "tenant", syncEnabled or pro_ strings.

Mutation checks. Mutation-check each new test:

  • add { id: 'account', label: 'Account' } to CORE_SETTINGS_CATEGORIES without a gate, and confirm both tests fail;
  • make isSettingsCategoryVisible return true for every id, and confirm the second test fails.

Commands:

bun run --cwd packages/desktop-app test src/tests/components/settings/ src/tests/free-user-guardrail.test.ts
bun run --cwd packages/desktop-app test:free-users
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, open Settings, and confirm the categories are Database, Display, Import Sources, Integrations, Labs and About. AI Models and Playbooks also appear if their Labs flags are on.

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

These use the ADR-082 (proposed) contract.

  • Registration. settingsSections: [{ id: 'account', label: 'Account', after: 'database', when: …, load: () => import(…) }]. after: 'database' keeps today's position. Core's settings host ignores a contributed id that equals a core category id, so the section only appears on this branch and later.
  • Navigation. The component receives { navigate }. Today's onNavigateToDatabase becomes navigate('database').
  • Imports. Only @nodespace/extension-api and its ui and testing entries, @tauri-apps/api, svelte, and the package's own files (ADR-082 §2.6):
    • Badge, Button, Card, Input and focusTrap come from the ui entry;
    • createLogger and toError come from the host API;
    • databaseStore.activeDatabaseId, which keys the members card today, becomes the databases active id.
  • Pro stores. The package uses its own proSync, membership, resolveProSyncVariant and membership service. That is Move the Pro sync and collaboration UI out of core #3333's SYNC gate, so ship both together.
  • Replacing proSyncSettled(). ADR-082 has no core "hooks settled" API. The Pro package keeps its own serialized activation chain (today's proActivateChain) behind its lifecycle.onDatabaseActivated hook (ADR-082 §2.5), and exposes its own settled promise for the members card to await.
  • Visibility. when() reads Pro state only. labsFlags is not in the host API, and Add the "Share / Sync this database" entry point that opens nodespace.ai #3362 removes syncEnabled (ADR-082 §2.3). If Pro wants an opt-in, it keeps its own setting.
  • Tests. Carry over the 15 + 25 + 9 cases deleted here, on the host API's testing entry. The 3 + 4 Labs-gating cases test a core gate that no longer exists. Replace them with tests of the section's own when().

Dependencies

Risks and rollback


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

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

pro-boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions