From 8cff9b7f309f239b10634c1e6fbc74505966c2bf Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 11 Oct 2026 20:51:35 +0200 Subject: [PATCH] verify-eve-browser-network: a waiter matches only lines whose newline has arrived A stdout chunk can end inside the benchmark JSON line; the waiter matched the half line and JSON.parse threw (seen once in two runs on the rust image). Waiters now read complete lines only. All commits build. Co-Authored-By: Claude Sonnet 5.5 --- scripts/verify-eve-browser-network.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/verify-eve-browser-network.mjs b/scripts/verify-eve-browser-network.mjs index dfa8d931..401e4afb 100644 --- a/scripts/verify-eve-browser-network.mjs +++ b/scripts/verify-eve-browser-network.mjs @@ -242,10 +242,15 @@ function startDotnet(arguments_) { waiter.reject(new Error(`dotnet sample exited ${code}\n${output}\n${error}`)); } }); + // A line is complete once its newline has arrived: a stdout chunk can end inside a line, and the 10,000-operation + // benchmark line was parsed as JSON half-written. + function completeLines() { + return output.split(/\r?\n/u).slice(0, -1); + } function settle() { for (let index = waiters.length - 1; index >= 0; index--) { const waiter = waiters[index]; - const line = output.split(/\r?\n/u).find(value => value.startsWith(waiter.prefix)); + const line = completeLines().find(value => value.startsWith(waiter.prefix)); if (!line) continue; waiters.splice(index, 1); clearTimeout(waiter.timer); @@ -258,7 +263,7 @@ function startDotnet(arguments_) { process.stdin.write(`${line}\n`); }, waitFor(prefix, timeoutMs = 30_000) { - const existing = output.split(/\r?\n/u).find(value => value.startsWith(prefix)); + const existing = completeLines().find(value => value.startsWith(prefix)); if (existing) return Promise.resolve(existing.slice(prefix.length)); return new Promise((resolve, reject) => { const waiter = {