Completes the search-provider-interface wiring that the catalog hardening commits already call into: - Skip the transactional search-index-event write path when Meilisearch is not the active provider (ItemRepository.WithActiveSearchProvider / SearchIndexEventRepository.disabledByActiveProvider). - Dead-letter catalog_search_index_events after 10 attempts instead of retrying forever. - Track the rebuild high-water mark (MaxEventID / MarkProcessedThrough) and persist last_processed_event_id in UpdateStateAfterRebuild so a rebuild reconciles events enqueued during the rebuild. - Validate (read-only) the embedding lock when embedding a search query instead of establishing/mutating it. - Surface total_exact on the legacy /items browse response. - Wire the active catalog search provider into the scanner and item repo at startup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
682 B
Go
23 lines
682 B
Go
package recommendations
|
|
|
|
import "testing"
|
|
|
|
func TestValidateQueryEmbeddingLockAllowsMissingLock(t *testing.T) {
|
|
if err := validateQueryEmbeddingLock(nil, "http://embeddings", "model-a", 1536); err != nil {
|
|
t.Fatalf("missing query embedding lock returned error: %v", err)
|
|
}
|
|
}
|
|
|
|
func TestValidateQueryEmbeddingLockChecksExistingLock(t *testing.T) {
|
|
lock := &EmbeddingLock{
|
|
BaseURL: "http://embeddings",
|
|
Model: "model-a",
|
|
SourceDimensions: 384,
|
|
StorageDimensions: CanonicalEmbeddingDimensions,
|
|
}
|
|
|
|
if err := validateQueryEmbeddingLock(lock, "http://embeddings", "model-a", 1536); err == nil {
|
|
t.Fatal("dimension mismatch returned nil error")
|
|
}
|
|
}
|