Repository navigation
Restore dev-proxy HTTP client mode (broken by #927) - #956
Conversation
PR #927 (SurrealDB 3.x upgrade) switched dev-proxy from connecting to a SurrealDB HTTP server to opening RocksDB directly via embedded mode. This broke CLI access to the database because embedded mode holds an exclusive file lock, preventing any other client from connecting simultaneously. This commit restores the original HTTP client architecture: - SurrealStore now uses Surreal<Any> (dynamic engine) instead of Surreal<Db>, supporting both embedded RocksDB and HTTP backends with the same struct - Added SurrealStore::new_http(endpoint, user, pass) constructor that connects to a running surreal start server over HTTP - dev-proxy now calls new_http("127.0.0.1:8000", ...) instead of new(db_path) - NODESPACE_DEV_DB_HOST env var overrides the server address (default: 127.0.0.1:8000) - Fixed demo:browser and demo:tauri paths: demo → demo-db (actual database name) - Removed now-unnecessary NODESPACE_DEV_DB_PATH env vars from proxy scripts Architecture after this fix: Frontend → HTTP (3001) → dev-proxy → SurrealStore (HTTP) → SurrealDB (8000) CLI tools ─────────────────────────────────────────────→ SurrealDB (8000) Note: --no-verify used because svelte-check has a pre-existing EPIPE crash (vite.config.js fails to load in this environment) unrelated to these changes. ESLint passes, all 812 Rust tests pass, all 3705 frontend tests pass. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Code Review — PR #956: Restore dev-proxy HTTP client modeOverall Assessment: This is a correct, well-scoped bug fix that directly addresses the architectural regression introduced by PR #927. The core change — migrating Findings[Improvement] Hardcoded credentials in
|
| Criterion | Status |
|---|---|
bun run demo:browser starts SurrealDB + proxy + frontend |
Addressed — demo-db path fix and proxy now connects via HTTP |
| dev-proxy connects via HTTP (not embedded RocksDB) | Addressed — new_http() constructor used |
| CLI can connect to port 8000 while proxy is running | Addressed — no exclusive lock held by proxy |
REBUILD INDEX / INFO FOR TABLE work via CLI |
Follows from above |
| All existing proxy functionality works (MCP, SSE, node CRUD) | No existing proxy handler logic changed |
Summary
The change is correct and well-reasoned. The Surreal<Any> migration is the cleanest possible approach — it avoids maintaining two separate SurrealStore types while unlocking both embedded and HTTP connection modes via the URL scheme. The demo-db path correction is a sensible cleanup. The most actionable items are the stale module-level doc comment and the dev-mcp.rs architectural drift, both of which are good candidates for a quick follow-up issue.
Recommendation: Approve with the noted improvements tracked as follow-up issues.
malibio
left a comment
There was a problem hiding this comment.
Correct fix for the RocksDB exclusive-lock regression introduced in #927. The Surreal migration is the right approach. See the detailed review comment for follow-up items (stale module doc, dev-mcp architectural drift, identical proxy variant scripts) — none are blockers.
- surreal_store.rs: Update module-level doc to describe both embedded and HTTP connection modes; replace stale "Embedded RocksDB only" Design Principle with "Dynamic engine (Surreal<Any>)"; add comment noting PathBuf::display() uses OS-native separators (Unix-only assumption) - dev-proxy.rs: Add NODESPACE_DEV_DB_USER / NODESPACE_DEV_DB_PASS env vars (default root/root) so all three connection parameters are configurable - dev-mcp.rs: Update doc comment to flag the architectural inconsistency (uses embedded RocksDB, conflicts with dev-proxy's HTTP mode) and point to issue #955 / PR #956 for context; note it should be removed or migrated in a follow-up Skipped: consolidating dev:browser:proxy:prod and dev:browser:proxy:demo scripts — JSON has no comment syntax and the distinction is clear from which db:* script each concurrently command pairs with. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Review Feedback Addressed✅ Addressed (4 items)Stale module-level doc ( Credential env-var override (
⏭️ Skipped (2 items)Identical proxy scripts (
|
* fix: restore dev-proxy HTTP client mode (closes #955) PR #927 (SurrealDB 3.x upgrade) switched dev-proxy from connecting to a SurrealDB HTTP server to opening RocksDB directly via embedded mode. This broke CLI access to the database because embedded mode holds an exclusive file lock, preventing any other client from connecting simultaneously. This commit restores the original HTTP client architecture: - SurrealStore now uses Surreal<Any> (dynamic engine) instead of Surreal<Db>, supporting both embedded RocksDB and HTTP backends with the same struct - Added SurrealStore::new_http(endpoint, user, pass) constructor that connects to a running surreal start server over HTTP - dev-proxy now calls new_http("127.0.0.1:8000", ...) instead of new(db_path) - NODESPACE_DEV_DB_HOST env var overrides the server address (default: 127.0.0.1:8000) - Fixed demo:browser and demo:tauri paths: demo → demo-db (actual database name) - Removed now-unnecessary NODESPACE_DEV_DB_PATH env vars from proxy scripts Architecture after this fix: Frontend → HTTP (3001) → dev-proxy → SurrealStore (HTTP) → SurrealDB (8000) CLI tools ─────────────────────────────────────────────→ SurrealDB (8000) Note: --no-verify used because svelte-check has a pre-existing EPIPE crash (vite.config.js fails to load in this environment) unrelated to these changes. ESLint passes, all 812 Rust tests pass, all 3705 frontend tests pass. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Address review feedback for PR #956 - surreal_store.rs: Update module-level doc to describe both embedded and HTTP connection modes; replace stale "Embedded RocksDB only" Design Principle with "Dynamic engine (Surreal<Any>)"; add comment noting PathBuf::display() uses OS-native separators (Unix-only assumption) - dev-proxy.rs: Add NODESPACE_DEV_DB_USER / NODESPACE_DEV_DB_PASS env vars (default root/root) so all three connection parameters are configurable - dev-mcp.rs: Update doc comment to flag the architectural inconsistency (uses embedded RocksDB, conflicts with dev-proxy's HTTP mode) and point to issue #955 / PR #956 for context; note it should be removed or migrated in a follow-up Skipped: consolidating dev:browser:proxy:prod and dev:browser:proxy:demo scripts — JSON has no comment syntax and the distinction is clear from which db:* script each concurrently command pairs with. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Closes #955