From 611faf7511c2f7ba564437daea18987db83fd82b Mon Sep 17 00:00:00 2001 From: Will Pfleger Date: Thu, 24 Sep 2026 11:30:56 -0400 Subject: [PATCH] fix(hooks): surface nextest failures and stale pnpm deps in pre-push (#7850) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-push hook failures were hard to diagnose in two ways that cost agents repeated reruns. **nextest printed no failures.** lefthook runs the `rust-tests` lane under a pty, and with an agent shell's `TERM=dumb` nextest picks its progress-bar reporter, which then swallows every FAIL line, panic, and summary — the lane only says `error: test run failed`. An orphaned nextest (left behind when a push is killed) also spins at ~100% CPU polling the dead pty for keyboard input. `rust-tests` now sets `NEXTEST_SHOW_PROGRESS=counter` and `NEXTEST_NO_INPUT_HANDLER=1` via lefthook's per-command `env:`. **Stale `node_modules` looked like a code error.** After merging main moved dependencies, `desktop-typecheck` failed with `Cannot find module` and no hint to reinstall. `desktop-check`, `desktop-typecheck`, and `desktop-test` now set `pnpm_config_verify_deps_before_run: warn` (a shared YAML anchor), so pnpm prints `Your node_modules are out of sync with your lockfile …` ahead of the script output. It is scoped to these lanes and set to `warn` because the check also gates `pnpm exec`, and `just bump-desktop-version` leaves the workspace flagged until the next install, so `error` would block desktop release pushes. pnpm uses recorded workspace state and manifest timestamps and is not a complete lockfile-content check, so this is a hint rather than a guarantee. --------- Signed-off-by: Will Pfleger Co-authored-by: Duncan --- lefthook.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lefthook.yml b/lefthook.yml index fc7e2f9ba9..2bc5d2c409 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -99,21 +99,36 @@ pre-push: rust-tests: files: git diff --name-only origin/main...HEAD glob: ["crates/**", "migrations/**", "schema/**", "Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "deny.toml", "scripts/run-tests.sh", "Justfile"] + env: + # Lanes run under a pty; with agent shells' TERM=dumb, nextest's + # progress bar swallows every FAIL line, panic, and summary. + NEXTEST_SHOW_PROGRESS: counter + # An orphaned nextest otherwise spins on the dead pty's input. + NEXTEST_NO_INPUT_HANDLER: "1" run: ./scripts/without-git-env.sh just test-unit desktop-check: files: git diff --name-only origin/main...HEAD glob: ["desktop/**", "pnpm-lock.yaml"] exclude: ["desktop/src-tauri/**"] + env: &pnpm-verify-deps + # Warn when node_modules looks stale against the workspace (pnpm uses + # recorded workspace state and manifest mtimes; not a complete + # lockfile-content check). `warn`, not `error`: `just + # bump-desktop-version` leaves the workspace flagged, and release prep + # pushes through this hook. + pnpm_config_verify_deps_before_run: warn run: ./scripts/without-git-env.sh just desktop-check desktop-typecheck: files: git diff --name-only origin/main...HEAD glob: ["desktop/**", "pnpm-lock.yaml"] exclude: ["desktop/src-tauri/**"] + env: *pnpm-verify-deps run: ./scripts/without-git-env.sh just desktop-typecheck desktop-test: files: git diff --name-only origin/main...HEAD glob: ["desktop/**", "pnpm-lock.yaml"] exclude: ["desktop/src-tauri/**"] + env: *pnpm-verify-deps run: ./scripts/without-git-env.sh just desktop-test desktop-tauri-checks: # Keep local lint parity with Desktop Core CI for every path that can