Files
cleveragents-core/features/vector_store_service.feature
T

104 lines
4.8 KiB
Gherkin

Feature: Vector Store Service
As a developer
I want deterministic semantic search helpers
So that vector store functionality stays well-covered
Scenario: Refresh rejects when vector store is disabled
Given a vector store service with search disabled
When I attempt to refresh the vector store for plan 1
Then a configuration error should mention disabled vector store support
Scenario: Search rejects when vector store is disabled
Given a vector store service with search disabled
When I search plan 1 with the query "Need answers" and limit 1
Then a configuration error should mention disabled vector store support
Scenario: Refresh removes cache and persisted files when contexts are empty
Given a vector store service with search enabled
And FAISS interactions are recorded
And plan 7 cache contains similarity results
And plan 7 already has persisted FAISS files
And plan 7 has no context documents
When I refresh the vector store for plan 7
Then the refresh result should be 0 documents
And the plan 7 cache should be empty
And the plan 7 persisted files should be removed
Scenario: Refresh indexes cleaned contexts into FAISS
Given a vector store service with search enabled
And FAISS interactions are recorded
And plan 3 has contexts with stored content and blanks
When I refresh the vector store for plan 3
Then the refresh result should be 1 document
And FAISS should be built with 1 cleaned document
And the plan 3 cache should hold the FAISS instance
Scenario: Refresh honors OpenAI provider configuration
Given a vector store service with search enabled
And a stub OpenAI embeddings backend is available
And the embeddings provider is "openai" using model "text-embedding-3-large"
And plan 4 has contexts with stored content
And FAISS interactions are recorded
When I refresh the vector store for plan 4
Then the last OpenAI embeddings model should be "text-embedding-3-large"
And the refresh result should be 2 documents
Scenario: Unsupported embeddings provider raises a configuration error
Given a vector store service with search enabled
And the embeddings provider flag is "replit"
And plan 6 has contexts with stored content
When I attempt to refresh the vector store for plan 6
Then a configuration error should mention unsupported embeddings provider
Scenario: Cached FAISS search formats similarity hits
Given a vector store service with search enabled
And FAISS interactions are recorded
And plan 5 cache contains similarity results
When I search plan 5 with the query "Need summary" and limit 1
Then the FAISS similarity search limit should be 1
And the search results should include one formatted hit with path "doc.md" and score 0.25
Scenario: Search loads persisted FAISS index when cache is empty
Given a vector store service with search enabled
And FAISS interactions are recorded
And plan 8 already has persisted FAISS files
When I search plan 8 with the query "Need summary"
Then FAISS should be loaded for plan 8
And the plan 8 cache should hold the FAISS instance
Scenario: Search returns empty when loading fails and refresh is disabled
Given a vector store service with search enabled
And FAISS interactions are recorded
And plan 9 already has persisted FAISS files
And loading the plan 9 index will fail
When I search plan 9 with the query "Need summary" and refresh disabled
Then the search results should be empty
Scenario: Search aborts when refresh indexes nothing
Given a vector store service with search enabled
And plan 12 has no context documents
When I search plan 12 with the query "Need refresh"
Then the search results should be empty
Scenario: Search rebuilds the vector index when nothing is cached
Given a vector store service with search enabled
And FAISS interactions are recorded
And future FAISS builds will return similarity hits
And plan 13 has contexts with stored content
When I search plan 13 with the query "Need refresh"
Then FAISS should be built with 2 cleaned document
And the plan 13 cache should hold the FAISS instance
And the search results should include one formatted hit with path "doc.md" and score 0.25
Scenario: Search trims blank queries
Given a vector store service with search enabled
When I search plan 10 with the query ""
Then the search results should be empty
Scenario: Invalidation without a plan identifier is a no-op
Given a vector store service with search enabled
And FAISS interactions are recorded
And plan 11 cache contains similarity results
When I invalidate the vector store without specifying a plan
Then the plan 11 cache should still contain the cached store