Repository navigation
Fix ODCS import/export specs and the v3.1.0 export of accepted legacy quality rules - #37617
Conversation
…published-schema validation Confirm the ODCS export version modal before waiting for the download, move the SLA timezone fixture into availabilityTime valueExt so it passes v3.1.0 schema validation, and match the current wrong-kind and kept-for-export report output.
…export confirm step
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Import accepts legacy root quality rules the published v3.1.0 format cannot express (a custom rule without engine/implementation, an unpublished metric) by embedding them in a custom 'odcs' rule. Export restored their source form, so exporting a just-imported contract failed the published schema with HTTP 400. For contracts carrying import metadata, v3.1.0 materialization now embeds such rules the same way, so re-import restores them unchanged; natively stored unrepresentable rules are still reported.
…export signal precisely
Code Review ✅ Approved 🟡 Medium riskEmbedding accepted legacy quality rules as custom ODCS declarations changes export serialization; compatibility errors could cause consumers to miss or misinterpret quality checks. Exports accepted legacy quality rules as embedded 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 |
Describe your changes:
Fixes the
ODCSImportExport.spec.tsandODCSImportExportPermissions.spec.tsfailures on main (nightly AUT, MySQL and PostgreSQL, every retry: https://github.com/open-metadata/openmetadata-nightly/actions/runs/43140585707). Most failures are specs that #36877 and #37450 changed behaviour under. Two are a real export bug in #37450, fixed here.1. Spec drift (Playwright only)
ODCSExportModal; the download starts only afterconfirm-odcs-export. 16 tests waited for a download that never cameconfirmODCSExporthelper inutils/odcsImportExport.tsafter every ODCS export click;exportContractYamlreuses itODCS_VALID_WITH_TIMESTAMPS_YAMLhadtimezoneon SLA entries, so import stayed blockedvalueExtonavailabilityTime(whatODCSSlaMapperreads); the test also asserts the timezone survives export/kind: does not have a value in the enumeration)/kindbusinessName) are reported as "kept for export" (odcs-report-info)value: 48); empty sections are omitted (slaProperties: []never appears)js-yamland assert values and absence2. Product bug: legacy quality rules the import accepts cannot be exported (server)
"Import ODCS with quality rules" and "…mustBeBetween quality rules" imported (201), then
GET /dataContracts/{id}/odcs/yaml?odcsVersion=v3.1.0returned 400:type: custom+rule: "price >= 0":required property 'engine' not found; required property 'implementation' not found.metric: uniqueValues+mustBeGreaterThan/mustBeLessThan:metric: does not have a value in the enumeration [...].Root cause.
ODCSImportCompatibility.projectRootQualityaccepts legacy root rules the published format can't express by wrapping them in acustomrule with engineodcs(ADR:2026-11-09-odcs-imports-validate-declared-published-profiles: "Legacy quality aliases that the published format cannot express use a custom declaration containing their source rule"). On export, the metadata overlay (ODCSQualityMetadata.restore) restores each rule's captured source form. OnlyfinalizeQualityre-wraps afterwards, and only for the fixedLEGACY_METRICSalias list. Everything else leaves raw and fails the published schema. Export can't round-trip what import accepted.Fix. For contracts that carry import metadata (
odcsPreservedFields), v3.1.0materializenow embeds any rule that the publishedDataQualityschema rejects but the legacy reader schema accepts. It uses the same declaration the import produced (sharedembeddedRulehelper).ODCSImportQuality.embeddedDeclarationalready unwraps that envelope on re-import, so the stored rule comes back unchanged.ODCSExportServiceTest.incompatiblePreservedContentIsReportedAndNeverErasedFromTheContractstill requires a natively storeduniqueValuesrule to be reported, and it still is. Profiles v3.0.x and v2.x already exported these rules validly and are not changed (the hook is v3.1.0'smaterialize).Alternatives considered
ODCSV31Mapper.placeRule. Rejected: it breaks the intended "natively stored unrepresentable rule is reported" behaviour (ODCSExportServiceTest,ODCSConverterTest), and the overlay restores the raw source on top anyway.ODCSQualityMetadata.restore. Rejected: the overlay runs on each target profile's representation (v3.0 rules userule:), so a v3.1 schema check there would hit valid v3.0 exports.Type of change:
High-level design:
N/A: two-file server fix plus spec updates; the design reasoning is above.
Tests:
Use cases covered
kindand for fields kept only for exportUnit tests
ODCSCrossVersionRoundTripTest:acceptedRootRulesTheTargetCannotExpressStillExport(all 6 published versions)unrepresentableRootRulesRoundTripThroughTheirEmbeddedDeclaration(v3.1.0: valid export, rules re-import as equal)origin/main'sODCSV31Mapper/ODCSImportCompatibility, the v3.1.0 cases fail (Tests run: 7, Failures: 1, Errors: 1).ODCSConverterTestpass (org.openmetadata.service.datacontract.odcs.*Test,ODCSConverterTest: 790 run, 0 failures, at bothe3d26e6b51aand0f8ae70b242).plan_local_java_tests.py --scope focused) selectsODCSCrossVersionRoundTripTest, which is covered by that run. It listsODCSImportCompatibilityandODCSV31Mapperas not referenced by name; both are exercised throughODCSExportServicein the round-trip, versioned-export and export-service tests.spotless:checkis clean, the impact map is complete (--check-branch) and decision records are clean.Backend integration tests
Not run locally. Pending: the
--scope fullplan (DataContractResourceITODCS matrix), which runs in the merge queue.Ingestion integration tests
Playwright (UI) tests
Ran locally against a server built from this branch (
openmetadata-servicebuilt frome3d26e6b51a's content;0f8ae70b242is a refactor of the same check, covered by the 790 unit tests; fresh MySQL DB, Vite dev server; chromium, 2 workers,--retries=0,PLAYWRIGHT_IS_OSS=true):ODCSImportExport.spec.ts+ODCSImportExportPermissions.spec.ts+ODCSExportVersions.spec.ts: 68 passed, 0 failed (6.2m). Before the server fix the same run was 65 passed / 3 failed. The replace-mode failure was spec drift, fixed in9ba99f5855b; the two quality-rule failures were the 400 above.Terminal output
Manual testing performed
type: custom, engine: odcs, and valid rules are unchanged.UI screen recording:
Not applicable: test fixes and a backend export fix, no UI behaviour change.
Checklist:
Fixes <issue-number>: <short explanation>: test fix, no issue (perpr-checklist)Fixes #<issue-number>above: test fix, no issueREVIEW.md.29a03d79fe0.e3d26e6b51a: no 🔴. Three 🟡, all addressed in0f8ae70b242:schema.isPublishedRulenow reuses the cached published schema viaODCSProfiles.validFragment(DEFAULT_VERSION, …)instead of loading a second copy.🤖 Generated with Claude Code