From ac23475b4a3d43a82e34d6176a85f215a6e11992 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 16:25:04 +0000 Subject: [PATCH] fix(ci): instrument webtorrent logic to debug flaky regression test - Add detailed logging inside `js/webtorrent.js` (guarded by `NODE_ENV=test`) to inspect the state of `peers`, `hasWebSeed`, and `webseedOnly` when a probe times out. - This is intended to diagnose why `webseedOnly` evaluates to false in CI despite logs indicating `hasExplicitWebSeed` is true. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- js/webtorrent.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/webtorrent.js b/js/webtorrent.js index c8a35f00..4dee682a 100644 --- a/js/webtorrent.js +++ b/js/webtorrent.js @@ -380,6 +380,9 @@ export class TorrentClient { timeoutId = setTimeout(() => { const peers = Math.max(0, Math.floor(normalizeNumber(torrent?.numPeers, 0))); const webseedOnly = peers === 0 && hasWebSeed; + if (typeof process !== "undefined" && process.env.NODE_ENV === "test" && !webseedOnly && hasWebSeed) { + console.log(`[probePeers:timeout] logic check: peers=${peers} hasWebSeed=${hasWebSeed} webseedOnly=${webseedOnly}`); + } finalize({ healthy: webseedOnly, peers,