Skip to content

Fixes #37202: support versioned ODCS imports - #37450

Merged
TeddyCr merged 16 commits into
open-metadata:mainfrom
TeddyCr:feat/37202-versioned-odcs-import
Nov 12, 2026
Merged

TeddyCr merged 16 commits into
open-metadata:mainfrom
TeddyCr:feat/37202-versioned-odcs-import

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #37202.

Import ODCS v3.1.0, v3.0.2, v3.0.1, v3.0.0, v2.2.2 and v2.2.1 through the same published-schema profiles used by export. JSON/YAML create and update, YAML parse, and preview now share validation and native conversion.

Type of change:

  • Improvement

High-level design:

Implemented UML

ODCS import UML: shared pipeline, direct adapter registry and version-family mappers

Open full-size PNG · Editable SVG

The diagram reflects the implemented architecture, including direct adapter resolution and parent-first legacy ARRAY reconstruction. Selected members are shown.

ODCSProfiles.resolve reads the declared version and returns its registered ODCSVersionAdapter directly. The registry owns the fixed adapter and published-schema mappings; there is no intermediate profile record. ODCSImportService owns one pipeline: validate the original document, invoke the selected adapter's normalizeLegacy only when validation fails, revalidate, then project through ODCSNativeContractConverter into the existing shared reader. The v2.2, v3.0 and v3.1 family adapters explicitly select their normalization rules; the common compatibility helper contains no version-string dispatch. ODCSPublishedSchemaValidator owns published-schema checks, and ODCSLegacyQualityValidator validates consumed legacy fields before relocation or encapsulation. Generic preserved JSON retains source version/schema identity and unmapped content.

Known historical OpenMetadata shapes are normalized explicitly and reported, then validated against the declared profile. Legacy quality payloads are checked against the reader schema before encapsulation, so a recognized alias cannot hide malformed fields. Existing generated models, pinned upstream schemas, model-generation commands and Docker packaging are unchanged.

Tradeoffs:

  • Missing/malformed versions and unregistered profiles, including v2.2.0/v3.2.0, are rejected instead of defaulted or read permissively.
  • Published-schema validity, native compatibility and test-case eligibility remain separate outcomes. Arbitrary JSON assertions and numbers the native numeric model cannot represent exactly survive without creating a different test.
  • Historical SQL without comparisons remains non-executable; implicit zero tolerance for old null/duplicate/missing/invalid-value checks becomes explicit.
  • Native edits/deletions take precedence over preserved representations, including custom-property values, array item types and quality-rule parameters.
  • v3.0 uses the final textual odcsId custom property as its historical ID annotation. Earlier properties survive; embedded source IDs win. A lone user property using that reserved convention is ambiguous. v3.1 properties with that name remain ordinary metadata.

The decision and support matrix are in docs/decisions/2026-11-09-odcs-imports-validate-declared-published-profiles.md. No data migration is required.

Tests:

Use cases covered

  • All six versions through JSON and YAML import, parse, preview, export and merge/replace updates.
  • Expected columns, owners, SLAs, custom properties, stable rule IDs and linked test cases.
  • Preview and rejected imports leave no contract or test-case writes.
  • Native custom-property edits/deletions, primitive array edits, literal dots, nested array children, v2 nullability defaults and source metadata preservation.
  • Scalar/object/array assertions, exact numeric preservation, malformed legacy rules, source-object selection and native edits replacing old quality wrappers.
  • Sparse documents, legacy flat columns/type aliases, old shared-POJO defaults and external v2 check metadata.

Unit tests

631 ODCS-focused Java unit tests pass. New import/profile class line coverage: ODCSImportService 97.4%, ODCSImportCompatibility 98.9%, ODCSImportQuality 97.5%, ODCSProfiles 100%.

Backend integration tests

All 94 ODCS-related DataContractResourceIT methods pass against disposable MySQL/Elasticsearch services (188 executions across the configured isolated/parallel lanes).

Commands:

