Skip to content

fix(deps): share llama backend in tests#209

Merged
saagpatel merged 1 commit into
masterfrom
codex/fix/llama-backend-init-v2
Jul 10, 2026
Merged

fix(deps): share llama backend in tests#209
saagpatel merged 1 commit into
masterfrom
codex/fix/llama-backend-init-v2

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

What

  • Update llama-cpp-2 and llama-cpp-sys-2 to 0.1.151.
  • Share one test-only LlamaBackend through OnceLock across the Rust test suite.
  • Add a regression test and ADR for the process-wide backend contract.
  • Silence the harmless origin/HEAD lookup error before the CI gate uses its existing master fallback.

Why

llama-cpp-2 0.1.151 permits backend initialization only once per process. The dependency-only update in #204 causes later engine tests to fail with BackendAlreadyInitialized. The repository policy also requires explicit test and ADR evidence for changes under the Rust KB path.

How

A test-only helper initializes the backend once and returns cloned Arc handles to the embedding and LLM tests. Production initialization and CI policy classification are unchanged.

Testing

  • cargo test --manifest-path src-tauri/Cargo.toml test_engine_creation -- --nocapture (2 passed)
  • cargo test --manifest-path src-tauri/Cargo.toml (312 unit tests passed, 1 ignored, plus all integration and doc tests)
  • cargo test --manifest-path src-tauri/Cargo.toml --test llama_backend_singleton_policy (passed)
  • node scripts/ci/require-tests-and-docs.mjs (passed)
  • GitHub CI must be fully green before merge.

Risks

Low. The backend helper is compiled only under cfg(test); production backend ownership and initialization are untouched.

Performance impact

No production impact. The shared test backend avoids repeated native backend initialization.

Lockfile rationale

Cargo.lock is refreshed by normal Cargo resolution for llama-cpp-2 0.1.151 and its transitive native build dependencies.

Screenshots

Not applicable; no UI changes.

@saagpatel saagpatel merged commit 0bb3dd2 into master Jul 10, 2026
19 checks passed
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.

1 participant