Skip to content

test(async-queries): prove OAuth2RedirectError survives async chart queries - #41839

Merged
rusackas merged 1 commit into
masterfrom
test/issue-39096-async-oauth2-redirect
Jul 7, 2026
Merged

test(async-queries): prove OAuth2RedirectError survives async chart queries#41839
rusackas merged 1 commit into
masterfrom
test/issue-39096-async-oauth2-redirect

Conversation

@rusackas

@rusackas rusackas commented Jul 6, 2026

Copy link
Copy Markdown
Member

SUMMARY

Test-only PR that proves issue #39096 is already fixed on master, and closes it.

closes #39096

The issue reported that with GLOBAL_ASYNC_QUERIES enabled, an OAuth2RedirectError raised while loading chart data (e.g. Trino + Keycloak OAuth2) was caught by the generic Exception handler in load_chart_data_into_cache and flattened to a plain {"message": "You don't have permission to access the data."}, losing the structured payload (url, tab_id, redirect_uri) the frontend needs to render the OAuth2 banner.

That code path has since been fixed:

What was still missing is a regression test for the issue's exact scenario: OAuth2RedirectError raised by ChartDataCommand.run inside load_chart_data_into_cache. The existing chart-path tests only cover a generic SupersetErrorException, and the OAuth2-specific test from #39897 only covers the explore-json path. This PR adds that complementary unit test, which asserts the async job is updated with the structured OAUTH2_REDIRECT envelope (including the url/tab_id/redirect_uri extras) rather than the flattened permission message. The test passes on current master, confirming the reported behavior is resolved and guarding against regression.

No production code is changed.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A (test-only change)

TESTING INSTRUCTIONS

python -m pytest tests/unit_tests/tasks/test_async_queries.py -x -q

All tests in the module pass, including the new test_load_chart_data_into_cache_preserves_oauth2_redirect_error.

ADDITIONAL INFORMATION

  • Has associated issue: closes OAuth2RedirectError lost in async chart queries (GLOBAL_ASYNC_QUERIES) #39096
  • 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

🤖 Generated with Claude Code

…ueries (#39096)

Adds a unit test asserting that an OAuth2RedirectError raised by
ChartDataCommand.run inside load_chart_data_into_cache reaches the async
query job as a structured SIP-40 error (OAUTH2_REDIRECT with url/tab_id/
redirect_uri extras) instead of a flattened plain message. This is the
exact scenario reported in #39096, fixed by the SIP-40 error extraction
from #36596 (chart data path) and #39897 (legacy explore_json path).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added the global:async-query Related to Async Queries feature label Jul 6, 2026
@bito-code-review

bito-code-review Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2cd37e

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 8183dd7..8183dd7
    • tests/unit_tests/tasks/test_async_queries.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • 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

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.77%. Comparing base (9e50d9e) to head (8183dd7).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41839      +/-   ##
==========================================
- Coverage   64.78%   64.77%   -0.01%     
==========================================
  Files        2689     2689              
  Lines      148936   148936              
  Branches    34365    34365              
==========================================
- Hits        96481    96474       -7     
- Misses      50690    50694       +4     
- Partials     1765     1768       +3     
Flag Coverage Δ
hive 39.20% <ø> (ø)
mysql 57.86% <ø> (ø)
postgres 57.92% <ø> (-0.01%) ⬇️
presto 40.73% <ø> (ø)
python 59.32% <ø> (-0.01%) ⬇️
sqlite 57.50% <ø> (ø)
unit 100.00% <ø> (ø)

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.

@rusackas rusackas added the merge-if-green If approved and tests are green, please go ahead and merge it for me label Jul 7, 2026
@rusackas
rusackas merged commit 19c982d into master Jul 7, 2026
64 checks passed
@rusackas
rusackas deleted the test/issue-39096-async-oauth2-redirect branch July 7, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

global:async-query Related to Async Queries feature merge-if-green If approved and tests are green, please go ahead and merge it for me size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth2RedirectError lost in async chart queries (GLOBAL_ASYNC_QUERIES)

3 participants