Phase 2.5 provider generalization
Org-safe memory_relationships CREATE with bidirectional graph-traversal indexes, supersession view, and depth-capped tip helper — schema readiness before Phase 3 writers.
Milestone 2.5.G5.M3 — Relationship Graph Readiness
Status: Completed (2026-08-25)
Goal: Track E — Schema Pre-Work
Phase: 2.5 — Provider Generalization & Foundation
Estimated effort: 1 day
ADR: ADR-0049
Why This Milestone Exists
Phase 3's extraction / conflict pipeline will write typed relationship edges at volume, and Phase 5 will walk supersession chains with recursive CTEs. Landing an org-safe table plus graph-traversal indexes now avoids a schema and performance cliff when those writers start.
Non-Goals
- Application code using the new index or view (pure schema-readiness)
- Changing the relationship type taxonomy
- Adding new edge types
- Apache AGE / external graph database
What shipped
- Migration
000016_create_memory_relationships— greenfield CREATE (not index-only ALTER) - Dual composite FKs
(source|target_memory_id, org_id) → memories; self-loop + confidence CHECKs - Indexes
(org_id, source_memory_id, relationship_type)and(org_id, target_memory_id, relationship_type) - View
memory_supersession_edges(security_invoker) +resolve_supersession_tip(depth/org/cycle) - FORCE RLS via
rls_org_visible; integration tests; ADR-0049; 3.1.1 expand-not-CREATE note
Success signals
- Migration applies cleanly; no application writers depend on the new objects
- EXPLAIN on sample source/target+type filters mentions the traversal indexes
-
make db-migrate/ migrate smoke to version 16 - Forward-only expand-contract consistent with ADR-0005
-
DATABASE_SCHEMA.mdupdated
Prerequisites
- Milestone 2.5.G5.M1 (temporal validity columns)
- Milestone 2.5.G5.M2 (multi-label category support)
Orientation (historical sketch)
-- Sketch only — shipped path is CREATE + dual org-scoped indexes (000016 / ADR-0049)
CREATE INDEX idx_memory_relationships_source_type
ON ibex_core.memory_relationships(source_memory_id, relationship_type);Edit on GitHub
Last updated on