Unify hierarchy and relationship edges into a single labelled graph#57
Conversation
…raph Both hierarchy levels and relationships now resolve into a single `resolvedParents: ResolvedParentRef[]` array on each node. Each ref carries `source: 'hierarchy' | 'relationship'` so downstream consumers can route edges without re-inspecting the schema. Key changes: - `resolveHierarchyEdges` → `resolveGraphEdges`, generalised to handle both hierarchy levels and relationship definitions in one post-parse pass - `validate-hierarchy` → `validate-graph`, with explicit `source` filtering: hierarchy edges go to structural checks, relationship edges to ref checks - `classifyNodes`, `show`, `diagram` filter to `source: 'hierarchy'` - Miro sync connector building and cache hashing filter to hierarchy edges - `multi` → `multiple` rename fixed in metadata contract and all schemas - `ResolvedParentRef` shape documented; concepts, schemas, architecture, and schema-authoring reference updated to reflect the unified graph model - Repro test (issue #56) replaced with permanent `source`-aware regression tests in resolve-hierarchy-edges.test.ts
|
Claude finished @mindsocket's task in 1m 34s —— View job Code Review: PR #57 - Unify hierarchy and relationship edges into a single labelled graphOverall Assessment: ✅ APPROVED with minor suggestions This is a well-executed refactoring that unifies the hierarchy and relationship edge resolution into a single, coherent graph model. The architectural decisions are sound, the implementation is clean, and the test coverage is excellent. ✅ Strengths1. Clean Architecture
2. Comprehensive Test Coverage
3. Thoughtful Consumer Updates
4. Good Documentation Updates
🔍 Issues FoundMinor: Stray Statement
💡 Suggestions (Optional)1. Type Safety export type EdgeSource = 'hierarchy' | 'relationship';
export interface ResolvedParentRef {
source: EdgeSource;
// ...
}2. Documentation Enhancement 📊 Test Results
🎯 SummaryThis refactoring successfully unifies the edge resolution model while maintaining backward compatibility for all consumers. The addition of the Recommendation: Merge after addressing the minor stray statement issue. The overall implementation is solid and ready for production. |
Summary
resolveHierarchyEdges→resolveGraphEdgesto handle both hierarchy levels and relationship definitions in a single post-parse passResolvedParentRefgainssource: 'hierarchy' | 'relationship'so downstream consumers can route edges without re-inspecting the schemavalidate-hierarchy→validate-graph, with explicit source filtering (hierarchy → structural checks, relationship → ref checks)classifyNodes,show,diagram, Miro sync all filter tosource: 'hierarchy'for tree/structural purposesmulti→multiplerename in metadata contract and all configured space schemassource-aware regression testsWhat's still open (tracked in #56 / #54)
parse-embeddedrefactor (Refactor parse-embedded to use clean mdast traversal with explicit signal tracking #54) and remaining Reconcile overlap between relationships and hierarchy #56 work will be tackled together in a follow-upTest plan
bun run test— 207 tests passbun run test:smoke— validate all configured spaces (pre-existing failures unaffected)resolvedParentsoutput viadumpon a space with relationships to confirmsourcefield is correctCloses part of #56