Repository navigation
Fixes #39129: prune no-snapshot update baseline to stop spurious JSON Patch removes - #39164
Merged
harshach merged 1 commit intoNov 28, 2026
Conversation
harshach
approved these changes
Nov 28, 2026
harshach
deleted the
detail/bug-fix/fixes-39129-prune-no-snapshot-update-baseline-to-s-1dd4eb
branch
November 28, 2026 19:24
6 of 7 tasks
mohityadav766
added a commit
that referenced
this pull request
Dec 2, 2026
…schema, stale and slow ITs (#39394) * fix(sdk): remove fields cleared on a server-returned entity in update() #39164 pruned the no-snapshot baseline to the fields the caller sent, so a field nulled on an entity returned by create() or update() was never removed. Prune only hand-built partial entities, which carry no version or updatedAt. * test(ontology): create bot_entity in OntologyEntityDAOIT's scratch schema Approval rules read bot_entity since #38797. Without it the gate refused every write with "Approval rules are unavailable". * test(context-memory): align ContextMemoryAnchorIT with memory-only search #38011 lets a memory-only search return anchored memories a reader may read, but left one assertion on the old rule. The "all" assertions counted fuzzy-matched tables and queried the question, which "all" does not search; count memories only and carry the query in the display name. * fix(glossary): retry the pending-label drop of a bulk asset removal on deadlock The chunked DELETE on tag_usage commits on its own and is idempotent, so DeadlockRetry can rerun it. * test: tolerate slow runners in OntologyGovernanceIT and ConceptContextIT Retry a SPARQL request the single worker turns away with 429, and give the approval workflow the 5 minutes MetricResourceIT already allows. * test(informix): drop the clear() of per-source stored procedure state PerSourceState is owned by each source instance, so a second run starts empty and the object has no clear(). * chore(airflow-apis): refresh uv.lock for the ingestion mcp extra * test: honour the SPARQL Retry-After and explain the workflow wait The bounded worker answers saturation with 429 and Retry-After by design, so the client waits as told. The approval workflow starts only when the serial WorkflowEventConsumer reaches the create event, which lags under parallel load. * test: poll the SPARQL retry with Awaitility; guard untouched fields in update() Replace the sleep loop with Awaitility at the server's Retry-After interval. Add a test that a server-returned entity with one changed field emits no remove ops.
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
Fixes #39129
Describe your changes:
I worked on the fluent Java SDK's detached-entity update path because a partial-entity update done without a prior
get()(no stored snapshot) emittedremoveops for server-populated fields the caller never touched, causing HTTP 500 (forSpreadsheet) or silent clearing of curated metadata (e.g.displayName).Bug:
EntityServiceBase.update()is the base of every generated SDK entity service. When no in-memory snapshot exists, it re-fetches the server's defaultGETprojection and diffs it directly against the submitted (often sparse) POJO. Because that baseline is not pruned to the submitted fields,JsonDiffturns every server-populated field absent from the submission into aremoveop:remove /service→ NullPointerException insideSpreadsheetRepository.prepare→ HTTP 500 for every sparseSpreadsheetupdate.remove /displayName→ silently clears the field on entities where the PATCH survives.The legacy sibling
BaseResourcealready prunes the baseline (pruneFieldsNotPresentInUpdated), with a test asserting no remove ops for unspecified fields — but no generated service extends it, soEntityServiceBase(used by all fluent facades likeSpreadsheets/Tables) lacked the same guard.Fix: In the no-snapshot branch of
EntityServiceBase.update(), call a newpruneFieldsNotPresentInUpdated(originalNode, updatedNode)right afterfetchUpdateBaseline(...)to drop baseline fields absent from the submission before diffing. The snapshot branch is unchanged, so the documented "field cleared after a fetch emits a remove op" behavior keeps working. This mirrors the protection already inBaseResource.Type of change:
High-level design:
N/A — small change. A single recursive baseline-pruner added to
EntityServiceBase.update()'s no-snapshot fallback, mirroring the existingBaseResource#pruneFieldsNotPresentInUpdated. The snapshot path is untouched.Tests:
Use cases covered
get()) changes only the submitted fields and emits noremoveops for unspecified server fields (/service,/displayName,/fullyQualifiedName,/updatedAt,/updatedBy,/serviceType).displayName) still diffs and sends that change.removefor explicitly cleared fields (snapshot path preserved).Spreadsheetupdate no longer 500s and preservesservice/displayName; fetch-then-clear of tags still clears them server-side.Unit tests
openmetadata-sdk/src/test/java/org/openmetadata/sdk/services/UpdatePruneBaselineTest.java(new) — 6 Mockito-based cases against the realSpreadsheetService/EntityServiceBasewith a realistic default-GET fixture.EntityServiceBaseTest(12/12, incl.relatedTermsreference-field re-fetch),BaseResourceTest(2/2), andFluentAddTagPatchRegressionTest(18/18, the tag-baseline machinery) all pass; the fullopenmetadata-sdksuite (412 tests) is green. Spotless and test-compile are clean. RED/GREEN confirmed: disabling the prune makes 4 of the 6 new tests fail with exactly the reported spurious remove ops (/fullyQualifiedName, /displayName, /service, /serviceType, /updatedAt, /updatedBy).Backend integration tests
openmetadata-integration-tests/for the changed update behavior.openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/SpreadsheetDetachedUpdateIT.java(new) — 3 end-to-end cases: detached partial update preserves server-populated fields (no 500), explicitdisplayNamechange still applies, fetch-then-clear of tags still clears them.make java_affected) confirmsSpreadsheetDetachedUpdateITandFluentAddTagPatchITare selected for the parallel lane.openmetadata-integration-testsmodule requires theopenmetadata-servicetest-jar, andopenmetadata-servicedoes not compile in this sandbox — a pre-existing shaded-dependency resolution failure where theelasticsearch-depsjar is present, on the classpath, and contains the relocatedes.co.elastic.*classes (directjavacagainst it resolves the imports), yet the Maven compiler reportspackage es.co.elastic.clients.elasticsearch._types does not exist. This blocker is environmental and unrelated to the change (which touches onlyopenmetadata-sdk). The mock-based equivalents of the tag-clear and field-preservation paths passed in the unit suite, but the server-side NPE / display-name-clearing contract relies on the merge-queue ITs.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Not performed — backend-only SDK change; end-to-end verification relies on the ITs above.
UI screen recording:
Not applicable — backend-only Java SDK change, no UI impact.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.mdand fixed every 🔴 finding.BaseResource) and introduces no new schema field, REST path, default, or cross-component contract.Automatic Fixes PRs can be configured here.