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


##########
superset-frontend/src/pages/ArchivedList/index.tsx:
##########
@@ -286,6 +301,123 @@ function ArchivedListBody({
     [performRowAction, addSuccessToast],
   );
 
+  const loadDatasetPurgeImpact = useCallback(async (item: ArchivedItem) => {
+    const generation = impactRequestGeneration.current + 1;
+    impactRequestGeneration.current = generation;
+    setDatasetPurgeModal({ status: 'loading', item });
+
+    try {
+      const { json } = await SupersetClient.get({
+        endpoint: `/api/v1/dataset/${item.uuid}/purge-impact`,
+      });
+      if (impactRequestGeneration.current !== generation) {
+        return;
+      }
+      setDatasetPurgeModal({
+        status: 'ready',
+        item,
+        impact: json as PurgeImpactResponse,
+      });
+    } catch (error) {
+      if (impactRequestGeneration.current !== generation) {
+        return;
+      }
+      const { error: message } = await getClientErrorObject(error);
+      if (impactRequestGeneration.current === generation) {
+        setDatasetPurgeModal({
+          status: 'error',
+          item,
+          message,
+        });
+      }
+    }
+  }, []);
+
+  const closeDatasetPurgeModal = useCallback(() => {
+    impactRequestGeneration.current += 1;
+    setDatasetPurgeModal({ status: 'closed' });
+  }, []);

Review Comment:
   **Suggestion:** Closing the modal invalidates the generation, but the POST 
continues; a successful purge then skips both its success notification and list 
refresh. [state/lifecycle]
   
   **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=ecc727ea20cf4b748d04177e8cd159db&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=ecc727ea20cf4b748d04177e8cd159db&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-frontend/src/pages/ArchivedList/index.tsx
   **Line:** 336:339
   **Comment:**
        *State Lifecycle: Closing the modal invalidates the generation, but the 
POST continues; a successful purge then skips both its success notification and 
list refresh.
   
   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%2F43724&comment_hash=1450f278b41613c265fd4f74e7ab70a0db564020ad189072772685a0e9b38d36&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43724&comment_hash=1450f278b41613c265fd4f74e7ab70a0db564020ad189072772685a0e9b38d36&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/commands/deletion_retention/purge_cascade.py:
##########
@@ -241,15 +248,22 @@ def cascade_hard_delete(
             if session.execute(claim.with_for_update()).scalar_one_or_none() 
is None:
                 raise PurgeRaceLostError
 
+            if entity_type == "dataset" and confirmed_impact_token is not None:
+                confirmed_impact = collect_dataset_purge_impact(session, 
entity_id)
+                if confirmed_impact.impact_token != confirmed_impact_token:
+                    raise PurgeImpactChangedError(confirmed_impact)

Review Comment:
   **Suggestion:** New charts can be inserted after this collection while the 
dataset lock is held, so they are omitted from the token but still become 
dangling after deletion. [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=ae093efe987a444c900bfd1cf3caf994&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=ae093efe987a444c900bfd1cf3caf994&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/commands/deletion_retention/purge_cascade.py
   **Line:** 251:254
   **Comment:**
        *Race Condition: New charts can be inserted after this collection while 
the dataset lock is held, so they are omitted from the token but still become 
dangling after deletion.
   
   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%2F43724&comment_hash=bc0ecdf8156d802056ac9b51f43437799ac36fac8019a3ea2b3c6dd48e24b973&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43724&comment_hash=bc0ecdf8156d802056ac9b51f43437799ac36fac8019a3ea2b3c6dd48e24b973&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