Repository navigation
Description
Summary
Stop core's collections tree from hiding the Pro tenant's workspace root.
After #3314, collectionsTree hides two sets of collections:
- the union of every extension's
collectionTreeRoots()(ADR-082 §2.2, proposed); - a transitional core fallback:
databaseStore.activeDatabase?.boundTenantCollection || ROOT_COLLECTION_ID.
This PR deletes the fallback, the ROOT_COLLECTION_ID constant and the databaseStore import. The Pro frontend supplies the root itself (ADR-083 §2, proposed).
No extension point is created here, and EXTENSION_API_VERSION does not change.
Context
Line numbers are at main @ af8ddb6. #3314 changes this code first, so locate it by symbol.
packages/desktop-app/src/lib/stores/collections.svelte.ts
| Symbol | Lines at af8ddb6 |
|---|---|
import { databaseStore } from '$lib/stores/database.svelte' |
6 |
The collectionsTree getter, with the bound-root fallback and its comment |
147-170 (fallback and comment at 153-163) |
ROOT_COLLECTION_ID ('c0000000-0000-0000-0000-000000000001') and its doc |
564-578 |
The buildCollectionsTree doc, and its root parameter, which defaults to ROOT_COLLECTION_ID |
580-600 |
| The parent filter and its comment | 620-623 |
| The top-level filter and its comment | 644-652 |
- The import.
databaseStoreis used only for the bound root.database.svelte.tsimportscollections.svelte, so removing the import also breaks a store import cycle. - Why the fallback is Pro-only. Core never creates either collection.
- The Pro daemon mints the per-install "My Workspace" root. It makes every pushed node and collection
member_ofthat root, for row-level-security visibility. - The legacy id is the root of the old shared tenant. In core's Rust it appears only in two
node_servicetests.
- The Pro daemon mints the per-install "My Workspace" root. It makes every pushed node and collection
- What ADR-083 §2 says.
collectionsTreestops readingboundTenantCollection.ROOT_COLLECTION_IDmoves to the Pro package.- The Pro frontend's
collectionTreeRootsreturns the bound collection, falling back to the legacy id.
- What Add the collectionTreeRoots extension point to the sidebar collection tree #3314 did.
- It added the contribution and its registry accessor. The accessor takes the union across extensions and is throw-safe.
- It routed
collectionsTreethrough them, andbuildCollectionsTreenow takes a set of root ids. - It kept the fallback, so nothing changed until this PR.
Scope
collections.svelte.ts
-
Delete
import { databaseStore }. -
In
collectionsTree, delete the fallback root and its comment, and pass only the contributed roots. -
Delete
ROOT_COLLECTION_IDand its doc. -
In
buildCollectionsTree, if the roots parameter still defaults toROOT_COLLECTION_ID(or to a set containing it), default it to an empty set. -
Rewrite
buildCollectionsTree's doc, the parent-filter comment and the top-level-filter comment neutrally. They should say that:- a root is a container collection that the tree does not show;
- a collection whose only parent is a root shows at the top level;
- with no roots, nothing is hidden.
Leave out tenant, per-install, RLS and "My Workspace" wording.
src/tests/stores/collections.test.ts
-
Drop the
ROOT_COLLECTION_IDimport. -
Rework the "buildCollectionsTree dynamic bound-root filtering" describe. It is at lines 638-746 at af8ddb6, unless Add the collectionTreeRoots extension point to the sidebar collection tree #3314 has changed it.
- Rename it "buildCollectionsTree root filtering".
- Rename
PER_INSTALL_ROOTtoROOT, and reword the comments neutrally. - Keep the cases where a root is passed:
- its members render as top-level peers;
- the root itself is excluded, even when it has content members;
- real sub-collections still nest.
- Rewrite "would WRONGLY nest them under the root when the stale legacy constant is used" as "with no roots, a container collection is an ordinary top-level collection with its members nested under it". Call it with no roots, instead of with
ROOT_COLLECTION_ID. - Replace "falls back to the legacy ROOT_COLLECTION_ID when no root id is given (public/legacy tenant)" with "does not special-case the legacy workspace-root id":
- use a fixture collection whose id is the literal
'c0000000-0000-0000-0000-000000000001', and whose members list it as their parent; - with no roots, it renders at the top level with its members nested under it.
- use a fixture collection whose id is the literal
-
In "collectionsTree hide-empty filter", add a case with no extension registered:
- call
collectionsData._setTestDatawith a container collection and its member collections; - the tree shows the container at the top, with its members nested under it.
Add the collectionTreeRoots extension point to the sidebar collection tree #3314's tests cover the contributed-roots path.
- call
Ratchet
Run bun run scripts/check-pro-boundary.ts and paste the printed BASELINES.
Out of scope
- The
collectionTreeRootscontribution, its accessor, the union and the throw handling (Add the collectionTreeRoots extension point to the sidebar collection tree #3314). DatabaseInfo.boundTenantCollectionandboundTenantSchema, theDatabaseEntryDTO and thedatabase_service.protofields (Move Pro-owned data out of core's data model (ADR-083) #3345). ADR-083 §7 lets them change only after this issue and Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332.- The tenant badge in
database-settings.svelte(Delete the Add synced database dialog and tenant badge from Database settings #3326). - The Rust tests that use the legacy id (Move Pro-owned data out of core's data model (ADR-083) #3345 or Remove Pro, Supabase and nodespace-sync wording from core comments, docs and the skill #3372).
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>-drop-tenant-root-fallback"}). - 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
- Confirm that Add the collectionTreeRoots extension point to the sidebar collection tree #3314 is on main, so
collectionsTreereads the contributed roots. - Make the
collections.svelte.tschanges. - Update the tests.
- Run the full frontend suite with
bun run test. Removing the store import changes which modules a test pulls in as a side effect. In particular,daemon-reconnect-retry.test.tsimportscollections.svelteon its own. - Run the searches under Acceptance criteria, then the ratchet.
- Finish:
- Run
bun run test:changed. - Run
bun run --cwd packages/desktop-app quality:fix, then commit. - Run
git push origin HEAD:issue-<N>-drop-tenant-root-fallback. - Run
gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-drop-tenant-root-fallback, 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:
- ADR-049: no
$effectfor derivations. - Use
createLogger. - Run tests with
bun run test, neverbun test.
Acceptance criteria
-
rg -n -i 'ROOT_COLLECTION_ID|boundTenant|databaseStore|tenant|per-install' packages/desktop-app/src/lib/stores/collections.svelte.tsfinds nothing. -
rg -n ROOT_COLLECTION_ID packages/desktop-app/srcfinds nothing. -
buildCollectionsTreehides exactly the roots it is given, and nothing by default. - With no extension registered,
collectionsData.collectionsTreehides nothing, including a collection with the legacy id. - Add the collectionTreeRoots extension point to the sidebar collection tree #3314's contributed-roots tests still pass.
-
EXTENSION_API_VERSIONis unchanged. - In the free app, a database that was never synced shows the same sidebar tree as before.
-
BASELINESinscripts/check-pro-boundary.tsis lowered to the printed counts, andbun run scripts/check-pro-boundary.tsexits 0. -
bun run testandbun run --cwd packages/desktop-app quality:fixpass.
Tests and verification
bun run --cwd packages/desktop-app test src/tests/stores/collections.test.ts src/tests/stores/daemon-reconnect-retry.test.tsbun run test- Free-app check: run
bun run tauri:devwith an isolatedNODESPACE_HOME, and open a database that was never synced. The sidebar tree matches main's. - Pro check, in nodespace-sync's pin-bump PR, with SYNC counterpart (c) from the parent: open a bound database. "My Workspace" is not listed, and its member collections appear as top-level peers.
Dependencies
- Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299: the ratchet.
- Add the collectionTreeRoots extension point to the sidebar collection tree #3314: the
collectionTreeRootscontribution, withcollectionsTreerouted through it. - NodeSpaceAI/nodespace-docs#92 (ADR-083) (ADR-083): the tree stops reading the tenant binding.
- Pin gate:
SYNC:Pro GUI and Pro daemon build from one pinned core rev.
Risks and rollback
- Deliberate behaviour change (ADR-083). Take a database that the Pro daemon bound, and open it in core without the Pro frontend.
- Its workspace root now shows as a top-level collection, with every collection nested under it.
- That is accurate, because it is a real collection.
- The free app with a never-synced database is unaffected.
- Pro build at a pin past this commit, without counterpart (c): the root reappears and nests everything. The pin gate keeps this out of Pro releases until sync's pin-bump PR carries (c).
- Rollback: revert the PR.
Plan key: C6.3 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Oct 1, 2026
Frontend baseline at 066fac4: 308 test files, 5606 tests passed
Hide only extension-contributed roots in the collections tree (closes #…