mvn -B verify -pl openmetadata-integration-tests -am -Pstatic-code-analysis -Dsonar.skip=true '-Dtest=ODCS*Test' '-Dit.test=DataContractResourceIT#*ODCS*+*Odcs*' -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dspring-boot.repackage.skip=true -Djsonschema2pojo.skip=true -Dmaven.compiler.useIncrementalCompilation=false
mvn -B package -pl openmetadata-service -am -Pstatic-code-analysis '-Dtest=ODCS*Test' -Dsurefire.failIfNoSpecifiedTests=false -Dspring-boot.repackage.skip=true -Djsonschema2pojo.skip=true -Dmaven.compiler.useIncrementalCompilation=false
mvn -B -pl openmetadata-service jacoco:report

Models were generated in the initial fresh-worktree build; the later checks reused those unchanged outputs. Focused verification is complete. Broader non-ODCS integration, search, and nightly checks were not run and merge readiness is not asserted. The Java impact map is complete.

UI tests

73 existing Jest tests pass for ODCSImportModal, ODCSImportReport and report utilities. No UI code changed.

Ingestion integration tests / Playwright

Not applicable — no ingestion or UI implementation changes.

Manual testing performed

Authenticated live API tests against sample_data.ecommerce_db.shopify.customers on commit a2487077200 pass all 36 version pairs in both input and output formats: 144 complete import/export/re-import/reverse-export cases, plus six edge checks. All 432 matrix export/re-import/reverse-export responses were HTTP 200; exported documents validate against the pinned schemas. Starting editable contract content was restored; table columns and test case identities/parameters are unchanged. Testing advanced contract version history. See the correction section below for the deployed artifact and focused verification. No browser testing was performed.

UI screen recording:

Not applicable — backend import implementation with unchanged UI workflow and response shapes.

Checklist:

  • Read contributing guidance; title and body link issue Support versioned ODCS imports using published schemas #37202.
  • Added focused unit/API tests and recorded their results.
  • Java formatting, commit hooks and impact-map checks pass.
  • Documented compatibility rules and tradeoffs in a decision record.
  • No JSON Schema/storage changes; migrations and model regeneration are not required for this diff.
  • Final independent review against REVIEW.md completed at d41fcfbe6ab04b32fd3529b7f33490fabb5aeb0c; all findings resolved. Review regressions cover scalar versus array assertions, malformed legacy payloads, parameter/unit edits, and metadata edits/deletions through wrapper decoding.

Cross-version export correction (2026-11-10)

Preserved source metadata is normalized only for versioned export. Source-only keys travel in scoped customProperties annotations and return as fields when the requested published schema accepts them. Description arrays retain an editable text projection and their exact original array. Native fields and aliases retain precedence; stale projections cannot resurrect edited or deleted values. Existing stored contracts benefit without migrations, schema generation, UI or Dockerfile changes.

v3.0.x library rules now convert both renamed aliases and unchanged metric names, including rowCount. The recognized current names come from the generated v3.1 schema model. The v3.1 exporter repeats quality normalization after the metadata overlay, which can restore source-version rule fields. Existing native metric values remain authoritative; unrecognized legacy names retain their existing compatibility handling.

The metadata tradeoff is a visible reserved compatibility annotation when source content has no direct target representation. Unknown field names are discovered from the pinned schema, so preservation needs no new field allowlist. The generic payload remains unchanged in storage.

