From b127b582bcb3243f42f147a3d37d45a5b93698ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20T=C3=B6rcsv=C3=A1ri?= Date: Fri, 31 Jul 2026 12:35:42 +0200 Subject: [PATCH] fix(boot): echo wasm dispatch/timer diagnostics to the browser console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Module.print feeds only the in-page log panel; it echoes to the JS console solely under ?trace=. That is right for ordinary wasm chatter and wrong for the two diagnostics wxwidgets now emits: production crash reports reach us as SAVED BROWSER CONSOLE DUMPS, so a diagnostic that never leaves the page is invisible in the one artifact we actually receive — and the in-page buffer is capped at 800 lines, so a long load can evict it before anyone reads it. Narrow by construction: only the "[wx-dispatch]" and "[wx-timer]" prefixes, both rate-limited in C++ and silent on a healthy load, so this cannot become noise. Verified by driving Module.print directly in a real browser: the two prefixes reach console.log / console.warn and an ordinary line does not. Also bumps wxwidgets for those diagnostics. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0137pGo8W7asomGUTRMB7RzM --- web/standalone/src/wasm/boot.ts | 22 ++++++++++++++++++++-- wxwidgets | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/web/standalone/src/wasm/boot.ts b/web/standalone/src/wasm/boot.ts index 233aa32..9e41dd9 100644 --- a/web/standalone/src/wasm/boot.ts +++ b/web/standalone/src/wasm/boot.ts @@ -166,6 +166,24 @@ function loadScript(src: string): Promise { * the page is COEP `require-corp`). The `.wasm`/`images.tar.gz` fetches just * need `ACAO` + `CORP` on the CDN. See docs/features/demo-deploy/0001-*. */ +/** + * C++ diagnostics that must reach the BROWSER console, not just the in-page log. + * + * Module.print normally feeds only the in-page buffer (capped at 800 lines, and + * echoed to the console only under ?trace=). That is right for ordinary wasm + * chatter, but wrong for these: production crash reports reach us as saved + * browser-console dumps, so a diagnostic that never leaves the page is invisible + * in the one artifact we actually receive — and it can be evicted from the + * capped buffer by a long load before anyone reads it. + * + * Deliberately narrow. Both emitters are rate-limited in C++ and silent on a + * healthy load (see wxwidgets src/wasm/{evtloop,timer}.cpp), so this cannot + * become noise. + */ +function isWasmDiagnostic(line: string): boolean { + return line.startsWith("[wx-dispatch]") || line.startsWith("[wx-timer]"); +} + function pthreadWorkerScript( base: string, bundle: Bundle, @@ -526,12 +544,12 @@ async function doBoot(opts: BootOptions): Promise { log(`[out] ${m}`); // With ?trace=, also echo to the JS console (the in-page log buffer is // capped at 800 lines and would truncate a full-set trace run). - if (traceMask) console.log(m); + if (traceMask || isWasmDiagnostic(m)) console.log(m); }, printErr: (...args: unknown[]) => { const m = args.join(" "); log(`[err] ${m}`); - if (traceMask) console.warn(m); + if (traceMask || isWasmDiagnostic(m)) console.warn(m); }, setStatus: (text: string) => { if (text) onStatus(text); diff --git a/wxwidgets b/wxwidgets index fd30c08..f62cd11 160000 --- a/wxwidgets +++ b/wxwidgets @@ -1 +1 @@ -Subproject commit fd30c08b184376fd1c2f39458c362001202432af +Subproject commit f62cd1165592af3b4944f02d465c6e7c7e7f27a5