Repository navigation
Conversation
Reload the stored contract with its patch fields before updating latestResult. Partial validation objects must not erase custom properties or reviewer metadata during version consolidation. Refs open-metadata#34343.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…upstream-20261008 # Conflicts: # openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DataContractResourceIT.java # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.java
The updater diffs every patch field between original and updated. Loading the original with a hand-picked "owners,reviewers,extension" list means any relationship field added to the patch fields later is recorded as deleted on every result write (open-metadata#34343). Use getPatchFields() so the reload always matches what the updater compares.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
The property is registered on the shared dataContract type, which test cleanup does not reap. Use CustomPropertyTestSupport and remove it in a finally block so reused test servers do not accumulate properties.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved🔴 High risk · Reloading patch fields before contract-result writes changes persisted version consolidation; fields omitted from that set could still be recorded as deletions. Reloads the stored data contract with VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
096ac83
|
🤖 Backport to |
|
🤖 Not backported to
|
Describe your changes:
Fixes #34343
Bug: after a contract is edited, recording a validation result (the nightly Data Contract Validation app or
PUT /v1/dataContracts/{id}/results) deletes the contract's custom properties (extension) and reviewers.Root cause: both callers pass
updateLatestResult()a contract loaded withoutextension/reviewers/owners. That method deep-copies the partial contract, setslatestResult, and runs the entity updater. The copy keeps the last editor'supdatedBy/updatedAt, so the updater consolidates the write into that editor's version. Consolidation diffs the previous version (which has the fields) against the partial copy and records the missing fields as deleted. The loss is persisted into version history.Fix: reload the stored contract with
getPatchFields()before updatinglatestResult, so the original handed to the updater has every field the updater compares.Note on
main: #34304 has since landed an equivalent reload onmain, with a hand-picked"owners,reviewers,extension"field list. This PR is merged withmainand replaces that list withgetPatchFields(). A relationship field added to the patch fields later is then covered automatically instead of being silently wiped on the next result write. The net diff againstmainis that one line plus the regression test.Backport:
2.0and2.0.3–2.0.6still useJsonUtils.deepCopy(dataContract, ...)without a reload, so the bug is live there (it was reported on 2.0.2).Known limitation (out of scope): result writes still consolidate into the last user edit and are attributed to that user. The reload stops the data loss; changing the attribution would change version and change-event behaviour, so it should be tracked separately.
Developed and tested with assistance from OpenAI Codex (original change) and Claude Code (merge with
main,getPatchFields()change, verification).Type of change:
High-level design:
Not applicable — a two-file bug fix.
Tests:
Use cases covered
latestResultpoints to the recorded result with the expected status.Backend integration tests
DataContractResourceIT.testContractResultsPreserveMetadata(new): adds a string custom property to thedataContracttype, creates a contract with that property and a reviewer, edits it, records Running and Success results, and after each result asserts that the extension, reviewers and description are kept and thatlatestResultmatches.Run on the current head (
06fd45fde5, merged withmain), MySQL + Elasticsearch,parallellane:The failsafe report from this run includes
testContractResultsPreserveMetadata.Manual testing performed (live server)
Standalone server on MySQL + Elasticsearch 9.3. Steps, through the REST API as
admin:dataContracttype.admin.PUT /v1/dataContracts/{id}/resultswithRunning, thenSuccess.fields=extension,reviewersafter each result, and GET/versions.Before the fix (
updateLatestResultas on2.0, no reload):After the fix (this PR,
getPatchFields()):The search document for the contract (
data_contract_search_index) still has its reviewer and custom property, withlatestResult.status=Success.Spotless passes on
openmetadata-serviceandopenmetadata-integration-tests.Ingestion integration tests
Not applicable — no ingestion code changed.
Playwright (UI) tests
Not applicable — no UI code changed.
Earlier verification by the original author (pre-merge commit
817cd7be1f, beforemain's #34304 landed)Local Java test run: PASSED
545614e388b5(baseupstream/main) — uncommitted changes were presentTests run locally
DataContractChildExtractionTest(15 passed),DataContractPipelineTokenRefreshTest(6 passed),DataContractValidateDQTest(4 passed),DataContractValidateWithoutThrowingTest(4 passed),MigrationUtilTest(158 passed),ODCSImportAnalyzerTest(13 passed),RuleEngineTest(11 passed)BaseEntityIT$ListEntityHistoryByTimestampPaginationTest(12 passed),ConfigResourceIT(13 passed),DataAccessRequestValidationIT(85 passed, 11 skipped),DataContractPermissionIT(8 passed, 1 skipped),DataContractResourceIT(31 passed),DataProductDomainMigrationIT(309 passed, 28 skipped),DataProductResourceIT(303 passed, 24 skipped),DatabaseSmokeIT(1 passed),GlossaryTermResourceIT(251 passed, 25 skipped),SeedDataPresenceIT(1 passed),SoftDeleteRetentionIT(71 passed, 10 skipped),TableResourceIT(219 passed, 11 skipped),TestSuiteResourceIT(59 passed, 5 skipped),UserResourceIT(302 passed, 26 skipped)DataContractValidationAppIT(2 passed),TestSuiteReindexIT(1 passed)Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The step totals above are Maven's own counts.
Why these tests
area data-contracts←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.javacalled from entity DataContract←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.javacalled from entity DataProduct←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.javacalled from entity TestSuite←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.javachanged test←openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DataContractResourceIT.javaentity DataContract←openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.javasmoke←code other than a test class changedCommands
UI screen recording / screenshots:
Not applicable — no UI changes.
Checklist:
Fixes <issue-number>: <short explanation>.Fixes #34343.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; the previous cleanup finding is fixed and no new actionable issues were found.Summary
Uses
getPatchFields()when reloading a contract before recording its latest result.Reviews (2) · Last reviewed commit: "test: remove the data contract custom pr..." · Reviewed by Greptile