Skip to content

Upgrade to SurrealDB 3.x and fix dev-proxy database initialization #920

Closed

Description

@malibio

Overview

Upgrade the entire NodeSpace stack from SurrealDB 2.x to SurrealDB 3.x, and fix the dev-proxy database initialization that fell out of sync with the Tauri app's refactored database management.

SurrealDB 3.0 was released February 2026 with significant performance improvements (8-22x faster graph queries), native AI agent memory support, and architectural changes. The current bun run dev:browser is broken due to SurrealDB SDK ^2.3 incompatibility with the installed SurrealDB 2.6.0 server — upgrading to 3.x resolves this and future-proofs the stack.

Problem Statement

Two issues converge here:

  1. Dev-proxy broken: bun run dev:browser fails — schema.surql execution returns 400 (HTTP RPC session state issue between SDK ^2.3 and SurrealDB 2.6.0 server)
  2. SurrealDB 2.x EOL: 3.0 is GA with breaking changes; staying on 2.x accumulates technical debt

Proposed Solution

Upgrade to SurrealDB 3.x across the entire stack and fix dev-proxy initialization.

Implementation Approach

Phase 1: Upgrade SurrealDB crate and server

  • Update workspace Cargo.toml: surrealdb = { version = "^3.0", ... }
  • Install SurrealDB 3.x server locally
  • Review feature flags — kv-rocksdb and protocol-http may have changed

Phase 2: Migrate schema.surql

  • MTREE → HNSW: Convert vector index from MTREE to HNSW
  • Function renames: ::from:: → ::from_, ::is:: → ::is_
  • <future> → COMPUTED: Replace any future fields with computed fields
  • SEARCH ANALYZER → FULLTEXT ANALYZER: Update index definitions
  • Review any LET parameter declarations, optional chaining syntax changes

Phase 3: Fix Rust code for API changes

  • Audit SurrealStore methods for any SDK API changes
  • Fix any query language changes in inline SurrealQL
  • Test embedded (RocksDB) and HTTP connection modes

Phase 4: Fix dev-proxy initialization

  • Align dev-proxy database init with Tauri app's create_service_bundle() approach
  • Make database connection configurable (not hardcoded)
  • Consider switching dev-proxy to embedded mode (eliminates HTTP session issues)

Phase 5: Verify end-to-end

  • bun run dev:tauri works with SurrealDB 3.x
  • bun run dev:browser works with fixed dev-proxy
  • All Rust tests pass
  • All frontend tests pass

Acceptance Criteria

  • SurrealDB Rust crate upgraded to ^3.0
  • schema.surql migrated (MTREE→HNSW, function renames, etc.)
  • All SurrealQL queries in Rust code updated for 3.x syntax
  • bun run dev:browser successfully starts and initializes schema
  • bun run dev:tauri works with SurrealDB 3.x
  • Dev-proxy database connection is configurable (not hardcoded)
  • Rust tests pass (bun run rust:test)
  • Frontend tests pass (bun run test)
  • Code passes bun run quality:fix

Technical Specifications

Reference Files

  • Workspace Cargo.toml: Cargo.toml — surrealdb = { version = "^2.3", features = ["kv-rocksdb", "protocol-http"] }
  • Schema: packages/core/src/db/schema.surql — MTREE vector index, analyzers, full schema
  • SurrealStore: packages/core/src/db/surreal_store.rs — new() (embedded) and new_http() (HTTP)
  • Dev-proxy: packages/dev-tools/src/bin/dev-proxy.rs — hardcoded HttpStore::new_http()
  • Tauri DB commands: packages/desktop-app/src-tauri/src/commands/db.rs — create_service_bundle()

Breaking Changes Reference (2.x → 3.x)

Version Targets

  • SurrealDB server: 3.0.1 (latest stable)
  • surrealdb Rust crate: ^3.0

Related Issues

Activity

  1. added
    bug
    on Feb 28, 2026
  2. changed the title [-]Dev-proxy database initialization out of sync with Tauri app refactoring[/-] [+]Upgrade to SurrealDB 3.x and fix dev-proxy database initialization[/+] on Mar 1, 2026
  3. malibio commented on Mar 7, 2026

    @malibio
    CollaboratorAuthor

    Baseline: Frontend 3681 passed (115 files), Rust 795 passed. Note: mcp::handlers::initialize integration tests hang indefinitely (pre-existing issue, excluded from baseline).

  4. self-assigned this
    on Mar 7, 2026
  5. added a commit that references this issue on Mar 13, 2026
    c3b8031
  6. added a commit that references this issue on Jun 22, 2026
    716d4bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backendbugfoundation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions