codeant-ai-for-open-source[bot] commented on code in PR #44169:
URL: https://github.com/apache/superset/pull/44169#discussion_r3988927154


##########
superset/commands/chart/create.py:
##########
@@ -81,7 +81,10 @@ def validate(self) -> None:
             # (SavedQuery/Query have no ``.name`` attribute, so accessing it
             # below raises an unhandled AttributeError) or silently, by
             # producing a permanently broken chart.
-            if datasource_type != DatasourceType.TABLE:
+            if datasource_type not in {
+                DatasourceType.TABLE,
+                DatasourceType.SEMANTIC_VIEW,
+            }:
                 raise DatasourceTypeInvalidError()
             datasource = get_datasource_by_id(datasource_id, datasource_type)

Review Comment:
   **Suggestion:** `Slice.datasource` returns only `self.table`; allowing 
`semantic_view` stores charts whose datasource is `None`, breaking consumers 
that use the chart relationship. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=3a1aeaf927334e6ba9a2dbb3bd1ed5d5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=3a1aeaf927334e6ba9a2dbb3bd1ed5d5&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/commands/chart/create.py
   **Line:** 84:89
   **Comment:**
        *Api Mismatch: `Slice.datasource` returns only `self.table`; allowing 
`semantic_view` stores charts whose datasource is `None`, breaking consumers 
that use the chart relationship.
   
   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%2F44169&comment_hash=a2ada88978000ca13c530724ea5bc9b2c17f620939bd74fe2a81aa6bfdd617de&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44169&comment_hash=a2ada88978000ca13c530724ea5bc9b2c17f620939bd74fe2a81aa6bfdd617de&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/commands/chart/update.py:
##########
@@ -236,7 +236,10 @@ def validate(self) -> None:  # noqa: C901
                 # below (SavedQuery/Query have no ``.name`` attribute, so
                 # accessing it raises an unhandled AttributeError) or
                 # silently.
-                if datasource_type != DatasourceType.TABLE:
+                if datasource_type not in {
+                    DatasourceType.TABLE,
+                    DatasourceType.SEMANTIC_VIEW,
+                }:
                     raise DatasourceTypeInvalidError()
                 if datasource_id is not None:
                     datasource = get_datasource_by_id(datasource_id, 
datasource_type)

Review Comment:
   **Suggestion:** Updates can repoint a chart to `semantic_view`, but `Slice` 
has no semantic-view relationship, so the saved chart becomes unresolved 
through `Slice.datasource`. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=46547f9ad41c48d1bbef3100a8c8e4cc&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=46547f9ad41c48d1bbef3100a8c8e4cc&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/commands/chart/update.py
   **Line:** 239:245
   **Comment:**
        *Api Mismatch: Updates can repoint a chart to `semantic_view`, but 
`Slice` has no semantic-view relationship, so the saved chart becomes 
unresolved through `Slice.datasource`.
   
   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%2F44169&comment_hash=02e31780531340f33bede03947905ce73955b608f8fcc625c8839711e71ceda9&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44169&comment_hash=02e31780531340f33bede03947905ce73955b608f8fcc625c8839711e71ceda9&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]

Reply via email to