Skip to content

Gate rust:test on --tests so integration tests run by default - #1863

Merged
malibio merged 1 commit into
mainfrom
issue-1796-integration-test-triage
Jul 31, 2026
Merged

malibio merged 1 commit into
mainfrom
issue-1796-integration-test-triage

Conversation

@malibio

@malibio malibio commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • rust:test ran cargo test --lib --bins, which never executes tests/*.rs — the same allowlist-shaped gap Rust test gate covers 2 of 9 crates: nodespace-daemon's 92 tests never run automatically #1792 was filed to close, one level down. 20 integration test files across core (11), daemon (5), agent (2), nlp-engine (1), and cli (1) were silently ungated.
  • Ran every file directly to determine which are hermetic/fast vs. dependent on external state (per the issue's suggested triage). 18 of 20 turned out gate-safe as-is — all under ~1s per crate, no real model or network required, including embedding_service_test.rs (uses stub embeddings despite its doc comment) and all of packages/daemon/tests/*.rs (in-process gRPC + PtySession::launch_for_test bypass, no real agent binary needed).
  • rust:test now runs --lib --bins --tests instead of --lib --bins, so tests/*.rs is covered by default going forward — a new integration test file no longer needs a script change to be gated.
  • The 2 files that aren't gate-safe (packages/agent/tests/search_skills_latency.rs, packages/nlp-engine/tests/integration_tests.rs) relied on a runtime model/backend probe that returns early when nothing is available — but ran for real, slowly, on any machine that happens to have a backend configured. Measured locally: nlp-engine's suite took 72.68s and agent's didn't finish in 2 minutes, both because this machine has a model/backend available. Both now carry #[ignore] with a documented opt-in, matching the pattern already used by this repo's other live/latency suites (live_openai_compat_*.rs, routing_latency.rs).

Test plan

  • bun run test:all — no new failures (Rust: all previously-ungated files now run and pass; frontend/skill/scripts unchanged)
  • bun run quality:fix — clean, no lint issues (reverted 3 unrelated cargo fmt reflows in files this PR doesn't otherwise touch)
  • Full pre-push gate passed: test:all + cargo build --bin nodespaced + test:e2e + cargo test -p nodespace-app (ADR-048 Tauri-seam suite)
  • Verified search_skills_latency.rs and integration_tests.rs now show ignored with the documented reason instead of running for real

Closes #1796

🤖 Generated with Claude Code

rust:test ran --lib --bins, which never executed tests/*.rs — the exact
allowlist-shaped gap #1792 was filed to close, one level down. 18 of the
20 previously-ungated integration files (core: 11, daemon: 5, cli: 1,
agent: 1) turned out to be hermetic and fast once actually run, so they
now gate by default via --tests.

The 2 that aren't gate-safe relied on a runtime model/backend probe that
silently ran for real (and slowly — 72s and 2+ minutes measured locally)
on any machine with a GGUF or inference server already available, instead
of failing closed. Both now carry #[ignore] with a documented opt-in,
matching the pattern already used by this repo's other live/latency
suites (live_openai_compat_*.rs, routing_latency.rs).

Closes #1796
@malibio

malibio commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Pragmatic code review

Verified the PR's core claims by re-deriving them independently rather than trusting the description:

Inventory checks out. find packages -path '*/tests/*.rs' finds 11 core / 5 daemon / 5 agent / 1 nlp-engine / 1 cli = 23 files outside the nodespace-app/nodespace-app-test-support exclusion (those 12 desktop-app/src-tauri/tests/*.rs files stay excluded, correctly — they're covered by the separate ADR-048 pre-push step). Of the agent 5, 3 (live_openai_compat_routing.rs, live_openai_compat_smoke.rs, live_routing_probe.rs) already carried #[ignore] before this PR, so they weren't part of the "20 ungated files" the issue counted — 23 − 3 = 20, matches the issue exactly.

The two #[ignore] targets are correctly identified and correctly scoped.

  • packages/nlp-engine/tests/integration_tests.rs: model_exists() calls EmbeddingConfig::resolve_model_path(), which is a real Path::exists() filesystem check (packages/nlp-engine/src/config.rs:121-125) — a genuine environment probe, not a mock. All 10 #[serial] tests in the file get #[ignore]; #[serial] + #[ignore] compose fine (ignore short-circuits before the lock).
  • packages/agent/tests/search_skills_latency.rs: resolve_backend() calls discover_models() against a real http://127.0.0.1:11434/v1 endpoint and falls back to a real GGUF path check — also a genuine probe. Only the 2 tests that call resolve_backend() got #[ignore]. The third test in the file, search_skills_response_includes_schema_metadata, was correctly left un-ignored: it drives BenchToolExecutor, a fully in-process impl AgentToolExecutor mock (line 123) that never touches resolve_backend() or the hardcoded URL — it's genuinely hermetic.

--tests scope is exactly what's intended. It only adds tests/*.rs integration binaries; cargo test doesn't pull in [[bench]] targets (packages/core/benches/*) or examples without --benches/--examples, so no scope creep there. nodespace-daemon is not in the exclude list (only nodespace-app/-test-support are), so all 5 daemon gRPC suites are correctly newly in-scope.

Spot-checked the 16 "hermetic, no changes needed" files for hidden risk (network calls, real daemon spawns, fixed ports, order-dependent shared state, sleep-based races):

  • All daemon/cli suites (grpc_round_trip.rs, agent_session_grpc.rs, database_service_e2e.rs, import_round_trip.rs, per_db_compute.rs, cli_integration.rs) use TcpListener::bind("127.0.0.1:0") (OS-assigned port — no collision risk) and tempfile::TempDir (isolated per test), with a retry-with-backoff connect loop (25ms × up to 50 tries) that's robust to CI startup jitter. Good pattern, low flakiness risk.
  • packages/core/tests/embedding_service_test.rs: doc comment claims "requires... a valid embedding model" but create_test_nlp_engine() builds EmbeddingService::new(config).unwrap() off NlpConfig::default() with no real model wired — genuinely stub/hermetic, confirming the PR's claim. Doc comment is stale but that's not new here.

Two minor, pre-existing observations, neither a blocker:

  1. packages/core/tests/schema_hydration_test.rs builds its tempdir manually (std::env::temp_dir().join(uuid)) instead of tempfile::TempDir, and only cleans it up via std::fs::remove_dir_all at the very end of the function. Any panic!/assert!/? failure earlier in the test leaks that directory (UUID-named, so no collision, just litter on repeated failures). Not introduced by this PR, but now that the file runs on every push it'll leak more often on real failures. Worth a follow-up to swap in TempDir at some point, not blocking.
  2. packages/core/tests/skill_updater_test.rs has two tests (test_skill_updater_updates_description_on_schema_created, test_skill_updater_adds_multiple_schemas) that use fixed sleep(200ms)/sleep(300ms) to wait for an async background task to react to an event before asserting on the result — the classic flaky-under-load pattern. Margins are generous for in-process work so this is low risk in practice, but it's the kind of test that could intermittently fail on a heavily loaded CI box now that it's gate-blocking rather than opt-in. Worth keeping an eye on if it ever flakes; not a reason to hold up this PR.

Everything else checks out:

  • package.json diff is the single intended change (--lib --bins → --lib --bins --tests), no unrelated script changes.
  • Doc comments in both edited test files are updated consistently with the new #[ignore] + --ignored opt-in pattern, matching the existing convention from live_openai_compat_*.rs/routing_latency.rs.
  • No lingering exclude-list-shaped gaps: the fix is a real inversion (--tests includes by default), so a new tests/*.rs file added later needs no script change to be gated — matches the issue's stated goal.
  • PR is minimal and scoped — no drive-by refactors, no unrelated formatting (confirmed via git diff --stat: only package.json + the 2 test files).

Verdict

Approve. The diff is small, the triage claims are independently verifiable and hold up, and the two genuinely non-hermetic files are handled the same way the rest of the codebase already handles live/latency suites. The two minor items above (temp-dir leak on failure, sleep-based test timing) are pre-existing and not introduced by this PR — flagging as follow-up material, not blocking.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review posted above (self-approval blocked by GitHub — PR author and reviewing account are the same). Verdict: approve, no blocking issues found.

@malibio
malibio merged commit 862999b into main Jul 31, 2026
2 checks passed
@malibio
malibio deleted the issue-1796-integration-test-triage branch July 31, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rust:test still gates by target allowlist: 20 tests/*.rs integration files never run, including the daemon's gRPC suites

1 participant