aminghadersohi commented on code in PR #42655:
URL: https://github.com/apache/superset/pull/42655#discussion_r3717945815
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -2379,6 +2387,19 @@ class UpdateChartRequest(ChartRequestNormalizerMixin,
QueryCacheControl):
),
)
+ @model_validator(mode="after")
+ def validate_column_patch(self) -> "UpdateChartRequest":
+ """Keep full-config replacement and additive table updates
unambiguous."""
+ if self.config is not None and self.add_columns is not None:
+ raise ValueError(
+ "Use either 'config' for a full visualization replacement or "
+ "'add_columns' to append table columns while preserving the
existing "
+ "configuration, not both."
+ )
Review Comment:
Valid — both branches were untested. Added in `79f2704`:
```python
class TestUpdateChartRequestColumnPatchValidation:
def test_config_and_add_columns_together_rejected(self) # "not both"
def test_empty_add_columns_rejected(self) # "at least one
column"
def test_add_columns_alone_accepted(self) # the valid
shape
```
Writing these paid for itself: the dimension-only case they exercise led me
to a real bug where appending a plain column to an aggregate table silently
dropped it. Fixed in the same commit — see the PR comment.
--
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]