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

オープン
#274 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
55/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Go
スター
0
フォーク
0
平均マージ
7時間 42分
マージ済み PR(30日)
111

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

seanb4t/codegraph-go のほかの issue

seanb4t/codegraph-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。