Skip to content

Implement nodespaced binary: gRPC server startup and NodeService registration #1112

Closed

Description

@malibio

Overview

Build the nodespaced binary — the background daemon that owns the RocksDB lock and exposes all NodeSpace services over gRPC on localhost:50051. This issue covers the server startup, NodeService handler registration, and graceful shutdown. It is the second step in the ADR-031 daemon-client architecture.

Problem Statement

All NodeSpace services currently live inside the Tauri process. ADR-031 moves them to a dedicated background daemon (nodespaced) that starts independently of any UI and remains running as long as the user's session is active. Without this daemon, no gRPC client (Tauri UI, CLI, agent tools) can connect.

Proposed Solution

Implement packages/daemon/src/main.rs as a tokio-based async binary that initializes NodeService (from packages/core), registers it with a tonic gRPC server, binds to localhost:50051, and handles SIGTERM/SIGINT for graceful shutdown.

Acceptance Criteria

  • nodespaced binary builds and starts without error
  • gRPC server listens on localhost:50051
  • All NodeService RPC methods (CreateNode, GetNode, UpdateNode, DeleteNode, GetChildren, SearchNodes) are registered and respond correctly
  • WatchNodes streaming RPC is registered (may return Unimplemented initially — covered by dedicated streaming issue)
  • Chat streaming RPC is registered (may return Unimplemented initially)
  • Graceful shutdown on SIGTERM / SIGINT: in-flight requests complete, server stops accepting new connections, RocksDB closes cleanly
  • cargo build --bin nodespaced succeeds
  • Integration test: start daemon, send GetNode via gRPC client, verify response
  • Code passes bun run quality:fix

Technical Specifications

Files to create/modify

  • packages/daemon/src/main.rs — binary entry point, server setup, shutdown handler
  • packages/daemon/src/services/node_service.rs — tonic NodeService trait implementation wrapping packages/core ops
  • packages/daemon/src/services/mod.rs — module exports
  • packages/daemon/Cargo.toml — add tokio, tonic, anyhow dependencies; declare [[bin]] target

Server startup pattern

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let addr = "[::1]:50051".parse()?;
    let node_service = NodeServiceImpl::new(/* core NodeService */);

    Server::builder()
        .add_service(NodeServiceServer::new(node_service))
        .serve_with_shutdown(addr, shutdown_signal())
        .await?;

    Ok(())
}

NodeService implementation

The tonic service impl wraps packages/core/src/ops/ — each RPC handler calls the corresponding op function and maps anyhow::Error to tonic::Status.

Dependencies (Cargo.toml)

tokio = { version = "1", features = ["full"] }
tonic = "0.12"
anyhow = "1"
tracing = "0.1"
tracing-subscriber = "0.3"

Reference files

Dependencies

Non-Goals

  • Tauri command migration (separate issue)
  • WatchNodes streaming implementation (separate issue)
  • CLI binary (separate issue)
  • System tray (separate issue)

Activity

  1. malibio commented on May 17, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 128 test files, 3918 tests passed (Duration 66.93s). Starting work in isolated worktree on branch feature/issue-1112-nodespaced-grpc-server.

  2. self-assigned this
    on May 17, 2026
  3. added 2 commits that reference this issue on May 17, 2026
    5e7ef28
    d6f9975
  4. added a commit that references this issue on Jun 22, 2026
    5ce9b47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions