Skip to content

Fix ignored embedding service integration tests #207

Closed

Description

@malibio

Problem

12 integration tests in packages/core/src/services/embedding_service_test.rs are marked with #[ignore] but should be running in CI/CD.

Current status:

  • ✅ ONNX model downloaded to ~/.nodespace/models/BAAI-bge-small-en-v1.5/
  • ✅ ONNX compatibility fixes applied (dtype, token_type_ids, model path, CPU-only mode)
  • ✅ 2 out of 12 tests already passing
  • ❌ 10 tests failing with various issues

Test Results

Passing (2 tests):

  • ✅ test_simple_summarize
  • ✅ test_error_handling_missing_topic

Failing (10 tests):

  • ❌ test_token_estimation - Assertion failure: left: 2, right: 1
  • ❌ test_batch_embedding_multiple_topics - Database error: "Unable to open connection" (SQLite error 14)
  • ❌ test_chunking_strategy_small - Database error 14
  • ❌ test_chunking_strategy_medium - Database error 14
  • ❌ test_chunking_strategy_large - Database error 14
  • ❌ test_debouncing - Database error 14
  • ❌ test_embedding_storage_format - Database error 14
  • ❌ test_performance_embedding_time - Database error 14
  • ❌ test_update_topic_embedding - Database error 14
  • ❌ test_vector_search_performance_10k_nodes - Database error 14

Root Causes

1. Database Connection Error (SQLite error 14: SQLITE_CANTOPEN)

Tests fail when calling create_test_topic() -> db.connect_with_timeout().await?

Error: LibsqlError(ConnectionFailed("Unable to open connection to local database /var/folders/.../test.db: 14"))

Note: Other database tests in db/database.rs using identical TempDir pattern work fine, suggesting this is specific to the embedding service test setup.

2. Token Estimation Assertion Mismatch

test_token_estimation expects different token counts than estimate_tokens() returns.

Investigation Notes

  • Database tests in packages/core/src/db/database.rs pass with same TempDir pattern
  • Error happens in create_test_topic() when getting database connection
  • The create_test_services() helper successfully creates DatabaseService
  • Error 14 suggests file permissions or file locking issue with temp database

Acceptance Criteria

  • Fix database connection issue (investigate error 14 - SQLITE_CANTOPEN)
  • Fix token estimation test assertions
  • Remove all #[ignore] attributes from 12 tests
  • All 12 tests pass when model is present
  • Add graceful skip logic if model not found (pattern from packages/nlp-engine/tests/integration_tests.rs)
  • Verify tests pass in CI/CD environment

Setup Instructions for Testing

# Download embedding model
bun run download:models

# Run ignored tests
cargo test --package nodespace-core -- --ignored

# Run specific test with backtrace
RUST_BACKTRACE=1 cargo test test_batch_embedding_multiple_topics -- --ignored --nocapture

References

  • ONNX fixes: Commits f914fe6, d101d3a
  • Model download script: scripts/download-models.ts
  • Working graceful skip pattern: packages/nlp-engine/tests/integration_tests.rs:11-25
  • Working database test pattern: packages/core/src/db/database.rs (tests module)
  • File location: packages/core/src/services/embedding_service_test.rs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions