Add title field sync for collection nodes (Issue #844)#845
Conversation
## Summary Enable indexed title field for collection nodes to improve lookup performance while excluding collections from @mention autocomplete results. ## Changes ### node_service.rs - Modified create_node() to set title for collection nodes (in addition to task nodes) - Modified create_node_with_parent() to include collections in title sync - Modified update_node() to sync title when collection content changes - Added comprehensive test module for collection title sync behavior ### surreal_store.rs - Updated get_collection_by_name() to query indexed title field instead of unindexed content - Updated get_collections_by_names() to query indexed title field for batch lookups - Added node_type != 'collection' filter to mention_autocomplete() to exclude collections - Added tests for collection lookup using title field and @mention exclusion ## Acceptance Criteria Met - ✅ Collection nodes have title field set to content on create - ✅ Collection nodes have title field updated when content changes - ✅ get_collection_by_name() queries indexed title field - ✅ get_collections_by_names() queries indexed title field - ✅ Collections do NOT appear in @mention autocomplete results - ✅ All existing tests pass - ✅ Added tests for collection title sync, lookup, and @mention exclusion Closes #844 Co-Authored-By: Claude <noreply@anthropic.com>
Code Review: PR #845 - Add title field sync for collection nodesReview Type: Initial Review Reviewer: Principal Engineer (Pragmatic Code Review) Requirements Check (Issue #844)
All acceptance criteria have been met. Code Review FindingsArchitecture & Design:large_green_circle: [Strength]: Clean, Surgical Changes The implementation makes minimal, focused changes to achieve the goal. The hybrid approach (setting title for indexed lookup while excluding from @mention results) is elegant and maintains backwards compatibility with existing collection semantics. Key design decisions are sound:
Functionality & Correctness:large_green_circle: [Strength]: Complete Coverage of Node Lifecycle The implementation correctly handles all code paths:
The markdown stripping ( :large_green_circle: [Strength]: Comprehensive Test Coverage The test suite is thorough:
Maintainability & Readability:large_green_circle: [Strength]: Excellent Documentation Every change includes clear issue references (#844) in comments, explaining the "why" behind the change. The docstrings for 🔸 [Nit]: Minor Comment Inconsistency
The comment "Issue #844: Exclude collection nodes from @mention results" appears twice - once in the preamble (line 2446-2449) and again immediately before the SQL (line 2463). The second one is redundant. // Issue #844: Exclude collection nodes from @mention results <-- redundant
let sql = r#"Security✅ No concerns. The changes are pure database query modifications with no new user input handling paths. All inputs were already validated by existing code. Performance:large_green_circle: [Strength]: Performance Improvement This change converts two unindexed field queries (
The additional Testing Strategy✅ Excellent coverage. Tests cover:
Minor Observations (Informational)
SummaryThis is a high-quality, well-tested change that:
The code is clean, well-documented, and follows established patterns. The change is a clear net positive. Recommendation✅ APPROVE This PR is ready to merge. |
malibio
left a comment
There was a problem hiding this comment.
Review Status: APPROVE (recommendation)
This PR meets all acceptance criteria and is recommended for merge. Since self-approval is not permitted, this is submitted as a comment review.
All code quality checks pass, tests are comprehensive, and the implementation follows established patterns.
## Summary Enable indexed title field for collection nodes to improve lookup performance while excluding collections from @mention autocomplete results. ## Changes ### node_service.rs - Modified create_node() to set title for collection nodes (in addition to task nodes) - Modified create_node_with_parent() to include collections in title sync - Modified update_node() to sync title when collection content changes - Added comprehensive test module for collection title sync behavior ### surreal_store.rs - Updated get_collection_by_name() to query indexed title field instead of unindexed content - Updated get_collections_by_names() to query indexed title field for batch lookups - Added node_type != 'collection' filter to mention_autocomplete() to exclude collections - Added tests for collection lookup using title field and @mention exclusion ## Acceptance Criteria Met - ✅ Collection nodes have title field set to content on create - ✅ Collection nodes have title field updated when content changes - ✅ get_collection_by_name() queries indexed title field - ✅ get_collections_by_names() queries indexed title field - ✅ Collections do NOT appear in @mention autocomplete results - ✅ All existing tests pass - ✅ Added tests for collection title sync, lookup, and @mention exclusion Closes #844 Co-authored-by: Claude <noreply@anthropic.com>
## Summary Enable indexed title field for collection nodes to improve lookup performance while excluding collections from @mention autocomplete results. ## Changes ### node_service.rs - Modified create_node() to set title for collection nodes (in addition to task nodes) - Modified create_node_with_parent() to include collections in title sync - Modified update_node() to sync title when collection content changes - Added comprehensive test module for collection title sync behavior ### surreal_store.rs - Updated get_collection_by_name() to query indexed title field instead of unindexed content - Updated get_collections_by_names() to query indexed title field for batch lookups - Added node_type != 'collection' filter to mention_autocomplete() to exclude collections - Added tests for collection lookup using title field and @mention exclusion ## Acceptance Criteria Met - ✅ Collection nodes have title field set to content on create - ✅ Collection nodes have title field updated when content changes - ✅ get_collection_by_name() queries indexed title field - ✅ get_collections_by_names() queries indexed title field - ✅ Collections do NOT appear in @mention autocomplete results - ✅ All existing tests pass - ✅ Added tests for collection title sync, lookup, and @mention exclusion Closes #844 Co-authored-by: Claude <noreply@anthropic.com>
## Summary Enable indexed title field for collection nodes to improve lookup performance while excluding collections from @mention autocomplete results. ## Changes ### node_service.rs - Modified create_node() to set title for collection nodes (in addition to task nodes) - Modified create_node_with_parent() to include collections in title sync - Modified update_node() to sync title when collection content changes - Added comprehensive test module for collection title sync behavior ### surreal_store.rs - Updated get_collection_by_name() to query indexed title field instead of unindexed content - Updated get_collections_by_names() to query indexed title field for batch lookups - Added node_type != 'collection' filter to mention_autocomplete() to exclude collections - Added tests for collection lookup using title field and @mention exclusion ## Acceptance Criteria Met - ✅ Collection nodes have title field set to content on create - ✅ Collection nodes have title field updated when content changes - ✅ get_collection_by_name() queries indexed title field - ✅ get_collections_by_names() queries indexed title field - ✅ Collections do NOT appear in @mention autocomplete results - ✅ All existing tests pass - ✅ Added tests for collection title sync, lookup, and @mention exclusion Closes #844 Co-authored-by: Claude <noreply@anthropic.com>
Summary
Changes
node_service.rs
create_node()to set title for collection nodes (in addition to task nodes)create_node_with_parent()to include collections in title syncupdate_node()to sync title when collection content changessurreal_store.rs
get_collection_by_name()to query indexed title field instead of unindexed contentget_collections_by_names()to query indexed title field for batch lookupsnode_type != 'collection'filter tomention_autocomplete()to exclude collectionsTest plan
cargo test -p nodespace-core --lib collection_title- 4 tests passcargo test -p nodespace-core --lib mention_autocomplete_excludes_collection- passescargo test -p nodespace-core --lib get_collection_by_name- passescargo test -p nodespace-core --lib get_collections_by_names- passesAcceptance Criteria
titlefield set tocontenton createtitlefield updated whencontentchangesget_collection_by_name()queries indexedtitlefieldget_collections_by_names()queries indexedtitlefieldCloses #844
🤖 Generated with Claude Code