Repository navigation
Description
Complete @mention System with Container Node Refactoring
Status: ✅ COMPLETE
Core functionality implemented in commits 764f4a4 and 246aa1b. Date picker functionality deferred to issue #201.
Overview
Complete the implementation of the @mention system for creating and linking nodes, including the container node concept refactoring and improved search logic.
✅ Completed Work
1. Initial @mention Implementation
Commits: dd6c698, dfc8e0b
- Basic @mention autocomplete modal
- Node creation from mentions
- Node reference insertion as markdown links
[title](nodespace://id) - Markdown rendering as clickable
<a>tags - Code review fixes (error logging, helper functions, test improvements)
2. Schema Refactoring - Container Node Pattern
Commits: 8c2698e, e38692f
- BREAKING: Renamed
origin_node_id→container_node_idacross entire stack - Updated database schema, Rust models, Tauri commands, TypeScript types
- Rationale: "Container" better describes nodes that contain other nodes
- Pattern: Container nodes have
container_node_id = NULL(they ARE containers) - Inheritance: Child nodes inherit
container_node_idfrom their container
3. Merge with Embedding Service
Commit: 764f4a4
- Resolved conflicts with PR Implement Topic Node Embeddings with Adaptive Chunking #198 (Topic Embedding Service)
- Updated all embedding SQL queries to use
container_node_id - Fixed vector type to use
F32_BLOB(384)for Turso native support - Updated embedding service tests
4. Rust Backend API
Commit: 246aa1b
New Commands:
-
create_container_node()- Creates root-level container nodes with enforced pattern- Auto-generates UUID
- Enforces:
parent_id = NULL,container_node_id = NULL,before_sibling_id = NULL - Optional
mentioned_byparameter creates mention relationship
-
create_mention()- Service method for managing mention relationships- Validates both nodes exist
- Inserts into
node_mentionstable withINSERT OR IGNORE
-
create_node_mention()- Tauri command exposing mention creation to frontend
Files Modified:
packages/core/src/services/node_service.rs- Addedcreate_mention()methodpackages/desktop-app/src-tauri/src/commands/nodes.rs- Added new commandspackages/desktop-app/src-tauri/src/lib.rs- Registered commands in invoke handler
5. Frontend Implementation
Commit: 246aa1b
TypeScript/Svelte Changes:
- Renamed
originNodeId→containerNodeIdacross all files (17 files modified) - Updated
isRootNode()→isContainerNode()with correct logic - Fixed @mention search logic: Now shows all non-text nodes (Tasks, Persons) + container text nodes
Search Logic (base-node.svelte):
// Show non-text nodes regardless of hierarchy
if (node.nodeType !== 'text') {
return true;
}
// For text nodes, only show container nodes
const isContainer = node.containerNodeId === null;
return isContainer;This enables @mention to discover:
- ✅ All Task nodes (anywhere in hierarchy)
- ✅ All Person nodes (anywhere in hierarchy)
- ✅ Top-level text nodes (Topics/Projects/etc.)
Files Modified:
packages/desktop-app/src/lib/design/components/base-node.svelte- Search logic + helperpackages/desktop-app/src/lib/types/node.ts- Type definitions- All TypeScript services - Updated field names
6. Quality & Testing
- ✅ All quality checks passing (oxlint, eslint, prettier, svelte-check, rustfmt, clippy)
- ✅ 882/889 tests passing (7 failures are pre-existing unrelated issues)
- ✅ Rust compilation verified with
cargo check
📋 Deferred Work
Date Picker and Shortcuts → Issue #201
The following features were deferred to keep this issue focused on core functionality:
- Date shortcuts (Today/Tomorrow/Yesterday) in @mention results
- Date picker integration for "Date (pick)" option
- Calendar component integration from design-system package
See: Issue #201 - Add date picker and shortcuts to @mention system
Acceptance Criteria
Core Functionality ✅
-
create_container_node()Rust function implemented and working -
create_mention()service method implemented - TypeScript types updated to use
containerNodeId -
isContainerNode()helper renamed and updated - @mention search shows correct nodes (non-text + container text nodes)
- All quality checks passing
- Tests passing (882/889, failures are pre-existing)
Date Features → Issue #201
- Date shortcuts (Today/Tomorrow/Yesterday) - Deferred
- Date picker integration - Deferred
Technical Notes
Container Node Pattern
Container Node (DateNode "2024-01-15")
├─ containerNodeId: null (it IS a container)
├─ parentId: null
│
├─ Child Note
│ ├─ containerNodeId: "2024-01-15" (belongs to container)
│ ├─ parentId: "2024-01-15"
│ │
│ └─ Grandchild
│ ├─ containerNodeId: "2024-01-15" (inherited)
│ └─ parentId: <child-id>
Mentions Table
CREATE TABLE node_mentions (
mentioning_node_id TEXT NOT NULL,
mentions_node_id TEXT NOT NULL,
PRIMARY KEY (mentioning_node_id, mentions_node_id),
FOREIGN KEY (mentioning_node_id) REFERENCES nodes(id) ON DELETE CASCADE,
FOREIGN KEY (mentions_node_id) REFERENCES nodes(id) ON DELETE CASCADE
);Search Behavior
The @mention search now correctly:
- Shows all non-text nodes (Tasks, Persons) regardless of where they are in the hierarchy
- Shows only container text nodes (top-level Topics/Projects)
- Excludes date nodes (they're accessed via date shortcuts - see Add date picker and shortcuts to @mention system #201)
- Filters by query text in title or content
Related Issues
- Add date picker and shortcuts to @mention system #201 - Add date picker and shortcuts to @mention system (follow-up)
- Implement Topic Node Embeddings with Adaptive Chunking #198 - Implement Topic Node Embeddings with Adaptive Chunking (merged)
Branch
feature/issue-199-mention-system-container-nodes
Commits
dd6c698- Initial @mention implementationdfc8e0b- Code review fixes8c2698e- Schema refactoring (origin_node_id → container_node_id)e38692f- Formatting764f4a4- Merge origin/main with container_node_id refactoring246aa1b- Implement container node pattern and @mention improvements
Activity
Fix autocomplete click test and add container node search tests
Refactor: Extract autocomplete filter logic to NodeSearchService
Fix autocomplete click test and add container node search tests
Merge feature/issue-199: Complete @mention system with container node…
Refactor: Extract autocomplete filter logic to NodeSearchService
Fix autocomplete click test and add container node search tests
Merge feature/issue-199: Complete @mention system with container node…
Refactor: Extract autocomplete filter logic to NodeSearchService
Fix autocomplete click test and add container node search tests
Merge feature/issue-199: Complete @mention system with container node…
Refactor: Extract autocomplete filter logic to NodeSearchService
Show "signed in as <email>" + add manual sign-out to the Pro pill (#226…