Repository navigation
Complete HierarchyRelationship abstraction - replace in/out with parentId/childId - #610
Conversation
…tId/childId This completes the abstraction started in PR #604 by: ## Frontend Changes - Update HierarchyRelationship type to use parentId/childId instead of in/out - Remove id field from type (frontend doesn't need edge IDs) - Remove helper functions getParentId()/getChildId() (no longer needed) - Update all usages in reactive-structure-tree.svelte.ts - Update debug logging in tauri-sync-listener.ts ## Backend Changes (Rust) - Create separate EdgeDbRecord (deserialize from SurrealDB) and HierarchyRelationship (serialize to frontend) types in live_query_service.rs - Add custom Serialize impl for EdgeRecord to emit parentId/childId (camelCase) - Remove id field from EdgeRecord serialization (frontend doesn't need it) ## Test Updates - Update all test files using old field names (in/out/id) to new format - All 1427 tests passing Benefits: - Clean domain model - Frontend uses domain terminology - Single responsibility - Database format isolated to backend - Better readability - Self-documenting parent/child semantics - Easier maintenance - Database changes don't ripple through frontend Closes #608 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Code Review: PR #610 - Complete HierarchyRelationship AbstractionReview Type: Initial Review Requirements Check (from Issue #608)
All acceptance criteria are met. Code Review SummaryThis is a well-executed refactoring PR that completes the abstraction started in PR #604. The implementation correctly isolates SurrealDB-specific terminology ( Architectural AssessmentThe implementation follows Single Responsibility Principle well:
The separation between Code Review Findings🟢 [Good Practice]: Clean Type Separation in RustFile: The implementation correctly separates concerns:
This is the correct pattern for serialization boundary abstraction. 🟢 [Good Practice]: Custom Serialization in Core StoreFile: The custom impl serde::Serialize for EdgeRecord {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut state = serializer.serialize_struct("EdgeRecord", 3)?;
state.serialize_field("parentId", &self.parent_id)?;
state.serialize_field("childId", &self.child_id)?;
state.serialize_field("order", &self.order)?;
state.end()
}
}Explicitly implementing 🟢 [Good Practice]: Simplified Frontend TypeFile: The new type is clean and self-documenting: export interface HierarchyRelationship {
parentId: string; // Parent node ID
childId: string; // Child node ID
order: number; // Sort order for children (fractional ordering)
}Removing 🟢 [Good Practice]: Comprehensive Test UpdatesAll test files have been systematically updated to use the new field names. The test updates in:
demonstrate thorough coverage of the refactoring. 🟡 [Nit]: Variable Naming ConsistencyFile: The parameter rename from No action required - this is just noting the naming is already well done. 🟡 [Nit]: Type Number vs f64 DiscrepancyFile: TypeScript uses No action required - the types are compatible. 🟢 [Good Practice]: SQL Query OptimizationFile: The SQL query was simplified to remove the -- Before:
SELECT id, in, out, order FROM has_child ORDER BY `in`, `order` ASC;
-- After:
SELECT in, out, order FROM has_child ORDER BY `in`, `order` ASC;This is a micro-optimization that reduces data transfer, aligning with the principle that if data isn't needed, don't fetch it. Security Assessment✅ No security concerns identified
Performance Assessment✅ No performance concerns
Summary
Recommendation✅ APPROVE This PR demonstrates excellent refactoring discipline:
The implementation completes what PR #604 started, resulting in cleaner, more maintainable code. Ready to merge. Reviewed using Pragmatic Quality Framework - Principal Engineer AI Reviewer |
Resolved conflict in event-types.ts: - Kept new NodeWithChildren type from main - Removed getParentId/getChildId helper functions (obsolete with new naming) - Updated index.ts exports to remove helper function re-exports 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…tId/childId (#610) This completes the abstraction started in PR #604 by: ## Frontend Changes - Update HierarchyRelationship type to use parentId/childId instead of in/out - Remove id field from type (frontend doesn't need edge IDs) - Remove helper functions getParentId()/getChildId() (no longer needed) - Update all usages in reactive-structure-tree.svelte.ts - Update debug logging in tauri-sync-listener.ts ## Backend Changes (Rust) - Create separate EdgeDbRecord (deserialize from SurrealDB) and HierarchyRelationship (serialize to frontend) types in live_query_service.rs - Add custom Serialize impl for EdgeRecord to emit parentId/childId (camelCase) - Remove id field from EdgeRecord serialization (frontend doesn't need it) ## Test Updates - Update all test files using old field names (in/out/id) to new format - All 1427 tests passing Benefits: - Clean domain model - Frontend uses domain terminology - Single responsibility - Database format isolated to backend - Better readability - Self-documenting parent/child semantics - Easier maintenance - Database changes don't ripple through frontend Closes #608 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
…tId/childId (#610) This completes the abstraction started in PR #604 by: ## Frontend Changes - Update HierarchyRelationship type to use parentId/childId instead of in/out - Remove id field from type (frontend doesn't need edge IDs) - Remove helper functions getParentId()/getChildId() (no longer needed) - Update all usages in reactive-structure-tree.svelte.ts - Update debug logging in tauri-sync-listener.ts ## Backend Changes (Rust) - Create separate EdgeDbRecord (deserialize from SurrealDB) and HierarchyRelationship (serialize to frontend) types in live_query_service.rs - Add custom Serialize impl for EdgeRecord to emit parentId/childId (camelCase) - Remove id field from EdgeRecord serialization (frontend doesn't need it) ## Test Updates - Update all test files using old field names (in/out/id) to new format - All 1427 tests passing Benefits: - Clean domain model - Frontend uses domain terminology - Single responsibility - Database format isolated to backend - Better readability - Self-documenting parent/child semantics - Easier maintenance - Database changes don't ripple through frontend Closes #608 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
…tId/childId (#610) This completes the abstraction started in PR #604 by: ## Frontend Changes - Update HierarchyRelationship type to use parentId/childId instead of in/out - Remove id field from type (frontend doesn't need edge IDs) - Remove helper functions getParentId()/getChildId() (no longer needed) - Update all usages in reactive-structure-tree.svelte.ts - Update debug logging in tauri-sync-listener.ts ## Backend Changes (Rust) - Create separate EdgeDbRecord (deserialize from SurrealDB) and HierarchyRelationship (serialize to frontend) types in live_query_service.rs - Add custom Serialize impl for EdgeRecord to emit parentId/childId (camelCase) - Remove id field from EdgeRecord serialization (frontend doesn't need it) ## Test Updates - Update all test files using old field names (in/out/id) to new format - All 1427 tests passing Benefits: - Clean domain model - Frontend uses domain terminology - Single responsibility - Database format isolated to backend - Better readability - Self-documenting parent/child semantics - Easier maintenance - Database changes don't ripple through frontend Closes #608 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
Summary
in/out) with domain-focused names (parentId/childId)idfield from frontend type (not needed)Test plan
Closes #608
🤖 Generated with Claude Code