codeant-ai-for-open-source[bot] commented on code in PR #37229:
URL: https://github.com/apache/superset/pull/37229#discussion_r3454536749


##########
superset-frontend/spec/fixtures/mockTimeSeries.ts:
##########
@@ -0,0 +1,269 @@
+/**
+ * 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 { DatasourceType } from '@superset-ui/core';
+import { EchartsTimeseriesChartProps } from 
'@superset-ui/plugin-chart-echarts';
+import { EchartsMixedTimeseriesProps } from 
'plugins/plugin-chart-echarts/src/MixedTimeseries/types';
+
+export const mockedTimeSeriesProps: EchartsTimeseriesChartProps = {
+  // Datasource metadata
+  datasource: {
+    id: 1,
+    name: 'test_datasource',
+    type: DatasourceType.Table,
+    columnFormats: {},
+    currencyFormats: {},
+    verboseMap: {
+      testing_count: 'Testing count',
+      'SUM(money_for_learning)': 'SUM(money_for_learning)',
+      time_start: 'time_start',
+    },
+  },
+
+  // Query results
+  queriesData: [
+    {
+      label_map: {
+        time_start: ['time_start'],
+        'SUM(money_for_learning)': ['SUM(money_for_learning)'],
+        'SUM(money_for_learning), 1 day ago': [
+          'SUM(money_for_learning)',
+          '1 day ago',
+        ],
+        'SUM(money_for_learning), 1 week ago': [
+          'SUM(money_for_learning)',
+          '1 week ago',
+        ],
+        'SUM(money_for_learning), 1 year ago': [
+          'SUM(money_for_learning)',
+          '1 year ago',
+        ],
+        testing_count: ['testing_count'],
+        'testing_count, 1 day ago': ['testing_count', '1 day ago'],
+        'testing_count, 1 week ago': ['testing_count', '1 week ago'],
+        'testing_count, 1 year ago': ['testing_count', '1 year ago'],
+        'Testing count': ['testing_count'],
+      },
+      colnames: [
+        'time_start',
+        'SUM(money_for_learning)',
+        'SUM(money_for_learning), 1 day ago',
+        'SUM(money_for_learning), 1 week ago',
+        'SUM(money_for_learning), 1 year ago',
+        'testing_count',
+        'testing_count, 1 day ago',
+        'testing_count, 1 week ago',
+        'testing_count, 1 year ago',
+      ],
+      indexnames: [0, 1, 2],
+      coltypes: [2, 0, 0, 0, 1, 0, 0, 0, 1],
+      data: [
+        {
+          time_start: 1533081600001,
+          'SUM(money_for_learning)': 101,
+          'SUM(money_for_learning), 1 day ago': null,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 1,
+          'testing_count, 1 day ago': null,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+        {
+          time_start: 1533168000001,
+          'SUM(money_for_learning)': 5791,
+          'SUM(money_for_learning), 1 day ago': 101,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 131,
+          'testing_count, 1 day ago': 11,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+      ],
+      result_format: 'json',
+      applied_filters: [
+        {
+          column: 'time_start',
+        },
+      ],
+      rejected_filters: [],
+    },
+  ],
+
+  // Filter and legend state
+  filterState: {
+    selectedValues: [],
+  },
+  legendState: {},
+
+  // Form data (chart configuration)
+  formData: {
+    metrics: [
+      {
+        aggregate: 'SUM',
+        column: {
+          column_name: 'money_for_learning',
+          filterable: true,
+          groupby: true,
+          id: 460,
+          is_dttm: false,
+          type: 'DOUBLE PRECISION',
+          type_generic: 0,
+        },
+        expressionType: 'SIMPLE',
+        hasCustomLabel: false,
+        label: 'SUM(money_for_learning)',
+        optionName: 'metric_olnflt1ak9g_z1vjg3dhmnf',
+      },
+      'testing_count',
+    ],
+  },
+
+  // Hooks
+  hooks: {
+    setDataMask: () => {},
+    setControlValue: () => {},
+    onContextMenu: () => {},
+    onLegendStateChanged: () => {},
+    onLegendScroll: () => {},
+  },
+
+  // UI state
+  inContextMenu: false,
+  emitCrossFilters: true,
+  legendIndex: 0,
+
+  // Raw form data (needed for additional validation)
+  rawFormData: {
+    datasource: '1__table',
+    viz_type: 'echarts_timeseries',
+    x_axis: 'ds',
+    time_compare: [],
+  },
+
+  // Theme
+  theme: {},
+} as any;

Review Comment:
   **Suggestion:** Replace this `as any` cast with a concrete type-safe 
alternative (for example, keep strict `EchartsTimeseriesChartProps` typing or 
explicitly use `Partial<EchartsTimeseriesChartProps>` if the fixture is 
intentionally partial) so the new fixture does not rely on `any`. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The new TypeScript fixture ends with `as any`, which directly violates the 
rule against introducing `any` in new or modified TS/TSX code. A concrete type 
or a narrower alternative should be used instead.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=cf0db3b58b4e4b82bd4c54ec9d8066f9&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=cf0db3b58b4e4b82bd4c54ec9d8066f9&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/spec/fixtures/mockTimeSeries.ts
   **Line:** 162:162
   **Comment:**
        *Custom Rule: Replace this `as any` cast with a concrete type-safe 
alternative (for example, keep strict `EchartsTimeseriesChartProps` typing or 
explicitly use `Partial<EchartsTimeseriesChartProps>` if the fixture is 
intentionally partial) so the new fixture does not rely on `any`.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37229&comment_hash=67139823daeec5a04cd194a7ceba0214a0a9c0433aec5b9d4080df979df698de&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37229&comment_hash=67139823daeec5a04cd194a7ceba0214a0a9c0433aec5b9d4080df979df698de&reaction=dislike'>👎</a>



##########
superset-frontend/spec/fixtures/mockTimeSeries.ts:
##########
@@ -0,0 +1,269 @@
+/**
+ * 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 { DatasourceType } from '@superset-ui/core';
+import { EchartsTimeseriesChartProps } from 
'@superset-ui/plugin-chart-echarts';
+import { EchartsMixedTimeseriesProps } from 
'plugins/plugin-chart-echarts/src/MixedTimeseries/types';
+
+export const mockedTimeSeriesProps: EchartsTimeseriesChartProps = {
+  // Datasource metadata
+  datasource: {
+    id: 1,
+    name: 'test_datasource',
+    type: DatasourceType.Table,
+    columnFormats: {},
+    currencyFormats: {},
+    verboseMap: {
+      testing_count: 'Testing count',
+      'SUM(money_for_learning)': 'SUM(money_for_learning)',
+      time_start: 'time_start',
+    },
+  },
+
+  // Query results
+  queriesData: [
+    {
+      label_map: {
+        time_start: ['time_start'],
+        'SUM(money_for_learning)': ['SUM(money_for_learning)'],
+        'SUM(money_for_learning), 1 day ago': [
+          'SUM(money_for_learning)',
+          '1 day ago',
+        ],
+        'SUM(money_for_learning), 1 week ago': [
+          'SUM(money_for_learning)',
+          '1 week ago',
+        ],
+        'SUM(money_for_learning), 1 year ago': [
+          'SUM(money_for_learning)',
+          '1 year ago',
+        ],
+        testing_count: ['testing_count'],
+        'testing_count, 1 day ago': ['testing_count', '1 day ago'],
+        'testing_count, 1 week ago': ['testing_count', '1 week ago'],
+        'testing_count, 1 year ago': ['testing_count', '1 year ago'],
+        'Testing count': ['testing_count'],
+      },
+      colnames: [
+        'time_start',
+        'SUM(money_for_learning)',
+        'SUM(money_for_learning), 1 day ago',
+        'SUM(money_for_learning), 1 week ago',
+        'SUM(money_for_learning), 1 year ago',
+        'testing_count',
+        'testing_count, 1 day ago',
+        'testing_count, 1 week ago',
+        'testing_count, 1 year ago',
+      ],
+      indexnames: [0, 1, 2],
+      coltypes: [2, 0, 0, 0, 1, 0, 0, 0, 1],
+      data: [
+        {
+          time_start: 1533081600001,
+          'SUM(money_for_learning)': 101,
+          'SUM(money_for_learning), 1 day ago': null,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 1,
+          'testing_count, 1 day ago': null,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+        {
+          time_start: 1533168000001,
+          'SUM(money_for_learning)': 5791,
+          'SUM(money_for_learning), 1 day ago': 101,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 131,
+          'testing_count, 1 day ago': 11,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+      ],
+      result_format: 'json',
+      applied_filters: [
+        {
+          column: 'time_start',
+        },
+      ],
+      rejected_filters: [],
+    },
+  ],
+
+  // Filter and legend state
+  filterState: {
+    selectedValues: [],
+  },
+  legendState: {},
+
+  // Form data (chart configuration)
+  formData: {
+    metrics: [
+      {
+        aggregate: 'SUM',
+        column: {
+          column_name: 'money_for_learning',
+          filterable: true,
+          groupby: true,
+          id: 460,
+          is_dttm: false,
+          type: 'DOUBLE PRECISION',
+          type_generic: 0,
+        },
+        expressionType: 'SIMPLE',
+        hasCustomLabel: false,
+        label: 'SUM(money_for_learning)',
+        optionName: 'metric_olnflt1ak9g_z1vjg3dhmnf',
+      },
+      'testing_count',
+    ],
+  },
+
+  // Hooks
+  hooks: {
+    setDataMask: () => {},
+    setControlValue: () => {},
+    onContextMenu: () => {},
+    onLegendStateChanged: () => {},
+    onLegendScroll: () => {},
+  },
+
+  // UI state
+  inContextMenu: false,
+  emitCrossFilters: true,
+  legendIndex: 0,
+
+  // Raw form data (needed for additional validation)
+  rawFormData: {
+    datasource: '1__table',
+    viz_type: 'echarts_timeseries',
+    x_axis: 'ds',
+    time_compare: [],
+  },
+
+  // Theme
+  theme: {},
+} as any;
+
+export const mockedMixedTimeSeriesProps: EchartsMixedTimeseriesProps = {
+  // Datasource metadata
+  ...mockedTimeSeriesProps,
+
+  // Query results
+  queriesData: [
+    mockedTimeSeriesProps.queriesData?.[0] || {},
+    {
+      label_map: {
+        time_start: ['time_start'],
+        'SUM(money_for_learning)': ['SUM(money_for_learning)'],
+        'SUM(money_for_learning), 1 day ago': [
+          'SUM(money_for_learning)',
+          '1 day ago',
+        ],
+        'SUM(money_for_learning), 1 week ago': [
+          'SUM(money_for_learning)',
+          '1 week ago',
+        ],
+        'SUM(money_for_learning), 1 year ago': [
+          'SUM(money_for_learning)',
+          '1 year ago',
+        ],
+        testing_count: ['testing_count'],
+        'testing_count, 1 day ago': ['testing_count', '1 day ago'],
+        'testing_count, 1 week ago': ['testing_count', '1 week ago'],
+        'testing_count, 1 year ago': ['testing_count', '1 year ago'],
+        'Testing count': ['testing_count'],
+      },
+      colnames: [
+        'time_start',
+        'SUM(money_for_learning)',
+        'SUM(money_for_learning), 1 day ago',
+        'SUM(money_for_learning), 1 week ago',
+        'SUM(money_for_learning), 1 year ago',
+        'testing_count',
+        'testing_count, 1 day ago',
+        'testing_count, 1 week ago',
+        'testing_count, 1 year ago',
+      ],
+      indexnames: [0, 1, 2],
+      coltypes: [2, 0, 0, 0, 1, 0, 0, 0, 1],
+      data: [
+        {
+          time_start: 1533081600000,
+          'SUM(money_for_learning)': 100,
+          'SUM(money_for_learning), 1 day ago': null,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 1,
+          'testing_count, 1 day ago': null,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+        {
+          time_start: 1533168000000,
+          'SUM(money_for_learning)': 5790,
+          'SUM(money_for_learning), 1 day ago': 100,
+          'SUM(money_for_learning), 1 week ago': null,
+          'SUM(money_for_learning), 1 year ago': null,
+          testing_count: 13,
+          'testing_count, 1 day ago': 1,
+          'testing_count, 1 week ago': null,
+          'testing_count, 1 year ago': null,
+        },
+      ],
+      result_format: 'json',
+      applied_filters: [
+        {
+          column: 'time_start',
+        },
+      ],
+      rejected_filters: [],
+    },
+  ],
+
+  // Filter and legend state
+  filterState: {
+    selectedValues: [],
+  },
+  legendState: {},
+
+  // Form data (chart configuration)
+  formData: {
+    metrics: mockedTimeSeriesProps.formData?.metrics || [],
+    metricsB: [
+      {
+        aggregate: 'SUM',
+        column: {
+          column_name: 'money_for_learning',
+          filterable: true,
+          groupby: true,
+          id: 460,
+          is_dttm: false,
+          type: 'DOUBLE PRECISION',
+          type_generic: 0,
+        },
+        expressionType: 'SIMPLE',
+        hasCustomLabel: false,
+        label: 'SUM(money_for_learning)',
+        optionName: 'metric_olnflt1ak9g_z1vjg3dhmnf',
+      },
+      'testing_count',
+    ],
+  },
+} as any;

Review Comment:
   **Suggestion:** Replace this `as any` cast with a concrete mixed-timeseries 
fixture type (such as strict `EchartsMixedTimeseriesProps` or an explicit 
`Partial<EchartsMixedTimeseriesProps>` path) to avoid introducing `any` in new 
code. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The final file state contains `as any` on the exported mixed-timeseries 
fixture as well, so this is a real occurrence of the prohibited `any` usage in 
newly added TypeScript code.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bbc08b7042f44c23908de33130a6032f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bbc08b7042f44c23908de33130a6032f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/spec/fixtures/mockTimeSeries.ts
   **Line:** 269:269
   **Comment:**
        *Custom Rule: Replace this `as any` cast with a concrete 
mixed-timeseries fixture type (such as strict `EchartsMixedTimeseriesProps` or 
an explicit `Partial<EchartsMixedTimeseriesProps>` path) to avoid introducing 
`any` in new code.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37229&comment_hash=9b3d1575796e4dd706d9ac8eab5c5dc55bdd6c2f0e530c753c57de8f26abcc0f&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37229&comment_hash=9b3d1575796e4dd706d9ac8eab5c5dc55bdd6c2f0e530c753c57de8f26abcc0f&reaction=dislike'>👎</a>



-- 
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