Skip to content

fix(dashboard): add --layout flag to widget add for predictable placement#700

Merged
BYK merged 2 commits intomainfrom
fix/691-widget-layout-mode
Apr 9, 2026
Merged

fix(dashboard): add --layout flag to widget add for predictable placement#700
BYK merged 2 commits intomainfrom
fix/691-widget-layout-mode

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 9, 2026

Summary

Fixes #691.

  • Adds a --layout/-l flag to sentry dashboard widget add with two modes:
    • sequential (default) — cursor-based append that places widgets after the last one, wrapping to a new row on overflow. Interior gaps beside taller widgets are never backfilled.
    • dense — preserves the original first-fit gap-filling behavior for compact layouts.
  • Existing --x/--y/--width/--height flags continue to work as explicit overrides on top of either mode.

Changes

File What
src/types/dashboard.ts Added WidgetLayoutMode type, extracted assignLayoutDense/assignLayoutSequential helpers, updated assignDefaultLayout signature
src/commands/dashboard/widget/add.ts Added --layout/-l flag with validation
test/types/dashboard.test.ts 10 new unit tests (sequential + dense modes)
test/types/dashboard.property.test.ts New property-based tests (grid bounds, no overlap, idempotency, monotonic y)
test/commands/dashboard/widget/add.test.ts 3 new tests for --layout flag

…ment (#691)

Replace the greedy first-fit auto-placer with a two-mode system:

- "sequential" (default): cursor-based append that places widgets after
  the last one, wrapping to a new row on overflow. Never backfills
  interior gaps beside taller widgets.
- "dense": preserves the original gap-filling behavior for users who
  want compact layouts.

The new --layout/-l flag on `sentry dashboard widget add` selects the
mode. Existing --x/--y/--width/--height flags continue to work as
explicit overrides on top of either mode.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 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).


New Features ✨

  • (commands) Add buildRouteMap wrapper with standard subcommand aliases by BYK in #690

Bug Fixes 🐛

Dashboard

  • Add --layout flag to widget add for predictable placement by BYK in #700
  • Render tracemetrics widgets in dashboard view by BYK in #695

Other

  • (init) Narrow command validation to actual shell injection vectors by betegon in #697
  • (init,feedback) Default to tracing only in feature select and attach user email to feedback by MathurAditya724 in #688

Internal Changes 🔧

  • (docs) Gitignore generated command docs, extract fragments by BYK in #696
  • (eval) Replace OpenAI with Anthropic SDK in init-eval judge by betegon in #683
  • (init) Use markdown pipeline for spinner messages by betegon in #686
  • Regenerate skill files and command docs by github-actions[bot] in 584ec0e0

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-04-09 12:28 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 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 98.53%. Project has 1480 uncovered lines.
❌ Project coverage is 95.46%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/types/dashboard.ts 97.92% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.47%    95.46%    -0.01%
==========================================
  Files          224       224         —
  Lines        32534     32591       +57
  Branches         0         0         —
==========================================
+ Hits         31059     31111       +52
- Misses        1475      1480        +5
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review April 9, 2026 12:16
Copy link
Copy Markdown
Contributor

@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.

Reviewed by Cursor Bugbot for commit 522cb2f. Configure here.

Move the validation check before the layoutMode ternary assignment
so invalid values throw before any variable references them.
@BYK BYK merged commit 419a033 into main Apr 9, 2026
37 of 39 checks passed
@BYK BYK deleted the fix/691-widget-layout-mode branch April 9, 2026 12:47
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.

dashboard widget add: auto-placer fills gaps greedily, breaking layout

1 participant