eschutho opened a new pull request, #41097: URL: https://github.com/apache/superset/pull/41097
### SUMMARY Two bugs that could cause blank PDFs to re-trigger screenshot tasks indefinitely: **Bug 1 — `webdriver.py` tiled fallback (`if img is None:` → `if not img:`):** `combine_screenshot_tiles([])` returns `b""` (falsy, not `None`) when the tile list is empty. The old check `if img is None:` let empty bytes pass through silently without triggering the standard screenshot fallback. Changed to `if not img:` to catch both `None` and `b""`. **Bug 2 — `screenshots.py` `compute_and_cache` (add `else: cache_payload.error()`):** When `get_screenshot` returned `None` or `b""` without raising an exception, the task finished with status still at `COMPUTING` (set at the start of the task). After `THUMBNAIL_ERROR_CACHE_TTL` elapsed, `is_computing_stale()` returned `True` and re-triggered the task indefinitely. The fix adds `else: cache_payload.error()` so any falsy image result always transitions to `ERROR` and uses the controlled TTL back-off instead of the stale-COMPUTING loop. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — backend-only bug fixes. ### TESTING INSTRUCTIONS - `pytest tests/unit_tests/utils/webdriver_test.py::TestWebDriverPlaywrightAnimationWaitOrder::test_tiled_fallback_triggered_on_empty_bytes` - `pytest tests/unit_tests/utils/test_screenshot_cache_fix.py::TestCacheOnlyOnSuccess::test_cache_error_status_when_screenshot_returns_empty_bytes` - Run full suite: `pytest tests/unit_tests/utils/webdriver_test.py tests/unit_tests/utils/test_screenshot_cache_fix.py tests/unit_tests/utils/test_screenshot_utils.py` ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API Part of the blank-PDF investigation series (follows the animation-wait ordering fix and debug logging additions on this branch). 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
