codeant-ai-for-open-source[bot] commented on code in PR #43568:
URL: https://github.com/apache/superset/pull/43568#discussion_r3871245529
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -1045,6 +1045,63 @@ def reject_sql_expression_on_dimensions(self) ->
"PieChartConfig":
return self
+class GaugeChartConfig(BaseChartConfig):
+ """Config for gauge charts (viz_type ``gauge_chart``).
+
+ Matches the frontend Gauge buildQuery contract: a single ``metric`` whose
+ value the dial displays, plus an optional multi ``groupby`` — with no
+ groupby the chart is one dial; with a groupby it renders one dial per row
+ (capped at the frontend's 10). ``min_val``/``max_val`` fix the dial scale
+ (both default to auto).
+ """
+
+ model_config = ConfigDict(extra="ignore", populate_by_name=True)
+
+ chart_type: Literal["gauge_chart"] = "gauge_chart"
+ metric: ColumnRef = Field(
+ ...,
+ description="Value metric the dial displays (use aggregate e.g. AVG, "
+ "SUM for ad-hoc, or set saved_metric=True for a saved dataset metric)",
+ )
+ groupby: List[ColumnRef] | None = Field(
+ None,
+ description="Optional category columns; each row becomes one dial. "
+ "Omit for a single-value gauge.",
+ )
+ row_limit: int = Field(10, description="Max dials", ge=1, le=10)
+ min_val: float | None = Field(
+ None, description="Minimum value of the dial scale (default: auto)"
+ )
+ max_val: float | None = Field(
+ None, description="Maximum value of the dial scale (default: auto)"
Review Comment:
**Suggestion:** Validate that the configured scale bounds are ordered before
mapping them to `form_data`. As written, a request with `min_val` greater than
`max_val` is accepted and reaches the frontend, where the negative scale range
produces invalid or misleading gauge axis calculations. Reject reversed bounds
with a model validator. [incorrect condition logic]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Gauge charts can display inverted axis ranges.
- ⚠️ Configured minimum and maximum semantics are not enforced.
- ⚠️ Gauge interval colors may use incorrect bounds.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=45f3592db71548d1881bb7f7a57f5dde&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=45f3592db71548d1881bb7f7a57f5dde&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/mcp_service/chart/schemas.py
**Line:** 1073:1076
**Comment:**
*Incorrect Condition Logic: Validate that the configured scale bounds
are ordered before mapping them to `form_data`. As written, a request with
`min_val` greater than `max_val` is accepted and reaches the frontend, where
the negative scale range produces invalid or misleading gauge axis
calculations. Reject reversed bounds with a model validator.
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%2F43568&comment_hash=1fe2b20b3a375fa940e521585a8c2dc6d0b5a429050366ad03be7c017cdc2515&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43568&comment_hash=1fe2b20b3a375fa940e521585a8c2dc6d0b5a429050366ad03be7c017cdc2515&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]