Automattic / Automattic/wp-codebox

Visual compare can screenshot before local stylesheets finish loading

Open
#2,401 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
16
Forks
4
Avg merge
59m
Merged PRs (30d)
131

Description

## Problem

`wordpress.visual-compare` can produce and classify a pixel diff while local linked stylesheets are still pending. `waitForVisualComparePaintReady()` caps its load wait and stylesheet wait at 10 seconds each, even when the command has a substantially larger wall timeout. Capture diagnostics then report pending stylesheets and low-confidence readiness, but the already-written screenshots continue into comparison as if they were conclusive.

This can create a false large layout delta when a pending stylesheet owns responsive visibility or geometry.

## Expected behavior

- Use a bounded stylesheet-readiness budget derived from the visual command timeout.
- Preserve enough wall time for settling, snapshots, screenshots, and diagnostics.
- Do not classify screenshots as conclusive visual evidence when required local stylesheets remain incomplete.
- Cover delayed local stylesheet loading with deterministic tests.

## Acceptance criteria

1. A local stylesheet that completes within the derived readiness budget is applied before capture.
2. A stylesheet that remains pending after the budget produces explicit incomplete-capture evidence rather than a misleading visual-diff classification.
3. Existing external-request isolation and overall command bounds remain intact.

## AI assistance

OpenAI GPT-5.6 Sol via OpenCode diagnosed the capture evidence, traced the owning implementation, and drafted this issue under human direction.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at waitForVisualComparePaintReady() and trace the wordpress.visual-compare capture path, including diagnostics, settling, snapshots, and screenshots. Exercise delayed local stylesheet loading with deterministic tests; done means readiness uses the command timeout without breaking external-request isolation, and pending stylesheets produce explicit incomplete-capture evidence instead of a conclusive visual-diff classification.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.