31472b5413
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 22s
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 3m58s
CI / security (pull_request) Successful in 4m8s
CI / integration_tests (pull_request) Successful in 9m33s
CI / unit_tests (pull_request) Successful in 10m12s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 12m18s
CI / e2e_tests (pull_request) Successful in 19m51s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 15s
CI / helm (push) Successful in 22s
CI / lint (push) Successful in 3m18s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 3m57s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m10s
CI / unit_tests (push) Failing after 6m58s
CI / docker (push) Has been skipped
CI / integration_tests (push) Successful in 9m15s
CI / coverage (push) Successful in 12m26s
CI / e2e_tests (push) Successful in 23m11s
CI / status-check (push) Failing after 1s
CI / benchmark-publish (push) Successful in 28m31s
CI / benchmark-regression (pull_request) Successful in 54m53s
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate. ISSUES CLOSED: #1232
126 lines
6.0 KiB
Gherkin
126 lines
6.0 KiB
Gherkin
@mock_only
|
|
Feature: FAISS vector backend uncovered paths (fvcov3)
|
|
As a test author
|
|
I want to exercise edge-case and error paths in the FAISS vector backend
|
|
So that code coverage improves for faiss_vector_backend.py
|
|
|
|
# --- _require_non_empty validation (line 28) ---
|
|
|
|
Scenario: Indexing with empty project raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I index embedding with empty project and doc_id "doc1" and vector "1.0,0.0"
|
|
Then fvcov3 the error message should contain "project must be a non-empty string"
|
|
|
|
Scenario: Indexing with whitespace-only doc_id raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I index embedding with project "proj" and doc_id " " and vector "1.0,0.0"
|
|
Then fvcov3 the error message should contain "doc_id must be a non-empty string"
|
|
|
|
# --- similarity_search empty embedding (line 48) ---
|
|
|
|
Scenario: Similarity search with empty embedding raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorBackend backed by it
|
|
When fvcov3 I similarity search with empty embedding
|
|
Then fvcov3 the error message should contain "embedding must be a non-empty list"
|
|
|
|
# --- similarity_search top_k < 1 (line 50) ---
|
|
|
|
Scenario: Similarity search with top_k zero raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorBackend backed by it
|
|
When fvcov3 I similarity search with top_k 0
|
|
Then fvcov3 the error message should contain "top_k must be positive"
|
|
|
|
# --- similarity_search skips hits without doc_id (line 62) ---
|
|
|
|
Scenario: Similarity search skips hits with missing doc_id
|
|
Given fvcov3 a mock vector store service that returns hits without doc_id
|
|
And fvcov3 a FAISSVectorBackend backed by it
|
|
When fvcov3 I perform a valid similarity search
|
|
Then fvcov3 the similarity search results should be empty
|
|
|
|
# --- index_embedding empty embedding (line 92) ---
|
|
|
|
Scenario: Index embedding with empty embedding raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I index embedding with project "proj" and doc_id "doc1" and empty embedding
|
|
Then fvcov3 the error message should contain "embedding must be a non-empty list"
|
|
|
|
# --- index_embedding metadata fallback to resource_type (line 95) ---
|
|
|
|
Scenario: Index embedding uses resource_type when location is absent
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I index embedding with metadata having resource_type "python_file" but no location
|
|
Then fvcov3 the indexed content should be "python_file"
|
|
|
|
Scenario: Index embedding uses default payload when neither location nor resource_type exists
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I index embedding with empty metadata for doc_id "my-doc"
|
|
Then fvcov3 the indexed content should be "embedding:my-doc"
|
|
|
|
# --- search_similar empty query_embedding (line 116) ---
|
|
|
|
Scenario: Search similar with empty query embedding raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I search similar with empty query embedding in project "proj"
|
|
Then fvcov3 the error message should contain "query_embedding must be a non-empty list"
|
|
|
|
# --- search_similar limit < 1 (line 118) ---
|
|
|
|
Scenario: Search similar with limit zero raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I search similar with limit 0 in project "proj"
|
|
Then fvcov3 the error message should contain "limit must be positive"
|
|
|
|
# --- search_similar min_relevance out of range (lines 120-121) ---
|
|
|
|
Scenario: Search similar with negative min_relevance raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I search similar with min_relevance -0.5 in project "proj"
|
|
Then fvcov3 the error message should contain "min_relevance must be in [0.0, 1.0]"
|
|
|
|
Scenario: Search similar with min_relevance above 1 raises ValueError
|
|
Given fvcov3 a mock vector store service
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I search similar with min_relevance 1.5 in project "proj"
|
|
Then fvcov3 the error message should contain "min_relevance must be in [0.0, 1.0]"
|
|
|
|
# --- search_similar skips hits below min_relevance (line 133) ---
|
|
|
|
Scenario: Search similar filters out hits below min_relevance
|
|
Given fvcov3 a mock vector store service that returns hits with low scores
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I search similar with min_relevance 0.8 in project "proj"
|
|
Then fvcov3 the search similar results should be empty
|
|
|
|
# --- search_similar skips hits without doc_id (line 137) ---
|
|
|
|
Scenario: Search similar skips hits with missing doc_id
|
|
Given fvcov3 a mock vector store service that returns search hits without doc_id
|
|
And fvcov3 a FAISSVectorIndexBackend backed by it
|
|
When fvcov3 I search similar with min_relevance 0.0 in project "proj"
|
|
Then fvcov3 the search similar results should be empty
|
|
|
|
# --- build_vector_backend non-faiss fallback (lines 164-167, 169) ---
|
|
|
|
Scenario: build_vector_backend falls back to InMemoryVectorBackend for non-faiss backend
|
|
Given fvcov3 a mock vector store service with backend name "memory"
|
|
When fvcov3 I call build_vector_backend
|
|
Then fvcov3 the result should be an InMemoryVectorBackend
|
|
|
|
# --- build_vector_index_backend non-faiss fallback (lines 184-187, 189) ---
|
|
|
|
Scenario: build_vector_index_backend falls back to InMemoryVectorIndexBackend for non-faiss backend
|
|
Given fvcov3 a mock vector store service with backend name "memory"
|
|
When fvcov3 I call build_vector_index_backend
|
|
Then fvcov3 the result should be an InMemoryVectorIndexBackend
|