Skip to content

fix(graphql): always register semantic-search schema; stub resolver when disabled#17591

Open
nwadams wants to merge 1 commit into
datahub-project:masterfrom
acryldata:feature/ai-586-oss
Open

fix(graphql): always register semantic-search schema; stub resolver when disabled#17591
nwadams wants to merge 1 commit into
datahub-project:masterfrom
acryldata:feature/ai-586-oss

Conversation

@nwadams
Copy link
Copy Markdown
Collaborator

@nwadams nwadams commented May 26, 2026

Summary

When SemanticSearchService is null (the default in OSS / local dev with ELASTICSEARCH_SEMANTIC_SEARCH_ENABLED=false), SemanticSearchPlugin was registering neither the GraphQL schema nor the resolvers. Clients calling semanticSearchAcrossEntities got a FieldUndefined validation 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 throw SemanticSearchDisabledException when 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 returns semantic-search.graphql.
  • SemanticSearchPlugin.configureExtraResolvers() registers stub fetchers (lambda → throws SemanticSearchDisabledException) for both semanticSearch and semanticSearchAcrossEntities when the service is null.
  • Updated SemanticSearchPluginTest to reflect the new contract — schema is always loaded; invoking either stub fetcher throws SemanticSearchDisabledException.

The "happy path" (service available) is unchanged.

Test plan

  • ./gradlew :datahub-graphql-core:test --tests SemanticSearchPluginTest — 10 passing
  • Verify against a GMS with semantic search enabled — existing semantic search behavior unchanged
  • Verify against a GMS with semantic search disabled — calling semanticSearchAcrossEntities returns a clear runtime error mentioning "disabled", not FieldUndefined

…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
@github-actions github-actions Bot added the product PR or Issue related to the DataHub UI/UX label May 26, 2026
@github-actions
Copy link
Copy Markdown
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.

@github-actions github-actions Bot added the community-contribution PR or Issue raised by member(s) of DataHub Community label May 26, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Bundle Report

Bundle size has no change ✅

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@maggiehays maggiehays added the needs-review Label for PRs that need review from a maintainer. label May 27, 2026
@nwadams nwadams requested review from alexsku and shirshanka May 28, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution PR or Issue raised by member(s) of DataHub Community needs-review Label for PRs that need review from a maintainer. product PR or Issue related to the DataHub UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants