Skip to content

fix(explore): hide edit-properties menu item for non-owner/non-editor users (#38884) - #42737

Open
rusackas wants to merge 3 commits into
masterfrom
tdd/issue-38884-alpha-edit-properties-gate
Open

fix(explore): hide edit-properties menu item for non-owner/non-editor users (#38884)#42737
rusackas wants to merge 3 commits into
masterfrom
tdd/issue-38884-alpha-edit-properties-gate

Conversation

@rusackas

@rusackas rusackas commented Aug 3, 2026

Copy link
Copy Markdown
Member

SUMMARY

Fixes #38884: an Alpha user with can write on Chart (but no ownership or editor rights on a specific chart) could open the "Edit chart properties" modal for a chart they don't own, only to have the save silently rejected server-side (UpdateChartCommand correctly enforces ownership) -- a confusing dead-end UI flow.

Root cause. useExploreAdditionalActionsMenu pushed the "Edit chart properties" menu item whenever a slice existed, with no check against the current user's ownership/editor rights. ExploreChartHeader's own title-edit affordance already gates on the equivalent can_overwrite signal (sourced from Redux state.explore.can_overwrite, itself derived from the chart's editors at hydration time), so the signal was already available in the codebase, just not applied to this menu item.

Fix. Mirror that same gate: the menu item now only renders when state.explore.can_overwrite is true.

Follow-up fixes needed after the initial commit:

  • The new test's slice fixture was an untyped object literal, so TypeScript inferred a narrow type without editors and rejected the override literals that added it once compiled for real (production Slice already declares editors?: number[], so this was purely a test-fixture typing gap). Fixed by explicitly typing the fixture as Slice.
  • Three pre-existing ExploreChartHeader.test.tsx tests exercised "Edit chart properties" without ever needing an explicit permission grant, since nothing gated that path before this fix. They now set can_overwrite: true in the Redux initialState they already render with.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A -- no visual change for owners/editors; the item is hidden for non-owner/non-editor users instead of leading to a dead-end save failure.

TESTING INSTRUCTIONS

cd superset-frontend
npx jest src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.tsx
npx jest src/explore/components/ExploreChartHeader/ExploreChartHeader.test.tsx

hides Edit chart properties from a user who is not an owner/editor of the chart (regression #38884) now passes (was red), and a companion test shows Edit chart properties for a chart editor confirms the item still renders for a user with edit rights. All 41 pre-existing ExploreChartHeader tests pass.

ADDITIONAL INFORMATION

…ers (#38884)

useExploreAdditionalActionsMenu shows the "Edit chart properties" menu
item whenever a slice exists, with no check against the current user's
ownership/editor rights on it -- so a user who can open the modal but
whose UpdateChartCommand save will be rejected server-side still sees a
fully-clickable "Edit chart properties" entry (dosubot pinned the same
root cause: the frontend gate is missing while the backend enforces
ownership correctly, and ExploreChartHeader's own title-edit affordance
already gates on the equivalent editors/user_subjects check this menu
item lacks).

Red: the menu item renders for a slice whose editors list doesn't
include the current user.

`type-checking-frontend` skipped -- pre-existing failures in unrelated
files (superset-frontend/src/components/Datasource/FoldersEditor/*)
needing a prebuilt lib/ this fresh worktree doesn't have; not caused by
this change. oxlint/custom-rules/stylelint all pass on the changed file.
@dosubot dosubot Bot added the explore:design Related to the Explore UI/UX label Aug 3, 2026

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #dcbc6f

Actionable Suggestions - 1
  • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.tsx - 1
Review Details
  • Files reviewed - 1 · Commit Range: 2fd27c4..2fd27c4
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

… users

The "Edit chart properties" menu item rendered unconditionally whenever a
chart was loaded, with no ownership/editor check, even though
UpdateChartCommand already rejects the save server-side for a user without
write access -- letting a user open a modal for an edit they can never
persist. Gate it the same way ExploreChartHeader already gates its
editable-title affordance: visible when the user can overwrite the chart,
or is listed in the chart's editors.

type-checking-frontend skipped: this worktree lacks the prebuilt lib/
artifacts it needs to run; oxfmt/oxlint/custom-rules/stylelint all pass.

Fixes #38884
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Aug 4, 2026
@rusackas rusackas changed the title test(explore): pin edit-properties menu gating for non-owner Alpha users (#38884) fix(explore): hide edit-properties menu item for non-owner/non-editor users (#38884) Aug 4, 2026
@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit a596f62
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a7133d702018800085482d6
😎 Deploy Preview https://deploy-preview-42737--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

…ting tests (#38884)

The prior commit's test fixture for useExploreAdditionalActionsMenu.test.tsx
passed slice.editors through an untyped object literal, which TypeScript's
excess-property check rejected once compiled for real -- the production
Slice type already declares editors, so this was purely a test-fixture
typing gap; fixed by explicitly typing the fixture as Slice.

Also updates three pre-existing ExploreChartHeader tests that exercised
"Edit chart properties" without previously needing an explicit permission
grant, since nothing gated that path before this issue's fix. They now set
can_overwrite: true in the Redux initialState they already render with,
matching how the fix's new permission check actually reads that signal.

type-checking-frontend skipped: this worktree lacks the prebuilt
lib/*.d.ts output the full project type-check needs. jest, oxlint,
custom-rules, and stylelint all pass on the changed files.
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.57%. Comparing base (25ab961) to head (522749e).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42737   +/-   ##
=======================================
  Coverage   65.57%   65.57%           
=======================================
  Files        2818     2818           
  Lines      160038   160044    +6     
  Branches    36557    36561    +4     
=======================================
+ Hits       104942   104948    +6     
  Misses      53051    53051           
  Partials     2045     2045           
Flag Coverage Δ
javascript 71.75% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bito-code-review

bito-code-review Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #dd730f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 2fd27c4..522749e
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.tsx
    • superset-frontend/src/explore/components/ExploreChartHeader/ExploreChartHeader.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas
rusackas requested a review from sadpandajoe August 4, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

explore:design Related to the Explore UI/UX preset-io size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alpha user can edit properties of another user's chart but not save in 6.0.0

2 participants