Skip to content

fix(OAuth2): Support OAuth2 exception with legacy endpoint#39897

Merged
Vitor-Avila merged 2 commits intomasterfrom
fix/legacy-charts-oauth2
May 6, 2026
Merged

fix(OAuth2): Support OAuth2 exception with legacy endpoint#39897
Vitor-Avila merged 2 commits intomasterfrom
fix/legacy-charts-oauth2

Conversation

@Vitor-Avila
Copy link
Copy Markdown
Contributor

@Vitor-Avila Vitor-Avila commented May 5, 2026

SUMMARY

This is a follow up to #39789, enforcing that the legacy endpoint properly handles the OAuth2 dance.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before
image

After
image

TESTING INSTRUCTIONS

  1. Create a DB connection authenticated with OAuth2.
  2. Create a dataset.
  3. Create a Nightingale chart using this dataset.
  4. Either delete the existing OAuth2 token for your test account, or access Superset using a different account that doesn't have an OAuth2 token yet.
  5. Access the chart.

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

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 5, 2026

Code Review Agent Run #0177de

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 688574a..688574a
    • superset/views/core.py
    • superset/viz.py
    • tests/integration_tests/core_tests.py
    • tests/unit_tests/test_viz_get_df_payload.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ 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

@dosubot dosubot Bot added authentication:sso Single Sign On change:backend Requires changing the backend labels May 5, 2026
@github-actions github-actions Bot added the api Related to the REST API label May 5, 2026
Comment thread superset/viz.py
@bito-code-review
Copy link
Copy Markdown
Contributor

The flagged issue is correct. Re-raising SupersetErrorException in get_df_payload breaks async legacy explore jobs, as load_explore_json_into_cache catches generic exceptions and converts them to plain strings, losing structured fields like error_type and OAuth2 extras. To resolve, update load_explore_json_into_cache to handle SupersetErrorException explicitly, similar to load_chart_data_into_cache. Checked PR comments: none found.

superset/tasks/async_queries.py

import dataclasses
from superset.exceptions import SupersetErrorException

# In load_explore_json_into_cache, modify the except Exception block:
try:
    # existing code
except Exception as ex:
    if isinstance(ex, SupersetErrorException):
        errors = [dataclasses.asdict(ex)]
    else:
        error = ex.message if hasattr(ex, "message") else str(ex)
        errors = [error]
    async_query_manager.update_job(..., errors=errors)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.87%. Comparing base (9459bc7) to head (578f7af).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
superset/tasks/async_queries.py 0.00% 2 Missing and 2 partials ⚠️
superset/views/core.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39897   +/-   ##
=======================================
  Coverage   63.87%   63.87%           
=======================================
  Files        2582     2582           
  Lines      136418   136428   +10     
  Branches    31454    31456    +2     
=======================================
+ Hits        87137    87149   +12     
+ Misses      47768    47763    -5     
- Partials     1513     1516    +3     
Flag Coverage Δ
hive 39.29% <9.09%> (-0.01%) ⬇️
mysql 59.01% <45.45%> (+<0.01%) ⬆️
postgres 59.09% <45.45%> (+<0.01%) ⬆️
presto 40.99% <9.09%> (-0.01%) ⬇️
python 60.54% <45.45%> (+<0.01%) ⬆️
sqlite 58.73% <45.45%> (+0.01%) ⬆️
unit 100.00% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Nice!

@Vitor-Avila Vitor-Avila merged commit 3745e37 into master May 6, 2026
65 checks passed
@Vitor-Avila Vitor-Avila deleted the fix/legacy-charts-oauth2 branch May 6, 2026 00:21
@bito-code-review
Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

bestlong pushed a commit to bestlong/superset that referenced this pull request May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to the REST API authentication:sso Single Sign On change:backend Requires changing the backend size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants