From 6de42f7fba2a02b517e6a265af74ed3db3624a51 Mon Sep 17 00:00:00 2001 From: Shawn Zivontsis Date: Fri, 20 Mar 2026 19:13:11 -0500 Subject: [PATCH] Fix empty descriptions in PR and commit issue queries The PR and commit queries read the `explanation` field from the AnalysisIssue type, which the server returns as empty. Use `issue { shortDescription }` instead, matching the pattern used by the default-branch query. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../tests/golden_files/commit_scope_response.json | 12 ++++++++---- .../issues/tests/golden_files/pr_scope_response.json | 8 ++++++-- deepsource/issues/queries/pr_issues.go | 10 +++++++--- deepsource/issues/queries/run_issues.go | 10 +++++++--- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/command/issues/tests/golden_files/commit_scope_response.json b/command/issues/tests/golden_files/commit_scope_response.json index c596ab1a..cde6d919 100644 --- a/command/issues/tests/golden_files/commit_scope_response.json +++ b/command/issues/tests/golden_files/commit_scope_response.json @@ -18,9 +18,11 @@ "endLine": 42, "title": "Unchecked error return value of os.ReadFile", "shortcode": "GO-W1007", - "explanation": "Return value of io.ReadAll is not checked for errors", "category": "BUG_RISK", - "severity": "MAJOR" + "severity": "MAJOR", + "issue": { + "shortDescription": "Return value of io.ReadAll is not checked for errors" + } } }, { @@ -31,9 +33,11 @@ "endLine": 91, "title": "HTTP request built with user-controlled URL", "shortcode": "GO-S1010", - "explanation": "Constructing HTTP request with user-controlled URL allows SSRF", "category": "SECURITY", - "severity": "MAJOR" + "severity": "MAJOR", + "issue": { + "shortDescription": "Constructing HTTP request with user-controlled URL allows SSRF" + } } } ] diff --git a/command/issues/tests/golden_files/pr_scope_response.json b/command/issues/tests/golden_files/pr_scope_response.json index 71c0bbf0..95039b73 100644 --- a/command/issues/tests/golden_files/pr_scope_response.json +++ b/command/issues/tests/golden_files/pr_scope_response.json @@ -13,7 +13,9 @@ "shortcode": "GO-W1007", "category": "BUG_RISK", "severity": "MAJOR", - "explanation": "Return value of io.ReadAll is not checked for errors" + "issue": { + "shortDescription": "Return value of io.ReadAll is not checked for errors" + } } }, { @@ -26,7 +28,9 @@ "shortcode": "GO-S1010", "category": "SECURITY", "severity": "MAJOR", - "explanation": "Constructing HTTP request with user-controlled URL allows SSRF" + "issue": { + "shortDescription": "Constructing HTTP request with user-controlled URL allows SSRF" + } } } ], diff --git a/deepsource/issues/queries/pr_issues.go b/deepsource/issues/queries/pr_issues.go index bad4beb7..48385604 100644 --- a/deepsource/issues/queries/pr_issues.go +++ b/deepsource/issues/queries/pr_issues.go @@ -34,7 +34,9 @@ const fetchPRIssuesQuery = `query GetPRIssues( shortcode category severity - explanation + issue { + shortDescription + } } } pageInfo { @@ -76,7 +78,9 @@ type PRIssuesListResponse struct { Shortcode string `json:"shortcode"` Category string `json:"category"` Severity string `json:"severity"` - Explanation string `json:"explanation"` + Issue struct { + ShortDescription string `json:"shortDescription"` + } `json:"issue"` } `json:"node"` } `json:"edges"` PageInfo pagination.PageInfo `json:"pageInfo"` @@ -130,7 +134,7 @@ func (r *PRIssuesListRequest) Do(ctx context.Context) ([]issues.Issue, error) { IssueCategory: node.Category, IssueSeverity: node.Severity, IssueSource: node.Source, - Description: node.Explanation, + Description: node.Issue.ShortDescription, Location: issues.Location{ Path: node.Path, Position: issues.Position{ diff --git a/deepsource/issues/queries/run_issues.go b/deepsource/issues/queries/run_issues.go index dfb61bc7..9548d24c 100644 --- a/deepsource/issues/queries/run_issues.go +++ b/deepsource/issues/queries/run_issues.go @@ -27,9 +27,11 @@ const fetchRunIssuesFlatQuery = `query GetRunIssues($commitOid: String!, $limit: endLine title shortcode - explanation category severity + issue { + shortDescription + } } } } @@ -70,9 +72,11 @@ type RunIssuesFlatResponse struct { EndLine int `json:"endLine"` Title string `json:"title"` Shortcode string `json:"shortcode"` - Explanation string `json:"explanation"` Category string `json:"category"` Severity string `json:"severity"` + Issue struct { + ShortDescription string `json:"shortDescription"` + } `json:"issue"` } `json:"node"` } `json:"edges"` } `json:"issues"` @@ -119,7 +123,7 @@ func (r *RunIssuesFlatRequest) Do(ctx context.Context) ([]issues.Issue, error) { IssueCategory: node.Category, IssueSeverity: node.Severity, IssueSource: node.Source, - Description: node.Explanation, + Description: node.Issue.ShortDescription, Location: issues.Location{ Path: node.Path, Position: issues.Position{