Repository navigation
Add full-server integration test for PATCH table embedding + semantic search - #26356
Conversation
…arch Adds testPatchTableDescriptionUpdatesEmbeddingForSemanticSearch to VectorEmbeddingIntegrationIT that validates the full flow: when a table's description is updated via PATCH, the embedding is regenerated (fingerprint and textToEmbed change) and a subsequent KNN semantic search returns the patched table as the top result. Also adds a reusable executeKnnSearch helper that builds a KNN query via VectorSearchQueryBuilder and executes it directly against the test OpenSearch index. Co-Authored-By: Claude Opus 4.6 <[email protected]>
| try { | ||
| return new String(b.bodyAsBytes(), java.nio.charset.StandardCharsets.UTF_8); | ||
| } catch (Exception e) { | ||
| return "{}"; |
There was a problem hiding this comment.
💡 Quality: Silent exception swallowing hides search failures
In executeKnnSearch, the lambda at lines 338-340 catches Exception and returns "{}". If the response body cannot be read (e.g., encoding issue, I/O error), the test will fail with a misleading assertion message ("Semantic search should return results") instead of surfacing the actual root cause. Since this is test code, it's better to let the exception propagate for clear diagnostics.
Suggested fix:
try {
return new String(b.bodyAsBytes(), java.nio.charset.StandardCharsets.UTF_8);
} catch (Exception e) {
throw new RuntimeException("Failed to read search response body", e);
}
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
… search - Create PatchTableEmbeddingIT that validates the E2E flow: create a table via API, PATCH its description, poll for the embedding to update in the search index, then execute a KNN semantic search and verify the patched table is found. - Enable NaturalLanguageSearch with DJL embeddings in TestSuiteBootstrap when running with OpenSearch, so the VectorEmbeddingHandler is active and indexes include the knn_vector embedding field. - Call initializeVectorSearchService() before createIndexes() so the embedding dimension is known at index creation time. - Test gracefully skips when not running with OpenSearch or when the DJL model is unavailable. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Instead of modifying the shared table search index with knn_vector settings (which causes 503 "all shards failed" in CI), create a temporary test-only knn_vector index, copy the embedding there, and run the KNN search against it. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…red indexes The NL search config in the Dropwizard app caused initializeVectorSearchService() to run during app startup, which then made any SearchIndexingApplication reindex add knn_vector to ALL shared indexes, causing 503 shard failures in CI. Now: NL search is only enabled inside PatchTableEmbeddingIT itself, and cleaned up after the test. This prevents knn_vector from leaking into shared indexes. Co-Authored-By: Claude Opus 4.6 <[email protected]>
| "opensearch".equalsIgnoreCase(System.getProperty("searchType", "elasticsearch")), | ||
| "Vector embedding tests require OpenSearch"); | ||
|
|
||
| SearchRepository searchRepo = Entity.getSearchRepository(); |
There was a problem hiding this comment.
⚠️ Bug: Global config mutation not fully protected by try/finally
Lines 54–55 mutate the shared SearchRepository config (enabling NL search and re-initializing the vector service) before the try block starts at line 60. If initializeVectorSearchService() throws, or if the Assumptions.assumeTrue at line 57 aborts the test (via TestAbortedException), the finally block at line 63 is never reached and the global config remains permanently modified with NL search enabled for all subsequent tests in the suite.
Move the mutation inside the try block so the finally cleanup always runs.
Suggested fix:
SearchRepository searchRepo = Entity.getSearchRepository();
try {
TestSuiteBootstrap.withNaturalLanguageSearch(searchRepo.getSearchConfiguration());
searchRepo.initializeVectorSearchService();
Assumptions.assumeTrue(
searchRepo.isVectorEmbeddingEnabled(), "Vector embedding could not be initialized");
runEmbeddingTest(ns);
} finally {
searchRepo.getSearchConfiguration().setNaturalLanguageSearch(null);
}
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
…search VectorEmbeddingIntegrationIT (parallel tests) registers a handler with the lifecycle event dispatcher pointing at its own testcontainers OpenSearch. When PatchTableEmbeddingIT runs later, the dispatcher keeps the old handler (skipping the new one), so embedding updates fail silently against the dead testcontainers client. Fix: unregister the old handler before calling initializeVectorSearchService() so the new handler with the correct OpenSearch client gets registered. Co-Authored-By: Claude Opus 4.6 <[email protected]>
🔍 CI failure analysis for 00fef9c: OpenSearch vector service encounters document-missing exceptions during entity embedding updates, causing failures in vector search operations; separately, 1 failed and 6 flaky Playwright E2E tests show UI/API timing issues likely related to test environment resource contention from the new embedding integration tests.OverviewAnalysis of 11 unique error templates across 18 CI logs reveals two distinct failure patterns: (1) backend vector embedding failures in OpenSearch during integration tests, and (2) frontend Playwright E2E test flakiness with UI timeouts and API response delays. The PR adds comprehensive integration tests for PATCH table embedding and semantic search functionality, which appears to introduce test environment stress affecting both backend operations and E2E test execution. FailuresOpenSearch Vector Service Document Missing Exceptions (confidence: high)
Playwright E2E Test Timeouts and UI Interaction Failures (confidence: medium)
SearchIndex Response Data Missing Fields (confidence: medium)
Summary
Code Review
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
Summary
PatchTableEmbeddingIT— a full-server integration test that validates the end-to-end flow: create a table via the REST API, PATCH its description, let the server'sVectorEmbeddingHandlerautomatically update the embedding in the search index, then execute a KNN semantic search and verify the patched table is foundNaturalLanguageSearchwith DJL embeddings inTestSuiteBootstrapwhen running with OpenSearch, so theVectorEmbeddingHandlerlifecycle handler is active and indexes include theknn_vectorembedding fieldinitializeVectorSearchService()beforecreateIndexes()so the embedding dimension is known at index creation timeAssumptions) when not running with OpenSearch or when the DJL model is unavailableTest plan
-DsearchType=opensearch)textToEmbedreflects the new description, and confirms KNN semantic search returns the patched table