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


##########
superset/versioning/restore.py:
##########
@@ -213,21 +213,21 @@ def _restore_dashboard_membership(dashboard: Any, 
transaction_id: int) -> list[i
     # pylint: disable=import-outside-toplevel
     # Local imports: models.slice transitively imports models.core, which needs
     # the initialised app โ€” a module-top import would recreate the bootstrap
-    # cycle documented in changes/listener.py. charts_attached_to_dashboard is
+    # cycle documented in changes/listener.py. 
chart_attachment_windows_for_dashboard is
     # imported lazily for the same reason: it pulls the window helpers, whose
     # package transitively imports the versioning.changes listener graph, so a
     # module-top import here would re-enter that same bootstrap cycle.
     from superset.models.slice import Slice
-    from superset.versioning.membership import charts_attached_to_dashboard
+    from superset.versioning.membership import 
chart_attachment_windows_for_dashboard
 
-    # charts_attached_to_dashboard owns the association-shadow read and the
+    # chart_attachment_windows_for_dashboard owns the association-shadow read 
and the
     # attach/detach window pairing (the single place that must never filter the
     # M2M shadow by end_transaction_id โ€” Continuum never closes it). A slice 
was
     # a member at transaction_id iff one of its windows contains it 
(sc-119907).
     member_ids = sorted(
         {
             slice_id
-            for slice_id, window in charts_attached_to_dashboard(dashboard.id)
+            for slice_id, window in 
chart_attachment_windows_for_dashboard(dashboard.id)

Review Comment:
   **Suggestion:** This reads attachment history while the revert is only in 
memory, so a concurrent membership edit can commit before assignment and then 
be overwritten by the restore flush. [race condition]
   
   **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=8b31c8d95a9f4894ae7dc8c4fe68fe95&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=8b31c8d95a9f4894ae7dc8c4fe68fe95&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/versioning/restore.py
   **Line:** 230:230
   **Comment:**
        *Race Condition: This reads attachment history while the revert is only 
in memory, so a concurrent membership edit can commit before assignment and 
then be overwritten by the restore flush.
   
   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%2F44185&comment_hash=aa1f4c9a97049d81a6744e6d04fd55fbdc45bf77d53ac4833c0cf95d38af53dd&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44185&comment_hash=aa1f4c9a97049d81a6744e6d04fd55fbdc45bf77d53ac4833c0cf95d38af53dd&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