Repository navigation
Description
Summary
This is a pure move with no behaviour change. It empties the generic registry files of Pro logic, so that #3310 can change the registry contract in files that no longer hold any.
-
DATABASE_SETTINGS_NODE_IDmoves to a neutral constants module. Core's database store uses it, and it is not a Pro concept (ADR-082 §2.2, proposed). -
The Pro variant machine moves verbatim into a new
src/lib/plugins/pro-sync-variant.svelte.ts:ProSyncVariant;DatabaseSettingsandactiveDatabaseSettings();resolveProSyncVariant()andisProSyncActive().
The file belongs to the built-in Pro extension and leaves core with it (Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332 deletes it).
-
The Pro test file is renamed to
src/tests/plugins/pro-sync-variant.test.tswithgit mv, so its history follows. -
Everything that points at the moved code is updated: every importer, every
vi.mockpath and the pin-guard exemption key.
The variant fields, the filters, pro-plugin.ts and every host component stay unchanged. Changing them is #3310.
Context
Paths are under packages/desktop-app/. Line hints are at af8ddb61; locate code by symbol.
src/lib/plugins/ui-extensions.ts:
DATABASE_SETTINGS_NODE_ID(L28-36).- Its doc says the singleton's properties are "
database-settings-namespaced". In fact they sit flat onproperties. - The value mirrors Rust's
DATABASE_SETTINGS_NODE_IDinpackages/core/src/services/node_service/mod.rs(L60).
- Its doc says the singleton's properties are "
ProSyncVariant(L41-47).
src/lib/plugins/ui-extensions.svelte.ts:
- L20:
import './pro-plugin'. It stays; Stop importing the Pro extension in core; register it only through the build entry #3316 removes it. - L22-32: the imports of
proSync,labsFlags,SharedNodeStore,DATABASE_SETTINGS_NODE_IDandProSyncVariant. - L34-55
DatabaseSettingsandactiveDatabaseSettings(); L57-95resolveProSyncVariant(); L97-106isProSyncActive(). - L108-118:
getActiveChromeContributionsandgetActiveViewerExtensions, which filter byresolveProSyncVariant().
src/tests/plugins/ui-extensions.test.ts (269 lines). All four of its describes exercise the Pro registration or the variant machine: 'registry registration', 'variant resolution', 'active contribution filtering' and 'Labs syncEnabled gate'.
Importers of the moved symbols in src/lib:
stores/membership.svelte.ts(isProSyncActive);components/settings/sections/account-settings.svelteandcomponents/collaboration/collaboration-locked.svelte(resolveProSyncVariant);stores/database.svelte.ts(DATABASE_SETTINGS_NODE_ID, L21).
Doc references in src/lib:
stores/pro-sync.svelte.ts(around L233);- the
DATABASE_SETTINGS_PIN_OWNERdoc instores/database.svelte.ts(L94-103); plugins/pro-plugin.ts(L6).
Tests that reference the moved symbols:
free-user-guardrail.test.ts(L46-51);stores/pro-sync-settings-refresh.test.ts(L51-52, and a comment at L96);stores/membership.test.ts(thevi.mockat L33-35);components/settings/account-settings.test.ts(L35, and a comment at L49);stores/database.test.ts(L128);services/shared-node-store-eviction.test.ts(L28, and a comment around L325);services/shared-node-store-pin-guard.test.ts(theREACHABLE_WITHOUT_PINkey at L112-113, and prose at L49-57 and L183-186).
Scope
1. New src/lib/constants/database-settings.ts
-
Move
DATABASE_SETTINGS_NODE_IDhere, with its value unchanged. -
Give it a new doc:
- it is the id of the per-database settings singleton that core seeds in every database;
- it mirrors Rust's
DATABASE_SETTINGS_NODE_ID; - the node's properties sit flat on
properties; - the schema slug is
database-settings, which is distinct from this instance id.
Do not list individual fields: ADR-083 decides which ones stay in core.
-
Re-export it from
src/lib/constants/index.ts.
2. New src/lib/plugins/pro-sync-variant.svelte.ts
- Move these verbatim, with their doc comments:
ProSyncVariant, fromui-extensions.ts;DatabaseSettings,activeDatabaseSettings(),resolveProSyncVariant()andisProSyncActive(), fromui-extensions.svelte.ts.
- Imports:
proSync,labsFlagsandSharedNodeStore, plusDATABASE_SETTINGS_NODE_IDfrom$lib/constants/database-settings. - Add a header saying:
- this is the variant state machine of the built-in Pro extension (
pro-plugin.ts); - it is not part of the extension API;
- it leaves core with the Pro UI (ADR-081, ADR-082 §2.3).
- this is the variant state machine of the built-in Pro extension (
- No logic change.
3. src/lib/plugins/ui-extensions.ts
- Delete
DATABASE_SETTINGS_NODE_IDandProSyncVariant. - Add
import type { ProSyncVariant } from './pro-sync-variant.svelte';so thevariantfields still type-check. The import is type-only and erased at runtime. Adopt ADR-082's contribution contract: ids, when() predicates, keyed and isolated outlets #3310 deletes it.
4. src/lib/plugins/ui-extensions.svelte.ts
- Delete the moved code, and the imports that only that code used.
- Import
resolveProSyncVariantfrom./pro-sync-variant.sveltefor the unchangedgetActive*filters. - Keep
import './pro-plugin';. - In the module doc (L1-18), say that the variant machine lives in
pro-sync-variant.svelte.ts.
5. Importers in src/lib
membership.svelte.ts,account-settings.svelteandcollaboration-locked.svelte: import from$lib/plugins/pro-sync-variant.svelte.database.svelte.ts: importDATABASE_SETTINGS_NODE_IDfrom$lib/constants/database-settings, and point theDATABASE_SETTINGS_PIN_OWNERdoc atpro-sync-variant.svelte.ts.pro-sync.svelte.tsandpro-plugin.ts: fix the doc references.
6. Tests
- Rename the Pro test file:
git mv src/tests/plugins/ui-extensions.test.ts src/tests/plugins/pro-sync-variant.test.ts.- Update its imports:
resolveProSyncVariantandisProSyncActivefrom$lib/plugins/pro-sync-variant.svelte, andDATABASE_SETTINGS_NODE_IDfrom$lib/constants/database-settings. - Update its header.
- Change no expectations. Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332 deletes this file together with the Pro UI.
- Update its imports:
- Update the imports in every test file listed under Context.
membership.test.ts: retargetvi.mock('$lib/plugins/ui-extensions.svelte', …)tovi.mock('$lib/plugins/pro-sync-variant.svelte', …). Without this, the real variant machine loads, and the roster tests stop controllingisPro.shared-node-store-pin-guard.test.ts: move theREACHABLE_WITHOUT_PINkey fromlib/plugins/ui-extensions.svelte.tstolib/plugins/pro-sync-variant.svelte.ts, because thegetNode(DATABASE_SETTINGS_NODE_ID)read moves there. Update the prose that names the reading file.
7. Pro-boundary ratchet (#3299)
- Run
bun run scripts/check-pro-boundary.tsand paste the printedBASELINES. - In the PR description, declare the relocation raise under Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299's relocation rule:
proNamedFilesrises by 2 (from 16 to 18 ataf8ddb61): the two newpro-sync-variant.*files.- Attribute each line-marker increase to a new import line, or to a renamed path string of the moved module. Examples: the
resolveProSyncVariantimport inui-extensions.svelte.ts, and the new pin-guard key.
- Lower every marker this change reduces, such as
cloudBindState, which the rewrittenDATABASE_SETTINGS_NODE_IDdoc lowers.
Out of scope
- Changing
variant, thegetActive*filters,pro-plugin.tsor any host component. That is Adopt ADR-082's contribution contract: ids, when() predicates, keyed and isolated outlets #3310. - Any change to the variant machine's logic.
- Deleting the Pro files (Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332).
Steps
- Start up as core's
CLAUDE.mddescribes:- on the primary checkout, run
git statusandgit pull origin main; - enter a worktree named
issue-<N>-pro-variant-move; - run
bun install; - self-assign at pickup with
bun run gh:assign <N> @me, never when filing.
- on the primary checkout, run
- Create the constants module, and update its importers.
- Create
pro-sync-variant.svelte.tsby cut and paste. Update its importers and the doc references. git mvthe test file, and update the imports in every listed test.- Update the pin-guard key and prose.
- Run the ratchet and paste
BASELINES. - Run the verification below, then
quality:fix. Commit, push and open the PR.
Acceptance criteria
Generic files:
-
ui-extensions.svelte.tsno longer containsproSync,labsFlags,SharedNodeStore,activeDatabaseSettingsorDATABASE_SETTINGS_NODE_ID. Its only remaining Pro references are theresolveProSyncVariantimport andimport './pro-plugin', and later sub-issues remove both. -
ui-extensions.tsdefines neitherDATABASE_SETTINGS_NODE_IDnorProSyncVariant. -
grep -rn DATABASE_SETTINGS_NODE_ID packages/desktop-app/src | grep plugins/ui-extensionsreturns nothing.
It is a pure move:
-
git diff -M --stat origin/mainshows the test file as a rename. -
git diff --color-moved origin/mainshows the moved functions unchanged.
Tests and checks:
- Every test passes with no expectation changed:
bun run test:changedandbun run --cwd packages/desktop-app test:free-users. -
bun run --cwd packages/desktop-app quality:fixleaves eslint, the design-token check and svelte-check clean. -
bun run scripts/check-pro-boundary.tsexits 0 andBASELINESequal its printed counts. Reduced markers are lowered, and the PR description declares the relocation raise.
Tests and verification
Nothing about behaviour changes, so there are no new tests. The moved tests, passing unchanged, are the proof.
bun run test:changed
bun run --cwd packages/desktop-app test src/tests/plugins src/tests/stores src/tests/services/shared-node-store-pin-guard.test.ts
bun run --cwd packages/desktop-app test:free-users
bun run --cwd packages/desktop-app quality:fix
bun run scripts/check-pro-boundary.ts
Dependencies
- NodeSpaceAI/nodespace-docs#90 (ADR-082) (ADR-082, proposed): records that the variant machine is Pro-only (§2.3).
- Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299: the ratchet, with its relocation-raise rule for moving existing Pro code inside core.
Risks and rollback
- A stale
vi.mockpath silently loads the real module instead of the mock. Themembership.test.tsretarget covers the one known case, andbun run testcatches any others. - Import graph. The new module imports exactly the stores that
ui-extensions.svelte.tsimported, so the module graph and evaluation order do not change. - Rollback. Revert the PR. It changes no data, no schema and no Rust code.
Plan key: C3.1a (pro-boundary DAG).
🤖 Generated with Claude Code
Activity