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
2 changes: 1 addition & 1 deletion DEVELOPER_GUIDE.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions changelog.d/unreleased/1779.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
category: fixed
issues:
- 1779
affected:
- src/CodeIndex/Models/QueryResults.cs
- src/CodeIndex/Database/DbReader.GraphQueries.cs
- DEVELOPER_GUIDE.md
---

## English

- **Impact results now identify graph rows and heuristic fallback hints (#1779)** — `impact` / MCP `impact_analysis` now stamp graph callers with `result_kind: "graph"` and file-level fallback hints with `result_kind: "file_heuristic"` so consumers can split authoritative hop-depth results from heuristic dependency hints deterministically.

## 日本語

- **impact 結果が graph 行と heuristic fallback hint を識別できるようになりました (#1779)** — `impact` / MCP `impact_analysis` は graph caller に `result_kind: "graph"`、file-level fallback hint に `result_kind: "file_heuristic"` を付けるため、利用側は authoritative な hop-depth 結果と heuristic dependency hint を決定的に分離できます。
1 change: 1 addition & 0 deletions src/CodeIndex/Database/DbReader.GraphQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,7 @@ FROM symbol_references r
reader.GetInt32(5) == 1,
new FileDependencyResult
{
ResultKind = ImpactResultKinds.FileHeuristic,
SourcePath = reader.GetString(1),
TargetPath = reader.GetString(2),
ReferenceCount = reader.GetInt32(3),
Expand Down
9 changes: 9 additions & 0 deletions src/CodeIndex/Models/QueryResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public class CalleeResult

public class ImpactResult
{
public string ResultKind { get; set; } = ImpactResultKinds.Graph;
public string Path { get; set; } = string.Empty;
public string? Lang { get; set; }
public string? CallerKind { get; set; }
Expand Down Expand Up @@ -280,6 +281,12 @@ public class ImpactResult
public bool PathsTruncated { get; set; }
}

public static class ImpactResultKinds
{
public const string Graph = "graph";
public const string FileHeuristic = "file_heuristic";
}

public class ImpactAnalysisResult
{
[JsonPropertyName("api_version")]
Expand Down Expand Up @@ -841,6 +848,8 @@ internal sealed class RepoFileStat

public class FileDependencyResult
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ResultKind { get; set; }
public string SourcePath { get; set; } = string.Empty;
public string TargetPath { get; set; } = string.Empty;
public int ReferenceCount { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion tests/CodeIndex.Tests/DbReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11280,7 +11280,8 @@ public static void Leaf() { }

Assert.False(analysis.Truncated);
Assert.Null(analysis.TruncatedReason);
Assert.Single(analysis.Callers);
var caller = Assert.Single(analysis.Callers);
Assert.Equal(ImpactResultKinds.Graph, caller.ResultKind);
}

[Fact]
Expand Down Expand Up @@ -11314,6 +11315,7 @@ public void Run(FolderDiffService service)
Assert.False(analysis.HasMultipleDefinitionFiles);
Assert.Equal(1, analysis.HintCount);
var edge = Assert.Single(analysis.FileImpacts);
Assert.Equal(ImpactResultKinds.FileHeuristic, edge.ResultKind);
Assert.Equal("src/App.cs", edge.SourcePath);
Assert.Equal("src/FolderDiffService.cs", edge.TargetPath);
Assert.Contains("ExecuteFolderDiffAsync", edge.Symbols);
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/QueryCommandRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26164,6 +26164,7 @@ public void Boot(FooService service)
Assert.Equal(string.Empty, stderr);
Assert.Equal("file_dependency_hints", json.GetProperty("impact_mode").GetString());
Assert.Equal(1, json.GetProperty("hint_count").GetInt32());
Assert.Equal("file_heuristic", json.GetProperty("file_impacts")[0].GetProperty("result_kind").GetString());
Assert.Equal("src/App.cs", json.GetProperty("file_impacts")[0].GetProperty("source_path").GetString());
}
finally
Expand Down
1 change: 1 addition & 0 deletions tests/CodeIndex.Tests/golden/impact.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"callers": [],
"file_impacts": [
{
"result_kind": "file_heuristic",
"source_path": "src/App.cs",
"target_path": "src/FolderDiffService.cs",
"reference_count": 2,
Expand Down
Loading