codeant-ai-for-open-source[bot] commented on code in PR #43390:
URL: https://github.com/apache/superset/pull/43390#discussion_r3831848418
##########
superset/commands/tag/delete.py:
##########
@@ -134,10 +134,33 @@ def run(self) -> None:
TagDAO.delete_tags(self._tags)
def validate(self) -> None:
- exceptions = []
- # Validate tag exists
- for tag in self._tags:
- if not TagDAO.find_by_name(tag):
- exceptions.append(TagNotFoundError(tag))
+ exceptions: list[TagNotFoundError | TagDeleteFailedError] = []
+ for tag_name in self._tags:
+ tag = TagDAO.find_by_name(tag_name)
+ # Validate tag exists
+ if not tag:
+ exceptions.append(TagNotFoundError(tag_name))
+ continue
Review Comment:
**Suggestion:** Tag lookup does not normalize `tag_name` before validation,
while `TagDAO.delete_tags` strips surrounding whitespace before deleting. A
valid request containing a tag name such as `" owned_tag "` therefore fails
validation as not found and cannot reach the DAO. Normalize the names before
lookup, or use the same normalized values for both validation and deletion.
[logic error]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Bulk deletion rejects names with surrounding whitespace.
- โ ๏ธ Tag-management clients receive false not-found errors.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/tag/delete.py
**Line:** 138:143
**Comment:**
*Logic Error: Tag lookup does not normalize `tag_name` before
validation, while `TagDAO.delete_tags` strips surrounding whitespace before
deleting. A valid request containing a tag name such as `" owned_tag "`
therefore fails validation as not found and cannot reach the DAO. Normalize the
names before lookup, or use the same normalized values for both validation and
deletion.
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%2F43390&comment_hash=883d3d98d19bc6235d1762ead9f512325616e83520bf90f73f1f4b0ba8655e5a&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43390&comment_hash=883d3d98d19bc6235d1762ead9f512325616e83520bf90f73f1f4b0ba8655e5a&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]