From b6359300c6c8a0bb560464103b5c65c27eee3bba Mon Sep 17 00:00:00 2001 From: mforce <> Date: Sun, 3 May 2026 20:49:52 -0700 Subject: [PATCH 1/2] fix: flaky lmStudio nonzero-exit test (race in Promise.all) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When lms exits nonzero, Promise.all rejects as soon as the ls call fails. The ps call (which has .catch) may or may not have written to the argv log yet — it's a race. Only assert that ls was called. --- src/listers.integration.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/listers.integration.test.ts b/src/listers.integration.test.ts index d348569..cd63e64 100644 --- a/src/listers.integration.test.ts +++ b/src/listers.integration.test.ts @@ -121,9 +121,10 @@ exit 1 const result = await listLmStudio("http://localhost:1234", "tok"); assert.deepEqual(result, [{ id: "fallback-model", display: "fallback-model", extras: [] }]); - // Both calls were attempted before falling back. - const argv = readArgvLog().sort(); - assert.deepEqual(argv, ["ls --llm --json", "ps --json"]); + // ls is always attempted; ps may or may not have completed before + // Promise.all rejects (race), so only assert ls was called. + const argv = readArgvLog(); + assert.ok(argv.includes("ls --llm --json"), "ls should have been called"); }, ); From 55c7e54e7f5366ad45beab17fafd96db2fc1e0f0 Mon Sep 17 00:00:00 2001 From: mforce <> Date: Sun, 3 May 2026 20:55:06 -0700 Subject: [PATCH 2/2] ci: add pre-push hook to run tests before pushing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Committed to .hooks/pre-push and activated via git core.hooksPath in the prepare script. Anyone who clones and runs npm install gets the hook automatically — no Husky or extra dependencies needed. --- .hooks/pre-push | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100755 .hooks/pre-push diff --git a/.hooks/pre-push b/.hooks/pre-push new file mode 100755 index 0000000..0159dcc --- /dev/null +++ b/.hooks/pre-push @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +echo "Running tests before push..." +npm test diff --git a/package.json b/package.json index 78e5f8d..ba194bb 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ ], "scripts": { "build": "tsc", - "prepare": "npm run build", + "prepare": "git config core.hooksPath .hooks 2>/dev/null; npm run build", "smoke": "node dist/cli.js --help", "test": "tsc -p tsconfig.test.json && node --test dist-test/*.test.js" },