Commit 8c34130
authored
feat: entity system and temporal graph with Postgres-native search (#249)
* feat: add v2 entity system with Postgres-native search
New entity system built as an independent package alongside the existing
asset system. Zero changes to existing asset code. All search is
Postgres-native — no Elasticsearch dependency for v2.
Core domain (core/entity/):
- Entity: open type system, temporal (valid_from/valid_to), properties JSONB
- Edge: typed, directed, temporal relationships
- Chunk: pgvector embeddings for semantic search
- Service: context assembly, impact analysis, search orchestration
- HybridSearch: keyword + semantic fusion via Reciprocal Rank Fusion
- SearchRepository: Postgres tsvector + pg_trgm (replaces ES)
Storage (store/postgres/):
- EntityRepository: CRUD with temporal support
- EdgeRepository: recursive CTE graph traversal
- ChunkRepository: pgvector cosine similarity search
- EntitySearchRepository: tsvector full-text + pg_trgm fuzzy matching
- Migration 000019: entities, edges, chunks tables with search_vector
generated column, GIN indexes, trigram indexes
Search architecture (all Postgres):
- Keyword: tsvector with weighted fields (URN/name=A, desc=B, source=C)
- Fuzzy: pg_trgm similarity with automatic fallback
- Semantic: pgvector cosine distance on chunk embeddings
- Hybrid: RRF fusion of keyword + semantic results
- Suggest: pg_trgm similarity-based autocomplete
MCP tools (internal/mcp/):
- search_entities: hybrid search across the entity graph
- get_context: assembled context subgraph
- impact: downstream blast radius analysis
* feat: add entity v2 handler with gRPC/REST endpoints
Generated Go code from proton proto definitions for entity v2 RPCs.
Created handler/entity.go implementing all 12 new RPC methods:
Entity CRUD: GetAllEntities, GetEntityByID, UpsertEntity, DeleteEntity
Search: SearchEntities, SuggestEntities, GetEntityTypes
Context: GetEntityContext, GetEntityImpact
Edges: UpsertEdge, GetEdges, DeleteEdge
Handler accepts entity and edge services via WithEntityService/
WithEdgeService options — no changes to existing handler constructor
signature. Serve function passes options through to handler.
* feat: remove old asset system, discussions, tags — entity-only
Deleted:
- core/asset/ — entire old asset package
- core/discussion/ — discussions and comments
- core/tag/ — tags and tag templates
- store/elasticsearch/ — ES client and discovery repos
- store/postgres/asset_*, lineage_*, discussion_*, comment_*, tag_* repos
- handler/asset.go, discussion.go, comment.go, tag.go, search.go, lineage.go
- All old CLI commands (assets, discussions, lineage, search)
- All old migrations (replaced with single 000001_init_schema.up.sql)
Updated:
- Proto regenerated from proton (entity-only service definition)
- handler.go: simplified — only namespace, star, user, entity, edge services
- bootstrap.go: removed ES, removed all old service wiring
- config.go: removed Elasticsearch config
- star package: updated to use entity.Entity instead of asset.Asset
- CLI: entity commands (list, view, upsert, delete, search, types, context, impact)
- Migration: single fresh schema with namespaces, users, entities, edges, chunks, stars
Schema (6 tables):
- namespaces, users, entities, edges, chunks, stars
- tsvector + pg_trgm + pgvector for search (no ES)
- RLS on all tables
* refactor: cleanup stale deps, fix namespace service, add entity tests
- go mod tidy: removed unused ES and other stale dependencies
- Namespace service: nil-safe DiscoveryRepository (ES removed)
- Deleted stale integration tests (postgres, user, namespace repo tests
that depended on deleted test infrastructure)
- Fixed last 2 "asset" string references in star errors and CLI
- Added entity unit tests (11 tests):
- Type validation (open type system)
- Entity.IsCurrent temporal check
- Reciprocal Rank Fusion (empty, single, multi-list)
- Service: Upsert, GetByURN, Delete, GetAll, GetTypes, Search
* chore: remove ES dependency, stale docs, configs, mocks, CI
- Removed elasticsearch from docker-compose.yaml (Postgres-only)
- Removed elasticsearch from config.yaml and config.example.yaml
- Removed elasticsearch service from .github/workflows/test.yml
- Deleted stale guide docs (ingestion, querying, starring, telemetry)
- Deleted stale handler mocks (no tests import them)
- Removed empty test/ directory
- Updated Postgres to v16 in docker-compose
- go mod tidy (cleaned unused indirect deps)
* build: update PROTON_COMMIT to eefb04d (merged entity proto)
* chore: gitignore docs/_drafts
* fix: resolve all lint issues
* fix: remove stale docs and fix sidebars.js
* fix: resolve broken doc links and update concepts overview1 parent 709bf5b commit 8c34130
File tree
219 files changed
+4521
-42592
lines changed- .github/workflows
- cli
- core
- asset
- mocks
- discussion
- mocks
- entity
- namespace
- star
- mocks
- tag
- mocks
- validator
- docs
- docs
- concepts
- guides
- reference
- tour
- gen/raystack/compass/v1beta1
- compassv1beta1connect
- handler
- mocks
- internal
- config
- mcp
- server
- store
- elasticsearch
- testdata
- testutil
- postgres
- migrations
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
219 files changed
+4521
-42592
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 21 | | |
38 | 22 | | |
39 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
0 commit comments