From e20e11e2d5aac204d9be8794d33325a476905248 Mon Sep 17 00:00:00 2001 From: Kamil Krzywda Date: Sun, 27 Sep 2026 07:13:56 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20npm=20test=20exit=201=20=E2=80=94=20uncau?= =?UTF-8?q?ght=20ECONNRESET=20from=20fake-bridge=20sockets=20without=20err?= =?UTF-8?q?or=20handlers=20(v0.21.8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/mesh/fake-bridge.ts | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9129167..d832a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.21.8 — 2026-09-27 07:13 + +- Fixed `npm test` exiting 1 with "Errors 2" even though all tests pass (every CI run red since v0.21.2): the two watchdog specs that force a reconnect destroy the service's socket while data is still pending in its receive buffer (the overflow spec floods 300 KB and destroys on the first ~64 KB chunk; the garbage spec destroys right after its last write), so the kernel sends RST instead of FIN and the fake bridge's accepted server-side sockets emit `read ECONNRESET`. Those test-owned sockets had no `'error'` handler, so Node threw it as an uncaught exception that vitest counts as a run-level failure. `startBridge()` now attaches a no-op `'error'` handler to every accepted socket (single registration point, covers all four spec files using the fake bridge). Test-only change — `fake-bridge.ts` is imported by specs only; no runtime diff, no deploy needed. + ## v0.21.7 — 2026-09-27 06:50 - Fixed double registration of scheduled jobs: `ScheduleModule.forRoot()` was called from both `WeatherModule` and `BatteryAlertModule`, so Nest created two ScheduleExplorers, each scanning all providers — every @Cron/@Interval job (hourly weather broadcast, per-minute battery check) fired twice. Removed the call from `battery.module.ts`; the single registration in `weather.module.ts` remains. diff --git a/package.json b/package.json index 014cdb0..ca3d6ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mesh-bot", - "version": "0.21.7", + "version": "0.21.8", "description": "", "author": "", "private": true, diff --git a/src/mesh/fake-bridge.ts b/src/mesh/fake-bridge.ts index 87bd96d..dec8899 100644 --- a/src/mesh/fake-bridge.ts +++ b/src/mesh/fake-bridge.ts @@ -10,6 +10,8 @@ export function startBridge( ): Promise<{ port: number; sockets: net.Socket[]; close: () => void }> { const sockets: net.Socket[] = []; const server = net.createServer((socket) => { + // Test-owned socket: the service destroys its end mid-test with unread data pending (overflow/garbage tests), which makes the kernel send RST and this side emit ECONNRESET. Expected teardown noise — without a handler Node throws it as an uncaught exception and vitest fails the whole run. + socket.on('error', () => {}); onSocket?.(socket); // attached at accept time, before any data can arrive sockets.push(socket); }); -- 2.54.0