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 runtime safety checks and improved tests #22457

Conversation

eric-briscoe
Copy link
Contributor

SUMMARY

Add runtime safety checks and improved tests to recursivelyDeleteChildren and findParentId functions

There have been cases where a dashboard ends up with an invalid componentId causing code in workspace to fail removal of a tab. The root cause of where the errant id comes from is still under investigation. This PR adds runtime safety checks to code that was fail when a bad ID existed to treat the symptom and make the application more fault tolerant.

PR adds test to simulate bad states passed into functions to ensure they do not throw uncaught errors.
PR also converts two files to TypeScript to make interfaces more clear.

All existing tests were left unchanged to ensure previous behavior is stable.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

image

TESTING INSTRUCTIONS

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

@eric-briscoe eric-briscoe changed the title fix (dashboard): Add runtime safety checks and improved tests fix(dashboard): Add runtime safety checks and improved tests Dec 19, 2022
@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

Merging #22457 (236448b) into master (858796b) will decrease coverage by 0.00%.
The diff coverage is 92.30%.

❗ Current head 236448b differs from pull request most recent head 71d01b9. Consider uploading reports for the commit 71d01b9 to get more accurate results

@@            Coverage Diff             @@
##           master   #22457      +/-   ##
==========================================
- Coverage   66.89%   66.88%   -0.01%     
==========================================
  Files        1850     1850              
  Lines       70701    70709       +8     
  Branches     7750     7760      +10     
==========================================
+ Hits        47292    47297       +5     
- Misses      21393    21394       +1     
- Partials     2016     2018       +2     
Flag Coverage Δ
javascript 53.86% <92.30%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...perset-frontend/src/dashboard/util/findParentId.ts 86.95% <86.95%> (ø)
...frontend/src/dashboard/reducers/dashboardLayout.js 93.40% <100.00%> (+0.07%) ⬆️

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

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

LGTM, with just one comment about ts ignores.

@eschutho eschutho merged commit fad873c into apache:master Jan 6, 2023
@sadpandajoe
Copy link
Contributor

🏷️ preset:2023.01

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Jan 6, 2023
@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/L 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants