From 38aadc2a25fd7abb1530afd46826aeba4fdf8af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 2 Apr 2026 23:30:35 +0200 Subject: [PATCH] fix(engine): suppress font-loading 404 noise in render console output (#195) * fix(engine): suppress font-loading 404 noise in render console output Co-Authored-By: Claude Opus 4.6 (1M context) * fix(engine): downgrade resource 404s to buffer-only instead of suppressing Address review feedback: instead of silently dropping "Failed to load resource" errors (which could hide real asset failures), keep them in browserConsoleBuffer for diagnostics but don't print to stdout. Real asset 404s are still caught by the file server's own logging. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(engine): narrow 404 filter to font CDN domains and woff2 files only Address review: filter was too broad and could suppress real asset failures. Now only suppresses 404s matching fonts.googleapis, fonts.gstatic, or .woff2 file extensions. Missing images, scripts, and videos will still surface as [Browser:ERROR] in render output. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- packages/engine/src/services/frameCapture.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/engine/src/services/frameCapture.ts b/packages/engine/src/services/frameCapture.ts index 60a14253b..6223b7a84 100644 --- a/packages/engine/src/services/frameCapture.ts +++ b/packages/engine/src/services/frameCapture.ts @@ -149,9 +149,21 @@ export async function initializeSession(session: CaptureSession): Promise page.on("console", (msg: ConsoleMessage) => { const type = msg.type(); const text = msg.text(); + + // Suppress font-loading 404s only. These are expected when deterministic + // font injection replaces Google Fonts @import URLs with embedded base64. + // Narrowed to font CDN domains and font file extensions to avoid hiding + // real asset failures (images, scripts, videos). + const isFontLoadError = + type === "error" && + text.startsWith("Failed to load resource") && + /fonts\.googleapis|fonts\.gstatic|\.woff2?(\b|$)/i.test(text); + const prefix = type === "error" ? "[Browser:ERROR]" : type === "warn" ? "[Browser:WARN]" : "[Browser]"; - console.log(`${prefix} ${text}`); + if (!isFontLoadError) { + console.log(`${prefix} ${text}`); + } session.browserConsoleBuffer.push(`${prefix} ${text}`); if (session.browserConsoleBuffer.length > BROWSER_CONSOLE_BUFFER_SIZE) {