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


##########
superset/dashboards/api.py:
##########
@@ -1058,11 +1058,15 @@ def put_colors(self, pk: int) -> Response:
             return self.response_400(message=error.messages)
 
         try:
+            dry_run = parse_boolean_string(request.args.get("dry_run", 
"false"))
             mark_updated = parse_boolean_string(
                 request.args.get("mark_updated", "true")
             )
-            UpdateDashboardColorsConfigCommand(pk, item, mark_updated).run()
-            response = self.response(200)
+            if dry_run:
+                response = self.response(200)
+            else:
+                UpdateDashboardColorsConfigCommand(pk, item, 
mark_updated).run()

Review Comment:
   **🟠 Architect Review — HIGH**
   
   When dry_run=true, put_colors returns 200 without invoking 
UpdateDashboardColorsConfigCommand.run(), so dashboard existence and ownership 
checks are skipped and dry-run requests can succeed for nonexistent or 
unauthorized dashboards instead of returning 404/403 as in the normal path.
   
   **Suggestion:** Keep dry_run non-persistent but still execute the 
command-level validation path (for example by calling 
UpdateDashboardColorsConfigCommand(...).validate() or an equivalent 
validate-only command) so that 404/403 are raised as usual while skipping the 
actual write.
   
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=421f8561256c4a8e92e65feb547340d0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=421f8561256c4a8e92e65feb547340d0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is an **Architect / Logical Review** comment left during a code review. 
These reviews are first-class, important findings — not optional suggestions. 
Do NOT dismiss this as a 'big architectural change' just because the title says 
architect review; most of these can be resolved with a small, localized fix 
once the intent is understood.
   
   **Path:** superset/dashboards/api.py
   **Line:** 1065:1068
   **Comment:**
        *HIGH: When dry_run=true, put_colors returns 200 without invoking 
UpdateDashboardColorsConfigCommand.run(), so dashboard existence and ownership 
checks are skipped and dry-run requests can succeed for nonexistent or 
unauthorized dashboards instead of returning 404/403 as in the normal path.
   
   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.
   If a suggested approach is provided above, use it as the authoritative 
instruction. If no explicit code suggestion is given, you MUST still draft and 
apply your own minimal, localized fix — do not punt back with 'no suggestion 
provided, review manually'. Keep the change as small as possible: add a guard 
clause, gate on a loading state, reorder an await, wrap in a conditional, etc. 
Do not refactor surrounding code or expand scope beyond the finding.
   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>



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