Verification on a2487077200:

  • 697 ODCS Java unit tests passed. The regression first reproduced the library-rule export failure before the fix.
  • All 36 source → target pairs pass with executable row-count rules, reverse imports, native edits and arbitrary source metadata. Additional regressions cover all five unchanged published metric names in every v3.0 patch and preserved-only row-count rules restored after serialization.
  • Three focused HTTP regression methods passed in the parallel MySQL/Elasticsearch lane: testVersionedODCSImportMatrix, testVersionedODCSInvalidDocumentsHaveNoSideEffects, and testNativeCustomPropertiesExportAsValidOdcsAcrossAllRoutes. The expanded matrix covers table row-count and column not-null rules and validates all six export targets after every YAML/JSON import. Its rule/test identity assertions compare complete sorted lists.
  • Line coverage: ODCSImportQuality 98.4%; ODCSV31Mapper 94.7%.
  • Live localhost JWT matrix: 144/144 complete round trips passed, covering all 36 version pairs × both input formats × both output formats. All 144 exports, 144 re-imports and 144 reverse exports returned HTTP 200. Six invalid-input/object-selection edge checks passed. Arbitrary metadata, exact v2.2.1 multi-part descriptions, owners, SLA, column schema and quality declarations survived. Four executable tests retained their identities, scopes, definitions and parameters; two other declarations remained non-executable. Starting contract content was restored and temporary credentials removed.
  • Spotless, commit hooks, impact-map checks and independent review passed. Broader non-ODCS/API/search/nightly suites were not rerun; merge readiness is not asserted.

Latest live validation was rerun against the user-rebuilt local server. Both its API and the service JAR in the rebuilt distribution archive report revision a2487077200b6fd26950f46404d7a316988b7ff1 (server build timestamp 1794352921045). All 144 complete version/format round trips and all six edge checks passed. Starting editable contract content was restored exactly; table columns and test case identities, scopes, definitions and parameters are unchanged. Testing advanced contract version history.

The metadata design and tradeoffs are documented in docs/decisions/2026-11-09-odcs-imports-validate-declared-published-profiles.md.

Scalar-column export correction (2026-11-11)

Commit 28a5afee88c15180780adc328c004b5d6facb65e fixes published-schema export failures when native scalar columns (for example VARCHAR) contain children. The shared mapper retains the declared scalar type and omits its children from exported ODCS; stored metadata is unchanged. Objects (STRUCT/MAP/JSON) and arrays retain their children. The behavior applies recursively and across the six export profiles. See docs/decisions/2026-11-11-odcs-scalar-columns-omit-native-children.md.

Verification:

  • New regressions first reproduced the reported v3 schema errors. After the fix, all 707 ODCS Java unit tests passed, including scalar types, nested scalars, object/array preservation, and all six export profiles.
  • DataContractResourceIT#testODCSExportScalarColumnWithChildren passed in the parallel MySQL/Elasticsearch lane: 16 HTTP exports (four v3 profiles × JSON/YAML by ID/FQN) returned 200, validated against the published schemas, and left the stored scalar children intact.
  • Changed mapper line coverage: 234/247 (94.7%). Spotless, commit hooks, decision-record checks, impact-map checks, and independent review of the above commit passed.
  • The combined Maven verify command completed all tests but failed afterward in the SonarCloud reporting step (authorization/organization HTTP 404). mvn -B -pl openmetadata-integration-tests failsafe:verify -Dsonar.skip=true successfully verified the saved integration results without rerunning them.
  • Broader non-ODCS unit/API/search/nightly suites were not rerun; merge readiness is not asserted. The pre-existing case of a quality rule explicitly scoped beneath a scalar remains outside this correction.

Import pipeline refactor verification

Commit ad41d9f37bc0ca8ee1121c61f3e20ddd239da985 implements the shared pipeline and family-owned normalization described above. Version diagnostics, caller immutability, recognized legacy forms, quality declarations, canonical source metadata and export behavior are preserved. The decision is recorded in docs/decisions/2026-11-11-odcs-import-pipeline-selects-profile-owned-normalizers.md.

  • Unit tests: all 768 ODCS Java tests passed, including 61 new ODCSImportPipelineTest cases for published-input bypass, malformed root references with/without schema, version diagnostics and source immutability. Existing versioned import and cross-version round-trip tests exercise the new components through the public importer and exporter, so they do not need direct references to every extracted class.
  • API integration: four DataContractResourceIT methods passed in the parallel MySQL/Elasticsearch lane: testVersionedODCSImportMatrix, testVersionedODCSInvalidDocumentsHaveNoSideEffects, testSchemaLessODCSInvalidQualityHasNoSideEffects, and testODCSExportScalarColumnWithChildren.
  • Line coverage: ODCSImportService, ODCSLegacyQualityValidator, ODCSNativeContractConverter, ODCSImportCompatibility and ODCSPublishedSchemaValidator 100%; ODCSProfiles 96.4%; v2.2/v3.0/v3.1 mappers 98.0%/96.1%/94.4%.
  • Checks: Spotless apply/check, commit hooks, decision records, impact-map ownership and independent review passed. Review found no actionable findings at the commit above. Rebase onto the equivalent remote merge preserved the exact tested file tree.
  • Broader non-ODCS/API/search/nightly checks were not rerun; merge readiness is not asserted.

