codeant-ai-for-open-source[bot] commented on code in PR #42540:
URL: https://github.com/apache/superset/pull/42540#discussion_r3896094171
##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx:
##########
@@ -392,7 +464,42 @@ const ColumnSelectPopover = ({
selectedMetric?.metric_name !== undefined ||
adhocColumn?.sqlExpression !== initialAdhocColumn?.sqlExpression;
- const savedExpressionsLabel = t('Saved expressions');
+ // With Saved classification, a value that can no longer be committed keeps
+ // Save disabled until the user explicitly picks a compatible dimension.
+ const invalidSelectionFeedback = useMemo(() => {
+ if (!savedClassification) {
+ return null;
+ }
+ if (adhocColumn) {
+ return t(
+ 'Custom column values are not supported here. Select a saved dimension
to replace this value.',
+ );
+ }
+ if (
+ selectedCalculatedColumn &&
+ compatibleDimensions != null &&
+ !compatibleDimensions.includes(selectedCalculatedColumn.column_name)
+ ) {
Review Comment:
**Suggestion:** Save validation checks incompatible dimensions but not
selected metrics, allowing an incompatible saved metric to be committed.
[incomplete implementation]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=623c48e72be0426d9197d2717ab160d7&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=623c48e72be0426d9197d2717ab160d7&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/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
**Line:** 479:482
**Comment:**
*Incomplete Implementation: Save validation checks incompatible
dimensions but not selected metrics, allowing an incompatible saved metric to
be committed.
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%2F42540&comment_hash=bd1b8653471c958020907324b819a70555b06d890b0c867a8b24054c4012764d&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42540&comment_hash=bd1b8653471c958020907324b819a70555b06d890b0c867a8b24054c4012764d&reaction=dislike'>๐</a>
##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx:
##########
@@ -446,9 +582,41 @@ const ColumnSelectPopover = ({
column_name: calculatedColumn.column_name,
verbose_name:
calculatedColumn.verbose_name ?? '',
- }),
- )}
- optionFilterProps={['column_name', 'verbose_name']}
+ disabled:
+ savedClassification &&
+ compatibleDimensions != null &&
+ !compatibleDimensions.includes(
+ calculatedColumn.column_name,
+ ),
+ })),
+ ...(savedClassification
+ ? availableMetrics.map(metric => ({
+ value: metric.metric_name,
+ label: (
+ <MetricOptionContainer>
+ <MetricIcon>ฦ</MetricIcon>
+ <MetricLabel>
+ {metric.verbose_name ||
+ metric.metric_name}
+ </MetricLabel>
+ </MetricOptionContainer>
+ ),
+ key: `metric-${metric.metric_name}`,
+ metric_name: metric.metric_name,
+ verbose_name: metric.verbose_name ?? '',
+ disabled:
+ compatibleDimensions != null &&
+ !compatibleDimensions.includes(
+ metric.metric_name,
+ ),
Review Comment:
**Suggestion:** Metric options use compatible dimension names, so compatible
metrics are disabled and incompatible metrics can remain selectable. [incorrect
variable usage]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Often`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=978e4be2fe9e444494fd8312848d62b0&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=978e4be2fe9e444494fd8312848d62b0&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/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
**Line:** 607:611
**Comment:**
*Incorrect Variable Usage: Metric options use compatible dimension
names, so compatible metrics are disabled and incompatible metrics can remain
selectable.
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%2F42540&comment_hash=f121b18e58eec32daadd4ab89a9a8ae8f145eff7eca834d4278446440c3b51f9&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42540&comment_hash=f121b18e58eec32daadd4ab89a9a8ae8f145eff7eca834d4278446440c3b51f9&reaction=dislike'>๐</a>
##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx:
##########
@@ -446,9 +582,41 @@ const ColumnSelectPopover = ({
column_name: calculatedColumn.column_name,
verbose_name:
calculatedColumn.verbose_name ?? '',
- }),
- )}
- optionFilterProps={['column_name', 'verbose_name']}
+ disabled:
+ savedClassification &&
+ compatibleDimensions != null &&
+ !compatibleDimensions.includes(
+ calculatedColumn.column_name,
+ ),
+ })),
+ ...(savedClassification
+ ? availableMetrics.map(metric => ({
+ value: metric.metric_name,
Review Comment:
**Suggestion:** When a semantic view has metrics but no dimensions, the
Saved select is not rendered, so the newly added metric options are
unreachable. [incomplete implementation]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=02b3d7fc2d124ca2be3967a3d5af4c50&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=02b3d7fc2d124ca2be3967a3d5af4c50&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/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
**Line:** 592:594
**Comment:**
*Incomplete Implementation: When a semantic view has metrics but no
dimensions, the Saved select is not rendered, so the newly added metric options
are unreachable.
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%2F42540&comment_hash=fba8e1a9ee51d1a1fc0ab399f2304b37ceec54552b55f4a15521a683d4954e5e&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42540&comment_hash=fba8e1a9ee51d1a1fc0ab399f2304b37ceec54552b55f4a15521a683d4954e5e&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]