Skip to content

fix(cli): Deduplicate metric suggestions in ResolutionError#1299

Open
sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/cli-deduplicate-metric-suggestions
Open

fix(cli): Deduplicate metric suggestions in ResolutionError#1299
sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/cli-deduplicate-metric-suggestions

Conversation

@sentry

@sentry sentry Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

The resolveMetricField function in the CLI, when a metric is not found, attempts to suggest similar metrics using fuzzyMatch. The candidateNames list, however, was populated directly from the metrics array returned by the API, which can contain duplicate entries for the same metric name (e.g., due to different tag combinations).

This led to fuzzyMatch returning the same metric name multiple times in the suggestions, resulting in confusing error messages like "Similar metrics: metric.name, metric.name, metric.name...".

This change wraps the metrics.map(m => m.name).filter(...) expression with [...new Set(...)] to ensure that candidateNames contains only unique metric names. This prevents duplicate suggestions in the ResolutionError message, improving clarity for the user.

Fixes CLI-1XK

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1299/

Built to branch gh-pages at 2026-07-25 22:45 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5493 uncovered lines.
✅ Project coverage is 81.75%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.74%    81.75%    +0.01%
==========================================
  Files          428       428         —
  Lines        30106     30105        -1
  Branches     19593     19593         —
==========================================
+ Hits         24611     24612        +1
- Misses        5495      5493        -2
- Partials      2054      2054         —

Generated by Codecov Action

@sentry
sentry Bot marked this pull request as ready for review July 25, 2026 22:53
@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants