You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "jaymasiwal (via GitHub)" <gi...@apache.org> on 2026/02/09 15:50:41 UTC

[PR] Fail fast on async query websocket misconfiguration [superset]

jaymasiwal opened a new pull request, #37809:
URL: https://github.com/apache/superset/pull/37809

   This PR prevents silent async query failures by validating async query
   websocket configuration during application initialization.
   
   When async queries are enabled with websocket transport but request handlers
   are disabled, Superset now raises a clear exception instead of silently
   skipping async JWT cookie creation.
   
   Changes include:
   - Fail-fast validation for websocket async query misconfiguration
   - Validation of async JWT cookie configuration
   - Unit tests covering both misconfigured and correctly configured scenarios
   
   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Fail fast on async query websocket misconfiguration [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #37809: fix: Fail fast on async query websocket misconfiguration
URL: https://github.com/apache/superset/pull/37809


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] Fail fast on async query websocket misconfiguration [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37809:
URL: https://github.com/apache/superset/pull/37809#issuecomment-3872553170

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] Fail fast on async query websocket misconfiguration [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #37809:
URL: https://github.com/apache/superset/pull/37809#issuecomment-3896219154

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/37809?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `16 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 43.47%. Comparing base ([`3b75af9`](https://app.codecov.io/gh/apache/superset/commit/3b75af9ac3b86547a27b6b512323300e75bc387c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9bcc584`](https://app.codecov.io/gh/apache/superset/commit/9bcc584a482b0da399b8e9bd1ce73f1c1b911514?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 67 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/37809?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/async\_events/async\_query\_manager.py](https://app.codecov.io/gh/apache/superset/pull/37809?src=pr&el=tree&filepath=superset%2Fasync_events%2Fasync_query_manager.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvYXN5bmNfZXZlbnRzL2FzeW5jX3F1ZXJ5X21hbmFnZXIucHk=) | 0.00% | [16 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37809?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #37809       +/-   ##
   ===========================================
   + Coverage        0   43.47%   +43.47%     
   ===========================================
     Files           0      647      +647     
     Lines           0    49587    +49587     
     Branches        0     5581     +5581     
   ===========================================
   + Hits            0    21560    +21560     
   - Misses          0    27727    +27727     
   - Partials        0      300      +300     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/37809/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/37809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.71% <0.00%> (?)` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/37809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.73% <0.00%> (?)` | |
   | [python](https://app.codecov.io/gh/apache/superset/pull/37809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `43.47% <0.00%> (?)` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/37809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/37809?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Fail fast on async query websocket misconfiguration [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37809:
URL: https://github.com/apache/superset/pull/37809#issuecomment-3940221734

   Superset uses Git pre-commit hooks courtesy of [pre-commit](https://pre-commit.com/). To install run the following:
   ```
   pip3 install -r requirements/development.txt
   pre-commit install
   ```
   A series of checks will now run when you make a git commit.
   
   Alternatively it is possible to run pre-commit by running pre-commit manually:
   ```
   pre-commit run --all-files
   ``` 
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Fail fast on async query websocket misconfiguration [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37809:
URL: https://github.com/apache/superset/pull/37809#issuecomment-4702710420

   <!-- Bito Reply -->
   The suggestion is appropriate and improves the test's robustness. Asserting the exception message ensures that the test specifically validates the configuration error path, preventing future regressions where the exception might be raised for a different reason while still matching the same exception type.
   
   **tests/unit_tests/async_events/async_query_manager_tests.py**
   ```
   with raises(AsyncQueryTokenException) as excinfo:
           manager.init_app(app)
       assert "GLOBAL_ASYNC_QUERIES_REGISTER_REQUEST_HANDLERS" in str(excinfo.value)
   ```


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Fail fast on async query websocket misconfiguration [superset]

Posted by "royy92 (via GitHub)" <gi...@apache.org>.
royy92 commented on code in PR #37809:
URL: https://github.com/apache/superset/pull/37809#discussion_r3410051951


##########
tests/unit_tests/async_events/async_query_manager_tests.py:
##########
@@ -166,3 +173,66 @@ def test_submit_explore_json_job_as_guest_user(
     )
 
     assert "guest_token" not in job_meta
+
+@mock.patch("superset.async_events.async_query_manager.get_cache_backend")
+def test_ws_transport_without_request_handlers_raises(mock_cache):
+    mock_cache.return_value = Mock()    
+    app = make_app(
+        {
+            "GLOBAL_ASYNC_QUERIES": True,
+            "GLOBAL_ASYNC_QUERIES_TRANSPORT": "ws",
+            "GLOBAL_ASYNC_QUERIES_REGISTER_REQUEST_HANDLERS": False,
+            "GLOBAL_ASYNC_QUERIES_JWT_SECRET": "x" * 32,
+            "GLOBAL_ASYNC_QUERIES_JWT_COOKIE_NAME": "async-token",
+            "GLOBAL_ASYNC_QUERIES_JWT_COOKIE_SECURE": True,
+            "GLOBAL_ASYNC_QUERIES_JWT_COOKIE_SAMESITE": "None",
+            "GLOBAL_ASYNC_QUERIES_JWT_COOKIE_DOMAIN": None,
+            "CACHE_CONFIG": {"CACHE_TYPE": "RedisCache"},
+            "DATA_CACHE_CONFIG": {"CACHE_TYPE": "RedisCache"},
+            "GLOBAL_ASYNC_QUERIES_REDIS_STREAM_PREFIX": "test-",
+            "GLOBAL_ASYNC_QUERIES_REDIS_STREAM_LIMIT": 100,
+            "GLOBAL_ASYNC_QUERIES_REDIS_STREAM_LIMIT_FIREHOSE": 100,
+        }
+    )
+
+    manager = AsyncQueryManager()
+
+    with raises(AsyncQueryTokenException):
+        manager.init_app(app)

Review Comment:
   suggestion: Since this test is specifically covering a configuration error path, would it be worth asserting that the exception message mentions `GLOBAL_ASYNC_QUERIES_REGISTER_REQUEST_HANDLERS`?
   
   That would help ensure future changes do not accidentally replace the actionable configuration guidance with a less specific error while still raising the same exception type.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Fail fast on async query websocket misconfiguration [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37809:
URL: https://github.com/apache/superset/pull/37809#issuecomment-6222077265

   @jaymasiwal thanks for this. The async query manager it patches was removed when #43407 moved Global Async Queries onto the task framework, so there's nothing left to apply this to. Closing, but appreciate the contribution. Fee free to comment or reopen if you think I'm mistaken, I won't mind at all :) 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org