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


##########
superset/mcp_service/explore/tool/generate_explore_link.py:
##########
@@ -94,6 +94,9 @@ async def generate_explore_link(
         # Map config to form_data using shared utilities
         form_data = map_config_to_form_data(request.config)
 
+        # Add datasource to form_data for consistency with generate_chart
+        form_data["datasource"] = f"{request.dataset_id}__table"

Review Comment:
   **Suggestion:** This unconditionally overwrites any existing `datasource` 
value in `form_data`, possibly discarding a valid datasource provided by 
`map_config_to_form_data`; only set `datasource` when it's missing or empty. 
[logic error]
   
   **Severity Level:** Minor ⚠️
   ```suggestion
           if "datasource" not in form_data or not form_data.get("datasource"):
   ```
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   Good catch — blindly overwriting an existing valid datasource from 
map_config_to_form_data can discard intentional values. Only setting the key 
when missing (or falsy) preserves upstream intent and avoids surprising 
modifications.
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/mcp_service/explore/tool/generate_explore_link.py
   **Line:** 98:98
   **Comment:**
        *Logic Error: This unconditionally overwrites any existing `datasource` 
value in `form_data`, possibly discarding a valid datasource provided by 
`map_config_to_form_data`; only set `datasource` when it's missing or empty.
   
   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.
   ```
   </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