Repository navigation
Description
Problem
Two distinct flakiness patterns make the local test gate unreliable, both traced to resource contention rather than any product bug. Neither is reproducible on demand, but both recurred repeatedly within a single session's work, and both look identical to a real failure at the moment they happen.
1. cargo test -p nodespace-core --lib fails intermittently under parallel load
Three separate one-off failures observed across a single session, each of which passed on rerun or when run in isolation, with no code change in between:
signal: 11, SIGSEGV: invalid memory reference— the whole test binary aborted mid-run, during unrelatedschema::schema_testcases- A panic at the shared
create_test_service()helper'sSqliteStore::new(db_path).await.unwrap(), surfacing as a failure inservices::node_service::tests::update_task_node_status_only_does_not_change_title— i.e. DB setup failing, not the assertion under test services::query_service::query_service_test::tests::test_multiple_sort_fieldsFAILED in a full run, then passed immediately when filtered to just that test
The common factor is many tests each building their own SqliteStore against a TempDir concurrently. The SIGSEGV in particular points at the libsql/SQLite FFI layer rather than Rust-level logic.
2. The pre-push gate fails right after a merge, then passes with no code change
On a merge commit, git push failed the gate twice in a row:
error: script "test:all" exited with code 101
✗ bun run test:all (frontend + skill + Rust) failed — push blocked.
Meanwhile, in the same working tree with the same commit:
bun run test:alldirectly → exit 0, zero failures in the logbun run scripts/test-gate.tsdirectly → exit 0
The third git push attempt then passed cleanly and pushed. The likely cause: a merge brings in new code, so the first gate run compiles the workspace and runs the full suite under peak memory pressure simultaneously; once the build cache is warm the same suite passes. Exit code 101 is a Rust process abort, consistent with pattern 1 firing under that pressure.
Why this matters
Per ADR-047 this hook is the only test gate — there is no CI runner. A gate that fails on load rather than on correctness has two bad outcomes:
- Time lost re-running a multi-minute suite to determine whether a failure was real
- Worse, it trains people to reach for
git push --no-verify, which CLAUDE.md explicitly reserves for WIP Handoff Commits. A gate that cries wolf is a gate that gets bypassed.
The failure is also indistinguishable from a genuine one at the moment it occurs: the output says the suite failed and the push is blocked, with no hint that load was the cause.
Suggested investigation
- Establish whether the SIGSEGV is reproducible under constrained memory or high
--test-threads, and whether it originates in libsql/SQLite FFI.rust:testalready caps concurrency (see the comment inscripts/test-gate.tsreferencing this) — check whethernodespace-core's lib tests are actually covered by that cap, since the observed aborts were in the lib suite. - Consider whether
create_test_service()'s per-testSqliteStore+TempDircan share a cheaper fixture, or whether in-memory SQLite is viable for tests that do not exercise on-disk behavior. - In
scripts/test-gate.ts, distinguish a process abort (signal/101) from genuine assertion failures, and either retry once or report it as "the suite aborted under load, not a test failure — rerun before assuming breakage." That alone would remove most of the wasted time and the incentive to bypass. - Consider serializing the compile step ahead of the test step on the gate's first run after a merge, so peak compile and peak test load do not overlap.
Acceptance criteria
- Root cause of the
nodespace-corelib-test SIGSEGV identified (FFI vs. concurrency vs. memory) and documented -
bun run test:allpasses reliably across repeated consecutive runs, including immediately after a merge with a cold build cache - A load-induced process abort is reported distinguishably from a real test failure, so a blocked push is not mistaken for broken code
- No new use of
--no-verifyis needed to work around gate flakiness
Context
Observed while working #2417 / PR #2424. Nothing in that change touches the failing tests — the same failures appeared in schema, query_service, and a task-node title test, and the frontend suite likewise failed 2 tests once and then passed 4863/4863 on rerun despite that PR containing no frontend changes at all.
Activity
mstomar125 commentedon Sep 8, 2026
Resolved (reporting half only) via #2475 (merged).
What shipped:
scripts/classify-test-failure.tsscans the pre-push gate's captured output for known process-abort signatures (SIGSEGV/SIGABRT/SIGBUS/SIGILL/SIGKILL,signal: N, segmentation fault, core dumped, the Windows STATUS_ACCESS_VIOLATION equivalent) and, when found,scripts/test-gate.tsnow prints a note before the usual "push blocked" message. Adversarial review verified this empirically against the live repo — grepped every trigger substring across the whole tree, traced the 2 real (non-test) hits found to their actual call sites, confirmed neither is reachable from any code path the gate exercises, so there's no realistic false-positive risk today. The outcome is unchanged either way: an abort still blocks the push, exactly like a genuine failure.What did NOT ship, staying open: the actual SIGSEGV itself is still there and still unexplained. This PR was deliberately scoped to reporting only — root-causing it needs real Rust/FFI investigation (leading suspects: libsql/SQLite FFI under concurrency, or a post-merge cold-build/test-load overlap), which is a different kind of work than a TypeScript classifier and wasn't attempted here.
malibio commentedon Sep 8, 2026
Frontend baseline: 238 files / 4925 tests passed
Add unit-of-work transaction seam; make multi-write operations atomic…
Serialize nodespace-agent/daemon/cli's libsql-ffi-linked tests (#2524)