Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ filters remain exact, so `--kind import` does not include local type declaration
| `instantiate` | Constructor or object creation |
| `join_condition_reference` | SQL join/merge condition column reference |
| `lifetime_reference` | Rust/C#-style lifetime or lifetime-like type reference |
| `member_read` | Non-invoking member/value read, including qualified C# enum constants, constants, static readonly fields, and static properties |
| `metadata` | Metadata-only reference |
| `reference` | Generic persisted reference row used by fixtures or extractors without a narrower edge kind |
| `razor_event_binding` | Razor event binding relationship |
Expand Down Expand Up @@ -1282,7 +1283,7 @@ every non-inspect command must reject that cursor family before execution.

### Reference taxonomy

`symbol_references.reference_kind` stores raw extractor labels. Default call-graph surfaces (`callers`, `callees`, inspect/analyze caller and callee bundles, and their JSON/MCP fields) expose the canonical public vocabulary `call`, `instantiate`, and `subscribe`. The primary `reference_kind`, `reference_kinds`, and `reference_kind_counts` keys use that same vocabulary. Use `--raw-kinds` on `callers` / `callees`, or `references --kind <raw-kind>`, when debugging raw extractor output.
`symbol_references.reference_kind` stores raw extractor labels. Default call-graph surfaces (`callers`, `callees`, inspect/analyze caller and callee bundles, and their JSON/MCP fields) expose the canonical public vocabulary `call`, `instantiate`, and `subscribe`. Non-invoking value reads use the canonical `member_read` label and stay out of default callers, callees, and impact traversal; opt in with CLI `--include-member-reads` or MCP `includeMemberReads`. The primary `reference_kind`, `reference_kinds`, and `reference_kind_counts` keys use that same vocabulary. Legacy indexes remain readable but stored these reads as `call`, so they retain the historical inclusive behavior until re-indexed. Use `--raw-kinds` on `callers` / `callees`, or `references --kind <raw-kind>`, when debugging raw extractor output.

`ReferenceRecord.SpanLength` and `symbol_references.span_length` persist the physical matched-token width rather than deriving it from the resolved symbol name; this matters for constructor-chain tokens such as `base`, `super`, and `this`. `DbReader.GetCallees` preserves that span while aggregating counts: it selects the smallest `(line, column_number)` among rows with a stored column, exposes that 1-based pair as `first_line` / nullable `first_column`, and carries the same row's nullable width as `first_length`; `reference_count` remains the independent aggregate. When every contributing legacy row has `column_number IS NULL`, the reader retains the minimum line and a null column. A migrated row can also retain a column with a null span length. CLI/MCP location adapters degrade either case without fabricating precision.

Expand All @@ -1291,6 +1292,7 @@ Reference extraction deduplicates only within the same indexed file and language
| Raw kind | Logical graph kind | Notes |
|---|---|---|
| `call` | `call` | Direct executable invocation edges. |
| `member_read` | `member_read` | Non-invoking member/value reads; excluded from default invocation graphs and included only by an explicit kind filter or the member-read compatibility option. |
| `instantiate` | `instantiate` | Constructor / construction edges. |
| `goroutine_spawn` | `goroutine_spawn` | Go `go f()` async spawn edges; the ordinary `call` edge is also emitted for the invoked function. |
| `channel_send`, `channel_receive` | raw label | Go channel communication edges for send and receive expressions; excluded from default invocation graphs. |
Expand Down Expand Up @@ -4251,6 +4253,7 @@ filter、downstream JSON consumer が同じ値を理解できるようにして
| `instantiate` | constructor または object creation |
| `join_condition_reference` | SQL join / merge condition column reference |
| `lifetime_reference` | Rust / C# 風 lifetime または lifetime-like type reference |
| `member_read` | C# の修飾付き enum 定数、定数、static readonly field、static property など、呼び出しを伴わない member / value 読み取り |
| `metadata` | metadata-only reference |
| `reference` | より狭い edge kind を持たない fixture / extractor 用の generic persisted reference row |
| `razor_event_binding` | Razor event binding relationship |
Expand Down Expand Up @@ -4706,13 +4709,14 @@ inspect 以外の各 command は実行前にその cursor family を拒否しな

### 参照 taxonomy