Commands used for focused execution:

mvn -B package -pl openmetadata-service -am -Pstatic-code-analysis -Dsonar.skip=true '-Dtest=ODCS*Test' -Dsurefire.failIfNoSpecifiedTests=false -Dspring-boot.repackage.skip=true -Dmaven.compiler.useIncrementalCompilation=false
mvn -B verify -pl openmetadata-integration-tests -am -Pstatic-code-analysis,mysql-elasticsearch -Dsonar.skip=true -DintegrationTests.lane=parallel -Dtest=NoUnitTestsInThisRun '-Dit.test=DataContractResourceIT#testVersionedODCSImportMatrix+testVersionedODCSInvalidDocumentsHaveNoSideEffects+testSchemaLessODCSInvalidQualityHasNoSideEffects+testODCSExportScalarColumnWithChildren' -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dspring-boot.repackage.skip=true -Dmaven.compiler.useIncrementalCompilation=false
mvn -B -pl openmetadata-service jacoco:report
mvn -B -pl openmetadata-service spotless:apply
mvn -B -pl openmetadata-service spotless:check

Direct adapter resolution

Commit ededa7578a412c6dbf858fd6d33b4dca5faafb57 removes the redundant ODCSProfile record. ODCSProfiles keeps the fixed adapter/schema mappings; resolve returns the adapter directly. Import and conversion use that adapter, and schema validation uses its declared version. The existing pipeline decision record includes the amendment.

The focused Maven verification was rerun successfully with all 768 ODCS unit tests and the same four parallel MySQL/Elasticsearch DataContractResourceIT methods listed above. This used the recorded verify command with -Dtest=ODCS*Test so unit and API tests ran together. Line coverage: registry 96.2%; importer, converter and published-schema validator 100%. Formatting, normal commit/push hooks, impact-map checks and independent review passed at this commit. No additional test cases were needed for the behavior-preserving removal. Broader non-ODCS/API/search/nightly checks remain deferred; merge readiness is not asserted.

Legacy ARRAY column-order correction and live verification

Commit b3e9f3256dc2526e02fdc1d2754d279cc9ba130f fixes v2.2.1/v2.2.2 flattened children declared before their ARRAY parents. Reconstruction parses qualified paths once and processes parents before descendants, so both outer and nested native arrays retain arrayDataType: STRUCT. Existing item metadata and quoted column names containing literal dots survive.

Verification at this commit:

  • Regression reproduction: 24 of 26 focused cases failed before the fix; all 26 passed afterward. Coverage includes all six declaration orders, both legacy versions, metadata-only item objects, nested arrays, literal dots and re-export to all six profiles.
  • Unit/API tests: all 792 ODCS unit tests and 97 ODCS endpoint integration tests passed. The new endpoint test checks JSON/YAML imports, response and persisted native types, and all six published export schemas in the parallel MySQL/Elasticsearch lane.
  • Changed mapper line coverage: ODCSV22Mapper 199/204 lines (97.5%). Spotless, normal commit/push hooks, impact-map ownership and independent review passed; review found no actionable findings.
  • Live server replay: rebuilt and recreated only the OpenMetadata server container on localhost:8585. The API reports this exact commit. All 288/288 complete version/format round trips passed (144 quality/metadata plus 144 nested-array cases), and 125/125 additional regression scenarios passed. Both formerly failing child-before-parent scenarios now preserve native STRUCT array item types. The matrix covers every ordered pair of the six supported profiles and both input/output formats.
  • Additional live checks cover create/merge/replace, scalar columns with stored children, native field and quality metadata edits/deletions, arbitrary JSON assertion values, legacy aliases/defaults, custom property edits/deletions, invalid input/version handling and ID/FQN export equivalence. All temporary services/contracts/tables were removed, original custom-property definitions restored, and the server homepage returned HTTP 200.
  • An initial setup request exceeded a 45-second client timeout while best-effort Airflow deployment took 62.734 seconds; it eventually returned HTTP 201. Its temporary data was confirmed removed. The complete replay passed with a 120-second timeout. Data-quality query execution itself was outside these import/export checks.
  • Local detailed evidence: /tmp/odcs-live-fixed-20261111/report.html and validated-summary.json. Broader non-ODCS and nightly suites were not rerun; merge readiness is not asserted.

