fix(hooks): surface nextest failures and stale pnpm deps in pre-push (#7850)

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 <pfleger.will@gmail.com>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
This commit is contained in:
Will Pfleger
2026-09-24 11:30:56 -04:00
committed by GitHub
parent ea1e97e65f
commit 611faf7511

View File

@@ -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