Skip to content

Stop importing the Pro extension in core; register it only through the build entry #3316

Closed as not planned

Description

@mstomar125

Summary

Cut the last link from core to the Pro UI.

  • Delete both registration paths. Remove the transitional import './pro-plugin' from ui-extensions.svelte.ts, and the self-registration in pro-plugin.ts. After that, the Pro extension registers only when a build injects it through NODESPACE_EXTENSIONS (Add the virtual:nodespace-extensions build entry and the extension-api import alias #3311).
  • Register explicitly in tests. The two tests that still exercise the Pro extension register it themselves.
  • Pin the free app's guarantee (ADR-082 §7) with a boundary test. With nothing injected, no contribution renders, no hook runs, and no core module imports the Pro extension.

Context

State after the earlier sub-issues:

Tests that rely on the side effect:

  • src/tests/plugins/pro-sync-variant.test.ts;
  • src/tests/free-user-guardrail.test.ts, in the describe "Pro-UI registry contributes nothing daemon-backed in community" (about L139-161).

The Pro GUI build.

  • Once the Pro GUI builds from a pinned core revision (the pin gate), merging this change cannot reach a Pro build until nodespace-sync bumps its pin.
  • The pin-bump PR that crosses this commit must set NODESPACE_EXTENSIONS to packages/desktop-app/src/lib/plugins/pro-plugin.ts in the pinned checkout. It does so for every GUI build that should show the Pro UI:
    • scripts/build-pro-dmg.sh;
    • .github/workflows/release.yml, including its disabled Windows job;
    • scripts/device-sync.sh, if that build should show the Pro UI.
  • This lasts until Move the Pro sync and collaboration UI out of core #3333 moves the Pro frontend into nodespace-sync.
  • Without the pin gate, the next Pro build silently loses the Collaboration tab and the consent and relogin modals.

Scope

1. Remove the imports

  • src/lib/plugins/ui-extensions.svelte.ts: delete import './pro-plugin'; and its comment, and update the module doc.
  • src/lib/plugins/pro-plugin.ts:
    • delete the uiExtensionRegistry.register(...) side effect, and the import that is now unused;
    • keep the named and default exports;
    • doc: the extension is registered by a build, through virtual:nodespace-extensions.

2. Explicit registration in pro-sync-variant.test.ts and free-user-guardrail.test.ts

3. New src/tests/plugins/core-extension-boundary.test.ts

Write it per #3299's absence-test convention: keep the file free of ratchet markers, and build any needle that would match a marker from fragments.

(a) The virtual module is empty.

  • virtual:nodespace-extensions is [].
  • If NODESPACE_EXTENSIONS is set, the test fails with the message: unset NODESPACE_EXTENSIONS to run core's test suite. Core's own test runs never set it, and nodespace-sync runs only its own files.

(b) Nothing is registered and nothing runs. Import ui-extensions.svelte.ts, settings-categories.ts and extension-lifecycle.ts with nothing registered. Then:

  • uiExtensionRegistry.all() is empty;
  • these all return []: both chrome slots, the collection viewer tabs, the settings sections, and both settings slots;
  • settingsCategories() equals the visible core categories;
  • collectionTreeRoots() is empty;
  • startExtensions() and notifyDatabaseActivated('db') call nothing and do not throw;
  • collectExtensionDebugDumps() is {}.

(c) No core module imports the Pro extension.

  • No .ts or .svelte file under src/lib or src/routes imports pro-plugin.
  • Check both static and dynamic import specifiers, with comments stripped.
  • There are no exemptions.

4. PR description

  • The nodespace-sync adaptation described under Context.
  • The dev loop for Pro developers: NODESPACE_EXTENSIONS=src/lib/plugins/pro-plugin.ts bun run --cwd packages/desktop-app dev:tauri.

5. Pro-boundary ratchet

Paste the printed BASELINES. This change lowers the Pro wording removed from the two modules' docs.

Out of scope

Steps

  1. Start up as core's CLAUDE.md describes: a worktree named issue-<N>-drop-pro-import, and self-assign at pickup.
  2. Confirm the pin gate: nodespace-sync's Pro app and Pro daemon build from one pinned core revision, not from core HEAD. Link the evidence in the PR.
  3. Remove the import and the self-registration, update the two tests, and add the boundary test.
  4. Verify both bundles, using the commands below.
    • Optionally, build the Pro app with nodespace-sync's build-pro-dmg.sh against this branch, with NODESPACE_EXTENSIONS exported.
    • Confirm that the Collaboration tab and the modals appear.
  5. Record the sync adaptation in the PR description and on the parent issue.

Acceptance criteria

Core no longer imports the Pro extension:

  • grep -rn pro-plugin packages/desktop-app/src/lib packages/desktop-app/src/routes finds no import; only the file itself matches.

The bundles:

  • The free bundle contains no Pro extension: bun run --cwd packages/desktop-app build && ! grep -rq 'Collaboration is off for this database' packages/desktop-app/build. That string appears only in a component the Pro extension loads.
  • The injected build still contains it: NODESPACE_EXTENSIONS=src/lib/plugins/pro-plugin.ts bun run --cwd packages/desktop-app build && grep -rq 'Collaboration is off for this database' packages/desktop-app/build.

Tests:

  • core-extension-boundary.test.ts passes. It fails when a core module re-adds the import; check this once by mutation, and note it in the PR.
  • pro-sync-variant.test.ts and test:free-users pass with explicit registration.
  • bun run test:changed passes, and quality:fix is clean.

Ratchet:

  • bun run scripts/check-pro-boundary.ts exits 0, BASELINES equal the printed counts, and reductions are lowered.

Tests and verification

bun run test:changed
bun run --cwd packages/desktop-app test src/tests/plugins
bun run --cwd packages/desktop-app test:free-users
bun run --cwd packages/desktop-app build && ! grep -rq 'Collaboration is off for this database' packages/desktop-app/build
NODESPACE_EXTENSIONS=src/lib/plugins/pro-plugin.ts bun run --cwd packages/desktop-app build && grep -rq 'Collaboration is off for this database' packages/desktop-app/build
bun run --cwd packages/desktop-app quality:fix
bun run scripts/check-pro-boundary.ts

Manual checks:

  • The free app in dev:tauri is unchanged: no Collaboration tab.
  • With NODESPACE_EXTENSIONS=src/lib/plugins/pro-plugin.ts, against a Pro daemon, the Pro UI appears as before.

Dependencies

Risks and rollback

  • Merging before the pin gate strips the Pro UI from the next Pro release. That is why the gate is a hard dependency.
  • A pin bump that forgets the variable ships a Pro app without its UI. The PR description and the parent issue spell out the adaptation, and nodespace-sync can run the bundle grep above as its check.
  • The bundle check keys on UI copy. If Move the Pro account, admission and synced-database settings out of core #3327 or Move the Pro sync and collaboration UI out of core #3333 changes that sentence before this lands, pick another string that only the Pro extension's components contain.
  • Rollback. Revert the PR. The transitional import and the self-registration come back.

Plan key: C3.5 (pro-boundary DAG).

🤖 Generated with Claude Code

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

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