Repository navigation
Description
Summary
Finish ADR-083 §2 (proposed; decision 2-A). Remove the typed tenant binding from core's registry, wire and frontend, and give extensions a generic registry setter.
- Registry entries.
DatabaseEntrylosesbound_tenant_schemaandbound_tenant_collection. Existing lines load intoextensions, which Carry opaque registry extensions through DatabaseInfo and drop the tray's synced label #3341 added, and survive every save under the same key names. - Setter.
DatabaseManager::set_bound_tenant(id, schema, collection)becomesset_extensions(id, entries):- entries are
(key, Option<String>)pairs, andNoneremoves a key; - all entries are written in one save;
- the registry's own keys (
id,name,path,created_at,last_opened_at) are rejected.
- entries are
- Wire and frontend. Proto
DatabaseInfofields 8 and 9 becomereserved 8, 9;. The daemon mapping, the desktop DTO and the frontendDatabaseInfodrop the typed fields.
Context (lines at af8ddb61 are hints)
Why the pin gate.
- Sync's release workflow and
build-pro-dmg.shbuild core's desktop app from core HEAD, whilenodespaced-prois pinned at680c35d8. - Without one pinned rev for both, this PR would reach the Pro GUI at once. The GUI would read
extensionsfrom a Pro daemon that still sends fields 8 and 9, and would show every database as unbound (ADR-083 §7 item 4). - With the gate in place, core merges first and sync adapts in its pin-bump PR.
Readers that must be gone first:
- Move the Pro account, admission and synced-database settings out of core #3327 (Delete the Add synced database dialog and tenant badge from Database settings #3326) deletes the Settings → Databases tenant badge, and the add-synced-database dialog with its test.
- Move the Pro sync and collaboration UI out of core #3333 (Remove the tenant-binding root fallback from the collections tree #3330) makes the collections tree take its hidden roots from ADR-082's
collectionTreeRootscontribution instead of fromboundTenantCollection. - Move the Pro sync and collaboration UI out of core #3333 (Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332) deletes the Pro sync store and its test.
- After these, nothing in core reads the typed binding.
Pro's side at its pin bump (sync notes, not gates). Key names do not change, so no data moves.
- Pro daemon reads
listing.entry.extensions.get("bound_tenant_schema")for the one-database-per-tenant check and for sign-out enumeration (cloud_sync/mod.rs~1021,grpc.rs~1130). - Pro daemon writes both keys with
set_extensionsafter the node write (main.rs~687,cloud_sync/mod.rs~1051), passingNoneon unbind. - Pro package. Its
database.rowbadge and itscollectionTreeRootscontribution readextensions["bound_tenant_schema"]andextensions["bound_tenant_collection"]from the host API's database list.
Code:
DatabaseEntryfields (~96-105).set_bound_tenant(~702-727), plus the docs that name it (~577, ~621).- Struct literals (~771-778, ~856-863, ~1162-1169, and
tray.rs~810-818). - Tests
set_bound_tenant_mirrors_persists_and_clears(~1468-1508) andset_bound_tenant_rolls_back_when_save_fails(~1728-1772). - Proto fields (~69-77). The comment at ~75 also cites an issue number, which core
CLAUDE.mdforbids. - Daemon mapping in
database_service.rs(~68-69). - DTO in
commands/database.rs(~49-55, ~87-88). - Frontend in
database.svelte.ts(~39-48, ~82-83). - Fixtures in
database.test.ts(~140-141) andnavigation-sidebar-nav-items.test.ts(~34-35).
Scope
Everything listed under Context, in core only.
Out of scope
- The settings-node keys (Replace DatabaseSettingsNode's Pro fields and accessors with a generic settings accessor #3340).
- The Pro package, the Pro daemon, and
ROOT_COLLECTION_ID(Remove the tenant-binding root fallback from the collections tree #3330). - Reserving the proto field names. Reserve the numbers only: core uses binary protobuf, and a
reserved "..."line would keep Pro names in core.
Steps
-
Start. Follow core
CLAUDE.md's startup sequence:EnterWorktree({name: "issue-<N>-registry-set-extensions"});bun install;- the
bun run testbaseline; gh:assign, thengh:status.
Then confirm the preconditions:
- Carry opaque registry extensions through DatabaseInfo and drop the tray's synced label #3341, Move the Pro account, admission and synced-database settings out of core #3327 and Move the Pro sync and collaboration UI out of core #3333 have merged.
- The pin gate is in place: sync's release workflow and
build-pro-dmg.shcheck out a pinned core rev. git grep -n boundTenant -- packages/desktop-app/srclists only the type,IMPLICIT_BROWSER_DATABASEand the fixtures.
-
Registry.
-
Delete the two typed fields and their docs.
-
Add
pub const REGISTRY_ENTRY_KEYS: [&str; 5] = ["id", "name", "path", "created_at", "last_opened_at"];. -
Add
pub async fn set_extensions(&self, id: &DatabaseId, entries: &[(&str, Option<String>)]) -> Result<()>:- reject any key in
REGISTRY_ENTRY_KEYSwith an error, before touching the registry; - fail an unknown id through
find_or_err, asrenamedoes; - otherwise run one
mutate_and_savethat inserts atoml::Value::Stringor removes the key.
Its doc names no key. It says that a failed save leaves the previous registry live, and that a successful one notifies
subscribe_changes. - reject any key in
-
Delete
set_bound_tenant, and fix the two docs that list it. -
Drop the typed fields from the struct literals.
-
-
Proto. Delete fields 8 and 9 and their comments. Add
reserved 8, 9;with the comment "Retired fields. Never reuse these numbers." -
Mapping, DTO and frontend. Delete:
- the typed fields and their mapping lines;
- the two lines in
IMPLICIT_BROWSER_DATABASE; - the fixture lines.
-
Tests (
database_manager.rs):- Delete the two
set_bound_tenant_*tests. set_extensions_persists_and_clears: set two keys, reload from disk and see both; then passNoneand see that key removed.set_extensions_rolls_back_when_save_fails: follow the shape ofrename_rolls_back_when_save_fails(~1675). Keep the old test's check that only a successful call notifies subscribers.set_extensions_rejects_registry_keys: passname; nothing is written.set_extensions_on_unknown_id_is_not_found.registry_entry_keys_match_the_serialized_entry: serialize an entry with everyOptionset and emptyextensionsinto atoml::Table. Its keys must equalREGISTRY_ENTRY_KEYS, which guards the list against drift.
- Delete the two
-
Grep.
git grep -n -E 'bound_?[tT]enant|[bB]oundTenant' -- packagesprints nothing. -
Ratchet. Run
bun run scripts/check-pro-boundary.tsand setBASELINESto the printed counts. ExpectcloudBindStateandtenantWordingto drop. -
Finish.
bun run test:changed, thenbun run quality:fix, then commit.- Push to
issue-<N>-registry-set-extensions. gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-registry-set-extensions, thengh:status "In Review".- After approval, run
bun run merge <PR#>in the background.
Acceptance criteria
- Core's registry, proto, DTO and frontend have no named binding field, and proto numbers 8 and 9 are reserved.
- A
databases.tomlholding the legacy binding lines loads, and those lines survive every registry mutation byte-for-value. Carry opaque registry extensions through DatabaseInfo and drop the tray's synced label #3341's round-trip test plus the manual check prove this. -
set_extensionspersists and clears keys, rolls back on a failed save, notifies on success, and rejects registry keys and unknown ids. - The free app's database create, rename, remove, set-default and switch flows are unchanged.
-
bun run scripts/check-pro-boundary.tsexits 0, andBASELINESequals its printed counts. - The pin gate was in place, and Move the Pro account, admission and synced-database settings out of core #3327, Move the Pro sync and collaboration UI out of core #3333 and Carry opaque registry extensions through DatabaseInfo and drop the tray's synced label #3341 had merged, before this PR merged.
Tests and verification
bun run test:changed.tools/bin/cargo-nextest nextest run -p nodespace-daemon --lib database_manager.tools/bin/cargo-nextest nextest run -p nodespace-daemon --lib traybun run rust:test:app-unitsbun run --cwd packages/desktop-app test src/tests/stores/database.test.ts src/tests/components/navigation-sidebar-nav-items.test.tscargo clippy -p nodespace-daemon -p nodespace-proto --all-targets -- -D warnings -D clippy::unused-async- Manual check. Use an isolated
NODESPACE_HOMEwhosedatabases.tomlentry hasbound_tenant_schemaandbound_tenant_collectionlines. Then:- the daemon starts and lists the database;
- a rename keeps both lines in the file;
- Settings → Databases shows no sync status.
Dependencies
- Carry opaque registry extensions through DatabaseInfo and drop the tray's synced label #3341: the
extensionsmap this PR moves the binding into. - Move the Pro account, admission and synced-database settings out of core #3327, Move the Pro sync and collaboration UI out of core #3333: every core reader of the typed binding is gone.
SYNC:Pro GUI and Pro daemon build from one pinned core rev: the canonical pin gate (ADR-083 §7 item 4). Sync adapts its Pro daemon and Pro package in its pin-bump PR.- NodeSpaceAI/nodespace-docs#92 (ADR-083) and Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299 are reached through Carry opaque registry extensions through DatabaseInfo and drop the tray's synced label #3341.
Risks and rollback
- Merging before the pin gate would make the Pro GUI show every database as unbound until the next Pro release built with a matching daemon. The gate prevents this.
- Rollback. Revert the PR. The legacy lines are still in
databases.toml, becauseextensionspreserved them, so the restored typed fields read them again.
Plan key: C7.6 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Sep 30, 2026
Acceptance criterion added (from #3341's review): when
set_extensions(or any writer of registry extension keys) is added here, reject keys that collide with the registry entry's own field names (id,name,path,created_at,last_opened_at, and thebound_*fields while they exist).DatabaseEntry.extensionsis#[serde(flatten)], so a colliding key would clobber the typed value on save.mstomar125 commentedon Oct 1, 2026
Superseded by #3412 (umbrella against the final ADR-081–085)