Skip to content

fix: cache warmup using WebDriver for reliable authentication#38449

Open
rusackas wants to merge 1 commit intomasterfrom
adopt-pr-34525-fix-cache-warmup
Open

fix: cache warmup using WebDriver for reliable authentication#38449
rusackas wants to merge 1 commit intomasterfrom
adopt-pr-34525-fix-cache-warmup

Conversation

@rusackas
Copy link
Member

@rusackas rusackas commented Mar 5, 2026

Summary

Adopts and rebases PR #34525 by @rusackas (originally PR #20387 by @ensky) onto
current master with conflict resolution.

  • Replaced HTTP/API-based warmup with WebDriver-based dashboard rendering
  • Added SUPERSET_CACHE_WARMUP_USER config (default: "admin")
  • Added persistent WebDriver instance support for efficiency
  • Warm up entire dashboards instead of individual charts
  • Added Celery beat configuration documentation

Attribution: Originally by @ensky (PR #20387), adopted by @rusackas (PR
#34525)

Test plan

  • Verify strategy tests pass with new URL-based assertions
  • Verify thumbnail tests pass with updated WebDriverSelenium API
  • Test cache warmup with configured SUPERSET_CACHE_WARMUP_USER

🤖 Generated with Claude Code

  Adopted from PR #34525 by @rusackas (originally PR #20387 by @ensky).
  Rebased on master with conflict resolution.

  Changes:
  - Use WebDriver (Selenium) to render dashboards for cache warmup
  - Add SUPERSET_CACHE_WARMUP_USER config for specifying the warmup user
  - Support persistent WebDriver instances for efficiency
  - Warm up entire dashboards instead of individual charts
  - Add Celery beat configuration documentation
  - Remove obsolete HTTP-based cache warmup tests

  Co-Authored-By: Evan Rusackas <evan@rusackas.com>
  Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dosubot dosubot bot added change:backend Requires changing the backend doc Namespace | Anything related to documentation labels Mar 5, 2026
@netlify
Copy link

netlify bot commented Mar 5, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 2ac03e4
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69a9bbcd7351d10008a0e320
😎 Deploy Preview https://deploy-preview-38449--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review Agent Run #f86fd5

Actionable Suggestions - 2
  • superset/utils/webdriver.py - 2
Review Details
  • Files reviewed - 9 · Commit Range: 2ac03e4..2ac03e4
    • docs/admin_docs/configuration/cache.mdx
    • superset/config.py
    • superset/tasks/cache.py
    • superset/utils/screenshots.py
    • superset/utils/webdriver.py
    • tests/integration_tests/strategy_tests.py
    • tests/integration_tests/tasks/test_cache.py
    • tests/integration_tests/tasks/test_utils.py
    • tests/integration_tests/thumbnails_tests.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

Comment on lines +420 to +423
if not self._driver:
self._driver = self._create()
assert self._driver # for mypy
self._driver.set_window_size(*self._window)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use of assert statement detected

Replace assert statement with explicit error handling. Use if not self._driver: raise RuntimeError(...) instead of assert self._driver.

Code suggestion
Check the AI-generated fix before applying
Suggested change
if not self._driver:
self._driver = self._create()
assert self._driver # for mypy
self._driver.set_window_size(*self._window)
if not self._driver:
self._driver = self._create()
if not self._driver:
raise RuntimeError("Failed to create WebDriver instance")
self._driver.set_window_size(*self._window)

Code Review Run #f86fd5


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment on lines +424 to +425
if self._user:
self._auth(self._user)
Copy link
Contributor

Choose a reason for hiding this comment

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

Authentication bypassed in driver property

The driver property calls _auth but ignores its return value, and _auth creates a new driver unnecessarily. This results in unauthenticated drivers for screenshots when user is provided. The authentication logic is bypassed.

Code Review Run #f86fd5


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@sadpandajoe
Copy link
Member

@rusackas I see we deleted 2 test files, are those tests covered in the new files that are created?

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

Labels

change:backend Requires changing the backend doc Namespace | Anything related to documentation size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants