codeant-ai-for-open-source[bot] commented on code in PR #42490:
URL: https://github.com/apache/superset/pull/42490#discussion_r3675314711
##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -755,6 +751,71 @@ def _ensure_temporal_adhoc_filter(form_data: Dict[str,
Any], column: str) -> Non
form_data["adhoc_filters"] = existing
+def _bind_dashboard_time_range_filter(
+ form_data: Dict[str, Any],
+ config: ChartConfig,
+ dataset_id: int | str | None,
+) -> None:
+ """Bind charts without time configuration to a temporal filter subject."""
+ if form_data.get("granularity_sqla") or any(
+ filter_.get("operator") == FilterOperator.TEMPORAL_RANGE.value
+ for filter_ in form_data.get("adhoc_filters", [])
+ ):
+ return
Review Comment:
**Suggestion:** An existing `TEMPORAL_RANGE` filter is treated as sufficient
solely based on its operator, so the function returns without adding the
explicitly selected `temporal_column` when an earlier chart-specific filter
targets a different column. In that case, dashboard time filters remain bound
to the old subject and the documented explicit-column selection is ignored.
Only skip binding when the existing temporal filter subject matches the
requested binding, or otherwise replace/add the requested subject while
preserving the existing chart-specific filter as appropriate. [incorrect
condition logic]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Explicit dashboard temporal-column selection is ignored.
- ❌ Scoped dashboard time filters target the wrong column.
- ⚠️ Affects generated XY chart explore and save flows.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=c309a42f2a6d4d66a2387985b80535f2&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=c309a42f2a6d4d66a2387985b80535f2&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/mcp_service/chart/chart_utils.py
**Line:** 760:764
**Comment:**
*Incorrect Condition Logic: An existing `TEMPORAL_RANGE` filter is
treated as sufficient solely based on its operator, so the function returns
without adding the explicitly selected `temporal_column` when an earlier
chart-specific filter targets a different column. In that case, dashboard time
filters remain bound to the old subject and the documented explicit-column
selection is ignored. Only skip binding when the existing temporal filter
subject matches the requested binding, or otherwise replace/add the requested
subject while preserving the existing chart-specific filter as appropriate.
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%2F42490&comment_hash=fdc4783c782d5743f9603cbdff6715e2965ca9ae5c2461df0d4de4c2e2cf56af&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42490&comment_hash=fdc4783c782d5743f9603cbdff6715e2965ca9ae5c2461df0d4de4c2e2cf56af&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]