You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2023/01/09 17:39:11 UTC

[GitHub] [superset] eric-briscoe opened a new pull request, #22648: Fixes areas that throw runtime errors in dashboard filters

eric-briscoe opened a new pull request, #22648:
URL: https://github.com/apache/superset/pull/22648

   
   
   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   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
   <!--- Skip this if not applicable -->
   ![image](https://user-images.githubusercontent.com/5614266/211370873-1439712b-31d9-42c9-a092-2aa2d0da0668.png)
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   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
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho merged pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
eschutho merged PR #22648:
URL: https://github.com/apache/superset/pull/22648


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #22648: fix(dashboard):Fixes areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #22648:
URL: https://github.com/apache/superset/pull/22648#issuecomment-1376127864

   # [Codecov](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22648](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (35863a9) into [master](https://codecov.io/gh/apache/superset/commit/7591acba548c7e501a1722a7a32660a1b6c619f7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7591acb) will **increase** coverage by `0.00%`.
   > The diff coverage is `87.50%`.
   
   ```diff
   @@           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%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ConfigModal/FiltersConfigForm/FilterScope/utils.ts](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL0ZpbHRlclNjb3BlL3V0aWxzLnRz) | `86.20% <87.50%> (-0.84%)` | :arrow_down: |
   | [...set-frontend/src/dashboard/util/permissionUtils.ts](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL3Blcm1pc3Npb25VdGlscy50cw==) | `86.66% <0.00%> (-3.34%)` | :arrow_down: |
   | [...c/components/Chart/DrillDetail/DrillDetailPane.tsx](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQ2hhcnQvRHJpbGxEZXRhaWwvRHJpbGxEZXRhaWxQYW5lLnRzeA==) | `75.00% <0.00%> (-1.05%)` | :arrow_down: |
   | [...-frontend/src/views/CRUD/welcome/ActivityTable.tsx](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvd2VsY29tZS9BY3Rpdml0eVRhYmxlLnRzeA==) | `41.81% <0.00%> (-0.29%)` | :arrow_down: |
   | [.../src/views/CRUD/data/savedquery/SavedQueryList.tsx](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9zYXZlZHF1ZXJ5L1NhdmVkUXVlcnlMaXN0LnRzeA==) | `63.30% <0.00%> (ø)` | |
   | [...re/components/controls/DatasourceControl/index.jsx](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRhc291cmNlQ29udHJvbC9pbmRleC5qc3g=) | `84.90% <0.00%> (+0.29%)` | :arrow_up: |
   | [...perset-frontend/src/views/CRUD/welcome/Welcome.tsx](https://codecov.io/gh/apache/superset/pull/22648?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvd2VsY29tZS9XZWxjb21lLnRzeA==) | `71.18% <0.00%> (+0.49%)` | :arrow_up: |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eric-briscoe commented on a diff in pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
eric-briscoe commented on code in PR #22648:
URL: https://github.com/apache/superset/pull/22648#discussion_r1065035634


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.test.ts:
##########
@@ -0,0 +1,18204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Layout } from 'src/dashboard/types';
+import { buildTree } from './utils';
+
+// The types defined for Layout and sub elements is not compatible with the data we get back fro a real dashboard layout
+// This test file is using data from a real example dashboard to test real world data sets.  ts-ignore is set for this entire file
+// until we can reconcile adjusting types to match the actual data structures used
+
+describe('Ensure buildTree does not throw runtime errors when encountering an invalid node', () => {
+  const node = {
+    children: ['TABS-97PVJa11D_'],
+    id: 'ROOT_ID',
+    type: 'ROOT',
+    parents: [],
+  };
+
+  const treeItem = {
+    children: [],
+    key: 'ROOT_ID',
+    type: 'ROOT',
+    title: 'All panels',
+  };
+
+  const layout: Layout = {

Review Comment:
   @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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on a diff in pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #22648:
URL: https://github.com/apache/superset/pull/22648#discussion_r1065037811


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.test.ts:
##########
@@ -0,0 +1,18204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Layout } from 'src/dashboard/types';
+import { buildTree } from './utils';
+
+// The types defined for Layout and sub elements is not compatible with the data we get back fro a real dashboard layout
+// This test file is using data from a real example dashboard to test real world data sets.  ts-ignore is set for this entire file
+// until we can reconcile adjusting types to match the actual data structures used
+
+describe('Ensure buildTree does not throw runtime errors when encountering an invalid node', () => {
+  const node = {
+    children: ['TABS-97PVJa11D_'],
+    id: 'ROOT_ID',
+    type: 'ROOT',
+    parents: [],
+  };
+
+  const treeItem = {
+    children: [],
+    key: 'ROOT_ID',
+    type: 'ROOT',
+    title: 'All panels',
+  };
+
+  const layout: Layout = {

Review Comment:
   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. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sadpandajoe commented on pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
sadpandajoe commented on PR #22648:
URL: https://github.com/apache/superset/pull/22648#issuecomment-1376321717

   🏷️ preset:2023.01


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] lyndsiWilliams commented on a diff in pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22648:
URL: https://github.com/apache/superset/pull/22648#discussion_r1065026428


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.test.ts:
##########
@@ -0,0 +1,18204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Layout } from 'src/dashboard/types';
+import { buildTree } from './utils';
+
+// The types defined for Layout and sub elements is not compatible with the data we get back fro a real dashboard layout
+// This test file is using data from a real example dashboard to test real world data sets.  ts-ignore is set for this entire file
+// until we can reconcile adjusting types to match the actual data structures used
+
+describe('Ensure buildTree does not throw runtime errors when encountering an invalid node', () => {
+  const node = {
+    children: ['TABS-97PVJa11D_'],
+    id: 'ROOT_ID',
+    type: 'ROOT',
+    parents: [],
+  };
+
+  const treeItem = {
+    children: [],
+    key: 'ROOT_ID',
+    type: 'ROOT',
+    title: 'All panels',
+  };
+
+  const layout: Layout = {

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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] lyndsiWilliams commented on a diff in pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22648:
URL: https://github.com/apache/superset/pull/22648#discussion_r1065026428


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.test.ts:
##########
@@ -0,0 +1,18204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Layout } from 'src/dashboard/types';
+import { buildTree } from './utils';
+
+// The types defined for Layout and sub elements is not compatible with the data we get back fro a real dashboard layout
+// This test file is using data from a real example dashboard to test real world data sets.  ts-ignore is set for this entire file
+// until we can reconcile adjusting types to match the actual data structures used
+
+describe('Ensure buildTree does not throw runtime errors when encountering an invalid node', () => {
+  const node = {
+    children: ['TABS-97PVJa11D_'],
+    id: 'ROOT_ID',
+    type: 'ROOT',
+    parents: [],
+  };
+
+  const treeItem = {
+    children: [],
+    key: 'ROOT_ID',
+    type: 'ROOT',
+    title: 'All panels',
+  };
+
+  const layout: Layout = {

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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] lyndsiWilliams commented on a diff in pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

Posted by GitBox <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22648:
URL: https://github.com/apache/superset/pull/22648#discussion_r1065026428


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.test.ts:
##########
@@ -0,0 +1,18204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Layout } from 'src/dashboard/types';
+import { buildTree } from './utils';
+
+// The types defined for Layout and sub elements is not compatible with the data we get back fro a real dashboard layout
+// This test file is using data from a real example dashboard to test real world data sets.  ts-ignore is set for this entire file
+// until we can reconcile adjusting types to match the actual data structures used
+
+describe('Ensure buildTree does not throw runtime errors when encountering an invalid node', () => {
+  const node = {
+    children: ['TABS-97PVJa11D_'],
+    id: 'ROOT_ID',
+    type: 'ROOT',
+    parents: [],
+  };
+
+  const treeItem = {
+    children: [],
+    key: 'ROOT_ID',
+    type: 'ROOT',
+    title: 'All panels',
+  };
+
+  const layout: Layout = {

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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org