From fb354fd0ff054c8cda92764cba01d4826ea67091 Mon Sep 17 00:00:00 2001 From: Priya Raman Date: Thu, 27 Aug 2026 21:15:28 +0000 Subject: [PATCH] fix(server): remove a NUL byte from the fatal-error test file and an unref hazard on the exit path The test file had one literal NUL byte in a string literal, so Git read the whole file as binary and hid it from every diff. The fallback string was unreachable, so the fix asserts on `error.stack` directly. `flushWithTimeout` also called `timer.unref?.()`. An unreferenced timer does not keep the event loop open, so a crash with no other open handle could let Node exit with code 0 before `process.exit(1)` runs. The 2-second bound already gives the same protection, so the line is removed, and the timer now clears inside `finish` instead. Co-authored-by: Paperclip --- .../src/__tests__/fatal-error-handler.test.ts | Bin 7504 -> 7535 bytes server/src/fatal-error-handler.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/__tests__/fatal-error-handler.test.ts b/server/src/__tests__/fatal-error-handler.test.ts index 71a2ca153ac5b386613f1d02b0f153177aa34c00..47eb4e6aa530fc43c02cd88f3253660f35cdaec3 100644 GIT binary patch delta 60 zcmca$_1 { if (settled) return; settled = true; + clearTimeout(timer); resolve(); }; const timer = setTimeout(finish, timeoutMs); - timer.unref?.(); client.flush().then(finish, finish); }); }