`symbol_references.reference_kind` には extractor が出力した raw label を保存する。既定の call-graph 表示(`callers`、`callees`、inspect/analyze の caller / callee bundle、および JSON/MCP フィールド)は、公開 canonical 語彙 `call`、`instantiate`、`subscribe` を返す。primary `reference_kind`、`reference_kinds`、`reference_kind_counts` の key はすべて同じ語彙を使う。raw extractor 出力を調べる場合は、`callers` / `callees` の `--raw-kinds`、または `references --kind <raw-kind>` を使う。
`symbol_references.reference_kind` には extractor が出力した raw label を保存する。既定の call-graph 表示(`callers`、`callees`、inspect/analyze の caller / callee bundle、および JSON/MCP フィールド)は、公開 canonical 語彙 `call`、`instantiate`、`subscribe` を返す。呼び出しを伴わない value read は canonical `member_read` を使い、既定の callers / callees / impact traversal から除外する。含める場合は CLI の `--include-member-reads` または MCP の `includeMemberReads` を明示する。primary `reference_kind`、`reference_kinds`、`reference_kind_counts` の key はすべて同じ語彙を使う。legacy index は引き続き読み取れるが、これらの read を `call` として保存しているため、再 index するまでは従来の inclusive な挙動を維持する。raw extractor 出力を調べる場合は、`callers` / `callees` の `--raw-kinds`、または `references --kind <raw-kind>` を使う。

`ReferenceRecord.SpanLength` と `symbol_references.span_length` は、解決後の symbol 名から導出せず、物理的に一致した token 幅を永続化する。これは `base`、`super`、`this` のような constructor-chain token で重要になる。`DbReader.GetCallees` は count を集約しながらその span を保持し、列が保存された row のうち最小の `(line, column_number)` を選び、その 1-based 座標を `first_line` / nullable な `first_column`、同じ row の nullable な幅を `first_length` として公開し、`reference_count` は独立した集約値のままにする。寄与する legacy row がすべて `column_number IS NULL` の場合は最小行と null 列を保持する。移行済み row では列があっても span 長が null の場合がある。CLI/MCP の location adapter はどちらの場合も精度を捏造せず劣化させる。

