Repository navigation
Migrate project documentation to NodeSpace collections - #831
Conversation
## Summary - Add lifecycle_status parameter to create_node and update_node MCP tools - Enhance import-docs.ts with intelligent collection routing and archival support - Update CLAUDE.md with documentation search section ## Changes ### Rust Backend - Add lifecycle_status to NodeUpdate struct in models/node.rs - Add lifecycle_status support in surreal_store.rs update method - Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams - Add lifecycle_status to MCP tool schemas (create_node, update_node) - Pass through lifecycle_status in node_service.rs update flow - Fix benchmarks to include lifecycle_status field ### Import Script (scripts/import-docs.ts) - Add intelligent collection routing (Upper Case, spaces allowed): - architecture/decisions/* -> "ADR" - */archived/* -> "Archived" (marked for archival) - */lessons/* -> "Lessons" - troubleshooting/* -> "Troubleshooting" - architecture/components/* -> "Components" - architecture/business-logic/* -> "Business Logic" - architecture/development/* -> "Development:*" (nested) - Add --dry-run flag for preview mode with collection distribution stats - Post-import lifecycle_status update for archived documents ### Documentation - Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md - Document semantic search usage and collection structure - Document import script usage ## Follow-Up Issues Created - #829: Documentation Accuracy Audit - #830: NodeSpace Skill for Claude Code Closes #770 Co-Authored-By: Claude <[email protected]>
…c import ## Search Results (#821) - Added `title` field to semantic search result objects - Previously only `content` was returned, which contains markdown formatting - The `title` field contains stripped/clean text for display ## Async Import Performance Fix - Moved collection membership creation into the async spawn - Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn, causing database contention during bulk imports - Now: collection path is resolved synchronously (for error reporting), but the actual membership creation happens in background using store directly - This restores the original fast async import behavior ## Changes - `search.rs`: Added `title` to node JSON in search results - `markdown.rs`: Restructured async flow to include collection handling in spawn Co-Authored-By: Claude <[email protected]>
- Add title field to TypeScript Node interface to match Rust backend
- Update base-node.svelte to use node.title for @mention results
- Falls back to content.split('\n')[0] for nodes without title
- Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete
The title field contains markdown-stripped content for clean display,
populated only for root nodes and task nodes (Issue #821).
Co-Authored-By: Claude <[email protected]>
Enhances the import script with two-phase import: Phase 1: Import all markdown files and build path-to-nodeId mapping - Imports docs with collection organization - Tracks file paths to node IDs Phase 2: Resolve internal markdown links to nodespace:// URIs - Converts [text](./relative/path.md) to [text](nodespace://uuid) - Backend automatically creates bidirectional mentions relationships - Reports unresolved links (pointing to non-imported files) This enables clickable cross-references between imported docs and shows backlinks in the "Mentioned by" panel. Co-Authored-By: Claude <[email protected]>
## Problem create_node() was calling get_schema_for_type() TWICE per node: 1. Line 1120: To apply schema defaults 2. Line 1144: To add schema version This caused 2 database queries per node creation, resulting in 5+ second response times for markdown imports. ## Solution - Fetch schema ONCE and reuse for all operations - Moved schema version addition into the same block as defaults/validation - Added timing instrumentation for debugging ## Performance Impact - Before: 5281ms for simple markdown import with collection - After: 779ms for same import (6.8x faster) - Without collection: 266ms (20x faster than before) ## Files Changed - packages/core/src/services/node_service.rs: Single schema fetch - packages/core/src/mcp/handlers/markdown.rs: Debug timing logs Co-Authored-By: Claude <[email protected]>
…rate-docs-to-nodespace
…rate-docs-to-nodespace
## Import System - Add File > Import Folder menu with folder picker dialog - Create StatusBar component showing import progress and embedding queue - Add import_directory Tauri command with progress events - Support auto_collection_routing and exclude_patterns options ## UI Fixes - Fix status bar overlapping BacklinksPanel (grid minmax fix) - Fix scroll position starting in middle by keying on nodeId+tabId+paneId - Add margin-top: auto to BacklinksPanel for proper bottom positioning ## Performance Optimizations - Fix N+1 query in get_collection_members (5-6x speedup) - Batch fetch nodes in single query instead of individual fetches - Add get_nodes_batch to SurrealStore for efficient bulk retrieval ## Collections Sidebar - Add reactive updates when member_of relationships change - Listen to RELATIONSHIP_CREATED/DELETED MCP events - Invalidate collection member caches on membership changes ## Status Bar Features - Toggle via View menu (Cmd+Shift+B) - Show embedding queue count (left side) - Show import progress with percentage (right side) - Auto-hide success messages after 3 seconds Closes #770 Co-Authored-By: Claude <[email protected]>
Principal Engineer Code ReviewReview Type: Initial Review Requirements Check (Issue #770)
Code Review Findings🟢 Notable Improvements1. N+1 Query Optimization (Critical Performance Fix)
2. Schema Fetch Deduplication
3. Bulk Import with Root-Only Notification
4. Scroll State Fix
🟡 Suggested Improvements1. Debug Logging Left in Production Code
2. Hardcoded File Write for Debugging
if let Ok(mut f) = std::fs::OpenOptions::new()
.create(true)
.append(true)
.open("/tmp/import-debug.log")
3. Status Bar Polling Interval
4. Collection Tree Building - First Parent Only
// Add to first parent only (to avoid showing same collection multiple times)
const firstParentId = parentIds[0];
🔵 Nit: Minor Polish1. Nit: Unused import removal
2. Nit: Magic numbers
3. Nit: Emoji in code comment
Architecture AssessmentStrengths:
No Architectural Concerns:
Security Check✅ No security issues identified:
Recommendation: APPROVE with Minor ChangesThe PR is a clear net positive with significant performance improvements and solid feature implementation. The only blocking concern is the debug logging that should be cleaned up before merge:
All other suggestions are improvements that can be addressed in follow-up work. Reviewed by Principal Engineer AI |
malibio
left a comment
There was a problem hiding this comment.
Code review complete. Please address the debug logging cleanup (println! statements in import.rs, console.log in collections.ts, and /tmp/import-debug.log file write) before merging. See detailed review comment for full analysis and recommendations.
- Remove println! debug statements from import.rs - Remove /tmp/import-debug.log file write - Remove console.log debug statement from collections.ts Addresses reviewer recommendations from PR #831. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Review Feedback AddressedChanges Made
Skipped Recommendations (with justification)
Summary
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: All changes are straightforward debug statement removal with no logic changes. Tests pass. The cleanup addresses exactly what was required with minimal code churn. PR is ready to merge. |
* Add lifecycle_status to MCP tools and enhance docs import script (#770) ## Summary - Add lifecycle_status parameter to create_node and update_node MCP tools - Enhance import-docs.ts with intelligent collection routing and archival support - Update CLAUDE.md with documentation search section ## Changes ### Rust Backend - Add lifecycle_status to NodeUpdate struct in models/node.rs - Add lifecycle_status support in surreal_store.rs update method - Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams - Add lifecycle_status to MCP tool schemas (create_node, update_node) - Pass through lifecycle_status in node_service.rs update flow - Fix benchmarks to include lifecycle_status field ### Import Script (scripts/import-docs.ts) - Add intelligent collection routing (Upper Case, spaces allowed): - architecture/decisions/* -> "ADR" - */archived/* -> "Archived" (marked for archival) - */lessons/* -> "Lessons" - troubleshooting/* -> "Troubleshooting" - architecture/components/* -> "Components" - architecture/business-logic/* -> "Business Logic" - architecture/development/* -> "Development:*" (nested) - Add --dry-run flag for preview mode with collection distribution stats - Post-import lifecycle_status update for archived documents ### Documentation - Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md - Document semantic search usage and collection structure - Document import script usage ## Follow-Up Issues Created - #829: Documentation Accuracy Audit - #830: NodeSpace Skill for Claude Code Closes #770 Co-Authored-By: Claude <[email protected]> * fix: Include title field in semantic search results and optimize async import ## Search Results (#821) - Added `title` field to semantic search result objects - Previously only `content` was returned, which contains markdown formatting - The `title` field contains stripped/clean text for display ## Async Import Performance Fix - Moved collection membership creation into the async spawn - Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn, causing database contention during bulk imports - Now: collection path is resolved synchronously (for error reporting), but the actual membership creation happens in background using store directly - This restores the original fast async import behavior ## Changes - `search.rs`: Added `title` to node JSON in search results - `markdown.rs`: Restructured async flow to include collection handling in spawn Co-Authored-By: Claude <[email protected]> * fix: Use title field for @mention autocomplete display - Add title field to TypeScript Node interface to match Rust backend - Update base-node.svelte to use node.title for @mention results - Falls back to content.split('\n')[0] for nodes without title - Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete The title field contains markdown-stripped content for clean display, populated only for root nodes and task nodes (Issue #821). Co-Authored-By: Claude <[email protected]> * feat: Add Phase 2 link resolution to docs import script Enhances the import script with two-phase import: Phase 1: Import all markdown files and build path-to-nodeId mapping - Imports docs with collection organization - Tracks file paths to node IDs Phase 2: Resolve internal markdown links to nodespace:// URIs - Converts [text](./relative/path.md) to [text](nodespace://uuid) - Backend automatically creates bidirectional mentions relationships - Reports unresolved links (pointing to non-imported files) This enables clickable cross-references between imported docs and shows backlinks in the "Mentioned by" panel. Co-Authored-By: Claude <[email protected]> * perf: Fix duplicate schema fetch in create_node (5x speedup) ## Problem create_node() was calling get_schema_for_type() TWICE per node: 1. Line 1120: To apply schema defaults 2. Line 1144: To add schema version This caused 2 database queries per node creation, resulting in 5+ second response times for markdown imports. ## Solution - Fetch schema ONCE and reuse for all operations - Moved schema version addition into the same block as defaults/validation - Added timing instrumentation for debugging ## Performance Impact - Before: 5281ms for simple markdown import with collection - After: 779ms for same import (6.8x faster) - Without collection: 266ms (20x faster than before) ## Files Changed - packages/core/src/services/node_service.rs: Single schema fetch - packages/core/src/mcp/handlers/markdown.rs: Debug timing logs Co-Authored-By: Claude <[email protected]> * feat: Import UI, status bar, scroll fixes, and N+1 query optimization ## Import System - Add File > Import Folder menu with folder picker dialog - Create StatusBar component showing import progress and embedding queue - Add import_directory Tauri command with progress events - Support auto_collection_routing and exclude_patterns options ## UI Fixes - Fix status bar overlapping BacklinksPanel (grid minmax fix) - Fix scroll position starting in middle by keying on nodeId+tabId+paneId - Add margin-top: auto to BacklinksPanel for proper bottom positioning ## Performance Optimizations - Fix N+1 query in get_collection_members (5-6x speedup) - Batch fetch nodes in single query instead of individual fetches - Add get_nodes_batch to SurrealStore for efficient bulk retrieval ## Collections Sidebar - Add reactive updates when member_of relationships change - Listen to RELATIONSHIP_CREATED/DELETED MCP events - Invalidate collection member caches on membership changes ## Status Bar Features - Toggle via View menu (Cmd+Shift+B) - Show embedding queue count (left side) - Show import progress with percentage (right side) - Auto-hide success messages after 3 seconds Closes #770 Co-Authored-By: Claude <[email protected]> * Address review: Remove debug logging statements - Remove println! debug statements from import.rs - Remove /tmp/import-debug.log file write - Remove console.log debug statement from collections.ts Addresses reviewer recommendations from PR #831. Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude <[email protected]>
* Add lifecycle_status to MCP tools and enhance docs import script (#770) ## Summary - Add lifecycle_status parameter to create_node and update_node MCP tools - Enhance import-docs.ts with intelligent collection routing and archival support - Update CLAUDE.md with documentation search section ## Changes ### Rust Backend - Add lifecycle_status to NodeUpdate struct in models/node.rs - Add lifecycle_status support in surreal_store.rs update method - Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams - Add lifecycle_status to MCP tool schemas (create_node, update_node) - Pass through lifecycle_status in node_service.rs update flow - Fix benchmarks to include lifecycle_status field ### Import Script (scripts/import-docs.ts) - Add intelligent collection routing (Upper Case, spaces allowed): - architecture/decisions/* -> "ADR" - */archived/* -> "Archived" (marked for archival) - */lessons/* -> "Lessons" - troubleshooting/* -> "Troubleshooting" - architecture/components/* -> "Components" - architecture/business-logic/* -> "Business Logic" - architecture/development/* -> "Development:*" (nested) - Add --dry-run flag for preview mode with collection distribution stats - Post-import lifecycle_status update for archived documents ### Documentation - Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md - Document semantic search usage and collection structure - Document import script usage ## Follow-Up Issues Created - #829: Documentation Accuracy Audit - #830: NodeSpace Skill for Claude Code Closes #770 Co-Authored-By: Claude <[email protected]> * fix: Include title field in semantic search results and optimize async import ## Search Results (#821) - Added `title` field to semantic search result objects - Previously only `content` was returned, which contains markdown formatting - The `title` field contains stripped/clean text for display ## Async Import Performance Fix - Moved collection membership creation into the async spawn - Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn, causing database contention during bulk imports - Now: collection path is resolved synchronously (for error reporting), but the actual membership creation happens in background using store directly - This restores the original fast async import behavior ## Changes - `search.rs`: Added `title` to node JSON in search results - `markdown.rs`: Restructured async flow to include collection handling in spawn Co-Authored-By: Claude <[email protected]> * fix: Use title field for @mention autocomplete display - Add title field to TypeScript Node interface to match Rust backend - Update base-node.svelte to use node.title for @mention results - Falls back to content.split('\n')[0] for nodes without title - Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete The title field contains markdown-stripped content for clean display, populated only for root nodes and task nodes (Issue #821). Co-Authored-By: Claude <[email protected]> * feat: Add Phase 2 link resolution to docs import script Enhances the import script with two-phase import: Phase 1: Import all markdown files and build path-to-nodeId mapping - Imports docs with collection organization - Tracks file paths to node IDs Phase 2: Resolve internal markdown links to nodespace:// URIs - Converts [text](./relative/path.md) to [text](nodespace://uuid) - Backend automatically creates bidirectional mentions relationships - Reports unresolved links (pointing to non-imported files) This enables clickable cross-references between imported docs and shows backlinks in the "Mentioned by" panel. Co-Authored-By: Claude <[email protected]> * perf: Fix duplicate schema fetch in create_node (5x speedup) ## Problem create_node() was calling get_schema_for_type() TWICE per node: 1. Line 1120: To apply schema defaults 2. Line 1144: To add schema version This caused 2 database queries per node creation, resulting in 5+ second response times for markdown imports. ## Solution - Fetch schema ONCE and reuse for all operations - Moved schema version addition into the same block as defaults/validation - Added timing instrumentation for debugging ## Performance Impact - Before: 5281ms for simple markdown import with collection - After: 779ms for same import (6.8x faster) - Without collection: 266ms (20x faster than before) ## Files Changed - packages/core/src/services/node_service.rs: Single schema fetch - packages/core/src/mcp/handlers/markdown.rs: Debug timing logs Co-Authored-By: Claude <[email protected]> * feat: Import UI, status bar, scroll fixes, and N+1 query optimization ## Import System - Add File > Import Folder menu with folder picker dialog - Create StatusBar component showing import progress and embedding queue - Add import_directory Tauri command with progress events - Support auto_collection_routing and exclude_patterns options ## UI Fixes - Fix status bar overlapping BacklinksPanel (grid minmax fix) - Fix scroll position starting in middle by keying on nodeId+tabId+paneId - Add margin-top: auto to BacklinksPanel for proper bottom positioning ## Performance Optimizations - Fix N+1 query in get_collection_members (5-6x speedup) - Batch fetch nodes in single query instead of individual fetches - Add get_nodes_batch to SurrealStore for efficient bulk retrieval ## Collections Sidebar - Add reactive updates when member_of relationships change - Listen to RELATIONSHIP_CREATED/DELETED MCP events - Invalidate collection member caches on membership changes ## Status Bar Features - Toggle via View menu (Cmd+Shift+B) - Show embedding queue count (left side) - Show import progress with percentage (right side) - Auto-hide success messages after 3 seconds Closes #770 Co-Authored-By: Claude <[email protected]> * Address review: Remove debug logging statements - Remove println! debug statements from import.rs - Remove /tmp/import-debug.log file write - Remove console.log debug statement from collections.ts Addresses reviewer recommendations from PR #831. Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude <[email protected]>
* Add lifecycle_status to MCP tools and enhance docs import script (#770) ## Summary - Add lifecycle_status parameter to create_node and update_node MCP tools - Enhance import-docs.ts with intelligent collection routing and archival support - Update CLAUDE.md with documentation search section ## Changes ### Rust Backend - Add lifecycle_status to NodeUpdate struct in models/node.rs - Add lifecycle_status support in surreal_store.rs update method - Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams - Add lifecycle_status to MCP tool schemas (create_node, update_node) - Pass through lifecycle_status in node_service.rs update flow - Fix benchmarks to include lifecycle_status field ### Import Script (scripts/import-docs.ts) - Add intelligent collection routing (Upper Case, spaces allowed): - architecture/decisions/* -> "ADR" - */archived/* -> "Archived" (marked for archival) - */lessons/* -> "Lessons" - troubleshooting/* -> "Troubleshooting" - architecture/components/* -> "Components" - architecture/business-logic/* -> "Business Logic" - architecture/development/* -> "Development:*" (nested) - Add --dry-run flag for preview mode with collection distribution stats - Post-import lifecycle_status update for archived documents ### Documentation - Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md - Document semantic search usage and collection structure - Document import script usage ## Follow-Up Issues Created - #829: Documentation Accuracy Audit - #830: NodeSpace Skill for Claude Code Closes #770 Co-Authored-By: Claude <[email protected]> * fix: Include title field in semantic search results and optimize async import ## Search Results (#821) - Added `title` field to semantic search result objects - Previously only `content` was returned, which contains markdown formatting - The `title` field contains stripped/clean text for display ## Async Import Performance Fix - Moved collection membership creation into the async spawn - Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn, causing database contention during bulk imports - Now: collection path is resolved synchronously (for error reporting), but the actual membership creation happens in background using store directly - This restores the original fast async import behavior ## Changes - `search.rs`: Added `title` to node JSON in search results - `markdown.rs`: Restructured async flow to include collection handling in spawn Co-Authored-By: Claude <[email protected]> * fix: Use title field for @mention autocomplete display - Add title field to TypeScript Node interface to match Rust backend - Update base-node.svelte to use node.title for @mention results - Falls back to content.split('\n')[0] for nodes without title - Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete The title field contains markdown-stripped content for clean display, populated only for root nodes and task nodes (Issue #821). Co-Authored-By: Claude <[email protected]> * feat: Add Phase 2 link resolution to docs import script Enhances the import script with two-phase import: Phase 1: Import all markdown files and build path-to-nodeId mapping - Imports docs with collection organization - Tracks file paths to node IDs Phase 2: Resolve internal markdown links to nodespace:// URIs - Converts [text](./relative/path.md) to [text](nodespace://uuid) - Backend automatically creates bidirectional mentions relationships - Reports unresolved links (pointing to non-imported files) This enables clickable cross-references between imported docs and shows backlinks in the "Mentioned by" panel. Co-Authored-By: Claude <[email protected]> * perf: Fix duplicate schema fetch in create_node (5x speedup) ## Problem create_node() was calling get_schema_for_type() TWICE per node: 1. Line 1120: To apply schema defaults 2. Line 1144: To add schema version This caused 2 database queries per node creation, resulting in 5+ second response times for markdown imports. ## Solution - Fetch schema ONCE and reuse for all operations - Moved schema version addition into the same block as defaults/validation - Added timing instrumentation for debugging ## Performance Impact - Before: 5281ms for simple markdown import with collection - After: 779ms for same import (6.8x faster) - Without collection: 266ms (20x faster than before) ## Files Changed - packages/core/src/services/node_service.rs: Single schema fetch - packages/core/src/mcp/handlers/markdown.rs: Debug timing logs Co-Authored-By: Claude <[email protected]> * feat: Import UI, status bar, scroll fixes, and N+1 query optimization ## Import System - Add File > Import Folder menu with folder picker dialog - Create StatusBar component showing import progress and embedding queue - Add import_directory Tauri command with progress events - Support auto_collection_routing and exclude_patterns options ## UI Fixes - Fix status bar overlapping BacklinksPanel (grid minmax fix) - Fix scroll position starting in middle by keying on nodeId+tabId+paneId - Add margin-top: auto to BacklinksPanel for proper bottom positioning ## Performance Optimizations - Fix N+1 query in get_collection_members (5-6x speedup) - Batch fetch nodes in single query instead of individual fetches - Add get_nodes_batch to SurrealStore for efficient bulk retrieval ## Collections Sidebar - Add reactive updates when member_of relationships change - Listen to RELATIONSHIP_CREATED/DELETED MCP events - Invalidate collection member caches on membership changes ## Status Bar Features - Toggle via View menu (Cmd+Shift+B) - Show embedding queue count (left side) - Show import progress with percentage (right side) - Auto-hide success messages after 3 seconds Closes #770 Co-Authored-By: Claude <[email protected]> * Address review: Remove debug logging statements - Remove println! debug statements from import.rs - Remove /tmp/import-debug.log file write - Remove console.log debug statement from collections.ts Addresses reviewer recommendations from PR #831. Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Closes #770