chore(graphstore): collapse the four full-scan edge index builders into one

Aperta
#274 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

Start with the four edge index builders: BuildReverseAdjacency and BuildImplementsIndex in internal/query/traverse.go, buildReverseAdjacency in internal/indexer/sync.go, and buildContainsIndex in internal/query/traverse.go. Add one graphstore function that takes the edge kinds to keep, keep the Source sort for implements, and point the call sites at it, including the eight listed in the issue. Done means task test passes and the golden files are unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:indexer chore priority:low
What kind of chore?

Repository housekeeping

What needs doing?

Four functions build an in-memory edge map from one full IterateEdges("") scan, keyed by edge.Target:

  • query.BuildReverseAdjacency in internal/query/traverse.go:31 keeps only calls edges.
  • query.BuildImplementsIndex in internal/query/traverse.go:369 keeps only implements edges and sorts each list by Source.
  • buildReverseAdjacency in internal/indexer/sync.go:614 copies the first function. Its comment says the copy exists because an internal/query test import of internal/indexer forms an import cycle.
  • query.buildContainsIndex in internal/query/traverse.go:401 is a fourth full scan. It keeps only contains edges, keys them by edge.Source and folds overload sets into a method-owner map, so it needs a parameter for the key as well as for the kinds.

Add one graphstore function that takes the set of edge kinds to keep. Keep the Source sort for implements, so list order does not change. Point the seam at internal/query/traverse.go:61 and the call sites at the new function. BuildReverseAdjacency has five callers outside the seam (internal/query/seeding.go:186, internal/query/expand.go:486, internal/query/traverse.go:757, 853 and 981). BuildImplementsIndex has three (internal/query/traverse.go:761, 857 and 985).

Run task test before the pull request. Each golden file stays the same.

Why now?

Decision D11 of the bounded-index-memory change (#271) gives the sync copy a set of edge kinds and leaves query unchanged. Task 6.1 then carries a second copy of the same algorithm. Collapsing the functions first means task 6.1 adds the edge-kind parameter to one function. The change's workflow follow-up asks for this issue.

Does this touch anything load-bearing?
  • The release pipeline (release.yml, .goreleaser.yaml, signing)
  • The upgrade identity (internal/upgrade/verify.go)
  • The perf baseline (tools/bench/baseline.json)
  • The graph schema / meta-key layout
  • None of these
Before submitting
  • I searched existing issues and this is not a duplicate

🤖 Generated with Claude Code

https://claude.ai/code/session_01ATb3AjCdy2v381oRkeyVrV

Lingua principale
Go
Stelle
0
Fork
0
Merge medio
7h 42m
PR unite (30g)
111

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di seanb4t/codegraph-go

Tutte le issue di seanb4t/codegraph-go

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.