Skip to content

feat(dashboard): add pagination and glob filtering to dashboard list#560

Merged
BYK merged 11 commits intomainfrom
feat/dashboard-list-pagination
Mar 25, 2026
Merged

feat(dashboard): add pagination and glob filtering to dashboard list#560
BYK merged 11 commits intomainfrom
feat/dashboard-list-pagination

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Mar 25, 2026

Summary

Add cursor-based pagination and client-side glob filtering to dashboard list, plus bare-org slug support across all dashboard commands.

Changes

API Layer

  • Replace listDashboards() with listDashboardsPaginated() returning PaginatedResponse with cursor support via Link header parsing

Dashboard List Command

  • Switch to buildListCommand with auto-injected --cursor/-c and --fresh/-f flags
  • Add positional name argument with title filtering: bare words, glob patterns ('Error*', '*API*'), and multi-word unquoted titles all work
  • Case-insensitive matching via Bun.Glob
  • Support org/project/name as single arg (splits on second /)
  • Extended cursor encoding (serverCursor|dashboardId) for mid-page resume when filtering fills --limit partway through a server page
  • Auto-paginate when --limit exceeds API_MAX_PER_PAGE (100)
  • Fuzzy suggestions (via fuzzyMatch()) when filter matches nothing
  • JSON output uses { data, hasMore, nextCursor? } paginated envelope

Dashboard Resolve

  • Bare org slug normalization: sentry dashboard list my-org 'Error*' and sentry dashboard view my-org 12345 now work (auto-appends / when first arg has no /)
  • resolveDashboardId() paginates through all dashboards and uses fuzzyMatch() for error suggestions instead of overwhelming full listings

AGENTS.md

  • Codify auto-pagination rule for --limit > API_MAX_PER_PAGE
  • Add fuzzy suggestion guidance for resolution errors

Examples

sentry dashboard list                         # auto-detect org
sentry dashboard list my-org/                 # explicit org
sentry dashboard list 'Error*'               # glob filter
sentry dashboard list my-org '*API*'          # bare org + filter
sentry dashboard list my-org/cli CLI          # org/project + filter
sentry dashboard list sentry/cli/CLI          # org/project/name single arg
sentry dashboard list my-org CLI Health       # multi-word unquoted filter
sentry dashboard list -c last                 # next page
sentry dashboard list --json                  # paginated JSON envelope
sentry dashboard view my-org 'My Dashboard'  # bare org in view

Test Plan

  • 81 tests across list.test.ts and resolve.test.ts covering pagination, glob filtering, cursor encoding/decoding, bare-org normalization, multi-word args, fuzzy suggestions, and org/project/name splitting

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

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


New Features ✨

Dashboard

  • Add pagination and glob filtering to dashboard list by BYK in #560
  • Rich terminal chart rendering for dashboard view by BYK in #555

Other

  • (formatters) Colorize SQL in DB span descriptions by BYK in #546
  • (init) Treat bare slug as new project name when not found by BYK in #554
  • Add sentry sourcemap inject and sentry sourcemap upload commands by BYK in #547
  • Native debug ID injection and sourcemap upload by BYK in #543

Bug Fixes 🐛

Dashboard

  • Scale timeseries bar width to fill chart area by BYK in #562
  • Resolve dashboard by ID/slug in addition to title by BYK in #559

Other

  • (event-view) Auto-redirect issue short IDs in two-arg form (CLI-MP) by BYK in #558
  • (help) Show help when user passes help as positional arg by BYK in #561
  • Reject @-selectors in parseOrgProjectArg with helpful redirect by BYK in #557

Internal Changes 🔧

Coverage

  • Use informational-patch input instead of sed hack by BYK in #544
  • Make checks informational on release branches by BYK in #541

Other

  • (api) Collapse stats on issue detail endpoints to save 100-300ms by BYK in #551
  • (ci) Upgrade GitHub Actions to Node 24 runtime by BYK in #542
  • (db) DRY up database layer with shared helpers and lint enforcement by BYK in #550
  • (issue-list) Use collapse parameter to skip unused Snuba queries by BYK in #545
  • Bump Bun from 1.3.9 to 1.3.11 by BYK in #552
  • Regenerate skill files by github-actions[bot] in ec1ffe28

🤖 This preview updates automatically when you update the PR.

@BYK BYK force-pushed the feat/dashboard-list-pagination branch 2 times, most recently from e2e4e14 to 6aeebbd Compare March 25, 2026 15:36
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Codecov Results 📊