| Raw kind | Logical graph kind | 備考 |
|---|---|---|
| `call` | `call` | 直接実行される呼び出しエッジ。 |
| `member_read` | `member_read` | 呼び出しを伴わない member / value read。既定の invocation graph から除外し、明示 kind filter または member-read compatibility option のときだけ含める。 |
| `instantiate` | `instantiate` | constructor / construction エッジ。 |
| `goroutine_spawn` | `goroutine_spawn` | Go の `go f()` による非同期 spawn edge。呼び出し先には通常の `call` edge も併せて出力する。 |
| `channel_send`, `channel_receive` | raw label | Go の channel send / receive 式を表す通信エッジ。既定の invocation graph からは除外する。 |
Expand Down
2 changes: 2 additions & 0 deletions TESTING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Use `docs/test-doc-maintenance-plan.md` before moving oversized suites or adding
`ReferenceExtractorTests.ExtractSymbolsAndReferences(...)` owns the common symbol-then-reference extraction setup for tests that need both lists; use it instead of repeating the two extractor calls when the fixture does not need a specialized path or workspace symbol setup, and discard the symbol tuple element with `_` instead of keeping an unused `symbols` local when the test only asserts references.
C# named-argument coverage keeps syntax discrimination in `ReferenceExtractorCSharpTests` and persisted query/dependency behavior in `QueryCommandRunnerIssue4833Tests`; preserve positional and reordered arguments, attributes, constructors, nested and multiline calls, expression-side, named-`out`, explicitly typed lambda/anonymous-method, and typed LINQ range-variable type references, property-subpattern types, and negative controls for aliases, labels, nullable types, and ternaries (#4833; regressions #106 and #122).
C# qualified common-call coverage keeps static BCL, instance, LINQ extension, alias-qualified, current-instance, and unresolved-receiver cases together. Assert that extraction retains every row, default bare-name references/callers/callees and hotspot counts retain resolved evidence while excluding unresolved noise, the completeness option restores that noise deterministically, and dependency queries remain identity-scoped (#4867).
C# member-read coverage keeps enum and const patterns, ordinary qualified constants, static readonly fields, static properties, cross-file targets, callable-name collisions, and a true method invocation together. Assert `member_read` extraction without a duplicate `call`, default callers/callees/impact exclusion, explicit compatibility inclusion, and legacy `call` readability in coordinated extractor, full-scan, and `DbReaderTests` fixtures (#4894).
Crystal, Groovy, Tcl, Prolog, and `ambiguous_pl` graph fixtures keep imports, parenthesized calls, conservative same-file command/predicate calls, caller containers, and keyword false-positive controls independently diagnosable; capability tests must keep their advertised symbol/reference/graph flags aligned with those extractor fixtures (#4746).
Database status tests must also pin stale and current extractor-version stamps for those languages so pre-graph rows cannot report authoritative graph readiness.
Database page-attribution coverage keeps empty/schema-only, WAL-visible overflow, database-truncating WAL, and a connection-pinned read snapshot after a newer WAL commit, cancellation of both `dbstat` aggregation and WAL validation, the bounded large-page-count rejection, reconciliation, corrupt-file rejection, main/WAL/SHM separation, the 20-object and 128-character support-safe output bounds, explicit unavailable/not-requested values, and unchanged `total_changes()` / `PRAGMA query_only` in coordinated `DbReaderTests` fixtures.
Expand Down Expand Up @@ -1045,6 +1046,7 @@ dotnet test --filter "FullyQualifiedName~GitHelperTests"
`ReferenceExtractorTests.ExtractSymbolsAndReferences(...)` は symbol 抽出から reference 抽出までの共通 setup を所有します。fixture が特殊な path や workspace symbol setup を必要としない場合は 2 つの extractor 呼び出しを繰り返さずこの helper を使い、reference だけを検証するテストでは未使用の `symbols` local を残さず symbol 側を `_` で捨ててください。
C# named-argument の coverage は構文の判別を `ReferenceExtractorCSharpTests`、永続化後の query / dependency 動作を `QueryCommandRunnerIssue4833Tests` に保持します。positional argument との混在、並べ替え、attribute、constructor、nested / multiline call、value 式側、named `out` declaration、明示型 lambda / anonymous method、および型付き LINQ range variable の type reference、property subpattern の型、ならびに alias、label、nullable type、ternary に対する負例を維持してください(#4833、回帰 #106 / #122)。
C# の修飾付き一般名 call の coverage は、static BCL、instance、LINQ extension、alias 修飾、current instance、未解決 receiver の各 case を同じ fixture に維持します。extraction が全 row を保持すること、無修飾名による references / callers / callees と hotspot count の既定動作が解決済み evidence を維持しつつ未解決 noise を除外すること、completeness option がその noise を決定的に復元すること、dependency query が identity scope のままであることを検証してください(#4867)。
C# member-read coverage は enum / const pattern、通常の修飾付き定数、static readonly field、static property、cross-file target、callable 名の衝突、真の method invocation を同じ fixture に維持します。連携する extractor / full-scan / `DbReaderTests` fixture で、重複 `call` を伴わない `member_read` 抽出、既定 callers / callees / impact からの除外、明示 compatibility option による復元、legacy `call` row の読み取りを検証してください(#4894)。
Crystal、Groovy、Tcl、Prolog、`ambiguous_pl` の graph fixture では、import、括弧付き call、同一ファイルに限定した保守的な command / predicate call、caller container、keyword の false-positive control を個別に診断可能な状態で維持し、capability test の symbol / reference / graph 広告を extractor fixture と一致させてください(#4746)。
さらに database status test でこれらの言語の古い extractor-version stamp と現行 stamp を固定し、graph 対応前の row が authoritative な graph readiness を報告できないことを検証してください。
database page-attribution coverage では、empty / schema-only、WAL から可視な overflow、database を縮小する WAL、後続 WAL commit 後も connection に固定された read snapshot の各 case、`dbstat` 集約と WAL 検証のキャンセル、large page count の上限付き拒否、再照合、破損 file の拒否、main/WAL/SHM の分離、20 object / 128文字の support-safe 出力上限、明示的な unavailable / not-requested 値、`total_changes()` / `PRAGMA query_only` が不変であることを、連携した `DbReaderTests` fixture で維持してください。
Expand Down
16 changes: 14 additions & 2 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,14 +779,20 @@ they are re-indexed with a current binary.
cdidx impact Run --max-hops 2 --exclude-tests
cdidx impact Run --max-hops 0 --json
cdidx impact FolderDiffService --with-paths --json
cdidx impact CurrentValue --include-member-reads --json
```

`impact` resolves a symbol and walks transitive callers through call-graph edges.
`--max-hops 0` resolves without traversing, while `--with-paths` emits shortest call
chains for converging routes. Metadata-only edges such as attributes,
annotations, and type-position references are excluded from the symbol-level BFS
so metadata cycles do not inflate caller counts; single-type queries may still
return heuristic file-level dependency hints.
return heuristic file-level dependency hints. Current indexes store non-invoking
member/value reads as `member_read`, which callers, callees, and impact exclude by
default. Use `--include-member-reads` (MCP: `includeMemberReads`) when read
dependencies are intentionally part of the graph. Legacy indexes stored those
reads as `call`; they remain readable and keep their historical inclusive behavior
until re-indexed.

On a current index, cycle detection follows the resolved source/target symbol IDs
on real directed edges. Two distinct methods with the same display name are not a
Expand Down Expand Up @@ -4063,14 +4069,20 @@ binary で再 index されるまで互換性のある raw-reference fallback を
cdidx impact Run --max-hops 2 --exclude-tests
cdidx impact Run --max-hops 0 --json
cdidx impact FolderDiffService --with-paths --json
cdidx impact CurrentValue --include-member-reads --json
```

`impact` は symbol を解決し、call-graph edges を通じて transitive callers を探索します。
`--max-hops 0` は traversal せず resolve のみ行い、`--with-paths` は収束する経路の shortest
call chains を出力します。Attributes、annotations、type-position references のような
metadata-only edges は symbol-level BFS から除外されるため、metadata cycle で caller
count が膨らむことはありません。ただし single-type query では heuristic file-level
dependency hints が返る場合があります。
dependency hints が返る場合があります。current index は呼び出しを伴わない
member / value read を `member_read` として保存し、callers / callees / impact は既定で
除外します。read dependency を graph に含める場合は `--include-member-reads`
(MCP は `includeMemberReads`)を明示してください。legacy index はこれらの read を
`call` として保存しているため、引き続き読み取り可能で、再 index するまでは従来の
inclusive な挙動を維持します。

current index では、cycle 判定は実在する有向辺の解決済み source/target symbol ID を
辿ります。表示名が同じ別 method は cycle にせず、直接再帰は singleton cycle として
Expand Down
33 changes: 33 additions & 0 deletions changelog.d/unreleased/4894.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
category: added
issues:
- 4894
affected:
- src/CodeIndex/Indexer/References/Languages/CSharpReferenceExtractor.QualifiedPatterns.cs
- src/CodeIndex/Indexer/References/ReferenceExtractor.CoreExtraction.cs
- src/CodeIndex/Indexer/CSharpStaticInterfacePrepass.cs
- src/CodeIndex/Indexer/Scanning/FileContentLoader.cs
- src/CodeIndex/Indexer/Scanning/FileIndexer.RecordLoading.cs
- src/CodeIndex/Database/DbWriter.CSharpContracts.cs
- src/CodeIndex/Database/DbReader.GraphQueries.cs
- src/CodeIndex/Cli/IndexCommandRunner.Update.CSharpPreflight.cs
- src/CodeIndex/Cli/IndexCommandRunner.FullScan.CSharpPreflight.cs
- src/CodeIndex/Cli/CliFlagSchema.cs
- src/CodeIndex/Mcp/McpToolCatalog.cs
- src/CodeIndex/Mcp/McpToolHandlers.Indexing.Execution.cs
- src/CodeIndex/Models/SymbolKindCatalog.cs
- tests/CodeIndex.Tests/ReferenceExtractorTests.cs
- tests/CodeIndex.Tests/IndexCommandRunnerFullScanTests.cs
- tests/CodeIndex.Tests/DbReaderTests.cs
- USER_GUIDE.md
- DEVELOPER_GUIDE.md
- TESTING_GUIDE.md
---

## English

- **Added canonical `member_read` references for non-invoking C# member/value reads (#4894)** — new indexes distinguish qualified enum constants, constants, static readonly fields, static properties, and constant-pattern reads from true `call` edges, including cross-file targets, scoped/watch-style incremental updates, and callable-name collisions. Callers, callees, and impact exclude these reads by default and expose explicit CLI `--include-member-reads` / MCP `includeMemberReads` compatibility controls; legacy indexes remain readable with their historical `call` rows.

## 日本語

- **呼び出しを伴わない C# member / value read 向けに canonical `member_read` reference を追加しました (#4894)** — 新しい index は cross-file target、scoped / watch-style incremental update、callable 名の衝突を含む修飾付き enum 定数、定数、static readonly field、static property、constant-pattern read を真の `call` edge と区別します。callers、callees、impact は既定でこれらを除外し、CLI `--include-member-reads` / MCP `includeMemberReads` の明示 compatibility control で復元できます。legacy index は従来の `call` row のまま引き続き読み取れます。
Loading
Loading