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


##########
superset-frontend/packages/superset-ui-core/src/number-format/NumberFormatter.ts:
##########
@@ -66,10 +66,15 @@ class NumberFormatter extends ExtensibleFunction {
     this.isInvalid = isInvalid;
   }
 
-  format(value: number | null | undefined) {
-    if (value === null || value === undefined || Number.isNaN(value)) {
+  format(value: number | bigint | null | undefined) {
+    if (
+      value === null ||
+      value === undefined ||
+      (typeof value === 'number' && Number.isNaN(value))
+    ) {
       return `${value}`;

Review Comment:
   **Suggestion:** `NumberFormatter` now forwards BigInt values to formatters 
such as `createLengthFormatter`, whose arithmetic mixes BigInt with number 
literals and throws at runtime. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=414cf68db29f4227aa636b0c10a616c8&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=414cf68db29f4227aa636b0c10a616c8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/packages/superset-ui-core/src/number-format/NumberFormatter.ts
   **Line:** 69:75
   **Comment:**
        *Api Mismatch: `NumberFormatter` now forwards BigInt values to 
formatters such as `createLengthFormatter`, whose arithmetic mixes BigInt with 
number literals and throws at runtime.
   
   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%2F44044&comment_hash=990980188a50137bd5b700348166328675f1b15df8cdfea66e9b170762da4423&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44044&comment_hash=990980188a50137bd5b700348166328675f1b15df8cdfea66e9b170762da4423&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createDurationFormatter.ts:
##########
@@ -53,7 +53,8 @@ export default function createDurationFormatter(
   return new NumberFormatter({
     description,
     formatFunc: value => {
-      const durObject = parseMilliseconds(value * multiplier);
+      const numValue = typeof value === 'bigint' ? Number(value) : value;
+      const durObject = parseMilliseconds(numValue * multiplier);

Review Comment:
   **Suggestion:** Very large BigInts convert to `Infinity`; 
`parseMilliseconds` then produces invalid duration fields, causing duration 
formatting to return invalid output or throw. [possible bug]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=ddcf8cedd12a4e0685c9de3aaee0d3a0&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=ddcf8cedd12a4e0685c9de3aaee0d3a0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/packages/superset-ui-core/src/number-format/factories/createDurationFormatter.ts
   **Line:** 56:57
   **Comment:**
        *Possible Bug: Very large BigInts convert to `Infinity`; 
`parseMilliseconds` then produces invalid duration fields, causing duration 
formatting to return invalid output or throw.
   
   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%2F44044&comment_hash=5453efd28e28849f9db2bb9e4b727b4c5d5233ce333435a39b9824ca1ebad084&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44044&comment_hash=5453efd28e28849f9db2bb9e4b727b4c5d5233ce333435a39b9824ca1ebad084&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