codeant-ai-for-open-source[bot] commented on code in PR #43175:
URL: https://github.com/apache/superset/pull/43175#discussion_r3786467231
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -367,9 +367,20 @@ export default function transformProps(
// metric. extraMetricLabels must be mapped the same way, or a sort-only
// metric with a verbose_name set would silently fail to match here (and in
// extractSeries below, which has the same requirement).
- const extraMetricLabels = extractExtraMetrics(chartProps.rawFormData)
- .map(getMetricLabel)
- .map(label => verboseMap[label] ?? label);
+ const rawExtraMetricLabels = extractExtraMetrics(chartProps.rawFormData).map(
+ getMetricLabel,
+ );
+ const timeCompareOffsets = ensureIsArray(timeCompare).map(String);
+ const extraMetricLabels = [
+ ...rawExtraMetricLabels.map(label => verboseMap[label] ?? label),
+ // Time comparison emits a derived column per query metric and sort-only
+ // metrics are part of the query, so the sort metric's shifted column has
+ // to be excluded as well. Those columns keep the raw label with an
+ // `__<offset>` suffix rather than the verbose name.
+ ...rawExtraMetricLabels.flatMap(label =>
+ timeCompareOffsets.map(offset => `${label}__${offset}`),
+ ),
Review Comment:
**Suggestion:** The exclusion only includes the exact shifted column name,
so when forecasting is enabled the sort-only metric's derived forecast columns
(for example `sort_metric__1 year ago__yhat`, `__yhat_lower`, or
`__yhat_upper`) are not excluded. `rebaseForecastDatum` preserves those shifted
forecast names, allowing them to be included in stacked totals and rendered as
extra series. Exclude the forecast-derived variants for each shifted sort
metric as well. [incomplete implementation]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Forecasted sort-only columns appear in chart legends.
- ❌ Stacked totals include unrequested forecast series.
- ⚠️ Forecasting and time comparison produce misleading visuals.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5ed77319ea124270924ca1f04d88767c&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=5ed77319ea124270924ca1f04d88767c&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/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
**Line:** 380:382
**Comment:**
*Incomplete Implementation: The exclusion only includes the exact
shifted column name, so when forecasting is enabled the sort-only metric's
derived forecast columns (for example `sort_metric__1 year ago__yhat`,
`__yhat_lower`, or `__yhat_upper`) are not excluded. `rebaseForecastDatum`
preserves those shifted forecast names, allowing them to be included in stacked
totals and rendered as extra series. Exclude the forecast-derived variants for
each shifted sort metric as well.
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%2F43175&comment_hash=dc4cdc525359ce7a8a5a5912374d62ed53e8c852a263e7c5e7fa80989a0b3236&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43175&comment_hash=dc4cdc525359ce7a8a5a5912374d62ed53e8c852a263e7c5e7fa80989a0b3236&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]