Repository navigation
Description
Summary
Refactor the properties JSON field to use type-namespaced structure, allowing nodes to preserve properties when converting between types.
Current Implementation
Properties are stored at the root level:
{
"status": "OPEN",
"due_date": "2025-10-25"
}Problem: When a task node converts to text or another type, these properties are lost or become meaningless for the new type.
Proposed Implementation
Store properties under type-specific namespaces:
{
"task": {
"status": "OPEN",
"due_date": "2025-10-25"
},
"project": {
"name": "Q1 Planning",
"status": "active"
}
}Benefits
- Type History Preservation - Properties from previous types remain when converting
- Safe Type Conversion - No data loss when changing node types (task → text → task preserves task properties)
- Clean Separation - Each type's properties are isolated and well-defined
- Multi-Type Support - A node could theoretically support properties for multiple types simultaneously
- Better Schema Validation - Schema system can validate type-specific properties more precisely
Implementation Scope
Backend Changes (Required)
- Database seed schemas - Update default property structure in
packages/core/src/db/database.rs - Node behaviors - Update validation in
packages/core/src/behaviors/mod.rsto checkproperties.{type}.* - Node service - Update CRUD operations in
packages/core/src/services/node_service.rs - Backward compatibility - Accept both formats during transition period
- Migration helper - Auto-migrate old format to new on first update
- Update all Rust tests - Fix test data and assertions
Frontend Changes (Minimal)
- Property access patterns - Update services to use
properties.task.statusinstead ofproperties.status - Property forms - Update schema property forms to read/write nested properties
- Update all frontend tests - Fix test data and assertions
Migration Strategy
-
Phase 1: Backend Support
- Implement nested property support
- Maintain backward compatibility (read both formats)
- New nodes created with nested format
-
Phase 2: Frontend Updates
- Update property access patterns
- Update property forms
-
Phase 3: Cleanup
- Remove backward compatibility after migration period
- Archive migration helper code
Design Decisions Needed
-
Multiple Active Types: Should a node support multiple type properties simultaneously? (e.g., both
taskandproject)- Recommendation: Yes, allow but only validate properties for current
node_type
- Recommendation: Yes, allow but only validate properties for current
-
Property Lookup: Should lookups fall back to root level for backward compat?
- Recommendation: Yes during migration, then remove fallback
-
Auto-Initialize: Should changing types auto-create nested property structure?
- Recommendation: Yes, use schema defaults when converting types
Related Issues
- Replace hardcoded behavior validation with schema-driven validation #392 - Replace hardcoded behavior validation with schema-driven validation
- Implement Node Splitting and Type Conversion #123 - Implement Node Splitting and Type Conversion
Acceptance Criteria
- Database seed schemas use nested property format
- Node behaviors validate
properties.{type}.*instead ofproperties.* - Converting task → text → task preserves task properties
- All backend tests pass with new format
- Frontend can read/write nested properties
- All frontend tests pass with new format
- Documentation updated with new property structure
- Backward compatibility maintained during transition
Priority
Medium - Important for data preservation during type conversions, but not blocking current features.
Labels
enhancement, backend, architecture, schema, technical-debt
Activity
malibio commentedon Nov 4, 2025
Implementation Approach Update
This is a PURE BACKEND implementation - the frontend will be completely oblivious to the internal property structure change.
How It Works
Internal Storage (Database) - Type-namespaced:
{ "task": {"status": "OPEN", "due_date": "2025-10-25"}, "project": {"name": "Q1", "status": "active"} }API Response (What Frontend Sees) - Flattened based on current
node_type:{ "status": "OPEN", "due_date": "2025-10-25" }Backend Responsibilities
properties.{node_type}.*→properties.*when returning nodesproperties.*→properties.{node_type}.*when saving nodesnode_typechangesnode_typeFrontend Impact
NONE - Frontend continues to work exactly as before:
node.properties.statusPATCH /nodes/{id} {"properties": {"status": "IN_PROGRESS"}}Implementation Scope (Updated)
Backend Changes (Pure Backend)
packages/core/src/models/node.rspackages/core/src/services/node_service.rspackages/core/src/behaviors/mod.rsto validate nested structureFrontend Changes
NONE ✅
Benefits of Pure Backend Approach:
Add missing core schema definitions and required fields (Issue #397)
malibio commentedon Nov 4, 2025
Session Handoff - Progress Update
✅ Completed Work
1. Schema Seed Data - COMPLETE (Commit:
deea207)versionanddescriptionfields to ALL schemasheaderLevelproperty from header schemaWhy version/description are critical:
Frontend
SchemaDefinitioninterface requires these fields:2. Project Management
feature/issue-397-type-namespaced-properties📋 Remaining Implementation - Type-Namespaced Properties
Objective: Store properties under type namespaces internally while presenting flat properties to frontend.
Architecture
Internal Storage (Database):
{ "task": {"status": "OPEN", "due_date": "2025-10-25"}, "project": {"name": "Q1", "status": "active"} }API Response (Frontend sees):
{ "status": "OPEN", "due_date": "2025-10-25" }Flattened based on current
node_typeBenefits:
🔨 Next Session Implementation Plan
Step 1: Node Model Helpers
packages/core/src/models/node.rsAdd to
impl Node:Step 2: NodeService Updates
packages/core/src/services/node_service.rsIn
create_node():In
update_node():In
get_node()andquery_nodes():Step 3: Behavior Validation Updates
packages/core/src/behaviors/mod.rsUpdate each behavior to validate nested properties:
Step 4: Test Updates
Search and replace across ~377 tests:
Key test files:
packages/core/src/behaviors/mod.rs(behavior tests)packages/core/src/services/node_service.rs(service tests)packages/core/src/db/database.rs(seed data tests - already updated)Step 5: Validation
cargo test --package nodespace-coreFix failures iteratively.
🎯 Success Criteria
flatten_properties()andnest_properties()helpersproperties.task.status)📦 Current State
Branch:
feature/issue-397-type-namespaced-propertiesCommit:
deea207- Schema fixes completeStatus: Ready for property implementation
Tests: All database tests passing ✅
To continue:
git checkout feature/issue-397-type-namespaced-properties git pull origin feature/issue-397-type-namespaced-properties # Start with Step 1: Node Model Helpers💡 Implementation Notes
node_typeEstimated Effort: 4-6 hours
WIP: Implement type-namespaced properties - Backend complete (Issue #397
Implement type-namespaced properties (Issue #397)
Implement type-namespaced properties (Issue #397) (#399)
Address review: Update architecture docs to reflect schema-driven val…
fix: Use nested property format consistently for task nodes (Issue #397)
4 remaining items
Strongly-Typed Node Structs with Direct Spoke Table Deserialization (#…
Implement type-namespaced properties (Issue #397) (#399)
Address review: Update architecture docs to reflect schema-driven val…
Fix 3 Rust test race conditions (pass individually, fail concurrently) (
Fix task node schema properties and viewer-local placeholders (#417)
Strongly-Typed Node Structs with Direct Spoke Table Deserialization (#…
Implement type-namespaced properties (Issue #397) (#399)
Address review: Update architecture docs to reflect schema-driven val…
Fix 3 Rust test race conditions (pass individually, fail concurrently) (
Fix task node schema properties and viewer-local placeholders (#417)
Strongly-Typed Node Structs with Direct Spoke Table Deserialization (#…
Implement type-namespaced properties (Issue #397) (#399)
Fix 3 Rust test race conditions (pass individually, fail concurrently) (
Fix task node schema properties and viewer-local placeholders (#417)
Strongly-Typed Node Structs with Direct Spoke Table Deserialization (#…