Repository navigation
Fixes #38002: Serve certification with both dates on every read; profiler skips unparseable tables - #38257
Conversation
…ry read A certification is read from any tag_usage row under the configured classification, but only rows written through validateAndStampCertification carry an expiry. Tags on create, dbt dataModel tags, a classification switch and the 1.12.5 migration leave it out, so typed clients (the Python AssetCertification requires expiryDate) reject the entity. - The read builder derives a missing expiry as appliedDate + the configured validityPeriod (the stamping arithmetic, now shared through expiryFor); a missing appliedAt reads as the epoch. The batch list path uses the same builder instead of its inline copy. - Bulk reads load certification whenever tags or certification is requested, as setFieldsInternal does, and clear it otherwise, so a stale inline copy in the entity row is never served (the profiler lists with fields=tags). - addDataModel and the CSV change-event write go through serializeForStorage, so they stop storing certification inline. - A Redis read-bundle entry whose certification lacks a date is treated as not loaded and rebuilds itself. ADR:2026-11-20-certification-reads-derive-a-missing-expiry-from-the-validity-period
…ot parse One table the client cannot parse (a certification served without the expiryDate its model requires, by a server without the fix) failed the whole list page, and the profiler dropped every table from that page to the end of the database. list_entities and list_all_entities take an optional on_skip hook, called for each element skip_on_failure drops. The profiler lists tables with skip_on_failure=True and records each skipped table in status.failed with its FQN, so the run summary still counts it.
❌ 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 |
Vamsi-klu
left a comment
There was a problem hiding this comment.
Self-review against REVIEW.md (independent reviewer, run on 3650ba4; fixes in 1a46199)
Verdict on 3650ba4: ready with nits (one should-fix).
- should-fix, applied: CertificationWithoutExpiryIT.listWithTagsOnly_servesCurrentCertification never built the stale inline copy it claimed to test. addDataModel loads certification before it applies the dbt tag, so a first dbt call on an uncertified table writes no copy, and a later PATCH goes through store(), which strips it again. The test now runs dbt twice, then puts back the dateless Gold copy an older server would have left in the row (tableDAO plus a cache invalidation, as ColumnCustomPropertiesIT does). With the bulk overwrite and the serializeForStorage writes reverted, it fails with expected Certification.Silver but was Certification.Gold. It also asserts a fields=owners list carries no certification.
- nit, applied: the appliedAt comment and the builder Javadoc were too narrow. A NULL appliedAt also comes from the 1.12.5 migration on both engines, and that migration and the CSV batch path also write an expiry.
- nit, applied: the ADR names "OpenMetadata maintainers" as deciders and cites real test names.
- nit, applied: issue numbers dropped from code comments; the fetchAndSetCertification comment now says it always overwrites, and nulls the field when neither tags nor certification is requested.
- nit, declined: an unparseable table is recorded as failed before the profiler's client-side view/classification filters run. This only happens against an unpatched server, and before this change the rest of the database was dropped.
- nit, declined (possible follow-up): a fields=tags list page now makes a second tag_usage query for certification rows; it could reuse the rows batchFetchTags already loads.
Checked with no finding: every read builder goes through buildCertificationFromCertTag (single GET, read bundle, bulk and its fallback, version latest, RDF, reindex, MCP); Redis bundles missing a date rebuild on hydration; nulling certification on lists that request neither field adds no deletion (updateCertification deletes on a null update regardless, and write paths load certification); serializeForStorage works on a copy, Table has no prepareForStorage, and re-encrypting an already tokenized secret is idempotent; stamping and derivation share one UTC Period calculation; on_skip runs inside the except block, defaults to None for other callers, and an exception in it is still caught per database. Reverting each part fails a test.
Unverified: whether Collate acts on certification.expiryDate. Legacy rows now read as expired once older than the validity period (or since 1970 when appliedAt is NULL).
Tests on the final SHA: CertificationWithoutExpiryIT 5/5 on MySQL+ES and on Postgres+OS; unit 51/51; profiler pytest and ruff clean. The wider 902-test regression run is at 3650ba4; production code has changed only in comments since.
|
Local Java test run: PASSED — details
Tests run locally
Broader coverage not executed by this focused run
Impacted, not run locally (7)
Commandsmvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=BundleWarmupCertificationBackfillTest,EntityRepositoryCertificationTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=CertificationWithoutExpiryIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
|
Approved from the ingestion side. @yan-3005 feel free to approve the PR once you're happy with the backend changes. |
|
@Vamsi-klu reviewed this. The fix is correct and I have no code changes to ask for: every read now hydrates the certification dates, the list path adds one batched query per page, and the profiler skip is in scope for #38002. One thing blocks merging: the branch now conflicts with Also, gitar's open thread about the P30D fallback for a null |
…on-read-derives-expiry # Conflicts: # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java
|
@yan-3005 thanks for taking a look. I merged |
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findingsDeriving missing certification expiries and replacing stale inline values changes API read semantics, which could affect consumers relying on certification validity. Adds read-side derivation of missing certification expiry from appliedDate plus validityPeriod, keeps stale inline certification copies out of bulk reads, and makes the profiler skip and report unparseable tables. Changes requested: the new P30D fallback for a null or unparseable validityPeriod on read, which writes still reject, is not recorded in the ADR Decision section and should be added before merge. ✅ 1 closedClosed: Quality: Read-side P30D fallback for a bad validityPeriod is not in the ADR
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 |
yan-3005
left a comment
There was a problem hiding this comment.
Verified at fffdd1e (MySQL + Elasticsearch): CertificationWithoutExpiryIT 18/0 failures, TableResourceIT 152/0. List path adds one batched certification query per page; addDataModel conflict resolution keeps main's storePendingGlossaryTerms. LGTM.
|
@stout-yeoman Please re approve |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
…iler skips unparseable tables (#38257) (#38562) * Fixes #38002: serve certification with both dates on every read A certification is read from any tag_usage row under the configured classification, but only rows written through validateAndStampCertification carry an expiry. Tags on create, dbt dataModel tags, a classification switch and the 1.12.5 migration leave it out, so typed clients (the Python AssetCertification requires expiryDate) reject the entity. - The read builder derives a missing expiry as appliedDate + the configured validityPeriod (the stamping arithmetic, now shared through expiryFor); a missing appliedAt reads as the epoch. The batch list path uses the same builder instead of its inline copy. - Bulk reads load certification whenever tags or certification is requested, as setFieldsInternal does, and clear it otherwise, so a stale inline copy in the entity row is never served (the profiler lists with fields=tags). - addDataModel and the CSV change-event write go through serializeForStorage, so they stop storing certification inline. - A Redis read-bundle entry whose certification lacks a date is treated as not loaded and rebuilds itself. ADR:2026-11-20-certification-reads-derive-a-missing-expiry-from-the-validity-period * Fixes #38002: profiler skips and reports a table it cannot parse One table the client cannot parse (a certification served without the expiryDate its model requires, by a server without the fix) failed the whole list page, and the profiler dropped every table from that page to the end of the database. list_entities and list_all_entities take an optional on_skip hook, called for each element skip_on_failure drops. The profiler lists tables with skip_on_failure=True and records each skipped table in status.failed with its FQN, so the run summary still counts it. (cherry picked from commit 5b5cb59) Co-authored-by: deepinsight coder <[email protected]> Co-authored-by: Ram Narayan Balaji <[email protected]>
Describe your changes:
Fixes #38002
The server could return
certification: {tagLabel, appliedDate}with noexpiryDate. The generated PythonAssetCertificationrequires all three, so every typed call that parsed such an entity raisedValidationError: certification.expiryDate Field required. In the profiler and auto-classification, one such table failed its list page and dropped every table from that page to the end of the database.This PR makes every read serve a certification with both dates, stops raw row writes from leaving a stale inline certification, lets stale Redis bundle entries heal, and makes the profiler skip and report a table it cannot parse.
expiryDatestaysrequired; no schema change and no migration.needs 2.0.x and 2.1 backport (reporter is on 2.0.7; backports follow once this merges).
Type of change:
High-level design:
Root cause (two independent defects):
tag_usagerow sits under the configured classification, and not every row carriesmetadata.expiryDate. Certification tags sent throughtagson create / bulk create, dbtPUT /tables/{id}/dataModeltags, the 2.0.x Tags-page asset picker, a switch ofallowedClassification, and the 1.12.5 migration of JSON that had no expiry all leave rows without it.buildCertificationFromCertTag(and a second inline copy inbatchFetchCertification) copied thenullthrough.appliedAtcan also be NULL: on pre-1.11.5 Postgres rows, and on rows the 1.12.5 migration moved without anappliedDate(both engines).TableRepository.addDataModelandcreateChangeEventForBulkOperationwrote the entity row withJsonUtils.pojoToJsoninstead ofserializeForStorage, so the certification was stored inline. A list withfields=tags(what the profiler requests) never reached a builder:fetchAndSetCertificationreturned early unlesscertificationwas requested, so the stored (and possibly stale) copy was served.Changes:
EntityRepository.buildCertificationFromCertTag: a missing expiry reads asappliedDate + validityPeriod, using the same UTCLocalDateTime.plus(Period)arithmetic as stamping (extracted toexpiryFor, which stamping now uses too). A missingappliedAtreads as the epoch, so it reads as expired. An unparseable or null validity period falls back to P30D with a WARN on read (writes still throw, as today). The batch list path calls the same builder instead of its inline copy.fetchAndSetCertification: bulk reads load certification whentagsorcertificationis requested (the rulesetFieldsInternalalready applies to single GETs) and set it to null otherwise, so an inline copy is never served.addDataModelandcreateChangeEventForBulkOperationwrite throughserializeForStorage, so the stored row matches whatstore()writes.list_entities/list_all_entitiestake an optionalon_skip(raw, exc)hook; the profiler lists tables withskip_on_failure=Trueand records each skipped table instatus.failedwith its FQN. This also covers a fixed client talking to an unpatched server.Persistence, freeze vs follow: the read writes nothing to
tag_usage. Copies taken from a read (version snapshots, change events, search and RDF docs, Redis bundles) keep the value derived at that moment. A legacy row's expiry therefore follows latervalidityPeriodedits while those copies do not; stamped rows never move. Derivation readsSettingsCache(3-minute TTL) while stamping reads the DB, so right after a period edit a pod can derive with the old period; only the strong body ETag (conditional GET 200 vs 304) can differ, If-Match uses the weak version ETag.Rejected:
matchAnyCertificationwould silently stop matching, so a Deny rule would quietly stop applying.expiryDateoptional in the schema: weakens a contract the server keeps on every write it controls, leaves deployed clients broken, and needs a three-language regeneration.skip_on_failurealone in the profiler: skipped tables would vanish from the run summary.Recorded in ADR:2026-11-20-certification-reads-derive-a-missing-expiry-from-the-validity-period.
Known and accepted, not changed here:
fields=tagslist page now runs a secondtag_usagequery for certification rows. A possible follow-up is to build certifications from the rowsbatchFetchTagsalready loads.Tests:
Use cases covered
Certification.Goldintags: GET, list withfields=certification, and PATCH of an unrelated field all returnappliedDateandexpiryDate = appliedDate + P30D; the PATCH does not move the expiry.PUT /tables/{id}/dataModelwith a certification tag: the response carries both dates.fields=tags(the profiler's projection) after two dbt runs serves the current certification. After a PATCH toCertification.Silver, with the dateless Gold copy an older server left in the entity row planted back, it still serves Silver; a list with neither field returns no certification.appliedAtreads as the epoch.status.failuresentry with its FQN.Unit tests
EntityRepositoryCertificationTest:getCertificationDerivesMissingExpiryFromConfiguredValidityPeriod(metadata null / empty, P90D stub),getCertificationKeepsStoredExpiry,getCertificationWithoutAppliedAtReadsAsAppliedAtEpoch,expiryForAddsTheCalendarPeriodInUtc,derivedExpiryFallsBackToDefaultPeriodWhenSettingIsNotAPeriod(PT720H, null),fetchAndSetFieldsDerivesMissingExpiryWhenCertificationRequested,fetchAndSetFieldsWithTagsOnlyReplacesStaleInlineCertification,fetchAndSetFieldsWithoutTagsOrCertificationClearsInlineCertification;applyCertificationSkipsWhenSameCertAlreadyExistsamended (it passed only becausenull == null).BundleWarmupCertificationBackfillTest#cachedCertificationWithoutExpiryIsRebuiltAndReCached.test_entity_fetcher.py::TestGetTableEntities::test_unparseable_table_is_skipped_and_recorded_as_failed: reallist_entitiesand fetcher, HTTP client mocked.origin/main, compile stubs only forexpiryFor/derivedExpiry):EntityRepositoryCertificationTest46 run, 6 failures + 2 errors:getCertificationDerivesMissingExpiry...(both params,expected: <1707776000000> but was: <null>),...WithoutAppliedAtReadsAsAppliedAtEpoch(expected: <0> but was: <null>),derivedExpiryFallsBackToDefaultPeriod...(null: NPE inPeriod.parse;PT720H:DateTimeParseException),fetchAndSetFieldsDerivesMissingExpiry...(expirynull),...WithTagsOnlyReplacesStaleInlineCertification(expected: <Certification.Silver> but was: <Certification.Gold>),...WithoutTagsOrCertificationClearsInlineCertification(stale Gold copy kept).BundleWarmupCertificationBackfillTest5 run, 1 failure:cachedCertificationWithoutExpiryIsRebuiltAndReCached(expected: <1700000000000> but was: <null>).getCertificationKeepsStoredExpiry,expiryForAddsTheCalendarPeriodInUtcand the amended test pass: they pin existing semantics. The pytest fails withValidationError: certification.expiryDate Field requiredfromlist_entities; with onlyon_skipreverted it fails onassert [] == ['my_service.prod.finance.broken'].1a46199e0cc(block below):EntityRepositoryCertificationTest46/46,BundleWarmupCertificationBackfillTest5/5; the pytest passes. Earlier, on3650ba4e343(production code has changed only in comments since), the regressionsBundleWarmupReadPathCertificationTest4/4,EntityRepositoryBulkImportSecretsTest3/3,BulkImportChangeEventMaskingTest2/2 (both exercise thecreateChangeEventForBulkOperationrow write) andEntityRepositoryTagCacheTest8/8 also passed (68 unit tests in that run).EntityRepository.java29/29 executable changed lines covered by the unit tests above (jacoco).TableRepository.java: the one changed line (theaddDataModelrow write) is covered by ITs only (CertificationWithoutExpiryIT,TableDataModelCertificationIT). Python: every changed line inometa_api.pyandfetcher_strategy.pyis covered bytest_entity_fetcher.py+test_classification_manager.py(the latter covers the paginatedlist_all_entitiescall).Backend integration tests
openmetadata-integration-tests/:CertificationWithoutExpiryIT(5 tests).origin/main(plus the two compile stubs): 5 run, 4 failures + 1 error.get_certificationTagOnCreate_hasExpiry,list_withCertificationField_hasExpiry,addDataModel_withCertificationTag_responseHasExpiry:no expiryDate: ...appliedDate=1795140306115,expiryDate=<null>;patchUnrelatedField_returnsStableExpiry: NPE reading the pre-PATCH expiry (it now asserts that read first, so it fails as an assertion);listWithTagsOnly_servesCurrentCertification:certification is missingon thefields=tagslist.fetchAndSetCertificationand bothserializeForStoragewrites back tomain):listWithTagsOnly_servesCurrentCertificationfails at the post-PATCH list withexpected: <Certification.Silver> but was: <Certification.Gold>, i.e. the stale inline copy is served. The other 4 tests pass.CertificationWithoutExpiryITon1a46199e0cc: 5/5 on MySQL + Elasticsearch (block below) and 5/5 on Postgres + OpenSearch.3650ba4e343(production code has changed only in comments since; test changes since are limited toCertificationWithoutExpiryITand two test comments):CertificationWithoutExpiryIT,TableCreateCertificationIT,TableDataModelCertificationIT,TableCertificationPropagationIT,SearchIndexingFieldsParityIT,EnricherBulkVsHistoryPathEquivalenceIT,DatabaseSchemaResourceIT,TeamResourceIT,UserResourceIT,UserImportPrivilegeEscalationIT:listWithTagsOnly_servesCurrentCertification, a test defect also seen on MySQL before that run: a stamped certification readsappliedDatefromtag_usage.appliedAt, a few ms off the clock the expiry was stamped with, so the exactappliedDate + P30Dcheck holds only for derived rows. The test now checks the stamped expiry.BundleWarmupCertificationIT2/2.corearea changes select the full suite there.Local Java test run: PASSED
1a46199e0cc4(baseorigin/main)--scope full).Ingestion integration tests
cd ingestion && PYTHONPATH=src python -W ignore -m pytest -q -p no:cacheprovider tests/unit/observability/profiler/test_entity_fetcher.py tests/unit/observability/profiler/test_workflow.py tests/unit/metadata/pii/test_classification_manager.py-> 70 passed (51 + 7 + 12); RED/GREEN for the new pytest above.ruff checkandruff format --checkclean on the three changed files.Wider check (fetcher, SDK and classification tests that exercise
list_entities):test_container_fetcher.py,test_entity_fetcher.py,test_classification_manager.py,test_tag_processor.py,test_patch_serialization.py,tests/unit/sdk: 578 passed, 1 skipped.Playwright (UI) tests
Manual testing performed
Not run. The repro in the issue (create with
tags:[Certification.Gold], a dbtPUT /tables/{id}/dataModel, thenGET ...?fields=certificationandGET /tables?databaseSchema=...&fields=tags, thenom.get_by_name/om.list_all_entitiesfrom the Python SDK) needs a full local server image build. The same API calls run against the real server inCertificationWithoutExpiryITon both engines, and the client side is covered by the pytest above.UI screen recording:
Not applicable: backend and ingestion fix, no UI change.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.3650ba4(verdict: ready with nits). The should-fix (IT5 never built a stale inline copy) and the comment/ADR nits are applied in1a46199; two nits are declined under "Known and accepted". Details in the review on this PR.Questions for maintainers
validityPeriodedits. If expiries must be fixed at apply time, I would follow up with stamping on every tag write path, a settings-change hook and a backfill (a backfill alone still leaves new rows on the follow path).appliedAt(pre-1.11.5 Postgres rows) reads as the epoch, so the certification reads as expired. Acceptable?tags(create, bulk create, dbtdataModel) are still stored without stamping. Should they be rejected, asAssetTagLabelServicedoes, or routed intocertificationand stamped? The update path already drops them.on_skipkeyword onlist_entities/list_all_entitiesacceptable, or would you prefer the profiler to page by hand?get_entity_versionparses snapshots. Leave them?expiryDate= import time (EntityCsv.getCertificationLabels->updateManyEntitiesForImport->applyCertificationBatch, stamping skipped). Not verified at runtime. Separate issue?createChangeEventForBulkOperationrunsprepareForStorage, which encrypts secrets for User, IngestionPipeline and Workflow. None of them reaches this path today (UserRepository.supportsBulkImportVersioning()is false; the other two have no CSV import), andstore()already re-runs it on every update. Keep it, or limit S3 toaddDataModel?

Confidence Score: 5/5
The PR appears safe to merge; no actionable defects were found.Summary
The PR supplies missing certification dates on reads and keeps stale inline copies out of responses.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Read certification] --> B{Cached value has both dates?} B -->|Yes| C[Return cached value] B -->|No or cache miss| D[Read certification tag] D --> E{Stored expiry exists?} E -->|Yes| F[Keep stored expiry] E -->|No| G[Derive expiry from applied date and validity period] F --> H[Return certification with both dates] G --> H H --> I[Refresh read bundle when needed]Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile