Repository navigation
Feature: search_semantic graph-aware enhancements (closes #1085) - #1101
Conversation
…aph_boost, param gap closure (closes #1085) - Phase 1: Expose missing params (threshold, include_archived, scope, node_types, property_filters, exclude_collections) in def_search_semantic and exec_search_semantic - Phase 2: Add include_edges param - attach outgoing edge data to results when enabled - Phase 3: Add graph_boost param - re-rank results by blending similarity with edge degree (0.7 * similarity + 0.3 * normalized_degree) - Refactor handle_search_semantic to delegate to search_ops::search_semantic (eliminates ~280 lines of duplicate code) Co-Authored-By: Claude <[email protected]>
Pragmatic Code Review: PR #1101Review Type: Initial Review Requirements Check (Issue #1085)Phase 1 (parameter gap closure)
Phase 2 (include_edges)
Phase 3 (graph_boost)
General
Code Review Findings🟡 Important: Doc comment/implementation mismatch on graph_boost degree calculation📁 The doc comment says: But the implementation at let out_count = node_service.get_related_nodes(&node.id, "mentions", "out")...
let in_count = node_service.get_related_nodes(&node.id, "mentions", "in")...
degrees.insert(node.id.clone(), out_count + in_count);The implementation (out+in) is the better choice — it captures total connectivity. The doc comment should be updated to match: Engineering Principle: Documentation that contradicts code is worse than no documentation — it creates false confidence and wastes debugging time. 🟡 Important: Duplicate
|
| Category | Status |
|---|---|
| Requirements | 28/29 acceptance criteria met (missing 1 unit test) |
| Code Quality | Clean — well-structured, follows project patterns |
| Security | No issues found |
| Performance | Minor duplicate DB calls when both graph_boost+include_edges enabled |
| Testing | Good coverage of new params and formula; 1 acceptance criterion test missing |
| Architecture | Excellent refactoring — single canonical search pipeline |
Recommendation: APPROVE with minor suggestions
The implementation is solid, well-tested, and the architectural refactoring is a clear improvement. The findings above are suggestions for polish — none are blocking. The missing scope passthrough test and the doc/impl mismatch are the most actionable items.
malibio
left a comment
There was a problem hiding this comment.
Recommendation: APPROVE with minor suggestions. See detailed review comment above.
Pragmatic Code Review - PR #1101Review Type: Initial Review Requirements Check (Issue #1085)Phase 1 (parameter gap closure)
Phase 2 (include_edges)
Phase 3 (graph_boost)
General
Code Review Findings🟡 Important: graph_boost makes N×2 sequential DB calls for degree counting📁 for (node, _) in &filtered_results {
let out_count = node_service
.get_related_nodes(&node.id, "mentions", "out")
.await
.map(|v| v.len())
.unwrap_or(0);
let in_count = node_service
.get_related_nodes(&node.id, "mentions", "in")
.await
.map(|v| v.len())
.unwrap_or(0);For 20 results this makes 40 sequential DB round-trips, fetching full Engineering Principle: Sequential I/O in a loop is a known anti-pattern for latency-sensitive paths. Opt-in nature makes this acceptable now but needs a fast-follow. Recommendation: No code change needed — the existing TODO is sufficient. Consider adding a tracing span around the loop to measure real-world latency. 🟡 Important: Duplicate outgoing edge fetches when both graph_boost and include_edges are true📁 When both Recommendation: If 🟡 Important: MCP handler response drops
|
| Category | Assessment |
|---|---|
| Requirements | 28/29 acceptance criteria met (missing scope forwarding unit test) |
| Code Quality | Excellent — clean deduplication, well-documented formulas |
| Security | N/A — no user-facing input paths affected |
| Performance | graph_boost has N×2 sequential DB calls (acceptable for opt-in V1, tracked via TODO) |
| Testing | Good param parsing + formula tests; missing one integration test |
| Documentation | Well-documented formulas and edge format in code comments |
Recommendation: ✅ APPROVE
The missing unit test for scope forwarding is a minor gap — the parameter forwarding is simple pass-through code that's verified by the type system and existing integration tests. The performance characteristics of graph_boost are acceptable for an opt-in V1 feature. The MCP handler deduplication alone makes this PR a net positive for maintainability.
…cope test - Fix doc comment on graph_boost: degree is (out+in), not just outgoing - Cache outgoing edges when both graph_boost and include_edges enabled, eliminating duplicate get_related_nodes DB round-trips - Add scope="conversations" passthrough test (issue #1085 acceptance criterion) - Update schema parity test to include newly exposed fields Addresses reviewer recommendations from PR #1101 review. Co-Authored-By: Claude <[email protected]>
Review Findings Addressed (commit 0830c07)Addressed (3/6)
Skipped (3/6)
Test Results
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: All changes are straightforward -- doc comment fixes, a simple cache introduction that doesn't change behavior, a new unit test, and a test list update. No architectural or logic changes. All 1179 tests pass. |
* Feature: search_semantic graph-aware enhancements - include_edges, graph_boost, param gap closure (closes #1085) - Phase 1: Expose missing params (threshold, include_archived, scope, node_types, property_filters, exclude_collections) in def_search_semantic and exec_search_semantic - Phase 2: Add include_edges param - attach outgoing edge data to results when enabled - Phase 3: Add graph_boost param - re-rank results by blending similarity with edge degree (0.7 * similarity + 0.3 * normalized_degree) - Refactor handle_search_semantic to delegate to search_ops::search_semantic (eliminates ~280 lines of duplicate code) Co-Authored-By: Claude <[email protected]> * Address review: fix doc mismatch, cache duplicate edge lookups, add scope test - Fix doc comment on graph_boost: degree is (out+in), not just outgoing - Cache outgoing edges when both graph_boost and include_edges enabled, eliminating duplicate get_related_nodes DB round-trips - Add scope="conversations" passthrough test (issue #1085 acceptance criterion) - Update schema parity test to include newly exposed fields Addresses reviewer recommendations from PR #1101 review. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Summary
Closes #1085 - Exposes missing opt-in parameters in the local agent's
search_semantictool and adds graph-aware search enhancements (include_edges,graph_boost) to both MCP and local agent paths.Changes
Gap 1+2: Local agent tool schema parity
SearchSemanticParamsfields in the local agent tool definition:threshold,exclude_collections,include_archived,scope,node_types,collection_id,property_filters,include_edges,graph_boostexec_search_semanticnow forwards all params tosearch_opsinstead of hardcodingNoneGap 3: Graph-aware enhancements (both paths)
include_edges(bool, default: false) — Attaches outgoing "mentions" relationships as anedgesarray on each result node. Reduces round-trips for graph traversal queries.graph_boost(bool, default: false) — Re-ranks results by blending similarity with graph connectivity:combined_score = 0.7 * similarity + 0.3 * normalized_degree. Surfaces well-connected central knowledge nodes over isolated but textually similar ones.Deduplication: MCP handler delegates to search_ops
handle_search_semanticinsearch.rsnow delegates entirely to the sharedsearch_ops::search_semanticlayer, removing ~250 lines of duplicated collection resolution, scope filtering, lifecycle filtering, over-fetching, and markdown inlining logic.Files changed
packages/core/src/ops/search_ops.rs— Core implementation: graph_boost re-ranking, include_edges attachment, new unit testspackages/core/src/mcp/handlers/search.rs— Replaced duplicated logic with delegation to search_ops; added param parsing testspackages/core/src/mcp/handlers/tools.rs— Added include_edges/graph_boost to MCP tool schemapackages/agent/src/local_agent/tools.rs— Full param schema + forwarding in executorTest plan
cargo test -p nodespace-core search— 82 tests pass (52 unit + 23 integration + 7 embedding)cargo clippy -p nodespace-core -p nodespace-agent— cleanbun run test— 3918 frontend tests pass🤖 Generated with Claude Code