Repository navigation
Description
Summary
Add a native File → "Share / Sync This Database..." item. In the focused window it does one of two things:
- if no extension contributes to the
database.sync-entryslot, it opens core's dialog from Make the Share / Sync website action the sync-entry default; remove the Labs card #3359 (syncEntryDialog.show()); - otherwise it opens Settings → Database (
openSettings('database')), where the slot renders the extension's contribution.
PR #2932 deleted the sidebar database switcher, so the app has no in-app database menu. The File menu stands in for the "database menu" that ADR-084 §1 names; it already holds Import, Settings... and Integrations....
Context
ADR-082 §2.2 ("Hosts"). Only webview UI can host the slot, and a native-menu placement needs its own rule in ADR-082. So this item is not a slot host:
- it never renders or runs an extension's code;
- it either opens core's dialog or sends the user to the webview host;
- core's code still doesn't know what fills the slot.
ADR-082 must describe this behavior for native placements (see Dependencies). Under ADR-084 decision 7(b), the Pro app keeps this item, and it leads to an empty place.
Where the menu is built.
- At
af8ddb61the menu is built inrun()inpackages/desktop-app/src-tauri/src/lib.rs, inside the.setup(move |app| { ... })closure. TheMenuItemBuilder::new(...)calls come first, thenSubmenuBuilder::new(app, "File"), whose last item is&open_integrations. .on_menu_event(|app, event| { ... })maps eachMenuIdtowindow_routing::emit_routed(app, "menu-…", (), None), which targets the focused window.- After Route the desktop app through run(extensions, context) with no extensions in core #3306, the same code sits in the ADR-082 entry point (
run(extensions, context)/assemble(builder, extensions), ADR-082 §3.2). After Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322's library split, it may live inpackages/desktop-app/app-lib/src/lib.rs. - Find it by
SubmenuBuilder::new(app, "File")andopen_integrations_id.
Frontend listeners live in app-shell.svelte:
let unlistenIntegrationsamong the handle declarations;listen('menu-open-integrations', ...);- its cleanup,
(await unlistenIntegrations)().
Source-text tests. Code inside the Tauri builder can't be driven with tauri::test::MockRuntime, so lib.rs asserts its menu wiring on source text (quit_wiring_tests). Those tests read their own file with include_str!, so a needle written as a literal in the test also matches the test itself. Build needles from fragments, as #3302's absence-test convention does.
Scope
-
Rust, in the menu construction:
- add
let share_sync_database = MenuItemBuilder::new("Share / Sync This Database...").id("share_sync_database").build(app)?;, with no accelerator; - add a new
PredefinedMenuItem::separator(app)?; - append the separator and
&share_sync_databaseafter&open_integrationsin the File submenu's.items(&[...]); - in
.on_menu_event, addlet share_sync_database_id = MenuId::new("share_sync_database");and a branch that callswindow_routing::emit_routed(app, "menu-share-sync-database", (), None);, with noprintln!.
Put no URL, slot id or product name in Rust.
- add
-
Rust test: a new
#[cfg(test)] mod share_sync_menu_wiring_testsnext toquit_wiring_tests. It asserts:- the File submenu's
.items(&[list, sliced fromSubmenuBuilder::new(app, "File")to the next.build(), contains&share_sync_database; - the 200 bytes after the
== share_sync_database_id {branch containmenu-share-sync-database.
Build both needles at runtime, for example
["== share_sync", "_database_id {"].concat(), so the test's own source never contains them. - the File submenu's
-
packages/desktop-app/src/lib/services/sync-entry.ts(from Make the Share / Sync website action the sync-entry default; remove the Labs card #3359). Add:export const SYNC_ENTRY_MENU_EVENT = 'menu-share-sync-database';export function runSyncEntryFromMenu(): void. IfhasActionSlotContribution(DATABASE_SYNC_ENTRY_SLOT), it callsopenSettings('database'); otherwise it callssyncEntryDialog.show(). It imports the registry directly, not the host API.export function listenForSyncEntryMenu(): Promise<UnlistenFn>, which callslisten(SYNC_ENTRY_MENU_EVENT, runSyncEntryFromMenu)from@tauri-apps/api/event.
-
app-shell.svelte:- declare
let unlistenSyncEntry: Promise<() => void> | null = null;next tounlistenIntegrations; - assign
unlistenSyncEntry = listenForSyncEntryMenu();next to themenu-open-integrationsregistration; - await and call it in the cleanup block.
- declare
Out of scope
- Letting an extension relabel or remove the native item. That would need a Tauri extension point, and ADR-082 doesn't define one.
- The daemon tray's Databases submenu.
- Refactoring the other menu branches.
Steps
- Run the startup sequence from CLAUDE.md, with
EnterWorktree({name: "issue-<N>-sync-entry-menu"}):bun install;bun run testfor a baseline;gh:comment,gh:assign @me,gh:status "In Progress".
- Pre-check that ADR-082 as merged covers this placement (see Dependencies). If the reviewer declined a native entry, close this issue instead.
- Add the Rust menu item, the handler branch and the wiring test.
- Add
runSyncEntryFromMenuandlistenForSyncEntryMenuwith their tests, and wire them intoapp-shell.svelte. - Finish:
bun run test:changed(this reaches the Rust tier);cargo clippy -p <package that holds the menu code> --all-targets -- -D warnings -D clippy::unused-async. Ataf8ddb61the package isnodespace-app;bun run scripts/check-pro-boundary.ts;bun run --cwd packages/desktop-app quality:fix, then commit;git push origin HEAD:issue-<N>-sync-entry-menu;gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-sync-entry-menu.- After approval:
bun run merge <PR#>in the background, thenExitWorktree({action: "remove", discard_changes: true}).
Standards:
- Use
createLogger, neverconsole.*. - No
#[allow(...)]and no lint suppression. - Run Rust only through
test:changedor a crate-scoped command. The dev machine is shared. - Code comments cite ADR-082 and ADR-084, never issue numbers.
Acceptance criteria
- The File menu ends with a separator and "Share / Sync This Database...".
- With no extension contributing to the slot, choosing the item in the focused window opens core's dialog, and Continue opens the entry URL.
- With a contribution registered, choosing the item opens Settings → Database, and core's dialog does not open.
- Only the focused window reacts.
- Rust gains no Tauri command, URL, slot id or product name.
- The listener is removed when the app shell is torn down.
-
share_sync_menu_wiring_testspasses, and fails when either the emit line or the File menu entry is removed (mutation-check both). -
bun run scripts/check-pro-boundary.tsexits 0, withBASELINESequal to the printed counts. This change should move none. -
bun run test:changed, crate-scoped clippy andquality:fixare clean.
Tests and verification
-
src/tests/services/sync-entry.test.ts.- Mock
@tauri-apps/api/eventwith aMapof handlers, and mock$lib/utils/open-settings. - Register the fixture extension through the registry's test API.
Cover:
listenForSyncEntryMenu()registersmenu-share-sync-database;- firing it with nothing registered sets
syncEntryDialog.open, and doesn't callopenSettings; - firing it with the fixture registered calls
openSettings('database'), and leaves the dialog closed; - the returned unlisten function removes the handler.
- Mock
-
Rust. Run
bun run test:changed. For a focused run:.tools/bin/cargo-nextest nextest run -p <package> share_sync_menu_wiring. -
Manual check. Run
bun run tauri:devwith an isolatedNODESPACE_HOME:- Choose File → Share / Sync This Database.... The dialog opens, and Continue opens the browser.
- With two windows open, only the focused one reacts.
Dependencies
- Make the Share / Sync website action the sync-entry default; remove the Labs card #3359:
syncEntryDialog,sync-entry.tsand the default action. - Route the desktop app through run(extensions, context) with no extensions in core #3306: the desktop app's ADR-082 entry point. The menu code follows it, so this change doesn't have to rebase across the entry-point rewrite.
- NodeSpaceAI/nodespace-docs#90 (ADR-082) (ADR-082): as merged, ADR-082 must allow this native placement. Either §2.2 says a native menu item may open core's default when nothing is registered for the slot and otherwise open the webview host, or it defines an equivalent native-menu extension point.
Risks and rollback
- The Pro label. The Pro app shows the same native label. Under ADR-084 decision 7(a) it matches the Pro action; under 7(b) it leads to an empty place.
- Two windows.
emit_routed(..., None)targets the focused window, so keep theNonetarget. - Rollback. Revert the PR. The Settings action from Make the Share / Sync website action the sync-entry default; remove the Labs card #3359 is unaffected.
Plan key: C9.2 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Oct 1, 2026
Superseded by #3413 (umbrella against the final ADR-081–085)