fix(ENG-4699): use run query on PR fallback in metrics & vulnerabilities#292
Merged
Conversation
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>
|
|
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.
sourya-deepsource
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
metricsandvulnerabilitiescommands 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 whenab.Fallbackis true, matching the existing behavior inissues.goand the non-PR fallback path.Sibling fix to ENG-4240 (issues command).
Changes
command/metrics/metrics.go— useGetRunMetricson fallbackcommand/vulnerabilities/vulnerabilities.go— useGetRunVulnson fallbackNotes
Downstream render/JSON/header paths already branch on
runMetrics/runVulnsfirst, so output renders correctly on fallback.Closes ENG-4699
🤖 Generated with Claude Code