Repository navigation
Closed
Labels
Description
Problem
We have strongly-typed node interfaces (TypeScript) and structs (Rust) for core node types like TaskNode, SchemaNode, etc., but CRUD operations still go through the generic NodeUpdate pipeline, which:
- Drops spoke fields -
NodeUpdateonly acceptscontent,nodeType,properties,embeddingVector - Loses type safety - Frontend sends
{ status: 'in_progress' }but backend silently ignores it - Requires workarounds - Developers must remember to use nested
properties.task.statusinstead of flatnode.status
Current State (Broken)
TaskNode.svelte reads node.status (flat) ✅
→ dispatches taskStateChanged event
→ base-node-viewer calls updateTaskStatus({ status: 'in_progress' })
→ sharedNodeStore.updateNode(nodeId, { status }, source)
→ tauriCommands.updateNode() → invoke('update_node', { update: { status } })
→ Rust NodeUpdate struct has no 'status' field
→ STATUS IS SILENTLY DROPPED ❌
Desired State (Type-Safe)
TaskNode.svelte uses TaskNode interface ✅
→ dispatches taskStateChanged event
→ base-node-viewer calls updateTaskNode(nodeId, { status: 'in_progress' })
→ sharedNodeStore routes to registered TaskNode updater (plugin system)
→ tauriCommands.updateTaskNode() → invoke('update_task_node', { status })
→ Rust NodeService::update_task_node() updates spoke table
→ Returns updated TaskNode with new status ✅
Scope
Frontend Changes
- Extend
UpdateNodeInputor create typed variants (UpdateTaskNodeInput, etc.) - Add type-specific update methods to
backend-adapter.ts:updateTaskNode(id, version, update: TaskNodeUpdate)- Pattern: one method per core node type with spoke fields
- Plugin registry dispatch -
sharedNodeStoreroutes updates based onnodeType:updateNode(nodeId, changes, source) { const node = this.getNode(nodeId); const updater = pluginRegistry.getUpdater(node.nodeType); if (updater) { return updater.update(nodeId, changes); // Type-specific } return genericUpdate(nodeId, changes); // Fallback for simple types }
- Remove workarounds in
base-node-viewer.sveltethat try to read from both nested and flat formats
Backend Changes
- Add
update_task_node()toNodeService:pub async fn update_task_node( &self, id: &str, expected_version: i64, update: TaskNodeUpdate, ) -> Result<TaskNode, NodeServiceError>
- Add
TaskNodeUpdatestruct with spoke fields:pub struct TaskNodeUpdate { pub content: Option<String>, pub status: Option<TaskStatus>, pub priority: Option<i32>, pub due_date: Option<Option<DateTime<Utc>>>, pub assignee: Option<Option<String>>, }
- Add Tauri command
update_task_nodeincommands/nodes.rs - Update spoke table in same transaction as hub table
Types Requiring Typed Updates
| Node Type | Has Spoke Table | Spoke Fields |
|---|---|---|
task |
Yes | status, priority, dueDate, assignee |
schema |
Yes | isCore, schemaVersion, description, fields |
date |
Yes | (TBD - calendar-specific fields) |
text |
No | None (hub-only) |
Acceptance Criteria
- Clicking task icon to toggle status persists to database
- Task status survives page reload
-
TaskNode.svelteusesTaskNodeinterface throughout (no genericNodecasting) - Backend
update_task_node()validates spoke fields with type safety - Plugin registry can register type-specific updaters
- Generic
update_node()still works for hub-only types (text, etc.) - No silent field dropping - unknown fields should error or warn
Related Issues
- Align TypeScript Node Type Interfaces with Rust Backend Serialization #700 - Align TypeScript Node Type Interfaces with Rust Backend Serialization (partial - read path only)
- Align TypeScript Node Type Interfaces with Rust Backend Serialization #702 - TypeScript interface alignment
- Strongly-Typed Node Structs with Direct Spoke Table Deserialization #673 - TaskNode strong typing
- Refactor Schema Seeding: Move from SurrealStore to NodeService #704 - Schema seeding refactor (exposed this gap)
Technical Notes
The hub-and-spoke architecture (Issue #560) was designed for this - spoke tables store type-specific data. We just never implemented the write path for spoke fields through the CRUD API.
Activity
Add TODO comments and spoke fields for Issue #709
malibio commentedon Dec 1, 2025
Test Baseline (feature/issue-709-type-safe-crud branch):
Starting implementation of type-safe CRUD operations end-to-end.
Implement type-safe CRUD operations for task nodes (closes #709)
Implement type-safe CRUD operations for task nodes (closes #709)
malibio commentedon Dec 1, 2025
Refined Implementation Plan (Type-Safe CRUD with Hybrid Schema Forms)
After further analysis, the implementation should follow a hybrid architecture pattern documented in
docs/architecture/components/component-architecture-guide.md:Key Insight
The current implementation (PR #711) added type-safe backend methods (
updateTaskNode) but the frontend routing is incomplete:SchemaPropertyFormstill calls genericsharedNodeStore.updateNode()base-node-viewer.updateSchemaField()has hardcoded routing (not plugin-based)The Complete Pattern
Remaining Implementation Tasks
Phase 1: Type-Specific Schema Form (TaskSchemaForm)
task-schema-form.sveltewith hardcoded UI for task spoke fieldsTaskNodeinterface directly (not genericNode)sharedNodeStore.updateNode()which will route toupdateTaskNode()Phase 2: Plugin-Based Routing
schemaFormproperty toPluginDefinitioninterfaceupdaterproperty for type-specific update logicsharedNodeStore.updateNode()to check for registered updaterbase-node-viewer.updateSchemaField()Phase 3: BaseNodeViewer Integration
TaskSchemaFormfor task nodes,SchemaPropertyFormfor othersSchemaPropertyFormimport (dynamic via plugin)Why This Pattern?
TaskSchemaFormusesTaskNodeinterface - full TypeScript inferenceSchemaPropertyFormhandles custom schemas at runtimeupdateNode(), routing is internalDocumentation
See updated architecture guide:
docs/architecture/components/component-architecture-guide.md#type-safe-crud-architecture-issue-709Add frontend type-safe CRUD for task nodes (Issue #709)
Add comprehensive tests for update_task_node and fix discovered bugs
Fix priority type mismatch and add comprehensive tests (Issue #709)
Add TODO comments and spoke fields for Issue #709
Implement type-safe CRUD operations for task nodes (closes #709)
Add frontend type-safe CRUD for task nodes (Issue #709)
Add comprehensive tests for update_task_node and fix discovered bugs
Fix priority type mismatch and add comprehensive tests (Issue #709)
Add PATCH /api/tasks/:id endpoint to dev-proxy and fix nodeType chang…
Fix TaskNode deserialization after text→task conversion (Issue #709)
Fix MCP→UI reactivity for task status updates (Issue #715)
Refactor MCP server as managed service and enable browser mode support (
Implement type-safe CRUD operations for task nodes (closes #709) (#711)
Refactor MCP server as managed service and enable browser mode support (
Implement type-safe CRUD operations for task nodes (closes #709) (#711)
Refactor MCP server as managed service and enable browser mode support (
Implement type-safe CRUD operations for task nodes (closes #709) (#711)
Refactor MCP server as managed service and enable browser mode support (