fix: cache warmup using WebDriver for reliable authentication#38449
fix: cache warmup using WebDriver for reliable authentication#38449
Conversation
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>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Code Review Agent Run #f86fd5
Actionable Suggestions - 2
-
superset/utils/webdriver.py - 2
- Use of assert statement detected · Line 420-423
- Authentication bypassed in driver property · Line 424-425
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
| if not self._driver: | ||
| self._driver = self._create() | ||
| assert self._driver # for mypy | ||
| self._driver.set_window_size(*self._window) |
There was a problem hiding this comment.
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
| 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
| if self._user: | ||
| self._auth(self._user) |
There was a problem hiding this comment.
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
|
@rusackas I see we deleted 2 test files, are those tests covered in the new files that are created? |
Summary
Adopts and rebases PR #34525 by @rusackas (originally PR #20387 by @ensky) onto
current master with conflict resolution.
SUPERSET_CACHE_WARMUP_USERconfig (default: "admin")Attribution: Originally by @ensky (PR #20387), adopted by @rusackas (PR
#34525)
Test plan
🤖 Generated with Claude Code