From 3cfed5e3c5a165d2cc19264206c3813f0b57c759 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Mon, 15 Jun 2026 05:49:37 -0400 Subject: [PATCH] c-tier loader: TEMPORARY debug log of every Module.print arg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The deployed loader emits chunks with currentOnChunk(line + '\n'), which my node tests confirm produces clean per-line chunks ('tick 0\n', 'tick 1\n', ...). But fox still reports horizontal output in his playground tab — same tier, same loop, same loader hash on the wire (verified via curl). Browser caches and module loaders are aggressive enough that hard-refresh isn't always enough. Adding a temporary console.log inside Module.print so when fox opens DevTools and re-runs the throttled loop he can see (a) is the print callback firing at all? and (b) what does Emscripten hand us — is it actually 'tick 0' or something stranger like 'tick 0\n' or 'tick' + ' 0' as two calls? Will revert this once the bug is resolved. EOF ) --- wasm/c/lumbda-c.loader.js | 6 ++++++ wasm/dist-repl/c/lumbda-c.loader.js | 6 ++++++ www/playground/c/lumbda-c.loader.js | 6 ++++++ www/repl/c/lumbda-c.loader.js | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/wasm/c/lumbda-c.loader.js b/wasm/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/wasm/c/lumbda-c.loader.js +++ b/wasm/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, diff --git a/wasm/dist-repl/c/lumbda-c.loader.js b/wasm/dist-repl/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/wasm/dist-repl/c/lumbda-c.loader.js +++ b/wasm/dist-repl/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, diff --git a/www/playground/c/lumbda-c.loader.js b/www/playground/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/www/playground/c/lumbda-c.loader.js +++ b/www/playground/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, diff --git a/www/repl/c/lumbda-c.loader.js b/www/repl/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/www/repl/c/lumbda-c.loader.js +++ b/www/repl/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); },