fix: Replace htmlUrl with url in gh search repos query
The gh CLI does not support 'htmlUrl' as a field name in search repos --json output. It only supports 'url'. This caused all research pipeline runs to fail silently because GitHubProvider.search() was querying for 'htmlUrl' which gh returned as undefined, leading to failed lookups. Fix: - Changed --json query parameters from 'htmlUrl' to 'url' - Updated GitHubRepoResult and GitHubIssueResult types - Updated all code references from repo.htmlUrl/issue.htmlUrl to repo.url/issue.url - Updated test mocks accordingly Fixes: DT-217, DT-218
This commit is contained in:
@@ -29,7 +29,7 @@ describe("GitHubProvider", () => {
|
|||||||
|
|
||||||
it("searches repositories", async () => {
|
it("searches repositories", async () => {
|
||||||
runGhJsonAsyncMock.mockResolvedValueOnce([
|
runGhJsonAsyncMock.mockResolvedValueOnce([
|
||||||
{ fullName: "org/repo", description: "desc", htmlUrl: "https://github.com/org/repo", stargazersCount: 12, language: "ts", updatedAt: "2026" },
|
{ fullName: "org/repo", description: "desc", url: "https://github.com/org/repo", stargazersCount: 12, language: "ts", updatedAt: "2026" },
|
||||||
]);
|
]);
|
||||||
const provider = new GitHubProvider();
|
const provider = new GitHubProvider();
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ describe("GitHubProvider", () => {
|
|||||||
|
|
||||||
it("searches issues", async () => {
|
it("searches issues", async () => {
|
||||||
runGhJsonAsyncMock.mockResolvedValueOnce([
|
runGhJsonAsyncMock.mockResolvedValueOnce([
|
||||||
{ title: "Issue", body: "body", htmlUrl: "https://github.com/org/repo/issues/1", state: "open", labels: [{ name: "bug" }] },
|
{ title: "Issue", body: "body", url: "https://github.com/org/repo/issues/1", state: "open", labels: [{ name: "bug" }] },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const provider = new GitHubProvider();
|
const provider = new GitHubProvider();
|
||||||
@@ -52,8 +52,8 @@ describe("GitHubProvider", () => {
|
|||||||
|
|
||||||
it("supports combined search", async () => {
|
it("supports combined search", async () => {
|
||||||
runGhJsonAsyncMock
|
runGhJsonAsyncMock
|
||||||
.mockResolvedValueOnce([{ fullName: "org/repo", htmlUrl: "https://github.com/org/repo" }])
|
.mockResolvedValueOnce([{ fullName: "org/repo", url: "https://github.com/org/repo" }])
|
||||||
.mockResolvedValueOnce([{ title: "Issue", htmlUrl: "https://github.com/org/repo/issues/1" }]);
|
.mockResolvedValueOnce([{ title: "Issue", url: "https://github.com/org/repo/issues/1" }]);
|
||||||
|
|
||||||
const provider = new GitHubProvider();
|
const provider = new GitHubProvider();
|
||||||
const results = await provider.search("query", {});
|
const results = await provider.search("query", {});
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ type SearchType = "repos" | "issues" | "both";
|
|||||||
interface GitHubRepoResult {
|
interface GitHubRepoResult {
|
||||||
fullName: string;
|
fullName: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
htmlUrl: string;
|
url: string;
|
||||||
stargazersCount?: number;
|
stargazersCount?: number;
|
||||||
language?: string;
|
language?: string;
|
||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
@@ -28,7 +28,7 @@ interface GitHubRepoResult {
|
|||||||
interface GitHubIssueResult {
|
interface GitHubIssueResult {
|
||||||
title: string;
|
title: string;
|
||||||
body?: string;
|
body?: string;
|
||||||
htmlUrl: string;
|
url: string;
|
||||||
state?: string;
|
state?: string;
|
||||||
labels?: Array<{ name?: string }>;
|
labels?: Array<{ name?: string }>;
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ export class GitHubProvider implements ResearchProvider {
|
|||||||
"repos",
|
"repos",
|
||||||
query,
|
query,
|
||||||
"--json",
|
"--json",
|
||||||
"fullName,description,htmlUrl,stargazersCount,language,updatedAt",
|
"fullName,description,url,stargazersCount,language,updatedAt",
|
||||||
"--limit",
|
"--limit",
|
||||||
String(maxResults),
|
String(maxResults),
|
||||||
],
|
],
|
||||||
@@ -69,9 +69,9 @@ export class GitHubProvider implements ResearchProvider {
|
|||||||
|
|
||||||
sources.push(
|
sources.push(
|
||||||
...repos.slice(0, maxResults).map((repo, idx) => ({
|
...repos.slice(0, maxResults).map((repo, idx) => ({
|
||||||
id: `github-repo-${idx}-${repo.htmlUrl}`,
|
id: `github-repo-${idx}-${repo.url}`,
|
||||||
type: "github" as const,
|
type: "github" as const,
|
||||||
reference: repo.htmlUrl,
|
reference: repo.url,
|
||||||
title: repo.fullName,
|
title: repo.fullName,
|
||||||
excerpt: repo.description ?? "",
|
excerpt: repo.description ?? "",
|
||||||
status: "completed" as const,
|
status: "completed" as const,
|
||||||
@@ -93,7 +93,7 @@ export class GitHubProvider implements ResearchProvider {
|
|||||||
"issues",
|
"issues",
|
||||||
query,
|
query,
|
||||||
"--json",
|
"--json",
|
||||||
"title,body,htmlUrl,state,labels",
|
"title,body,url,state,labels",
|
||||||
"--limit",
|
"--limit",
|
||||||
String(maxResults),
|
String(maxResults),
|
||||||
],
|
],
|
||||||
@@ -102,9 +102,9 @@ export class GitHubProvider implements ResearchProvider {
|
|||||||
|
|
||||||
sources.push(
|
sources.push(
|
||||||
...issues.slice(0, maxResults).map((issue, idx) => ({
|
...issues.slice(0, maxResults).map((issue, idx) => ({
|
||||||
id: `github-issue-${idx}-${issue.htmlUrl}`,
|
id: `github-issue-${idx}-${issue.url}`,
|
||||||
type: "github" as const,
|
type: "github" as const,
|
||||||
reference: issue.htmlUrl,
|
reference: issue.url,
|
||||||
title: issue.title,
|
title: issue.title,
|
||||||
excerpt: issue.body?.slice(0, 280) ?? "",
|
excerpt: issue.body?.slice(0, 280) ?? "",
|
||||||
status: "completed" as const,
|
status: "completed" as const,
|
||||||
|
|||||||
Reference in New Issue
Block a user