Commit Graph

4 Commits

Author SHA1 Message Date
Elizabeth Thompson
8716f627ee fix(tests): update tiled-fallback test and guard double error() call
- Rename and update test_tiled_screenshot_failure_returns_none_without_fallback
  to reflect new behavior: falsy tiled result falls back to standard screenshot
  instead of returning None
- Guard the else: cache_payload.error() call in compute_and_cache to only fire
  when status is not already ERROR, preserving the original failure timestamp
- Remove stale PT004 ignore (rule removed in ruff 0.9.7)
- Apply ruff 0.9.7 formatting to match CI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 18:58:28 +00:00
Elizabeth Thompson
ec23f11ce6 fix(tests): resolve PT001 ruff version mismatch and improve tiled fallback test
Add PT001 to ruff ignore list so local and CI ruff versions don't conflict over
fixture parentheses style. Also fix test_tiled_fallback_triggered_on_empty_bytes
to patch page.screenshot directly instead of the static method, which was
returning a MagicMock in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 18:58:28 +00:00
Elizabeth Thompson
ce2f8b53fd fix(screenshots): catch empty-bytes tiled result and set ERROR on falsy image
Two bugs that could cause blank PDFs to re-trigger indefinitely:

1. webdriver.py: tiled fallback used `if img is None:` which let b""
   (returned by combine_screenshot_tiles on an empty tile list) pass
   through silently. Changed to `if not img:` to catch both cases.

2. screenshots.py: compute_and_cache had no else branch after
   `if image: cache_payload.update(image)`. When get_screenshot returned
   None or b"" without raising, status stayed at COMPUTING instead of
   ERROR, causing is_computing_stale() to re-trigger the task
   indefinitely after THUMBNAIL_ERROR_CACHE_TTL. Added
   `else: cache_payload.error()` so failed screenshots always transition
   to ERROR and use the controlled TTL back-off.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 18:58:04 +00:00
Elizabeth Thompson
08c1d03479 fix(screenshots): Only cache thumbnails when image generation succeeds (#36126)
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-21 17:11:20 -08:00