Repository navigation
Description
Summary
Core's shared code stops starting, re-targeting and inspecting Pro sync:
- App shell: no longer calls
proSync.start(). - Database store:
- no longer invokes
pro_activate_database(proActivateChain,activateProSync()); - no longer invalidates the Pro membership cache;
- no longer hydrates the settings singleton on its own.
- no longer invokes
- Debug channel: no longer dumps
proSync.
The Pro frontend does this work through #3313's hooks (ADR-082 §2.5, proposed): lifecycle.start, lifecycle.onDatabaseActivated and debugDump.
databaseStore.refreshDatabaseSettings() stays, because it is the host-API method databases.refreshDatabaseSettings() (ADR-082 §2.6). Core stops calling it.
The Pro modules stay in core, unused, until #3331 and #3332 delete them.
Context
Line numbers are at main @ af8ddb6. #3317 and #3327 will have shifted them, so locate code by symbol.
packages/desktop-app/src/lib/components/layout/app-shell.svelte
| Symbol | Lines | Notes |
|---|---|---|
import { proSync } from '$lib/stores/pro-sync.svelte' |
36 | |
let cleanupProSync |
248 | |
The "Pro-tier sync listener" comment and the proSync.start().then(…).catch(…) chain |
256-263 | Runs on every launch, inside the __TAURI_INTERNALS__ check. In community it invokes pro_tier, pro_current_status and pro_subscribe_sync_status, which do nothing |
cleanupProSync?.() |
605 | In the onMount cleanup |
The same onMount also holds code that other issues add. This PR changes none of it:
- from Add a neutral daemon:data-plane-ready event and stop reloading on pro:tier-detected #3318: the
daemon:data-plane-readylistener (unlistenDataPlaneReady), which reloads schemas and collections, and theschemasDataimport it uses; - from Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313: the extension
startdispatch and its cleanup.
packages/desktop-app/src/lib/stores/database.svelte.ts
| Symbol | Lines |
|---|---|
import { membership } from '$lib/stores/membership.svelte' |
12 |
DATABASE_SETTINGS_PIN_OWNER and its doc |
94-104 |
this.refreshDatabaseSettings() in the browser-mode branch of load() |
182 |
this.activateProSync(resolved) in load() |
234 |
The else branch in load() that calls this.refreshDatabaseSettings() |
243-247 |
proActivateChain and its doc |
283-293 |
proSyncSettled(), already deleted by #3325 |
295-304 |
activateProSync() and its doc |
306-327 |
The re-target comment and this.activateProSync(id) in switchTo() |
451-455 |
The membership comment and membership.invalidateForDatabaseSwitch() in evictAndReloadActiveDatabase() |
517-520 |
The re-hydrate comment and this.refreshDatabaseSettings() at the end of evictAndReloadActiveDatabase() |
544-546 |
refreshDatabaseSettings() and its doc |
549-593 |
The module-level onDaemonReconnect comment, which says a failed load leaves "the settings node unhydrated" |
659-663 |
The docs say refreshDatabaseSettings() exists only to feed the Pro variant machine. No core UI reads the settings singleton.
packages/desktop-app/src/lib/services/debug-channel.ts
captureStoreDump() has two Pro parts:
- a PII note naming
proSync.userEmail(lines 120-122); - a dynamic import and dump of
proSync(lines 156-161).
#3313 already added the debugDump loop over registered extensions.
Hook timing, from #3313
onDatabaseActivated fires after evictAndReloadActiveDatabase() in switchTo(), and after the if/else in load(). It therefore always fires after sharedNodeStore.clearAll().
That matters because clearAll() wipes every pin and bumps the database epoch. The Pro frontend uses this hook for three things:
- the serialized
pro_activate_databasere-target, with its own copy ofproActivateChain; membership.invalidateForDatabaseSwitch();databases.refreshDatabaseSettings(), whose pin survives because it runs afterclearAll().
Scope
app-shell.svelte
- Delete these four things:
- the
proSyncimport; let cleanupProSync;- the "Pro-tier sync listener" comment with the
proSync.start()chain; cleanupProSync?.().
- the
- Keep these:
schemasData;- Add a neutral daemon:data-plane-ready event and stop reloading on pro:tier-detected #3318's listener and
unlistenDataPlaneReady; - Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313's extension start and stop;
- the chrome outlets.
database.svelte.ts
-
Check:
proSyncSettledis gone (Delete the Pro Account section, workspace-members card and tenant-admission calls #3325). If it is not, stop, because Delete the Pro Account section, workspace-members card and tenant-admission calls #3325 has not merged. -
Pro re-target:
- Delete
proActivateChainandactivateProSync(), with their docs. - Delete the call in
load(), and the comment and call inswitchTo(). - Leave Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313's
onDatabaseActivateddispatch where Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313 put it.
- Delete
-
Membership: delete the import, and the comment and call in
evictAndReloadActiveDatabase(). -
Automatic settings hydration: delete core's three calls to
refreshDatabaseSettings(). Inload(), theif (resolved !== null && resolved !== this.defaultDatabaseId)block keeps its eviction call and loses itselse. -
Keep
refreshDatabaseSettings()andDATABASE_SETTINGS_PIN_OWNERunchanged in behaviour, and rewrite both docs neutrally. The new docs say that the method:- hydrates and pins the per-database settings singleton for extension code that reads it, and is the host-API method
databases.refreshDatabaseSettings()(ADR-082 §2.6); - is never called by core itself;
- pins the singleton because nothing in the structure tree reaches it, and never unpins it;
- loses its pin to a database switch's
clearAll(), so a caller re-runs it fromonDatabaseActivated, which fires after the eviction.
Remove every mention of these from the two docs:
resolveProSyncVariant,activeDatabaseSettings,pro-sync-variant.svelte.ts,membership.svelte.ts,collaboration-locked.svelte,sync_enabledandauth_status. - hydrates and pins the per-database settings singleton for extension code that reads it, and is the host-API method
-
onDaemonReconnectcomment: drop "(and the settings node unhydrated)". This PR makes it false.
debug-channel.ts
- Delete the
proSyncblock incaptureStoreDump(). - In the doc, drop the
proSync.userEmailexample if it is still there. Keep the PII warning, which Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313 extended to extension dumps.
Host API, only if needed
Check that src/lib/extension-api/index.ts (#3315) exports databases.refreshDatabaseSettings(). If it does not:
- add it to the
databasesfacade; - re-record the host API's export snapshot;
- apply Publish the extension host API: services, ui and testing entries, version policy #3315's versioning rule for an additive export. ADR-082 §6 calls for a minor bump.
Tests
src/tests/stores/database.test.ts
Setup:
- Reword the
pinNodesmock comment (lines 26-28) neutrally: extension code reads the singleton outside any open tab. - Delete the
$lib/stores/membership.sveltemock andmembershipInvalidateForDatabaseSwitch(lines 79-84). - In
settingsNode()(lines 146-158), setpropertiesto{}.
describe('load'): two tests change.
- The tests:
- "reloads the database-scoped stores when the restored database is not the default" (line 347);
- "does not reload the stores when the restored database is the default" (line 363).
- In both, replace
expect(mockGetNode).toHaveBeenCalledWith(DATABASE_SETTINGS_NODE_ID)withexpect(mockGetNode).not.toHaveBeenCalledWith(DATABASE_SETTINGS_NODE_ID).
describe('switchTo'):
- In "flushes, switches, clears caches, resets tabs, and reloads", drop three things:
- the
pro_activate_databasenote on the mock (line 467); - the re-target comment and
vi.waitFor(lines 473-479); - the membership assertion and its comment (lines 521-524).
- the
- Delete "completes the switch even if the Pro sync re-target fails" (lines 537-555).
- Delete "does not dispatch a later pro_activate_database call until an earlier one settles…" (lines 557-587). The serialization contract moves to the Pro frontend's tests.
- Drop
pro_activate_databasefrom the inline comments at lines 633 and 710.
describe('refreshDatabaseSettings'):
- Reword the comment in "pins DATABASE_SETTINGS_NODE_ID reachable…" (lines 772-778) neutrally.
- Delete "load() hydrates the settings node through the same forced refetch" (lines 798-811).
- Delete "switchTo re-pulls the new database settings after the caches are cleared" (lines 844-856). Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313's lifecycle describe covers the hook's order relative to
clearAll(). - Keep the other five tests.
describe('isActiveDatabaseEvent'): retitle "passes events with no database id (single-database / Pro daemon)" (line 898) to "passes events with no database id (not scoped to a database)". #3366 no longer lists this title.
Leave #3313's lifecycle-hooks describe unchanged.
src/tests/stores/daemon-reconnect-retry.test.ts
- Delete the comment at lines 102-103: "…also hydrates the DatabaseSettingsNode — the Pro-sync variant machine's axis-2 feed".
- The
list_databasesassertion on line 104 stays. - Remove Pro and cloud-sync wording from frontend comments, tests and the fly-out tooltip #3366 no longer lists this comment.
Ratchet
Run bun run scripts/check-pro-boundary.ts and paste the printed BASELINES.
Out of scope
- Add a neutral daemon:data-plane-ready event and stop reloading on pro:tier-detected #3318:
- the app shell's
daemon:data-plane-readylistener, theschemasDataimport andunlistenDataPlaneReady; props-driven-components.test.ts;- the
daemon-status.tsmodule doc.
- the app shell's
- Delete the Collaboration tab, membership store and service, and the Pro plugin from core #3331 and Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332: deleting
pro-sync.svelte.ts, the membership store and service, the modals,components/collaboration/*andpro-sync-variant.svelte.ts.pro-sync.svelte.tsandfirst-pro-consent-slot.sveltekeep callingrefreshDatabaseSettings(), which still exists. - Remove the tenant-binding root fallback from the collections tree #3330 and Move Pro-owned data out of core's data model (ADR-083) #3345:
boundTenant*and the collections tree. - Turn the UI-extension registry into ADR-082's build-time frontend extension API #3317: where the hooks fire, the
debugDumploop, and the overlay slot's name. - Move the Pro Tauri layer out of core: pro_* commands, ProClient, proto, update source #3336: the Rust
pro:tier-detectedemit and thepro_activate_databasecommand. - Move Pro-owned data out of core's data model (ADR-083) #3345: the
DATABASE_SETTINGS_NODE_IDdoc and the settings-node fields. - Remove Pro and cloud-sync wording from frontend comments, tests and the fly-out tooltip #3366: the
isActiveDatabaseEventdoc.
Steps
- Startup, per core's CLAUDE.md:
- On the primary checkout, run
git status, thengit fetch origin && git pull origin main. - Run
EnterWorktree({name: "issue-<N>-pro-lifecycle-hooks"}). - Inside the worktree, run
bun install, thenbun run testfor the baseline. - Run
bun run gh:comment <N> "Frontend: X passed",bun run gh:assign <N> "@me"andbun run gh:status <N> "In Progress".
- On the primary checkout, run
- Check the preconditions:
rg -n proSyncSettled packages/desktop-app/srcfinds nothing (Delete the Pro Account section, workspace-members card and tenant-admission calls #3325).rg -n 'pro:tier-detected' packages/desktop-app/src/lib/components/layout/app-shell.sveltefinds nothing (Add a neutral daemon:data-plane-ready event and stop reloading on pro:tier-detected #3318).- Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313's hooks exist, and its lifecycle describe in
database.test.tsasserts thatonDatabaseActivatedfires afterclearAll. - The pin gate holds: nodespace-sync's Pro GUI build reads a pinned core revision.
- Make the
app-shell.sveltechanges. - Make the
database.svelte.tschanges. - Make the
debug-channel.tschanges. - Check the host API facade, and add
refreshDatabaseSettingsif it is missing. - Update the tests.
- Run the searches under Acceptance criteria, then the ratchet.
- Run the free-app check under Tests and verification.
- Finish:
- Run
bun run test:changed. - Run
bun run --cwd packages/desktop-app quality:fix, then commit. - Run
git push origin HEAD:issue-<N>-pro-lifecycle-hooks. - Run
gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-pro-lifecycle-hooks, thenbun run gh:status <N> "In Review". - Run
/pragmatic-code-review, then/address-review. - Merge only after the user approves. Run
bun run merge <PR#>in the background, thenExitWorktree.
- Run
Standards:
- Use
createLogger, neverconsole.*. - Mock Tauri with
mockTauriCorefromsrc/tests/helpers/mock-tauri-core. - Run tests with
bun run test, neverbun test. - No
any, and no lint suppression. - No GitHub issue numbers in code comments. Cite ADRs instead.
Acceptance criteria
-
rg -n 'proSync|pro-sync' packages/desktop-app/src/lib/components/layout/app-shell.svelte packages/desktop-app/src/lib/stores/database.svelte.ts packages/desktop-app/src/lib/services/debug-channel.tsfinds nothing. -
rg -n 'pro_activate_database|proSyncSettled|activateProSync|proActivateChain' packages/desktop-app/srcfinds nothing. -
rg -n membership packages/desktop-app/src/lib/stores/database.svelte.tsfinds nothing. -
rg -n -F 'refreshDatabaseSettings(' packages/desktop-app/src/libmatches only these four places:- the definition;
- the host-API facade;
stores/pro-sync.svelte.tsandcomponents/first-pro-consent-slot.svelte, which Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332 deletes.
-
@nodespace/extension-apiexportsdatabases.refreshDatabaseSettings(), and its export snapshot passes. - Core's debug store dump has no
proSyncsection, and Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313'sdebugDumptests indebug-channel.test.tspass. - Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313's test that
onDatabaseActivatedfires afterclearAll()still passes. - The free app is unchanged (see the free-app check under Tests and verification).
-
BASELINESinscripts/check-pro-boundary.tsis lowered to the printed counts, andbun run scripts/check-pro-boundary.tsexits 0. -
bun run test:changedandbun run --cwd packages/desktop-app quality:fixpass.
Tests and verification
Unit tests
bun run --cwd packages/desktop-app test src/tests/stores/database.test.ts src/tests/stores/daemon-reconnect-retry.test.ts src/tests/services/debug-channel.test.ts src/tests/services/shared-node-store-pin-guard.test.tsbun run test:changed
The pin-guard's second test still finds pinNodes(DATABASE_SETTINGS_PIN_OWNER, [DATABASE_SETTINGS_NODE_ID]) in database.svelte.ts, because the method stays.
Free-app check
Run bun run tauri:dev with an isolated NODESPACE_HOME, never the live ~/.nodespace.
- Stop the daemon, then cold-start the app. The sidebar's collections and the schema-backed types load without a manual reload.
- Switch databases A → B → A. The sidebar, schemas, saved queries and AI chats reload for each database, and the console shows no errors.
- No
pro_*command is invoked. The acceptance searches check this statically: after this PR, the only callers are in Pro modules that core no longer registers (Stop importing the Pro extension in core; register it only through the build entry #3316) or starts.
Pro check, in nodespace-sync's pin-bump PR
When sync moves its pin past this commit, with SYNC counterpart (b) from the parent, build with scripts/build-pro-dmg.sh and check:
- the sync status arrives after launch;
- switching databases re-targets sync to the new database;
- a rapid A → B → A switch ends on A;
- after a switch, the settings singleton rehydrates, so the consent modal appears for a signed-in database that is not yet enabled;
- the Collaboration tab's roster shows the new database's members.
Before merging, you may also build the Pro app from a sync branch pinned to this PR's head.
Dependencies
- Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299: the ratchet.
- Add start, onDatabaseActivated and debugDump extension lifecycle hooks #3313: the
start,onDatabaseActivatedanddebugDumphooks, withonDatabaseActivatedfiring after the eviction. - Publish the extension host API: services, ui and testing entries, version policy #3315: the host API facade.
- Add a neutral daemon:data-plane-ready event and stop reloading on pro:tier-detected #3318: the app shell's reload no longer uses
pro:tier-detected, and Add a neutral daemon:data-plane-ready event and stop reloading on pro:tier-detected #3318 ownsschemasDataand the listener. - Delete the Pro Account section, workspace-members card and tenant-admission calls #3325:
proSyncSettled()and its only consumer,workspace-members-card, are gone. - Pin gate:
SYNC:Pro GUI and Pro daemon build from one pinned core rev.
Risks and rollback
- Pro build at a pin past this commit, without counterpart (b): sync never starts, and the relogin modal never shows. The pin gate keeps this out of Pro releases until sync's pin-bump PR carries (b).
- Two lifecycles at once:
- Suppose sync pins to a revision between Stop importing the Pro extension in core; register it only through the build entry #3316 and this PR while its Pro frontend already implements
startandonDatabaseActivated. - Core's
proSync.start()andactivateProSyncthen run next to the Pro frontend's copies. - Their two
pro_activate_databasechains are not serialized with each other, so they can race. - To avoid this, sync turns its hooks on in the pin bump that crosses this PR.
- Suppose sync pins to a revision between Stop importing the Pro extension in core; register it only through the build entry #3316 and this PR while its Pro frontend already implements
- Rollback: revert the PR.
- The Pro build is unaffected until sync pins to a revision that contains the revert.
- Do not let sync pin to that revision while its Pro frontend drives the lifecycle, for the reason above.
Plan key: C6.2 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Oct 1, 2026
Superseded by #3412 (umbrella against the final ADR-081–085)