fix(graphql): always register semantic-search schema; stub resolver when disabled#17591
Open
nwadams wants to merge 1 commit into
Open
fix(graphql): always register semantic-search schema; stub resolver when disabled#17591nwadams wants to merge 1 commit into
nwadams wants to merge 1 commit into
Conversation
…hen disabled
Previously when SemanticSearchService was null (the default for OSS /
local dev with ELASTICSEARCH_SEMANTIC_SEARCH_ENABLED=false), neither the
schema file nor the resolvers were registered. Clients calling
`semanticSearchAcrossEntities` received a FieldUndefined validation
error — a schema-level error that varies by GMS configuration and is
indistinguishable from a typo on the client side.
Always load semantic-search.graphql so the field is defined, and when
the service is unavailable register stub fetchers that throw
SemanticSearchDisabledException. Clients now see a stable runtime error
("Semantic search is disabled in this environment") and can reliably
detect the disabled state to fall back to keyword search.
Refs: AI-586
Contributor
|
Linear: CAT-2152 Thanks for your contribution! We have created an internal ticket to track this PR. A member of the core DataHub team will be assigned to review it within the next few business days - you will get a follow-up comment once a reviewer is assigned. |
Bundle ReportBundle size has no change ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
SemanticSearchServiceis null (the default in OSS / local dev withELASTICSEARCH_SEMANTIC_SEARCH_ENABLED=false),SemanticSearchPluginwas registering neither the GraphQL schema nor the resolvers. Clients callingsemanticSearchAcrossEntitiesgot aFieldUndefinedvalidation error — a schema-level error that varies by GMS configuration and is indistinguishable from a typo on the client side.This makes the schema always-defined and registers stub
DataFetchers that throwSemanticSearchDisabledExceptionwhen the service is unavailable. Clients now see a stable runtime error ("Semantic search is disabled in this environment") and can reliably detect the disabled state to fall back to keyword search.Discovered while debugging silent zero-hit failures in Ask DataHub on OSS quickstart environments (see internal report; the integrations service couldn't tell apart "semantic search is off" from "field is misspelled" and swallowed both as empty results).
Changes
SemanticSearchPlugin.getSchemaFiles()unconditionally returnssemantic-search.graphql.SemanticSearchPlugin.configureExtraResolvers()registers stub fetchers (lambda → throwsSemanticSearchDisabledException) for bothsemanticSearchandsemanticSearchAcrossEntitieswhen the service is null.SemanticSearchPluginTestto reflect the new contract — schema is always loaded; invoking either stub fetcher throwsSemanticSearchDisabledException.The "happy path" (service available) is unchanged.
Test plan
./gradlew :datahub-graphql-core:test --tests SemanticSearchPluginTest— 10 passingsemanticSearchAcrossEntitiesreturns a clear runtime error mentioning "disabled", notFieldUndefined