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


##########
superset-frontend/plugins/plugin-chart-echarts/test/Radar/transformProps.test.ts:
##########
@@ -204,6 +204,57 @@ describe('legend sorting', () => {
   });
 });
 
+describe('missing (null) values', () => {
+  // Regression for #30270: "Wrong visualization of missing values in radar
+  // charts". A null metric value must NOT be transformed into 0. In
+  // `normalizeArray`, `null / max` coerces the null to 0, so a missing data
+  // point ends up plotted at the center of the radar as if it were a real
+  // zero, instead of being left out (a gap). This test feeds a datum with a
+  // null metric and asserts the null is preserved in the normalized series
+  // value rather than silently becoming 0.
+  const missingValueData = [
+    {
+      data: [
+        {
+          name: 'Series A',
+          'SUM(jp_sales)': 10,
+          'SUM(other_sales)': null,
+          'SUM(eu_sales)': 30,
+        },
+      ],
+    },
+  ];
+
+  const missingValueProps = new ChartProps({
+    formData: {
+      ...formData,
+      // No columnConfig custom bounds so every metric is normalized.
+      columnConfig: {},
+      groupby: ['name'],
+      metrics: ['SUM(jp_sales)', 'SUM(other_sales)', 'SUM(eu_sales)'],
+    },
+    width: 800,
+    height: 600,
+    queriesData: missingValueData,
+    theme: supersetTheme,
+  });
+
+  test('preserves a null metric instead of plotting it as 0', () => {
+    const result = transformProps(missingValueProps as EchartsRadarChartProps);
+    const series = result.echartOptions.series as RadarSeriesOption[];
+    const value = (series[0].data as RadarSeriesData[])[0].value as (
+      | number
+      | null
+    )[];
+
+    // Index 1 corresponds to 'SUM(other_sales)', which was null in the datum.
+    // The correct behavior is to keep the gap (null/undefined) so ECharts does
+    // not draw a point at the center. On master this is 0, so this fails.
+    expect(value[1]).not.toBe(0);
+    expect(value[1] == null).toBe(true);
+  });
+});

Review Comment:
   **Suggestion:** Replace this single-case `describe()` wrapper with a 
standalone `test()` and keep the setup/assertions inline so the new test block 
does not introduce an unnecessary suite wrapper. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   This new test block introduces a single-case `describe()` suite containing 
only one `test()`, which matches the rule against using `describe()` when a 
standalone test would suffice.
   </details>
   <details>
   <summary><b>Rule source ๐Ÿ“– </b></summary>
   
   .github/copilot-instructions.md (line 43)
   </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=6cac036f628341328f04c1e7b86d418d&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=6cac036f628341328f04c1e7b86d418d&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/plugins/plugin-chart-echarts/test/Radar/transformProps.test.ts
   **Line:** 207:256
   **Comment:**
        *Custom Rule: Replace this single-case `describe()` wrapper with a 
standalone `test()` and keep the setup/assertions inline so the new test block 
does not introduce an unnecessary suite wrapper.
   
   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%2F41962&comment_hash=e4eae003874004a5e31f3395260913306caf6bae30fb395ac7aed6bd2b79fd4d&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41962&comment_hash=e4eae003874004a5e31f3395260913306caf6bae30fb395ac7aed6bd2b79fd4d&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