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


##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Polygon/transformProps.ts:
##########
@@ -112,7 +111,10 @@ function processPolygonData(
     return [];
   }
 
-  const metricLabel = getMetricLabelFromFormData(metric);
+  // Metric from GUI Config (Explore) can be an object (saved/adhoc), so 
normalize it to
+  // the query-result label; this key is used to read the metric and expose it
+  // in extraProps for tooltip resolution.
+  const metricLabel = metric ? getMetricLabel(metric as any) : undefined;

Review Comment:
   **Suggestion:** Replace the `any` cast on `metric` with a concrete metric 
type (or a narrow union/type guard) before calling `getMetricLabel`, so the new 
tooltip metric path remains fully type-safe. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The custom rule explicitly forbids new or modified TypeScript code that uses 
`any`. This line introduces `metric as any` in the updated file, so the 
violation is real and directly matches the rule.
   </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=215b5ceb624545a4bc87233b4b33f1b2&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=215b5ceb624545a4bc87233b4b33f1b2&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/preset-chart-deckgl/src/layers/Polygon/transformProps.ts
   **Line:** 117:117
   **Comment:**
        *Custom Rule: Replace the `any` cast on `metric` with a concrete metric 
type (or a narrow union/type guard) before calling `getMetricLabel`, so the new 
tooltip metric path remains fully type-safe.
   
   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%2F41341&comment_hash=a1972e2327b10457753e7564045af963e1071ef56e03888b32c97adb1045e546&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41341&comment_hash=a1972e2327b10457753e7564045af963e1071ef56e03888b32c97adb1045e546&reaction=dislike'>👎</a>



##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -170,6 +176,36 @@ function buildFieldBasedTooltipItems(
     }
   });
 
+  // In the geojson polygcon chart, where users can only pick columns as 
tooltip_contents,
+  // we still include the configured metric, so hover also shows the 
aggregation value.
+  const hasSelectedMetricItem = formData.tooltip_contents.some(
+    (item: any) =>
+      item && typeof item === 'object' && item.item_type === 'metric',

Review Comment:
   **Suggestion:** Replace the `any` callback parameter with a concrete tooltip 
item type (or a narrow union such as string/object tooltip item variants) so 
type checks are preserved when detecting metric items. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The modified TypeScript/TSX file introduces a new callback parameter typed 
as `any` in `formData.tooltip_contents.some((item: any) => ...)`.
   This directly violates the rule requiring a concrete type, reusable existing 
type, or narrower generic instead of `any`.
   </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=9492de6bbdd24c70b21df50c5605ba36&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=9492de6bbdd24c70b21df50c5605ba36&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/preset-chart-deckgl/src/utilities/tooltipUtils.tsx
   **Line:** 181:183
   **Comment:**
        *Custom Rule: Replace the `any` callback parameter with a concrete 
tooltip item type (or a narrow union such as string/object tooltip item 
variants) so type checks are preserved when detecting metric items.
   
   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%2F41341&comment_hash=8c49024d386f61bbeabec30c9352b2cd5e7f905aa4312bb8dd41eb2290685d23&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41341&comment_hash=8c49024d386f61bbeabec30c9352b2cd5e7f905aa4312bb8dd41eb2290685d23&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