Skip to content

fix(dashboard): guard sort param by dataset in widget table queries#715

Merged
BYK merged 2 commits intomainfrom
fix/129-dashboard-widget-sort-400
Apr 11, 2026
Merged

fix(dashboard): guard sort param by dataset in widget table queries#715
BYK merged 2 commits intomainfrom
fix/129-dashboard-widget-sort-400

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 10, 2026

Summary

  • Fix queryWidgetTable sending sort param for non-spans datasets (errors/discover reject with 400 Bad Request)
  • Enrich ApiError captures in exceptionWhileRunningCommand with structured Sentry context (status, endpoint, detail) for better diagnostics

Fixes CLI-129

Details

queryWidgetTimeseries already correctly guarded the sort parameter behind dataset === "spans" (lines 384-389), but queryWidgetTable was passing query?.orderby unconditionally. When a dashboard has a table or big_number widget with error-events or discover widget type and the widget query has orderby, the events endpoint returns 400.

The api_error context on Sentry.setContext() ensures future ApiError events include the endpoint URL and response detail, making it possible to diagnose which API call failed without guessing from minified stack traces.

…129)

queryWidgetTable was passing sort/orderby to the events API for all
datasets, but the sort param is only supported on the spans dataset.
Errors/discover endpoints reject it with 400 Bad Request.

Also enrich ApiError captures in exceptionWhileRunningCommand with
structured Sentry context (status, endpoint, detail) for better
diagnostics on future API errors.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (build) Normalize Windows backslash paths for sourcemap resolution by BYK in #714
  • (dashboard) Guard sort param by dataset in widget table queries by BYK in #715

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-04-11 00:13 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@BYK BYK marked this pull request as ready for review April 10, 2026 23:54
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 90.91%. Project has 1573 uncovered lines.
✅ Project coverage is 95.37%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/api/dashboards.ts 0.00% ⚠️ 3 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.37%    95.37%        —%
==========================================
  Files          232       232         —
  Lines        33928     33941       +13
  Branches         0         0         —
==========================================
+ Hits         32355     32368       +13
- Misses        1573      1573         —
- Partials         0         0         —

Generated by Codecov Action

The authenticatedFetch wrapper returned Response objects without throwing
on 4xx, so withTracing always marked HTTP spans as "ok" regardless of
the actual HTTP status. This made traces misleading — a 400 Bad Request
showed span.status: "ok" because the span status was set before
apiRequestToRegion checked response.ok.

Switch from withHttpSpan to withTracingSpan in createAuthenticatedFetch
to set http.response.status_code as a span attribute and mark non-ok
responses with error status. OAuth callers of withHttpSpan are unaffected
since they already throw inside the callback on non-ok responses.
@BYK BYK merged commit 8245dec into main Apr 11, 2026
26 checks passed
@BYK BYK deleted the fix/129-dashboard-widget-sort-400 branch April 11, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant