Copilot commented on code in PR #39994:
URL: https://github.com/apache/superset/pull/39994#discussion_r3236438983


##########
superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts:
##########
@@ -63,7 +63,8 @@ export default async function parseResponse<T extends 
ParseMethod = 'json'>(
           (value?.isGreaterThan?.(Number.MAX_SAFE_INTEGER) ||
             value?.isLessThan?.(Number.MIN_SAFE_INTEGER))
         ) {
-          return BigInt(value);
+          // toFixed() avoids scientific notation, which BigInt() rejects.
+          return BigInt(value.toFixed());

Review Comment:
   `toFixed()` is doing important correctness work here (no exponent form) and 
relies on implicit defaults. To make the intent unambiguous and more resilient 
to library/config differences, consider calling `toFixed(0)` explicitly (since 
the branch is gated by `isInteger() === true`). This also documents that the 
output must be an integer-only string suitable for `BigInt()`.
   



##########
superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts:
##########
@@ -63,7 +63,8 @@ export default async function parseResponse<T extends 
ParseMethod = 'json'>(
           (value?.isGreaterThan?.(Number.MAX_SAFE_INTEGER) ||
             value?.isLessThan?.(Number.MIN_SAFE_INTEGER))
         ) {
-          return BigInt(value);
+          // toFixed() avoids scientific notation, which BigInt() rejects.
+          return BigInt(value.toFixed());

Review Comment:
   This change can materially increase worst-case CPU/memory usage: `toFixed()` 
will expand very large exponents into a full digit string, which could be 
extremely large (potentially freezing the UI or exhausting memory) if a 
response contains enormous integers. Consider adding a defensive cap (e.g., 
based on `value.e`/exponent or estimated digit length) and falling back to 
leaving the value as-is (BigNumber) or returning a string representation when 
it exceeds a reasonable threshold.



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