Skip to content

fix(ENG-4699): use run query on PR fallback in metrics & vulnerabilities#292

Merged
vishnu-deepsource merged 1 commit into
masterfrom
eng-4699
Jun 30, 2026
Merged

fix(ENG-4699): use run query on PR fallback in metrics & vulnerabilities#292
vishnu-deepsource merged 1 commit into
masterfrom
eng-4699

Conversation

@vishnu-deepsource

Copy link
Copy Markdown
Contributor

Summary

When auto-branch resolution detects a PR but the current run is still in progress, the CLI falls back to the last completed run. On the PR path, the metrics and vulnerabilities commands unconditionally queried the PR-scoped endpoints (GetPRMetrics / GetPRVulns), which return empty until the run completes — so users saw empty results on fallback.

This switches to the run-scoped query (GetRunMetrics / GetRunVulns) with the fallback commit OID when ab.Fallback is true, matching the existing behavior in issues.go and the non-PR fallback path.

Sibling fix to ENG-4240 (issues command).

Changes

  • command/metrics/metrics.go — use GetRunMetrics on fallback
  • command/vulnerabilities/vulnerabilities.go — use GetRunVulns on fallback

Notes

Downstream render/JSON/header paths already branch on runMetrics/runVulns first, so output renders correctly on fallback.

Closes ENG-4699

🤖 Generated with Claude Code

When auto-branch resolution detects a PR but the current run is still
in progress, the CLI falls back to the last completed run. The PR branch
of the resolve switch unconditionally queried the PR-scoped endpoints
(GetPRMetrics / GetPRVulns), which return empty until the run completes.

Switch to the run-scoped query (GetRunMetrics / GetRunVulns) with the
fallback commit OID when ab.Fallback is true, matching issues.go and the
non-PR fallback path.

Closes ENG-4699. Sibling fix to ENG-4240 (issues command).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@deepsource-io

deepsource-io Bot commented Jun 30, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 5414f73...422ccf4 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Coverage  

Code Review Summary

Analyzer Status Updated (UTC) Details
Go Jun 30, 2026 4:16a.m. Review ↗
Secrets Jun 30, 2026 4:16a.m. Review ↗
Code coverage Jun 30, 2026 4:16a.m. Review ↗

Code Coverage Summary

Language Line Coverage (New Code) Line Coverage (Overall)
Aggregate
0%
[⤫ below threshold]
25.4%
Go
0%
[⤫ below threshold]
25.4%
[✓ above threshold]

➟ Additional coverage metrics may have been reported. See full coverage report ↗


Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@vishnu-deepsource vishnu-deepsource merged commit 6708c22 into master Jun 30, 2026
4 of 5 checks passed
@vishnu-deepsource vishnu-deepsource deleted the eng-4699 branch June 30, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants