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


##########
superset/commands/theme/import_themes.py:
##########
@@ -44,6 +44,11 @@ def import_theme(config: dict[str, Any], overwrite: bool = 
False) -> "Theme | No
     if existing:
         if not overwrite or not can_write:
             return existing
+        if existing.is_system or existing.is_system_default or 
existing.is_system_dark:
+            raise ThemeImportError(
+                "Cannot overwrite a system theme or the active "
+                "system-default/dark theme via import"
+            )

Review Comment:
   **Suggestion:** The active system-default and system-dark themes are 
rejected unconditionally, so administrators cannot overwrite these themes 
through import even though `UpdateThemeCommand` explicitly allows 
administrators to edit them. Restrict the rejection to non-admin users while 
continuing to protect `is_system` themes. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Administrator theme imports fail for active default themes.
   - ❌ Administrator theme imports fail for active dark themes.
   - ⚠️ Update and import commands have inconsistent admin behavior.
   ```
   </details>
   
   [![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)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/commands/theme/import_themes.py
   **Line:** 47:51
   **Comment:**
        *Api Mismatch: The active system-default and system-dark themes are 
rejected unconditionally, so administrators cannot overwrite these themes 
through import even though `UpdateThemeCommand` explicitly allows 
administrators to edit them. Restrict the rejection to non-admin users while 
continuing to protect `is_system` themes.
   
   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%2F43389&comment_hash=a023deb4f46a1d2e23b81885181f2461a2bbe32aa177624f56236f6048dfc682&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43389&comment_hash=a023deb4f46a1d2e23b81885181f2461a2bbe32aa177624f56236f6048dfc682&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