-
Notifications
You must be signed in to change notification settings - Fork 18k
fix(reports): fail loudly instead of falling back to unguarded screenshot when tiled capture fails #42273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(reports): fail loudly instead of falling back to unguarded screenshot when tiled capture fails #42273
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,18 +563,23 @@ def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # n | |
| log_context=log_context, | ||
| ) | ||
| if not img: | ||
| # _get_screenshot() has no wait/readiness logic at | ||
| # all, so falling back to it here would risk | ||
| # silently delivering a screenshot of spinners or | ||
| # a blank dashboard. Fail the capture loudly | ||
| # (report error, thumbnail cache ERROR) instead of | ||
| # guessing at a "safer" fallback. | ||
| logger.warning( | ||
| ( | ||
| "Tiled screenshot failed, " | ||
| "falling back to standard screenshot" | ||
| ) | ||
| "Tiled screenshot failed for url %s and no " | ||
| "safe fallback exists; failing the capture", | ||
| url, | ||
| ) | ||
| img = WebDriverPlaywright._get_screenshot( | ||
| page, element, element_name | ||
| raise PlaywrightTimeout( | ||
| f"Tiled screenshot failed for url {url}" | ||
| ) | ||
|
Comment on lines
565
to
579
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The tiled helper returns Severity Level: Major
|
||
| logger.debug( | ||
| "Tiled screenshot result: %d bytes for url: %s", | ||
| len(img) if img else 0, | ||
| len(img), | ||
| url, | ||
| ) | ||
| else: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch has now flipped twice. #41080 removed the fallback for exactly the reason the new comment gives (blank capture silently reaching report recipients), and #41097 re-added it eleven days later while fixing the
b""/COMPUTING retry loop — its description presents the fallback as the intended behavior and doesn't mention #41080.The comment explains why there is no fallback, but not why the reason it came back no longer applies. Someone arriving from #41097 has nothing telling them not to restore it. Worth pinning the history and the reason the retry loop stays closed:
compute_and_cache()catches the exception and callscache_payload.error(), so the payload leavesCOMPUTINGexactly as it did when the fallback produced a falsy image.