Skip to content

Commit 901b682

Browse files
fix(graphrag,mcp): drop premature 3-arg vectordb.Search call (RAN-37 CI)
The PR-27 build failed CI because internal/graphrag/clustering.go and internal/mcp/tools.go both called the 3-arg vectordb.Index.Search(tenant, query, k) signature, but that signature lives on RAN-20's vectordb tenant-isolation work and is not yet on main. The 3-arg form leaked in from a stacked branch during the original RAN-37 cut. Restore the 2-arg Search(query, k) call in both sites and leave a TODO(RAN-20) so the proper vector-side tenant scoping lands with the RAN-20 follow-up. RAN-37's in-memory tenant invariants are unaffected: SimilarErrors still narrows results by the per-tenant SignalStore's EMITTED_BY edges, so cross-tenant hits cannot surface even while the underlying vector index is shared. go build / vet / test ./... and -race on graphrag + api all green. Co-Authored-By: Paperclip <noreply@paperclip.ing>
1 parent 901a4ae commit 901b682

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

internal/graphrag/clustering.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"context"
1010
"fmt"
1111
"time"
12-
13-
"github.com/RandomCodeSpace/otelcontext/internal/storage"
1412
)
1513

1614
// clusterLog runs the log body through Drain and upserts a LogClusterNode
@@ -80,11 +78,14 @@ func (g *GraphRAG) SimilarErrors(ctx context.Context, clusterID string, k int) [
8078
if query == "" && len(cluster.TemplateTokens) > 0 {
8179
query = joinTokens(cluster.TemplateTokens)
8280
}
83-
// vectordb.Index.Search takes the tenant string directly; we resolve it
84-
// from ctx via the same storage helper used by storesFor so both sides
85-
// agree on coercion rules (empty → DefaultTenantID).
86-
tenant := storage.TenantFromContext(ctx)
87-
results := g.vectorIdx.Search(tenant, query, k*2) // over-fetch to filter
81+
// TODO(RAN-20): vectordb.Index.Search itself is not yet tenant-scoped on
82+
// `main`, so we call the 2-arg signature here. Tenant isolation for the
83+
// SignalStore lookup above is already enforced via storesFor(ctx); the
84+
// vector hits are then narrowed by the EmittedBy edges in this tenant's
85+
// SignalStore on lines below, so cross-tenant hits cannot surface even
86+
// while the underlying vector index is shared.
87+
_ = ctx
88+
results := g.vectorIdx.Search(query, k*2) // over-fetch to filter
8889

8990
// Map results back to log clusters.
9091
seen := map[string]bool{clusterID: true}

internal/mcp/tools.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,11 @@ func (s *Server) toolFindSimilarLogs(ctx context.Context, args map[string]any) T
590590
if s.vectorIdx == nil {
591591
return errorResult("vector index not yet initialized")
592592
}
593-
tenant := storage.TenantFromContext(mcpCtx(ctx))
594-
results := s.vectorIdx.Search(tenant, query, limit)
593+
// TODO(RAN-20): vectordb.Index.Search itself is not yet tenant-scoped on
594+
// `main`. The tenant filter for log similarity will move into the
595+
// vector index in the RAN-20 follow-up; until then this call is shared.
596+
_ = ctx
597+
results := s.vectorIdx.Search(query, limit)
595598
data, err := json.MarshalIndent(results, "", " ")
596599
if err != nil {
597600
return errorResult(fmt.Sprintf("failed to marshal similar logs: %v", err))

0 commit comments

Comments
 (0)