Repository navigation
Description
Problem
The local pre-commit hook (scripts/pre-commit, symlinked from .git/hooks/pre-commit) cannot pass on macOS because its Rust pipeline runs a full cargo test under a 180s wall-clock cap that covers BOTH compilation and the test run, but a clean full cargo test on a macOS dev machine takes ~449s (measured uncapped, exit 0, all tests passing).
The cap is at scripts/pre-commit:140:
RUST_BACKTRACE=1 "$TIMEOUT_CMD" --kill-after=30 180 cargo test > "$TEST_TMP" 2>&1 &Net effect: every local commit on this Mac fails with cargo test exceeded the 180s wall-clock cap (exit 124) (the diagnostic at scripts/pre-commit:160-165). Since CLAUDE.md forbids --no-verify, the only ways to land a commit are (a) open a PR where CI gates instead, or (b) somehow make the local suite fit 180s.
This is deterministic, every-time, on a warm cache. It is NOT the cold-cache lock-contention flake tracked in #629 (see "Distinct from" below).
Root cause / mechanism
The ~449s is cumulative across many test binaries and is dominated by simlin-serve's filesystem-watcher / websocket / e2e integration tests, which are wall-clock/timing-bound and slow on macOS fsevents:
tests/watcher_merge.rsalone: ~34.3swatcher_smoke: ~11.9s- plus
e2e_live_update,ws_updates, and similar timing-bound suites
These tests sleep/poll on real filesystem event delivery, which is materially slower under macOS FSEvents than under Linux inotify.
Why CI is NOT affected (this is a local-hook-only gap)
.github/workflows/ci.yaml is structured to avoid exactly this:
cargo test --workspace --no-runruns FIRST (compile, untimed) atci.yaml:49.- Only THEN
cargo test --workspaceruns undertimeout-minutes: 3atci.yaml:62-63, on fast Linux runners where the fsevents/timing tests are also faster.
So CI's 3-minute budget is post-compile and on hardware where these tests are cheap. The local hook has no separate pre-compile step and runs on macOS, so its 180s budget must absorb compilation AND the slow timing tests AND the macOS fsevents penalty. The hook's own comment (scripts/pre-commit:130-137) claims a healthy run is "well under a minute on dev machines and ~60s on CI" -- that is now badly stale for macOS.
Why it matters
- Developer experience / blocked workflow: a developer on macOS literally cannot produce a clean local commit through the sanctioned path; they are forced into the PR-only flow even for trivial changes, and
--no-verifyis prohibited. - The misleading diagnostic ("Individual unit tests should complete in a few seconds") points the developer at per-test budgets when the real problem is a handful of inherently timing-bound integration suites plus uncounted compile time on slower hardware.
Component(s) affected
scripts/pre-commit(Pipeline A: Rust -- the 180scargo testcap that includes compilation)src/simlin-servetests:tests/watcher_merge.rs,watcher_smoke,e2e_live_update,ws_updates(the wall-clock-dominant, macOS-fsevents-sensitive suites)
Possible approaches for resolution (for maintainers to weigh; not prescribing)
- Mirror CI in the local hook: run
cargo test --no-run(orcargo build --all-targets) before the timedcargo test, so the 180s budget measures test execution, not compilation. This is the smallest change and brings the local hook in line withci.yaml:49+ci.yaml:62. (This same warm-up step is also proposed in build: pre-commit Rust pipeline spuriously fails on a cold cache (parallel clippy --all-features + capped cargo test contend on package-cache lock) #629 option 3 for the cold-cache case, so the two issues share a candidate fix even though the failure modes differ.) - Raise the local cap to match measured reality (e.g. 600s) or make it configurable via an env var, with the comment updated to reflect macOS timings.
- Speed up or
#[ignore](run-on-CI-only) the slowsimlin-servewatcher/e2e tests for the pre-commit fast path, so the local hook exercises the fast unit suite and CI carries the timing-bound integration tests. (Note: the macOS watcher correctness gaps already documented in tech-debt.md build(deps): bump dns-packet from 1.3.1 to 1.3.4 #37 are a separate concern from these tests' wall-clock cost.) - Adopt
cargo-nextestfor faster parallel local runs.
Whatever the fix, it should preserve the original intent of the cap -- guarding against the PR #461 pathological-runtime regression class (a single test binary taking 44 minutes) -- rather than removing the guard rail.
How it was discovered
Found while attempting a local commit on the user's macOS (darwin) dev machine: the pre-commit hook's Rust pipeline tripped the 180s cap (exit 124) every time, while an uncapped cargo test completed in ~449s with all tests passing. Per-binary timing then isolated the cost to the simlin-serve fsevents/websocket/e2e suites.
Distinct from (checked for duplicates)
- build: pre-commit Rust pipeline spuriously fails on a cold cache (parallel clippy --all-features + capped cargo test contend on package-cache lock) #629 -- pre-commit Rust pipeline spuriously fails on a cold cache due to parallel
clippy --all-features+ cappedcargo testcontending on the package-cache lock. That is intermittent and clears on a warm-cache rerun (~22s). THIS issue is a deterministic, warm-cache, macOS-specific failure caused by genuine test runtime (~449s), not build-lock contention. - ci: run the ignored C-LEARN-scale engine tests in an optimized build #657 -- add a release-mode CI lane to un-ignore C-LEARN-scale
simlin-enginetests. Different tests, different location (CI), different cost mechanism (debug vs release compile of LTM, not macOS fsevents). - CI: Code Coverage job (cargo-tarpaulin) times out at 90m on main, masking coverage signal #622 -- CI
cargo-tarpaulincoverage job 90-minute timeout. A CI ptrace-instrumentation timeout, not the local hook'scargo testcap. - tech-debt.md build(deps): bump dns-packet from 1.3.1 to 1.3.4 #37 -- macOS watcher loses pre-existing-file removal/rename events (correctness). About wrong behavior in three
#[ignore]d tests, not the wall-clock cost of the watcher tests that do run. - tech-debt.md create clouds, ordinarys, stocks #13 / multi-part connectors #60 -- ignored-test inventory and the missing CI feature matrix. Adjacent CI/test-budget concerns, neither covers the local 180s cap being unachievable on macOS.
Activity
build: consolidate integration tests into one harness per crate