Repository navigation
fix(dashboards): read the dashboard's widgets when GET /widgets fails - #235
Open
Severin Neumann (svrnm) wants to merge 1 commit into
Open
Severin Neumann (svrnm) wants to merge 1 commit into
Severin Neumann (svrnm) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The fallback treats an attached-only widget inventory as complete, risking deletion of detached or shared definitions and failing to resolve valid references to unattached widgets.
2 open issues
What changed in this PR
Adds a fallback for dashboard apply, dry-run, and export when the org-wide widget list returns a server error, addressing the failure reported in #222.
Changes:
- Fetches attached widgets individually after a widget-list 5xx and prints a fallback notice.
- Preserves existing handling for other errors and returns the original error if fallback fails.
- Adds fake-server failure injection and regression coverage for re-apply and export.
| File | Description |
|---|---|
internal/cli/dashlive.go |
Implements dashboard-scoped widget fetching after list server errors. |
internal/cli/dashfake_test.go |
Adds a switch to simulate widget-list failures. |
internal/cli/dashapply_test.go |
Tests no-write re-apply, fallback notice, and export during list failures. |
Review effort: Balanced
| // a broken widget elsewhere in the org. Apply and export only need | ||
| // this dashboard's widgets. The cost: apply can't see widgets it | ||
| // owns that were detached from the dashboard, so it leaves them be. | ||
| if fbErr := fetchDashboardWidgets(ctx, app, st); fbErr != nil { |
Comment on lines
+154
to
+157
| if st.Dashboard == nil { | ||
| return nil | ||
| } | ||
| for _, row := range rowsFromPayload(payload, "widgets") { | ||
| for _, id := range st.Dashboard.WidgetIDs { |
apply, apply --dry-run and export all list every widget in the org first. When that list answers 5xx (a broken widget elsewhere in the org, #111 and again #222), fetchWidgetsAndDefs now reads the dashboard's attached widgets one by one via GET /widgets/{id} and prints a note. Widgets the dashboard owns but that were detached from it are invisible in this mode, so apply leaves them alone. Closes #222. Assisted-By: Claude
Severin Neumann (svrnm)
force-pushed
the
fix/dashboards-widgets-list-fallback
branch
from
November 11, 2026 06:53
dd5710e to
82a34a9
Compare
This branch was successfully deployed
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.


Closes #222.
dashboards apply(and--dry-run) anddashboards exportsharefetchWidgetsAndDefs, which lists every widget in the org. Live, that list can return 500 because of one broken widget elsewhere in the org (#111, and again in #222). All three commands then failed before doing anything.Now, when
GET /widgetsreturns a 5xx,fetchWidgetsAndDefsreads the dashboard'swidget_idsone at a time throughGET /widgets/{id}(a new dashboard has none) and prints a note on stderr. Other errors (401, 403, network) still fail as they did before. If the fallback fails too, the original error is reported.Trade-off, which the code comment also states: while in fallback mode, apply can't see widgets it owns that were detached from the dashboard, so it leaves them alone instead of deleting them.
Test:
TestWidgetListFailureFallsBackToDashboardWidgetsadds alistErrswitch to thefakeOrgtest server. It applies a manifest, makes the list return 500, then checks that a re-apply makes zero writes and prints the note, and that export still writes the widgets.The percentile-with-group_by 500 mentioned at the end of #222 is a server-side issue and is not covered here.
🤖 Generated with Claude Code