Skip to content

test(mcp): pin is_guest_user False in the RLS tool test fixture - #46125

Open
sadpandajoe wants to merge 2 commits into
masterfrom
ultraset-mcp-rls-tool-tests-guest-forbidden
Open

sadpandajoe wants to merge 2 commits into
masterfrom
ultraset-mcp-rls-tool-tests-guest-forbidden

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

Since #45644 (5a0e884), SecurityManager.is_guest_user() no longer gates on the current user's username, so it returns user.is_guest_user for whatever g.user is. The RLS tool tests' autouse mock_auth fixture builds that user as a bare Mock(), whose auto-created is_guest_user attribute is truthy. When EMBEDDED_SUPERSET is enabled in the test worker, the guest guard in list_rls_filters / get_rls_filter_info treats the fixture user as an embedded guest and returns Forbidden, failing 10 tests in tests/unit_tests/mcp_service/rls/tool/test_rls_tools.py on master.

The production behaviour from #45644 is correct (real User objects have no is_guest_user; GuestUser sets it to True). This change pins mock_user.is_guest_user = False in the fixture so it models the regular user it is meant to be. Guest denial stays covered by the existing tests that patch is_guest_user to True.

TESTING INSTRUCTIONS

  1. Create a config file containing FEATURE_FLAGS = {"EMBEDDED_SUPERSET": True} and point SUPERSET_CONFIG_PATH at it.
  2. Run pytest tests/unit_tests/mcp_service/rls/tool/test_rls_tools.py: on master 10 tests fail with RLS filters are not available to embedded guests.; with this change they all pass.
  3. Unset SUPERSET_CONFIG_PATH and run it again: all tests still pass.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Notes:

  • EMBEDDED_SUPERSET leaks across tests in the same xdist worker: build_app in tests/unit_tests/conftest.py loads config via from_object("superset.config"), so app.config["DEFAULT_FEATURE_FLAGS"] is the module-level dict, and feature_flag_manager.init_app (superset/utils/feature_flag_manager.py:44-45) updates it in place. A parametrized FEATURE_FLAGS = {"EMBEDDED_SUPERSET": True} therefore stays on for later apps in that worker. Follow-up, not addressed here.
  • Other MCP tests that use a bare Mock() user without is_guest_user (e.g. chart/tool/test_get_chart_info.py, test_dashboard_scope.py, test_dataset_scope.py) have the same exposure but did not fail.

🤖 Generated with Claude Code

The autouse mock_auth fixture built the request user as a bare Mock(), so
`is_guest_user` resolved to a truthy auto-attribute. Since #45644,
SecurityManager.is_guest_user() no longer short-circuits on the username
lookup, so with EMBEDDED_SUPERSET enabled the RLS tools' guest guard treated
the fixture user as an embedded guest and returned Forbidden. Pin the
attribute so the fixture models the regular user it is meant to be.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sadpandajoe sadpandajoe added the ai:fix-master generated by AI to fix master branch label Nov 9, 2026
@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 93004ffeac62

@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.21%. Comparing base (a131fcb) to head (8b99f94).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #46125       +/-   ##
===========================================
+ Coverage   65.35%   85.21%   +19.85%     
===========================================
  Files        3083     3083               
  Lines      211224   211224               
  Branches    49803    49803               
===========================================
+ Hits       138054   180002    +41948     
+ Misses      69992    27817    -42175     
- Partials     3178     3405      +227     
Flag Coverage Δ
hive 34.05% <ø> (ø)
mysql 51.81% <ø> (+<0.01%) ⬆️
postgres 51.84% <ø> (ø)
presto 35.69% <ø> (ø)
python 88.10% <ø> (+35.96%) ⬆️
sqlite 51.52% <ø> (ø)
unit 83.22% <ø> (?)

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.

@netlify

netlify Bot commented Nov 10, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 93004ff
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6af35ecc9be1f8ec3f05b73a
😎 Deploy Preview https://deploy-preview-46125--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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:fix-master generated by AI to fix master branch size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant