mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 21:15:18 +09:00
## Summary Recover screenshot and rendered-audit capture when a discovered Chromium executable fails before its DevTools endpoint becomes ready. The CLI now tries the next compatible installed browser for standalone screenshots, reusable captures, and multi-viewport capture batches. When no candidate starts, the error identifies every attempted executable and its startup failure. ## Root cause Browser discovery stopped after selecting the first executable that existed on disk. If that executable aborted, failed to spawn, or never exposed its DevTools endpoint, capture failed even when another supported browser was installed. Startup failures also crossed the Vision/CLI package boundary through an untyped string code, and concurrent captures could duplicate failure diagnostics. ## Technical choices - Define the typed `BrowserStartupError` contract in Vision. - Keep executable discovery and fallback ownership in CLI, where all browser candidates are known. - Share one fallback loop across standalone capture, reusable capture, and viewport batches. - Treat an explicit `browserPath` as strict and never launch a different executable. - Reuse the first successful browser session and deduplicate concurrent startup failures by executable path. - Preserve original startup causes while adding aggregate executable diagnostics. ## Checklist - [x] Classify browser exits, synchronous spawn failures, and DevTools startup timeouts. - [x] Fall back across compatible installed browsers. - [x] Cover standalone, reusable, and multi-viewport capture paths. - [x] Preserve strict explicit-browser behavior. - [x] Aggregate all failed executable paths and causes. - [x] Deduplicate concurrent failure diagnostics. - [x] Demonstrate each regression failing before and passing after the fix. - [x] Review fixture impact: no fixture inputs or generated fixture outputs are affected. - [x] Review documentation impact: no user-facing documentation changes are required. ## Verification - `pnpm --filter webstudio test` — 62 files, 978 tests passed - `pnpm --filter @webstudio-is/vision test` — 13 files, 79 tests passed - `pnpm --filter webstudio typecheck` - `pnpm --filter @webstudio-is/vision typecheck` - `git diff --check` - Independent subagent reproduction and post-fix harness verification passed for standalone capture, reusable capture, viewport batches, explicit paths, aggregate failures, session reuse, and concurrent failures. The full agent evaluation command was not run because it requires separate approval. ## Known limitation The exact nested SVG fragment from #6132 completes on current main and the reported CLI release, so this PR does not claim to fix or close that issue. Closes #6133 Closes #6134 Ref #6132
Vision
@webstudio-is/vision provides source-agnostic browser capture, screenshot
comparison, OCR analysis, caching primitives, and portable visual reports.
Import the smallest relevant entry point:
import { createBrowserScreenshotSession } from "@webstudio-is/vision/browser";
import { captureVisualEntries } from "@webstudio-is/vision/capture";
import { diffPngFiles } from "@webstudio-is/vision/diff";
import {
classifyScreenshotComparisonReport,
writeScreenshotComparisonReport,
} from "@webstudio-is/vision/report";
import { selectRepresentativeViewports } from "@webstudio-is/vision/viewports";
Consumers own their source-specific orchestration. The visual regression runner, for example, handles Git revisions and Storybook CSF rendering while this package handles capture batches, image comparison, and reports.