Skip to content

Commit 8c34130

Browse files
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 overview
1 parent 709bf5b commit 8c34130

File tree

219 files changed

+4521
-42592
lines changed

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

.github/workflows/test.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,6 @@ concurrency:
1818
jobs:
1919
test:
2020
runs-on: ubuntu-latest
21-
services:
22-
elasticsearch:
23-
image: elasticsearch:8.17.1
24-
ports:
25-
- 9200:9200
26-
env:
27-
discovery.type: single-node
28-
xpack.security.enabled: "false"
29-
ES_JAVA_OPTS: "-Xms128m -Xmx128m"
30-
options: >-
31-
--health-cmd "curl -f http://localhost:9200/_cluster/health"
32-
--health-interval 10s
33-
--health-timeout 5s
34-
--health-retries 10
35-
env:
36-
ES_TEST_SERVER_URL: "http://localhost:9200"
3721
steps:
3822
- uses: actions/checkout@v6
3923
- uses: actions/setup-go@v6

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ vendor/
2828
compass.yaml
2929
temp/
3030
.mcp.json
31+
docs/_drafts/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ COMMIT := $(shell git rev-parse --short HEAD)
33
TAG := "$(shell git rev-list --tags --max-count=1)"
44
VERSION := "$(shell git describe --tags ${TAG})-next"
55
BUILD_DIR=dist
6-
PROTON_COMMIT := "b9ed2ad"
6+
PROTON_COMMIT := "eefb04d"
77

88
.PHONY: all build clean test tidy vet proto setup format generate lint install
99

0 commit comments

Comments
 (0)