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


##########
superset/mcp_service/chart/tool/update_chart.py:
##########
@@ -230,12 +230,16 @@ def _build_update_payload(
     )
 
     if parsed_config is not None:
+        existing_form_data = _get_existing_form_data(chart)

Review Comment:
   **Suggestion:** The update now reads existing form data before saving 
without version checking, so a concurrent Explore edit can be overwritten by 
this stale merged snapshot. [race condition]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely`
   
   [![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)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d48430a992894aea8d7743598fe19ff6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=d48430a992894aea8d7743598fe19ff6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/mcp_service/chart/tool/update_chart.py
   **Line:** 233:233
   **Comment:**
        *Race Condition: The update now reads existing form data before saving 
without version checking, so a concurrent Explore edit can be overwritten by 
this stale merged snapshot.
   
   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%2F43679&comment_hash=4e76843f9bfa07da1b1af9a04fe4382f0a34230b539cc97ff2f17abf8543a197&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43679&comment_hash=4e76843f9bfa07da1b1af9a04fe4382f0a34230b539cc97ff2f17abf8543a197&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/mcp_service/chart/tool/update_chart.py:
##########
@@ -230,12 +230,16 @@ def _build_update_payload(
     )
 
     if parsed_config is not None:
+        existing_form_data = _get_existing_form_data(chart)
         new_form_data = map_config_to_form_data(
             parsed_config, dataset_id=effective_dataset_id
         )
         new_form_data.pop("_mcp_warnings", None)
-        merge_table_column_config(_get_existing_form_data(chart), 
new_form_data)
-        merge_interactive_pivot_ui_config(_get_existing_form_data(chart), 
new_form_data)
+        merge_table_column_config(existing_form_data, new_form_data)
+        merge_interactive_pivot_ui_config(existing_form_data, new_form_data)
+        new_form_data = _merge_replacement_config(
+            existing_form_data, new_form_data, parsed_config
+        )

Review Comment:
   **Suggestion:** When `dataset_id` changes, the merge retains the old 
`datasource` form-data value while the payload updates `datasource_id`, leaving 
saved queries bound to the old dataset. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![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)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=49abd62d99794ffc9c0ab82a876d76d8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=49abd62d99794ffc9c0ab82a876d76d8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/mcp_service/chart/tool/update_chart.py
   **Line:** 240:242
   **Comment:**
        *Api Mismatch: When `dataset_id` changes, the merge retains the old 
`datasource` form-data value while the payload updates `datasource_id`, leaving 
saved queries bound to the old dataset.
   
   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%2F43679&comment_hash=b4af0f026552d2ebaa34709e34a28ce561b4467def3851360ce0311ca9e155c9&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43679&comment_hash=b4af0f026552d2ebaa34709e34a28ce561b4467def3851360ce0311ca9e155c9&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