You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate PR issues to new flattened API with server-side filters (#270)
* Migrate PR issues to new flattened API with server-side filters
- Switch from `issueOccurrences` to `issues` field in PR issues GraphQL query
- Flatten response structure, remove nested issue/analyzer objects
- Add source, category, severity, and q filter params to PR issues query
- Add buildPRFilters() to map CLI flags to server-side filter params
- Update GetPRIssues signature to accept filter params
- Update golden files and tests to match new schema
* Handle nil issues list before filtering
- Return early when issuesList is nil to avoid passing nil to filterIssues
* Improve "no runs found" messages with actionable hints
- Suggest checking if branch has been pushed/analyzed when no runs exist
- Replace generic "no completed runs" with "analysis still in progress"
- Point users to --default-branch as a fallback option
- Update test assertions to match new message text
* Bump version to 2.0.41
* Suppress empty-results message when showing fallback data
- Add Fallback field to AutoBranchResult to track when results come
from a previous completed run while a new analysis is in progress
- Propagate fallback state to issues, metrics, and vulnerabilities commands
- Skip "no results found" message in fallback mode since it's misleading
when the data is from an older run, not the current commit
* Bump version to 2.0.42
Copy file name to clipboardExpand all lines: command/cmdutil/resolve_run.go
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ func resolveRunFromCommits(
67
67
}
68
68
iflen(allRuns) ==0 {
69
69
returnnil, fmt.Errorf(
70
-
"no analysis runs found for branch %q.\nTry: --default-branch, --commit <sha>, or --pr <number>",
70
+
"no analysis runs found for branch %q. Has this branch been pushed and analyzed on DeepSource?\nTry: --default-branch, --commit <sha>, or --pr <number>",
71
71
branchName,
72
72
)
73
73
}
@@ -223,6 +223,7 @@ type AutoBranchResult struct {
223
223
PRNumberint// >0 if a PR was detected for the branch
224
224
UseRepobool// true when the caller should fall back to repo-level (default branch) data
225
225
Emptybool// true when there are no results (timeout, no completed runs)
226
+
Fallbackbool// true when showing results from a previous completed run while a new analysis is in progress
226
227
}
227
228
228
229
// ResolveAutoBranch encapsulates the shared "default" branch resolution logic
@@ -286,12 +287,13 @@ func resolveWithPR(
286
287
returnnil, fallbackErr
287
288
}
288
289
ifcompletedRun==nil {
289
-
style.Infof(w, "No completed analysis runs found for branch %q.", branchName)
290
+
style.Infof(w, "Analysis is still in progress for branch %q. Try again shortly, or use --default-branch to see results from the default branch.", branchName)
290
291
result.Empty=true
291
292
returnresult, nil
292
293
}
293
294
style.Infof(w, "Analysis is running on commit %s. Showing results from the last analyzed commit (%s).", run.CommitOid[:8], completedRun.CommitOid[:8])
294
295
result.CommitOid=completedRun.CommitOid
296
+
result.Fallback=true
295
297
returnresult, nil
296
298
}
297
299
}
@@ -336,12 +338,13 @@ func resolveWithoutPR(
336
338
returnnil, fallbackErr
337
339
}
338
340
ifrun==nil {
339
-
style.Infof(w, "No completed analysis runs found for branch %q.", branchName)
341
+
style.Infof(w, "Analysis is still in progress for branch %q. Try again shortly, or use --default-branch to see results from the default branch.", branchName)
340
342
result.Empty=true
341
343
returnresult, nil
342
344
}
343
345
style.Infof(w, "Analysis is running on commit %s. Showing results from the last analyzed commit (%s).", commitOid[:8], run.CommitOid[:8])
344
346
commitOid=run.CommitOid
347
+
result.Fallback=true
345
348
}
346
349
ifIsRunTimedOut(finalStatus) {
347
350
style.Warnf(w, "Analysis timed out for branch %q.", branchName)
style.Infof(opts.stdout(), "No completed analysis runs found for branch %q.", branch)
222
+
style.Infof(opts.stdout(), "Analysis is still in progress for branch %q. Try again shortly, or use --default-branch to see results from the default branch.", branch)
223
223
returnnil
224
224
}
225
225
style.Infof(opts.stdout(), "Analysis is running on commit %s. Showing results from the last analyzed commit (%s).", run.CommitOid[:8], completed.CommitOid[:8])
style.Infof(opts.stdout(), "No completed analysis runs found for branch %q.", branchName)
279
+
style.Infof(opts.stdout(), "Analysis is still in progress for branch %q. Try again shortly, or use --default-branch to see results from the default branch.", branchName)
280
280
returnnil
281
281
}
282
282
style.Infof(opts.stdout(), "Analysis is running on commit %s. Showing results from the last analyzed commit (%s).", run.CommitOid[:8], completed.CommitOid[:8])
0 commit comments