Focused commands (successful):

mvn -B package -pl openmetadata-service -am -Pstatic-code-analysis -Dsonar.skip=true '-Dtest=ODCS*Test' -Dsurefire.failIfNoSpecifiedTests=false -Dspring-boot.repackage.skip=true -Dmaven.compiler.useIncrementalCompilation=false
mvn -B verify -pl openmetadata-integration-tests -am -Pstatic-code-analysis,mysql-elasticsearch -Dsonar.skip=true -DintegrationTests.lane=parallel -Dtest=NoUnitTestsInThisRun '-Dit.test=DataContractResourceIT#*ODCS*+*Odcs*' -Dsurefire.failIfNoSpecifiedTests=false -Dfailsafe.failIfNoSpecifiedTests=false -Dspring-boot.repackage.skip=true -Dmaven.compiler.useIncrementalCompilation=false

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Nov 9, 2026
@TeddyCr
TeddyCr marked this pull request as ready for review November 9, 2026 23:21
@TeddyCr
TeddyCr requested a review from a team as a code owner November 9, 2026 23:21
@TeddyCr
TeddyCr requested review from sonika-shah and a balanced review from Copilot November 9, 2026 23:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 23:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs and removed safe to test Add this label to run secure Github workflows on PRs labels Nov 9, 2026
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI balanced review requested due to automatic review settings November 10, 2026 20:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 10, 2026 22:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 15:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 21:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Versioned ODCS imports now normalize and map contracts and quality rules across six profiles, so conversion errors could alter persisted contract data or executable checks.

Adds versioned ODCS import support for v3.1.0, v3.0.x, and v2.2.x through the same published-schema profiles used by export, with a shared validate-normalize-convert pipeline. No open issues remain; the malformed root quality rule bypass when schema is absent was resolved.

✅ 1 closed
✅ Bug: Malformed root quality rules bypass validation when schema is absent

📄 openmetadata-service/src/main/java/org/openmetadata/service/datacontract/odcs/ODCSImportCompatibility.java:70-71 📄 openmetadata-service/src/main/java/org/openmetadata/service/datacontract/odcs/ODCSImportCompatibility.java:228-242 📄 openmetadata-service/src/main/java/org/openmetadata/service/datacontract/odcs/ODCSImportService.java:66-78
In projectRootQuality, a root rule with a column in a document that has no schema is never checked. The whole object is serialized into a type: custom, engine: odcs wrapper, and ODCSProfiles.validationErrors only validates that wrapper. readProfile then hands normalized.canonical() to the lenient reader. The canonical copy is taken before projectRootQuality and still holds the raw rule. qualityRule() returns the input unchanged when validLegacyQuality fails, so a rule like {column: id, metric: nullValues, mustBeBetween: [1], unexpectedField: x} gets past the published-schema gate. It is then imported (and can turn into a test case) instead of blocking the import. This goes against the ADR's rules that "invalid fields outside these compatibility forms still block import" and that "legacy quality payloads are type-checked before encapsulation". The schemaAbsent branch also skips the textual-column check that projectRule enforces. Fix: before wrapping a rule, require it to be a valid compatibility form (or pass the reader schema), and reject it otherwise.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@TeddyCr
TeddyCr enabled auto-merge (squash) November 12, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support versioned ODCS imports using published schemas

3 participants