Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: drop html_url from MinimalCodeResult
The URL is derivable from repository + path + sha, so it's redundant
token cost per result.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
SamMorrowDrums and Copilot committed May 13, 2026
commit 7073022c10f5555e615806f513fa1804f6c12f11
1 change: 0 additions & 1 deletion pkg/github/minimal_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ type MinimalCodeResult struct {
Name string `json:"name"`
Path string `json:"path"`
SHA string `json:"sha"`
HTMLURL string `json:"html_url"`
Repository string `json:"repository"`
TextMatches []*github.TextMatch `json:"text_matches,omitempty"`
}
Expand Down
1 change: 0 additions & 1 deletion pkg/github/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ func SearchCode(t translations.TranslationHelperFunc) inventory.ServerTool {
Name: code.GetName(),
Path: code.GetPath(),
SHA: code.GetSHA(),
HTMLURL: code.GetHTMLURL(),
TextMatches: code.TextMatches,
}
if code.Repository != nil {
Expand Down
15 changes: 6 additions & 9 deletions pkg/github/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,9 @@ func Test_SearchCode(t *testing.T) {
IncompleteResults: github.Ptr(false),
CodeResults: []*github.CodeResult{
{
Name: github.Ptr("file1.go"),
Path: github.Ptr("path/to/file1.go"),
SHA: github.Ptr("abc123def456"),
HTMLURL: github.Ptr("https://github.com/owner/repo/blob/main/path/to/file1.go"),
Name: github.Ptr("file1.go"),
Path: github.Ptr("path/to/file1.go"),
SHA: github.Ptr("abc123def456"),
Repository: &github.Repository{
Name: github.Ptr("repo"),
FullName: github.Ptr("owner/repo"),
Expand All @@ -445,10 +444,9 @@ func Test_SearchCode(t *testing.T) {
},
},
{
Name: github.Ptr("file2.go"),
Path: github.Ptr("path/to/file2.go"),
SHA: github.Ptr("def456abc123"),
HTMLURL: github.Ptr("https://github.com/owner/repo/blob/main/path/to/file2.go"),
Name: github.Ptr("file2.go"),
Path: github.Ptr("path/to/file2.go"),
SHA: github.Ptr("def456abc123"),
Repository: &github.Repository{
Name: github.Ptr("repo"),
FullName: github.Ptr("owner/repo"),
Expand Down Expand Up @@ -562,7 +560,6 @@ func Test_SearchCode(t *testing.T) {
assert.Equal(t, tc.expectedResult.CodeResults[i].GetName(), code.Name)
assert.Equal(t, tc.expectedResult.CodeResults[i].GetPath(), code.Path)
assert.Equal(t, tc.expectedResult.CodeResults[i].GetSHA(), code.SHA)
assert.Equal(t, tc.expectedResult.CodeResults[i].GetHTMLURL(), code.HTMLURL)
assert.Equal(t, tc.expectedResult.CodeResults[i].Repository.GetFullName(), code.Repository)
}

Expand Down
Loading