bito-code-review[bot] commented on code in PR #37107:
URL: https://github.com/apache/superset/pull/37107#discussion_r2688249554


##########
superset-frontend/src/explore/reducers/exploreReducer.ts:
##########
@@ -0,0 +1,601 @@
+/**
+ * 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.
+ */
+/* eslint camelcase: 0 */
+import { ensureIsArray, QueryFormData, JsonObject } from '@superset-ui/core';
+import {
+  ControlState,
+  ControlStateMapping,
+  Dataset,
+} from '@superset-ui/chart-controls';
+import { omit, pick } from 'lodash';
+import { DYNAMIC_PLUGIN_CONTROLS_READY } from 
'src/components/Chart/chartAction';
+import { getControlsState } from 'src/explore/store';
+import {
+  getControlConfig,
+  getControlStateFromControlConfig,
+  getControlValuesCompatibleWithDatasource,
+  StandardizedFormData,
+} from 'src/explore/controlUtils';
+import * as actions from 'src/explore/actions/exploreActions';
+import { HYDRATE_EXPLORE, HydrateExplore } from '../actions/hydrateExplore';
+import { Slice } from 'src/types/Chart';
+import { SaveActionType } from 'src/explore/types';
+
+// Type definitions for explore state
+export interface ExploreState {
+  can_add?: boolean;
+  can_download?: boolean;
+  can_overwrite?: boolean;
+  isDatasourceMetaLoading?: boolean;
+  isDatasourcesLoading?: boolean;
+  isStarred?: boolean;
+  triggerRender?: boolean;
+  datasource?: Dataset;
+  controls: ControlStateMapping;
+  form_data: QueryFormData;
+  hiddenFormData?: Partial<QueryFormData>;
+  slice?: Slice | null;
+  sliceName?: string;
+  controlsTransferred?: string[];
+  standalone?: boolean;
+  force?: boolean;
+  common?: JsonObject;
+  metadata?: {
+    owners?: string[] | null;
+  };
+  saveAction?: SaveActionType | null;
+}
+
+// Action type definitions
+interface DynamicPluginControlsReadyAction {
+  type: typeof DYNAMIC_PLUGIN_CONTROLS_READY;
+  controlsState: ControlStateMapping;
+}
+
+interface ToggleFaveStarAction {
+  type: typeof actions.TOGGLE_FAVE_STAR;
+  isStarred: boolean;
+}
+
+interface PostDatasourceStartedAction {
+  type: typeof actions.POST_DATASOURCE_STARTED;
+}
+
+interface StartMetadataLoadingAction {
+  type: typeof actions.START_METADATA_LOADING;
+}
+
+interface StopMetadataLoadingAction {
+  type: typeof actions.STOP_METADATA_LOADING;
+}
+
+interface SyncDatasourceMetadataAction {
+  type: typeof actions.SYNC_DATASOURCE_METADATA;
+  datasource: Dataset;
+}
+
+interface UpdateFormDataByDatasourceAction {
+  type: typeof actions.UPDATE_FORM_DATA_BY_DATASOURCE;
+  prevDatasource: Dataset;
+  newDatasource: Dataset & { uid: string };
+}
+
+interface FetchDatasourcesStartedAction {
+  type: typeof actions.FETCH_DATASOURCES_STARTED;
+}
+
+interface SetFieldValueAction {
+  type: typeof actions.SET_FIELD_VALUE;
+  controlName: string;
+  value: unknown;
+  validationErrors?: string[];
+}
+
+interface SetExploreControlsAction {
+  type: typeof actions.SET_EXPLORE_CONTROLS;
+  formData: QueryFormData;
+}
+
+interface SetFormDataAction {
+  type: typeof actions.SET_FORM_DATA;
+  formData: QueryFormData;
+}
+
+interface UpdateChartTitleAction {
+  type: typeof actions.UPDATE_CHART_TITLE;
+  sliceName: string;
+}
+
+interface SetSaveActionAction {
+  type: typeof actions.SET_SAVE_ACTION;
+  saveAction: SaveActionType | null;
+}
+
+interface CreateNewSliceAction {
+  type: typeof actions.CREATE_NEW_SLICE;
+  slice: Slice;
+  form_data: QueryFormData;
+  can_add: boolean;
+  can_download: boolean;
+  can_overwrite: boolean;
+}
+
+interface SetStashFormDataAction {
+  type: typeof actions.SET_STASH_FORM_DATA;
+  fieldNames: readonly string[];
+  isHidden: boolean;
+}
+
+interface SliceUpdatedAction {
+  type: typeof actions.SLICE_UPDATED;
+  slice: Omit<Slice, 'owners'> & {

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Type mismatch in action interface</b></div>
   <div id="fix">
   
   The SliceUpdatedAction interface expects owners as Array<{value: number; 
label: string}>, but the action creator sliceUpdated takes Slice with owners as 
number[]. This mismatch could cause runtime failures in the reducer handler 
when mapping owner.value, as the handler assumes owners are objects with 
value/label properties.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
     slice: Slice & {
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/234c958/.cursor/rules/dev-standard.mdc#L16";>dev-standard.mdc:16</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #706562</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]

Reply via email to