126 passed | Total: 126 | 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 97.68%. Project has 1271 uncovered lines.
✅ Project coverage is 95.4%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
dashboards.ts 3.34% ⚠️ 289 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.37%    95.40%    +0.03%
==========================================
  Files          194       194         —
  Lines        27448     27655      +207
  Branches         0         0         —
==========================================
+ Hits         26178     26384      +206
- Misses        1270      1271        +1
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review March 25, 2026 16:22
BYK added 7 commits March 25, 2026 17:44
- Replace listDashboards() with listDashboardsPaginated() returning
  PaginatedResponse with cursor support via Link header parsing
- Rewrite dashboard list command using buildListCommand with auto-injected
  --cursor/-c and --fresh/-f flags
- Add positional name argument with glob filtering (case-insensitive via
  Bun.Glob). Supports: 'Error*', '*API*', 'My Dashboard' (space = filter)
- Add extended cursor encoding (serverCursor|dashboardId) for mid-page
  resume when client-side filtering fills --limit partway through a page
- Auto-paginate when --limit exceeds API_MAX_PER_PAGE (100)
- Support bare org slug as first arg: 'sentry dashboard list my-org Error*'
  normalizes to org/ format for parseOrgProjectArg
- Fix parseDashboardPositionalArgs bare-org normalization (affects view,
  widget add/edit/delete commands too)
- Update resolveDashboardId to paginate through all dashboards and use
  fuzzyMatch() for error suggestions instead of listing all titles
- JSON output uses { data, hasMore, nextCursor? } paginated envelope
- Add AGENTS.md rules: auto-pagination for large limits, fuzzy suggestions
  in resolution errors
- Update dashboard view examples to show bare org and org/project patterns
…arch

A bare word like 'CLI' or 'Performance' was being routed through
project-search, which resolveOrgFromTarget silently ignores for
dashboards (they're org-scoped). Now any single arg without '/' is
always a title filter. To specify an org, use 'org/' or two args.
'sentry dashboard list sentry/cli/CLI' now correctly splits into
target='sentry/cli' and filter='CLI'. Previously all slash-containing
single args were treated as targets, so the name portion was ignored.

Split logic: 1 slash = target only (org/ or org/project), 2+ slashes =
org/project/name where name becomes the title filter.
'sentry dashboard list sentry/cli CLI Health' arrives as 4 args. The
filter now joins args[1:] with spaces so unquoted multi-word titles
work: ['sentry/cli', 'CLI', 'Health'] → filter='CLI Health'.
When a title filter produces zero results, show up to 5 fuzzy-matched
similar dashboard titles in the hint instead of a bare 'No dashboards
found.' message. Uses the same fuzzyMatch() utility as resolveDashboardId.

Example: 'sentry dashboard list my-org/ clil' might suggest 'CLI'.
The fuzzy suggestions for no-match filters were in the hint (footer)
while the formatter independently showed 'No dashboards found.' —
producing duplicate messaging. Now the formatter receives titleFilter
and allTitles in the result, and shows the appropriate message:
- With filter, has suggestions: 'No dashboards matching X. Did you mean:'
- With filter, no suggestions: 'No dashboards matching X.'
- Without filter: 'No dashboards found.'
1. processPage: if bookmarked dashboard ID was deleted between requests,
   use findIndex + fallback to process entire page (no silent skip).
2. parseDashboardListArgs: filter out undefined/empty args that
   buildListCommand's interceptSubcommand injects.
3. Include titleFilter in pagination context key so different filter
   queries don't share cursors.
@BYK BYK force-pushed the feat/dashboard-list-pagination branch from 64d6c9f to 38767e1 Compare March 25, 2026 17:47
The -c last hint now includes the filter arg so the suggested command
matches the stored cursor's context key. Without it, following the hint
after a filtered query would fail with 'No saved cursor for this query'.
- Add descriptive placeholder 'org/title-filter' for array positional
  (SKILL.md now shows '<org/title-filter...>' instead of '<args...>')
- Remove all ASCII art separator dividers (// --------) per style rules
- Regenerate SKILL.md
The glob matching lowercases the filter but the context key stored it
in original case, so 'Error*' and 'error*' stored separate cursors
despite producing identical results.
…views

Strip glob metacharacters (*?[]) from the filter before passing to
fuzzyMatch so they don't inflate Levenshtein distances. 'Error*' now
correctly suggests 'Error Rate' etc.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@BYK BYK merged commit 92e472e into main Mar 25, 2026
22 checks passed
@BYK BYK deleted the feat/dashboard-list-pagination branch March 25, 2026 20:04
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