Repository navigation
Fixes #38569: keep draft ontology terms out of reembed semantic search writes - #38574
Merged
harshach merged 1 commit intoNov 25, 2026
Conversation
harshach
deleted the
detail/bug-fix/fixes-38569-keep-draft-ontology-terms-out-of-reemb-41235e
branch
November 25, 2026 04:09
This was referenced Nov 25, 2026
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.
Detail bug report: View on Detail
Describe your changes:
Fixes #38569
I worked on keeping draft/unpublished ontology terms out of the semantic-search chunk index when the
reembedCLI runs, because the 2-argupdateEntityEmbeddingsoverload keyed its term vs. data-asset branch on whether anontologyBodywas passed rather than on the entity type. ThereembedCLI iterates all ofAvailableEntityTypes.LIST(which includesontologyConcept/ontologyProperty) using that 2-arg overload, so it embedded every term from its mutable working (draft) DB row straight into the searchableontology_embeddings_chunksindex with no publication check — publishing drafts, terms of a sealed-but-unactivated release, and terms deprecated in the active release. Every other term entry point routes through the release-aware gated writer (OntologyTermSearch.writeCurrentEmbedding), which only writes active, non-deleted, non-deprecated members of the published release, using content from the release snapshot (ADR2026-11-23-ontology-terms-have-dedicated-search-indexes).Type of change:
High-level design:
N/A — small change.
Two-layer fix:
OpenSearchVectorService,ElasticSearchVectorService):updateEntityEmbeddings(entity, indexName, ontologyBody)now selects the term path by entity type, not byontologyBody == null. WhenOntologyTermSearch.isTerm(type)and no body is supplied, it warns and returns before building chunk docs — so no embedding provider call is made and nothing is written. Terms with a body still route throughwriteCurrentOntologyEmbeddings/writeCurrentEmbedding(the release-aware gate). Non-term entities are unchanged.reembedCLI (OpenMetadataOperations): the producer loop andcalculateReembedTotalBatchesnow skip ontology term types via a small staticisReembedableEntityTypepredicate (mirrors the existingplanSmartReindex/resolveChangedEntitieshelper pattern). Term embeddings are rebuilt only via the release-awarereindexpath, as the ADR prescribes for manual reindexing.The two layers are belt-and-braces: the CLI skips terms, and the vector-service guard refuses them even if a term reaches the 2-arg path through some future caller.
Tests:
Use cases covered
reembedCLI no longer embeds/publishes draft, sealed-but-unactivated, or deprecated-in-active-release ontology terms into the searchable chunk index.reembedexactly as before.Unit tests
openmetadata-service/.../search/vector/OpenSearchVectorServiceTest.java—twoArgOverloadRefusesOntologyConceptWithoutWritingOrEmbedding,twoArgOverloadRefusesOntologyPropertyWithoutWritingOrEmbedding,twoArgOverloadStillWritesNonTermEntitiesopenmetadata-service/.../search/vector/ElasticSearchVectorServiceTest.java—twoArgOverloadRefusesOntologyConceptWithoutWritingOrEmbeddingopenmetadata-service/.../util/OpenMetadataOperationsReembedEligibilityTest.java(new) — pinsisReembedableEntityTypeexcluding both term kinds and keeping data-asset types re-embeddable.The vector-service tests assert no OpenSearch/Elasticsearch requests and no embedding provider calls are issued for a term on the 2-arg path, and that a
Tablestill writes its chunks. The eligibility test pins the CLI's term-type skip.Backend integration tests
OntologyTermSearchIT(search-it, nightly), which exercises activate → only active terms surface, drafts don't, deprecated terms are excluded, and the reindex path repopulates from the release snapshot. It is unchanged by this fix.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Ran the
java-affected-testsimpacted plan (make java_affectedaftergit fetch origin main), which selected both vector services (both engines, per theOpenSearch*/Elastic*engine rules) and theOpenMetadataOperationsarea. Ran its exact unit command for the impacted set: 458 tests acrossopenmetadata-service+openmetadata-mcp(includingOpenSearchVectorServiceTest37,ElasticSearchVectorServiceTest25,SearchRepositoryBehaviorTest159, both bulk-sink behavior tests,DistributedJobParticipantTest,SemanticSearchToolTest,GetEntityToolTest,VectorEmbeddingHandlerTest,AvailableEntityTypesConsistencyTest,OntologyTermIndexTest), 0 failures, 0 errors. Spotless apply + check clean; targeted compile ofopenmetadata-serviceclean.I could not run the integration tests (
OntologyTermSearchITandVectorEmbeddingIntegrationIT) in this environment:TestSuiteBootstrapthrowsTestSuiteBootstrap initialization failedduring app startup — an NPE in thev200.MigrationUtiltask-workflow seed (Entity.getEntityRelationshipRepository()returns null) that fires before any test class loads. I confirmed this is pre-existing and not caused by this change by stashing my changes and re-running the exact IT command against the unmodified baseline, which produced the identical failure (0 tests run, BUILD FAILURE). The same blocker reproduces on both the search-it and global-state lanes becauseTestSuiteBootstrapis a sharedLauncherSessionListener. No running OpenMetadata server was obtainable to manually run thereembedCLI end-to-end for the same reason.UI screen recording:
Not applicable — backend-only search/vector change, no UI impact.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.2026-11-23-ontology-terms-have-dedicated-search-indexes: "Manual entity reindexing uses the same published-term writer") rather than introducing a new one, so no newdocs/decisions/record is required.Automatic Fixes PRs can be configured here.