Repository navigation
Add GetRoots RPC and restore root_node_count to diagnostics - #1165
Conversation
…1153) Co-Authored-By: Claude <[email protected]>
Code Review SummaryThis PR is a clean, targeted fix for a well-diagnosed problem. The structural analysis in issue #1153 is accurate — parentage lives in the relationship table, not on the node row, so exposing a Two implementation issues should be addressed before merge, and one nit. FindingsImprovements[Improvement] The daemon fetches the full root set from SurrealDB, then slices with This creates a misleading contract: the RPC signature implies server-side pagination but the implementation silently fetches everything first. The fix is either:
Given the diagnostics caller always passes [Improvement] Ok(response) => response.into_inner().nodes.len(),The response carries both NitpicksNit: Every neighbouring public method on |
- diagnostics: use response.count instead of nodes.len() for root_node_count (count is the authoritative total; nodes.len() would silently under-count if a non-zero limit were ever passed) - proto: document that GetRootsRequest limit/offset are applied in memory, not at the store layer; reference follow-up issue #1167 - core: add doc comment to get_roots Co-Authored-By: Claude <[email protected]>
Review Feedback Addressed✅ Addressed (2/2 important findings):
✅ Nit addressed: Added doc comment to Follow-up issue created: #1167 — Push GetRoots limit/offset pagination into SurrealStore::get_children |
* Add GetRoots RPC and restore root_node_count to diagnostics (closes #1153) Co-Authored-By: Claude <[email protected]> * Address review: use count over nodes.len, document pagination limitation - diagnostics: use response.count instead of nodes.len() for root_node_count (count is the authoritative total; nodes.len() would silently under-count if a non-zero limit were ever passed) - proto: document that GetRootsRequest limit/offset are applied in memory, not at the store layer; reference follow-up issue #1167 - core: add doc comment to get_roots Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude <[email protected]>
Summary
GetRootsRPC toNodeServiceproto withGetRootsRequest(limit/offset) returningNodeListResponsenode_service.rswired toCoreNodeService::get_roots()→SurrealStore::get_children(None)root_node_counttoDiagnosticsReport,print_human, andprint_jsonin the CLI diagnostics commanddiagnostics_collect_reports_counts_and_recencyintegration test to assertroot_node_count == baseline + 1Closes #1153
Test plan
cargo build -p nodespace-daemon -p nodespace-clisucceedscargo clippy --all-targets -- -D warnings -D clippy::unused-asyncclean (pre-existingnodespace-apperror unrelated to this PR)cargo test -p nodespace-cli— all 5 tests pass includingdiagnostics_collect_reports_counts_and_recency🤖 Generated with Claude Code