fix(pdf): verify probe screenshot before skipping blank-SPA poll#838
Closed
cursor[bot] wants to merge 1 commit into
Closed
fix(pdf): verify probe screenshot before skipping blank-SPA poll#838cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
The #837 painted/text fast path trusted in-page DOM signals alone. A page with 200+ chars of SSR text (or a decoded hero image) under a fixed white loading overlay passed waitForReady and skipped the white-screen poll, shipping a blank PDF. Take one cheap probe capture when the gate reports painted content; only skip the poll loop when that capture is non-white. Adds a regression test for the overlay case.
Member
Kikobeats
added a commit
that referenced
this pull request
Jul 16, 2026
…hot fast path (#839) * fix(pdf): verify probe screenshot before skipping blank-SPA poll The #837 painted/text fast path trusted in-page DOM signals alone. A page with 200+ chars of SSR text (or a decoded hero image) under a fixed white loading overlay passed waitForReady and skipped the white-screen poll, shipping a blank PDF. Take one cheap probe capture when the gate reports painted content; only skip the poll loop when that capture is non-white. Adds a regression test for the overlay case. * fix(screenshot): detect covered content in readiness gate, keep zero-screenshot fast path A fixed opaque overlay (or white-on-white text) passes every DOM paint signal while a capture stays white, so PR #837's fast path could ship a blank PDF. PR #838 fixed it with a probe screenshot on every painted page, which pays a capture on the fast path and makes the branch equivalent to the poll loop's first iteration. Instead, detect the cover in the in-page snapshot itself: - `covered`: hit-test the counted content samples for an unrelated opaque viewport-filling layer, plus a root-level scan for `pointer-events: none` overlays hit-testing can't see - skip text whose color matches its effective background (invisible on capture) when counting the `text` paint signal - pdf fast path requires `!ready.covered`; the probe screenshot is removed, so a clean painted page takes zero captures again Covered or suspicious pages fall through to the existing blank-SPA screenshot poll, where a capture verifies ground truth. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
PR #837 added a fast path in
prepare()that skipped the white-screen screenshot poll whenwaitForReadyreported painted content (visible images or 200+ chars of text). In-page DOM signals do not guarantee a non-white capture: SSR text or a hero image under a fixed white loading overlay passes the gate, skips the poll, and ships a blank PDF.Root cause
The fast path equated DOM text/image presence with visual paint readiness.
checkVisibilitydoes not detect opaque fixed overlays covering the viewport.Fix
When the gate reports painted content, take one cheap probe screenshot first. Only skip the poll loop when the probe is non-white; otherwise fall through to the existing blank-SPA poll.
Validation
test/pdf.jstests passwait-for-ready.jsunit tests pass