Block external requests during visual-compare capture (deterministic, no timeout)#1612
Merged
Merged
Conversation
Disposable WP Codebox sandboxes have no outbound network egress. A page captured by wordpress.visual-compare that references external resources (Google Fonts, CDNs, analytics) left those requests hanging until the navigation/screenshot hit the wall timeout, surfacing as `stage: capture-failed` / "source-capture exceeded 120000ms" even though the local document served fine. This blocked real visual parity on any real-world fixture that links external fonts. Install a page route during pair-capture that aborts every request whose origin differs from the live preview origin (same-origin document/CSS/JS/images and non-HTTP schemes pass through). Both source and candidate then render deterministically offline (system-font fallback) and capture fast. On by default; `block-external-requests=false` opts back into the live, egress-dependent behavior. Verified against the SSI fixture-matrix: 15-saas (links Google Fonts) went from a 120s source-capture timeout to a completed pixel-diff in seconds, and full source-vs-imported comparisons now produce real mismatch ratios. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What
Aborts cross-origin requests during
wordpress.visual-comparecapture (block-external-requests, default on) so screenshots render offline/deterministically. Egress-free sandboxes were hanging on fixtures' external Google Fonts<link>s until the 120s wall, making source-capture always time out.Change
packages/runtime-playground/src/browser-visual-compare.ts: block external requests during capture.Verification
AI assistance