codeant-ai-for-open-source[bot] commented on code in PR #43820:
URL: https://github.com/apache/superset/pull/43820#discussion_r3922185397
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts:
##########
@@ -129,7 +131,7 @@ export const getColorFunction = (
typeof targetValue === 'number' && value > targetValue!
? {
cutoffValue: targetValue!,
- extremeValue: Math.max(...allValues),
+ extremeValue: maxBound ?? Math.max(...allValues),
Review Comment:
**Suggestion:** `maxBound` can be below the greater-than target, creating an
inverted gradient range and unexpected opacity values for matching data. [logic
error]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=52c02c9b0af84aa8a1a1c9b4388ccd9c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=52c02c9b0af84aa8a1a1c9b4388ccd9c&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-chart-controls/src/utils/getColorFormatters.ts
**Line:** 134:134
**Comment:**
*Logic Error: `maxBound` can be below the greater-than target, creating
an inverted gradient range and unexpected opacity values for matching data.
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%2F43820&comment_hash=b459d0c827f362c7809f54f75c1995be65946adf3cd135829ee7b44204d49ccb&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43820&comment_hash=b459d0c827f362c7809f54f75c1995be65946adf3cd135829ee7b44204d49ccb&reaction=dislike'>๐</a>
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts:
##########
@@ -117,8 +119,8 @@ export const getColorFunction = (
if (typeof value !== 'number') {
return { cutoffValue: value!, extremeValue: value! };
}
- const cutoffValue = Math.min(...allValues);
- const extremeValue = Math.max(...allValues);
+ const cutoffValue = minBound ?? Math.min(...allValues);
+ const extremeValue = maxBound ?? Math.max(...allValues);
return value >= cutoffValue && value <= extremeValue
? { cutoffValue, extremeValue }
: false;
Review Comment:
**Suggestion:** With manual bounds, values below `minBound` or above
`maxBound` return no color instead of receiving the nearest fixed-scale
endpoint color. [incorrect condition logic]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f5bb8674a2ae4ef5924293c40339fc62&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f5bb8674a2ae4ef5924293c40339fc62&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-chart-controls/src/utils/getColorFormatters.ts
**Line:** 122:126
**Comment:**
*Incorrect Condition Logic: With manual bounds, values below `minBound`
or above `maxBound` return no color instead of receiving the nearest
fixed-scale endpoint color.
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%2F43820&comment_hash=0e12e6140c6d0c6f436abbed5ccd7bf908696d61fea26c0e014fe244ac62b08e&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43820&comment_hash=0e12e6140c6d0c6f436abbed5ccd7bf908696d61fea26c0e014fe244ac62b08e&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]