rusackas commented on code in PR #43390:
URL: https://github.com/apache/superset/pull/43390#discussion_r3845542899


##########
superset/commands/tag/delete.py:
##########
@@ -134,10 +137,42 @@ 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))
+        # Every item appended here must be a ValidationError (or subclass),
+        # since TagInvalidError.normalized_messages() calls
+        # .normalized_messages() on each one to build the aggregated 422
+        # response.
+        exceptions: list[ValidationError] = []
+        for tag_name in self._tags:
+            tag_name = tag_name.strip()
+            tag = TagDAO.find_by_name(tag_name)
+            # Validate tag exists
+            if not tag:
+                exceptions.append(
+                    TagNotFoundValidationError(f"Tag with name {tag_name} not 
found.")
+                )
+                continue
+            # System-generated tags (type:*, editor:*, favorited_by:*) are
+            # maintained by Superset itself and must not be deletable through
+            # the bulk route.
+            if tag.type is not None and tag.type != TagType.custom:
+                exceptions.append(
+                    TagDeleteForbiddenValidationError(
+                        f"Tag {tag_name} is a system tag and cannot be deleted"
+                    )
+                )
+                continue

Review Comment:
   Confirmed and followed up on: nothing in the UI ever surfaced these (every 
tags list/filter in the frontend explicitly excludes non-custom tags), so it 
was pure write-side overhead — 13 event listeners across 5 models on every 
save/favorite. Removed the generation, kept the `TagType` enum, the 
`custom_tag` filter, and MCP's support for querying by these types for backward 
compat with upgraded deployments. #43471



-- 
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