codeant-ai-for-open-source[bot] commented on code in PR #43457:
URL: https://github.com/apache/superset/pull/43457#discussion_r3843332032
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/transformProps.ts:
##########
@@ -219,9 +219,19 @@ export default function transformProps(chartProps:
ChartProps<QueryFormData>) {
config.colorScheme !== ColorSchemeEnum.Green &&
config.colorScheme !== ColorSchemeEnum.Red,
);
+ // Conditional-formatting extremes (min/max) must be computed from every
+ // rollup level that actually gets rendered -- leaf rows, subtotals, and
+ // the grand total -- not just the leaf-level `mainQuery.data`. Subtotal
+ // and grand-total values are synthesized client-side into `data` above
+ // and never appear in `mainQuery.data`, so a color scale built only from
+ // `mainQuery.data` can be miscalibrated: a large grand-total value can
+ // fall outside the scale's range and silently fail to receive a color,
+ // while smaller leaf-level values within range render as expected.
+ // See #43084.
+ const allLevelRecords = data.flatMap(level => level.data);
Review Comment:
**Suggestion:** `data` also contains rollup levels that are forced solely to
calculate percentage denominators when the corresponding total or subtotal is
disabled. Those denominator records are not rendered as cells, but including
them in `getColorFormatters` changes the min/max used by `Comparator.None` and
threshold-based formatters, causing visible cells to receive colors calibrated
against hidden raw totals. Build the color-scale input from levels that are
actually rendered, or otherwise exclude calculation-only denominator levels.
[logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Percentage pivot views include hidden denominator values in color
calibration.
- ⚠️ Visible leaf cells can receive misleading conditional colors.
- ⚠️ Disabled total rows or columns still affect formatting ranges.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
<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-pivot-table/src/plugin/transformProps.ts
**Line:** 231:231
**Comment:**
*Logic Error: `data` also contains rollup levels that are forced solely
to calculate percentage denominators when the corresponding total or subtotal
is disabled. Those denominator records are not rendered as cells, but including
them in `getColorFormatters` changes the min/max used by `Comparator.None` and
threshold-based formatters, causing visible cells to receive colors calibrated
against hidden raw totals. Build the color-scale input from levels that are
actually rendered, or otherwise exclude calculation-only denominator levels.
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%2F43457&comment_hash=2da064a40683940544f53ad60e080067dcb424d7721d3cd8b8c2a68f72f89950&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43457&comment_hash=2da064a40683940544f53ad60e080067dcb424d7721d3cd8b8c2a68f72f89950&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]