Skip to content

Block external requests during visual-compare capture (deterministic, no timeout)#1612

Merged
chubes4 merged 1 commit into
mainfrom
cook/visual-compare-abort-external
Jun 28, 2026
Merged

Block external requests during visual-compare capture (deterministic, no timeout)#1612
chubes4 merged 1 commit into
mainfrom
cook/visual-compare-abort-external

Conversation

@chubes4

@chubes4 chubes4 commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

What

Aborts cross-origin requests during wordpress.visual-compare capture (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

  • 15-saas went from a 120s source-capture timeout to a completed pixelmatch diff in seconds (live run). Both sides render deterministically offline.

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (Claude Opus 4.8, 1M context)
  • Used for: Diagnosis, fix, and live verification under human review.

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>
@chubes4 chubes4 merged commit af6b2b7 into main Jun 28, 2026
@chubes4 chubes4 deleted the cook/visual-compare-abort-external branch June 28, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant