Skip to content

Add a File menu item that opens the Share / Sync this database entry #3360

Closed as not planned

Description

@mstomar125

Summary

Add a native File → "Share / Sync This Database..." item. In the focused window it does one of two things:

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 af8ddb61 the menu is built in run() in packages/desktop-app/src-tauri/src/lib.rs, inside the .setup(move |app| { ... }) closure. The MenuItemBuilder::new(...) calls come first, then SubmenuBuilder::new(app, "File"), whose last item is &open_integrations.
  • .on_menu_event(|app, event| { ... }) maps each MenuId to window_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 in packages/desktop-app/app-lib/src/lib.rs.
  • Find it by SubmenuBuilder::new(app, "File") and open_integrations_id.

Frontend listeners live in app-shell.svelte:

  • let unlistenIntegrations among 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

  1. 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_database after &open_integrations in the File submenu's .items(&[...]);
    • in .on_menu_event, add let share_sync_database_id = MenuId::new("share_sync_database"); and a branch that calls window_routing::emit_routed(app, "menu-share-sync-database", (), None);, with no println!.

    Put no URL, slot id or product name in Rust.

  2. Rust test: a new #[cfg(test)] mod share_sync_menu_wiring_tests next to quit_wiring_tests. It asserts:

    • the File submenu's .items(&[ list, sliced from SubmenuBuilder::new(app, "File") to the next .build(), contains &share_sync_database;
    • the 200 bytes after the == share_sync_database_id { branch contain menu-share-sync-database.

    Build both needles at runtime, for example ["== share_sync", "_database_id {"].concat(), so the test's own source never contains them.

  3. 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. If hasActionSlotContribution(DATABASE_SYNC_ENTRY_SLOT), it calls openSettings('database'); otherwise it calls syncEntryDialog.show(). It imports the registry directly, not the host API.
    • export function listenForSyncEntryMenu(): Promise<UnlistenFn>, which calls listen(SYNC_ENTRY_MENU_EVENT, runSyncEntryFromMenu) from @tauri-apps/api/event.
  4. app-shell.svelte:

    • declare let unlistenSyncEntry: Promise<() => void> | null = null; next to unlistenIntegrations;
    • assign unlistenSyncEntry = listenForSyncEntryMenu(); next to the menu-open-integrations registration;
    • await and call it in the cleanup block.

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

  1. Run the startup sequence from CLAUDE.md, with EnterWorktree({name: "issue-<N>-sync-entry-menu"}):
    • bun install;
    • bun run test for a baseline;
    • gh:comment, gh:assign @me, gh:status "In Progress".
  2. Pre-check that ADR-082 as merged covers this placement (see Dependencies). If the reviewer declined a native entry, close this issue instead.
  3. Add the Rust menu item, the handler branch and the wiring test.
  4. Add runSyncEntryFromMenu and listenForSyncEntryMenu with their tests, and wire them into app-shell.svelte.
  5. 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. At af8ddb61 the package is nodespace-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, then ExitWorktree({action: "remove", discard_changes: true}).

Standards:

  • Use createLogger, never console.*.
  • No #[allow(...)] and no lint suppression.
  • Run Rust only through test:changed or 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_tests passes, and fails when either the emit line or the File menu entry is removed (mutation-check both).
  • bun run scripts/check-pro-boundary.ts exits 0, with BASELINES equal to the printed counts. This change should move none.
  • bun run test:changed, crate-scoped clippy and quality:fix are clean.

Tests and verification

  • src/tests/services/sync-entry.test.ts.

    • Mock @tauri-apps/api/event with a Map of handlers, and mock $lib/utils/open-settings.
    • Register the fixture extension through the registry's test API.

    Cover:

    • listenForSyncEntryMenu() registers menu-share-sync-database;
    • firing it with nothing registered sets syncEntryDialog.open, and doesn't call openSettings;
    • firing it with the fixture registered calls openSettings('database'), and leaves the dialog closed;
    • the returned unlisten function removes the handler.
  • 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:dev with an isolated NODESPACE_HOME:

    1. Choose File → Share / Sync This Database.... The dialog opens, and Continue opens the browser.
    2. With two windows open, only the focused one reacts.

Dependencies

Risks and rollback


Plan key: C9.2 (pro-boundary DAG).

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Sep 30, 2026
  2. added
    pro-boundary
    on Sep 30, 2026
  3. mstomar125 commented on Oct 1, 2026

    @mstomar125
    ContributorAuthor

    Superseded by #3413 (umbrella against the final ADR-081–085)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

pro-boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions