bito-code-review[bot] commented on code in PR #32958:
URL: https://github.com/apache/superset/pull/32958#discussion_r3465102937
##########
superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx:
##########
@@ -46,7 +46,7 @@ const mockedIsFeatureEnabled = isFeatureEnabled as jest.Mock;
const spyColorSchemeSelect = jest.spyOn(ColorSchemeSelect, 'default');
const mockedJsonMetadata =
- '{"timed_refresh_immune_slices": [], "expanded_slices": {},
"refresh_frequency": 0, "default_filters": "{}", "color_scheme":
"supersetColors", "label_colors": {"0": "#D3B3DA", "1": "#9EE5E5", "0.
Pre-clinical": "#1FA8C9", "2. Phase II or Combined I/II": "#454E7C", "1. Phase
I": "#5AC189", "3. Phase III": "#FF7F44", "4. Authorized": "#666666", "root":
"#1FA8C9", "Protein subunit": "#454E7C", "Phase II": "#5AC189", "Pre-clinical":
"#FF7F44", "Phase III": "#666666", "Phase I": "#E04355", "Phase I/II":
"#FCC700", "Inactivated virus": "#A868B7", "Virus-like particle": "#3CCCCB",
"Replicating bacterial vector": "#A38F79", "DNA-based": "#8FD3E4", "RNA-based
vaccine": "#A1A6BD", "Authorized": "#ACE1C4", "Non-replicating viral vector":
"#FEC0A1", "Replicating viral vector": "#B2B2B2", "Unknown": "#EFA1AA", "Live
attenuated virus": "#FDE380", "COUNT(*)": "#D1C6BC"}, "filter_scopes": {"358":
{"Country_Name": {"scope": ["ROOT_ID"], "immune": []}, "Product_Category":
{"scope": ["ROOT_ID"], "im
mune": []}, "Clinical Stage": {"scope": ["ROOT_ID"], "immune": []}}}}';
+ '{"timed_refresh_immune_slices": [], "expanded_slices": {},
"expand_all_slices": "false", "refresh_frequency": 0, "default_filters": "{}",
"color_scheme": "supersetColors", "label_colors": {"0": "#D3B3DA", "1":
"#9EE5E5", "0. Pre-clinical": "#1FA8C9", "2. Phase II or Combined I/II":
"#454E7C", "1. Phase I": "#5AC189", "3. Phase III": "#FF7F44", "4. Authorized":
"#666666", "root": "#1FA8C9", "Protein subunit": "#454E7C", "Phase II":
"#5AC189", "Pre-clinical": "#FF7F44", "Phase III": "#666666", "Phase I":
"#E04355", "Phase I/II": "#FCC700", "Inactivated virus": "#A868B7", "Virus-like
particle": "#3CCCCB", "Replicating bacterial vector": "#A38F79", "DNA-based":
"#8FD3E4", "RNA-based vaccine": "#A1A6BD", "Authorized": "#ACE1C4",
"Non-replicating viral vector": "#FEC0A1", "Replicating viral vector":
"#B2B2B2", "Unknown": "#EFA1AA", "Live attenuated virus": "#FDE380",
"COUNT(*)": "#D1C6BC"}, "filter_scopes": {"358": {"Country_Name": {"scope":
["ROOT_ID"], "immune": []}, "Product_Categor
y": {"scope": ["ROOT_ID"], "immune": []}, "Clinical Stage": {"scope":
["ROOT_ID"], "immune": []}}}}';
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type mismatch in test fixture</b></div>
<div id="fix">
The `expand_all_slices` value uses string `"false"` instead of boolean
`false`. This creates a type mismatch with the schema definition at
`DashboardJSONMetadataSchema` (line 200 in `superset/dashboards/schemas.py`)
which expects `fields.Boolean()`. Additionally, tests may not fully verify this
property's behavior per BITO.md rule [6262].
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
---
a/superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx
+++
b/superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx
@@ -46,7 +46,7 @@ const spyColorSchemeSelect =
jest.spyOn(ColorSchemeSelect, 'default');
const mockedJsonMetadata =
- '{"timed_refresh_immune_slices": [], "expanded_slices": {},
"expand_all_slices": "false", "refresh_frequency": 0, "default_filters": "{}",
"color_scheme": "supersetColors", "label_colors": {"0": "#D3B3DA", "1":
"#9EE5E5", "0. Pre-clinical": "#1FA8C9", "2. Phase II or Combined I/II":
"#454E7C", "1. Phase I": "#5AC189", "3. Phase III": "#FF7F44", "4. Authorized":
"#666666", "root": "#1FA8C9", "Protein subunit": "#454E7C", "Phase II":
"#5AC189", "Pre-clinical": "#FF7F44", "Phase III": "#666666", "Phase I":
"#E04355", "Phase I/II": "#FCC700", "Inactivated virus": "#A868B7", "Virus-like
particle": "#3CCCCB", "Replicating bacterial vector": "#A38F79", "DNA-based":
"#8FD3E4", "RNA-based vaccine": "#A1A6BD", "Authorized": "#ACE1C4",
"Non-replicating viral vector": "#FEC0A1", "Replicating viral vector":
"#B2B2B2", "Unknown": "#EFA1AA", "Live attenuated virus": "#FDE380",
"COUNT(*)": "#D1C6BC"}, "filter_scopes": {"358": {"Country_Name": {"scope":
["ROOT_ID"], "immune": []}, "Product_Cat
egory": {"scope": ["ROOT_ID"], "immune": []}, "Clinical Stage": {"scope":
["ROOT_ID"], "immune": []}}}}';
+ '{"timed_refresh_immune_slices": [], "expanded_slices": {},
"expand_all_slices": false, "refresh_frequency": 0, "default_filters": "{}",
"color_scheme": "supersetColors", "label_colors": {"0": "#D3B3DA", "1":
"#9EE5E5", "0. Pre-clinical": "#1FA8C9", "2. Phase II or Combined I/II":
"#454E7C", "1. Phase I": "#5AC189", "3. Phase III": "#FF7F44", "4. Authorized":
"#666666", "root": "#1FA8C9", "Protein subunit": "#454E7C", "Phase II":
"#5AC189", "Pre-clinical": "#FF7F44", "Phase III": "#666666", "Phase I":
"#E04355", "Phase I/II": "#FCC700", "Inactivated virus": "#A868B7", "Virus-like
particle": "#3CCCCB", "Replicating bacterial vector": "#A38F79", "DNA-based":
"#8FD3E4", "RNA-based vaccine": "#A1A6BD", "Authorized": "#ACE1C4",
"Non-replicating viral vector": "#FEC0A1", "Replicating viral vector":
"#B2B2B2", "Unknown": "#EFA1AA", "Live attenuated virus": "#FDE380",
"COUNT(*)": "#D1C6BC"}, "filter_scopes": {"358": {"Country_Name": {"scope":
["ROOT_ID"], "immune": []}, "Product_Categ
ory": {"scope": ["ROOT_ID"], "immune": []}, "Clinical Stage": {"scope":
["ROOT_ID"], "immune": []}}}}';
```
</div>
</details>
</div>
<small><i>Code Review Run #632ae5</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/dashboard/components/SaveModal.tsx:
##########
@@ -48,6 +48,7 @@ type SaveModalProps = {
dashboardTitle: string;
dashboardInfo: Record<string, any>;
expandedSlices: Record<string, any>;
+ expandAllSlices: boolean;
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Unused prop declared in interface</b></div>
<div id="fix">
The `expandAllSlices: boolean` prop added at line 51 is never used within
the component. It is not destructured in the function parameters (line 80 only
shows `expandedSlices`), nor is it referenced anywhere in the component body.
Additionally, the caller in `useHeaderActionsDropdownMenu.tsx` (lines 253-273)
does not pass this prop. This dead code creates maintenance confusion and
should be removed.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
--- superset-frontend/src/dashboard/components/SaveModal.tsx (lines
48-54)---
48: dashboardTitle: string;
49: dashboardInfo: Record<string, any>;
50: expandedSlices: Record<string, any>;
51:- expandAllSlices: boolean;
52: layout: Record<string, any>;
53: saveType: SaveType;
54: triggerNode: JSX.Element;
```
</div>
</details>
</div>
<small><i>Code Review Run #632ae5</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]