Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters #22648

Conversation

eric-briscoe
Copy link
Contributor

@eric-briscoe eric-briscoe commented Jan 9, 2023

SUMMARY

There are cases where invalid componentIds have been present in dashboard data structures passed through this utility function. This PR adds runtime safety checks in the code to avoid runtime errors in cases where we can safely ignore and id that does not return a component and other cases that could throw an uncaught error disrupting recursion and putting application in failure state.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

image

image

TESTING INSTRUCTIONS

This is a fix that does not have easily reproducible steps, but new added unit tests can create the error case seen in production system and verify these changes address the issue.

General testing should be done around creating, editing, and deleting dashboard filters and behavior should work as it did before these changes, no new errors should be present

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

…nentId is present in dashboard data structure and add unit tests for this case
@eric-briscoe eric-briscoe changed the title Fixes areas that throw runtime errors in dashboard filters fix(dashboard):Fixes areas that throw runtime errors in dashboard filters Jan 9, 2023
@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Merging #22648 (35863a9) into master (7591acb) will increase coverage by 0.00%.
The diff coverage is 87.50%.

@@           Coverage Diff           @@
##           master   #22648   +/-   ##
=======================================
  Coverage   67.03%   67.03%           
=======================================
  Files        1859     1859           
  Lines       71043    71054   +11     
  Branches     7776     7783    +7     
=======================================
+ Hits        47622    47631    +9     
+ Misses      21397    21396    -1     
- Partials     2024     2027    +3     
Flag Coverage Δ
javascript 53.86% <87.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ConfigModal/FiltersConfigForm/FilterScope/utils.ts 86.20% <87.50%> (-0.84%) ⬇️
...set-frontend/src/dashboard/util/permissionUtils.ts 86.66% <0.00%> (-3.34%) ⬇️
...c/components/Chart/DrillDetail/DrillDetailPane.tsx 75.00% <0.00%> (-1.05%) ⬇️
...-frontend/src/views/CRUD/welcome/ActivityTable.tsx 41.81% <0.00%> (-0.29%) ⬇️
.../src/views/CRUD/data/savedquery/SavedQueryList.tsx 63.30% <0.00%> (ø)
...re/components/controls/DatasourceControl/index.jsx 84.90% <0.00%> (+0.29%) ⬆️
...perset-frontend/src/views/CRUD/welcome/Welcome.tsx 71.18% <0.00%> (+0.49%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eric-briscoe eric-briscoe changed the title fix(dashboard):Fixes areas that throw runtime errors in dashboard filters fix (dashboard):Fixes areas that throw runtime errors in dashboard filters Jan 9, 2023
@eric-briscoe eric-briscoe changed the title fix (dashboard):Fixes areas that throw runtime errors in dashboard filters fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters Jan 9, 2023
title: 'All panels',
};

const layout: Layout = {
Copy link
Member

Choose a reason for hiding this comment

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

Could/should this be moved to a separate fixtures type of file to make this test file more readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lyndsiWilliams that is a great point. I am waiting to hear back on timing as this is desired for a patch asap. Depending on time I will either make change in this PR, or I will do a small refinement follow on with the change so we are not blocked waiting on the git checks to re-run.

Copy link
Member

Choose a reason for hiding this comment

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

Good idea, @lyndsiWilliams. I'm going to approve and merge so that we can get this bug fix in, and @eric-briscoe will follow up with a new PR to clean up the test.

title: 'All panels',
};

const layout: Layout = {
Copy link
Member

Choose a reason for hiding this comment

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

Good idea, @lyndsiWilliams. I'm going to approve and merge so that we can get this bug fix in, and @eric-briscoe will follow up with a new PR to clean up the test.

@eschutho eschutho merged commit 02e8511 into apache:master Jan 9, 2023
sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Jan 9, 2023
@sadpandajoe
Copy link
Contributor

🏷️ preset:2023.01

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XXL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants