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


##########
superset-frontend/src/pages/DatasetList/index.tsx:
##########
@@ -852,9 +827,11 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
         Cell: ({ row: { original } }: CellProps<Dataset>) => {
           const isSemanticView = original.kind === 'semantic_view';
 
+          const allowEdit = isUserEditorOrAdmin(user, original.editors);
+
           // Semantic view: show edit and delete buttons
           if (isSemanticView) {
-            if (!canEdit && !canDelete) return null;
+            if ((!canEdit && !canDelete) || !allowEdit) return null;

Review Comment:
   **Suggestion:** The semantic-view branch hides the entire actions cell for 
users who are not editors/admins, while this change set’s intended behavior is 
to keep edit/delete visible but disabled. Returning `null` here removes the 
controls entirely and creates inconsistent behavior versus regular datasets. 
Render the buttons with `disabled={!allowEdit}` (and explanatory tooltips) 
instead of short-circuiting the whole cell. [incorrect condition logic]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Semantic view rows lack disabled edit/delete controls for non-editors.
   - ⚠️ UX inconsistent between datasets and semantic views permission handling.
   - ⚠️ Users confused whether they have edit rights on semantic views.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Navigate to the Datasets page in Superset, which renders the 
`DatasetList` React
   component defined at `superset-frontend/src/pages/DatasetList/index.tsx`; 
the actions
   column cell renderer is shown in the file read at lines 48-85 of the snippet.
   
   2. Ensure the logged-in user has dataset-level write permissions so 
`canEdit` and/or
   `canDelete` passed into `DatasetList` are true, but the user is not in the 
dataset's
   `editors` list, making `allowEdit = isUserEditorOrAdmin(user, 
original.editors)` at line
   51 evaluate to false.
   
   3. Ensure at least one dataset row represents a semantic view 
(`original.kind ===
   'semantic_view'`), so the actions cell renderer enters the semantic-view 
branch `if
   (isSemanticView) { ... }` at lines 49-55.
   
   4. When rendering that semantic-view row, the condition `if ((!canEdit && 
!canDelete) ||
   !allowEdit) return null;` at line 55 evaluates to true (because `allowEdit` 
is false),
   causing the cell renderer to return `null` and omit the edit/delete controls 
entirely; in
   contrast, the non-semantic dataset branch at lines 88-169 always renders 
IconButtons with
   `disabled={!allowEdit}` and explanatory tooltips, so semantic views do not 
follow the
   intended disabled-but-visible behavior introduced elsewhere in this PR.
   ```
   </details>
   
   [![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=6fffc85c9a51492e9e2216c9b300e91e&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=6fffc85c9a51492e9e2216c9b300e91e&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 a comment left during a code review.
   
   **Path:** superset-frontend/src/pages/DatasetList/index.tsx
   **Line:** 834:834
   **Comment:**
        *Incorrect Condition Logic: The semantic-view branch hides the entire 
actions cell for users who are not editors/admins, while this change set’s 
intended behavior is to keep edit/delete visible but disabled. Returning `null` 
here removes the controls entirely and creates inconsistent behavior versus 
regular datasets. Render the buttons with `disabled={!allowEdit}` (and 
explanatory tooltips) instead of short-circuiting the whole cell.
   
   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%2F32995&comment_hash=2a95d9141bee3a623510cbb87463ba3b7edddd720c665be477abdb2d33720e47&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F32995&comment_hash=2a95d9141bee3a623510cbb87463ba3b7edddd720c665be477abdb2d33720e47&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