Repository navigation
Fixes #23002: Add createdAt/createdBy creation audit and show table creation time - #34025
Conversation
Add OpenMetadata-internal creation audit, the counterpart to updatedAt/updatedBy, on 15 entities (12 data assets plus user, team and role). - Schemas declare createdAt/createdBy and implement a new CreationAudited interface. The accessors cannot live on EntityInterface: Task already declares a required createdBy of type EntityReference. - EntityRepository stamps them in the three create funnels (createNewEntity, createManyEntities, createManyEntitiesForImport) and carries them from the stored entity in every update path, so PUT and PATCH cannot move them. - A 2.1.0 data migration backfills existing rows from the oldest entity_extension version and falls back to the row's own updatedAt/updatedBy when there is no history. Idempotent on MySQL and Postgres. - Search mappings index createdAt (epoch_millis) and createdBy (keyword). - The Table header shows the source creation time that connectors already write to lifeCycle.created (BigQuery, Snowflake, Redshift).
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
|
| Count | Rule |
|---|---|
| 1 | no-restricted-imports |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/utils/DataAssetsHeader.utils.tsx:22:1 |
no-restricted-imports |
'../assets/svg/external-links.svg' import is restricted from being used by a pattern. Do not import SVG icons directly from assets/ paths; use the designated ab |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed
✅ Generated Sources Auto-UpdatedThe generated TypeScript types ( |
✅ Playwright Results — workflow succeededValidated commit ✅ 3411 passed · ❌ 0 failed · 🟡 4 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 50m 39s ⏱️ Max setup 4m 40s · max shard execution 19m 47s · max shard-job elapsed before upload 25m 52s · reporting 15s 🌐 212.67 requests/attempt · 2.02 app boots/UI scenario · 36.82% common-shard skew Optimization targets still in progress:
🟡 4 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…on-audit-23002 # Conflicts: # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java
When a source reported no creation time, LifeCycleQueryMixin substituted datetime.min, so affected tables stored lifeCycle.created.timestamp = -62135596800000. The Table header added in this PR would render that as "Created Time: Jan 1, 0001", and API, search and MCP consumers already received it. - The mixin leaves `created` (and `updated`) unset when the source has no value. It still yields the record, so the sink, which replaces lifeCycle wholesale, clears a stored placeholder on the next run. - A 2.1.0 migration, LifeCycleCreatedSentinelMigration, removes lifeCycle.created from table_entity rows with a negative timestamp, on MySQL and Postgres. Only tables receive life-cycle data from the mixin, and no real table predates 1970. Idempotent.
…on-audit-23002 # Conflicts: # openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v210/Migration.java # openmetadata-service/src/main/java/org/openmetadata/service/migration/postgres/v210/Migration.java
…23002) The v210 data migration re-runs whenever its fingerprint changes, and the fingerprint covers every class in utils/v210, so any helper added later in the release reran both steps. Their SQL was already a no-op on a second run, but it still scanned the tables: the backfill's join over entity_extension for 15 entity types, and a full table_entity scan for the repair. - New DataMigrationStep.runOnce records a per-step marker in SERVER_MIGRATION_SQL_LOGS when a step succeeds and skips the step while the marker exists. The marker goes through the migration's own handle, so it commits or rolls back with the step, and a failed step is retried. - Both v210 Migration classes run the creation-audit backfill and the lifeCycle placeholder repair through it. - LifeCycleQueryMixin no longer yields a record for a table with neither timestamp. The server keeps each stored aspect when the incoming one is empty, so that patch changed nothing; only the migration can remove a stored placeholder. Corrected the comment that said otherwise.
… the life-cycle Either - IngestionPipelineMigrationEntryPointTest builds the v210 Migration by reflection and set only handle and collectionDAO. runDataMigration now gates its one-time steps through DataMigrationStep.runOnce, which reads migrationDAO, so the test needs one like the other collaborators. - Re-indenting the `Either(right=...)` yield moved it off its basedpyright baseline entry, which matches by column range, so the existing reportCallIssue counted as new. Passing left=None satisfies the checker instead of adding a suppression.
Code Review ✅ Approved 2 closed / 2 findings🔴 High risk · 2.1.0 migrations backfill audit fields across 15 entities and remove stored timestamp values Adds creation audit fields ( ✅ 2 closed✅ Quality: Empty lifeCycle patch can't clear the stored placeholder
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
|
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|



Describe your changes:
Fixes #23002
The issue asks for a table creation time that connectors know where to put and the UI can show. This PR does three things:
createdAt/createdByon 15 entities as the counterpart toupdatedAt/updatedBy. This follows the direction on this issue ("add it for EntityInterface") and the review of the closed Added creation time in data, user and team entities #24412 ("changecreationTimetocreatedAtlike we haveupdatedAt", "also addcreatedBy"). These fields record when and by whom an entity was created in OpenMetadata.BIGQUERY_LIFE_CYCLE_QUERYruns the sameINFORMATION_SCHEMA.TABLES.creation_timequery quoted in the issue, and BigQuery, Snowflake and Redshift write the result tolifeCycle.created.timestamp. It was never rendered, so the Table header now shows it as Created Time. No new field was added for it.datetime.mininstead, so affected tables holdlifeCycle.created.timestamp = -62135596800000and the new header would read "Jan 1, 0001". The mixin now leavescreatedunset, and a 2.1.0 migration removes the placeholders already stored.Type of change:
High-level design:
Schema. 15 entity schemas get optional
createdAt(timestamp) andcreatedBy(string) and implement a newCreationAuditedinterface: table, database, databaseSchema, dashboard, chart, dashboardDataModel, pipeline, topic, mlmodel, container, metric, query, user, team and role. The fields are server-assigned, so they are not added to anycreate*request schema.Why
CreationAuditedand notEntityInterface.Taskalready declares a requiredcreatedByof typeEntityReference, so aString getCreatedBy()onEntityInterfacedoes not compile. Renaming Task's field would let this collapse ontoEntityInterface. I left that call to reviewers because it changes Task's published API.Stamping on create.
EntityRepository.setCreationAuditruns in the three create funnels (createNewEntity,createManyEntities,createManyEntitiesForImport). It derives fromupdatedAt/updatedBy, so a new entity hascreatedAt == updatedAt. The stamping deliberately does not happen in:prepareInternal: PUT reaches create throughEntityResource.createOrUpdate, which callsprepareInternal(entity, true). A!updatehook there would skip every entity created by ingestion.copy(): it runs on every PUT, so re-ingesting would reset the value. This is the bug in Added creation time in data, user and team entities #24412.Immutability.
carryCreationAudit(original, updated)copies the stored values onto the incoming entity inupdateInternal,updateInternalForImportand the bulkupdateManyloop. These are private paths that cover both PUT and PATCH, so no repository subclass can bypass them. The copy happens before diffing, so these fields never produce a change record or a version bump.Backfill (2.1.0 data migration).
CreationAuditMigrationis wired into bothv210/Migrationclasses and runs two passes, each only on rows wherecreatedAtis absent. That makes it idempotent on MySQL and Postgres.updatedAt/updatedByfrom the entity's oldestentity_extensionversion row.updatedAt/updatedBy.Run once per version. Both data-migration steps (this backfill and the placeholder repair below) go through a new
DataMigrationStep.runOnce. It records a marker inSERVER_MIGRATION_SQL_LOGSwhen the step succeeds, and skips the step while that marker exists. Without it the steps would repeat. The framework re-runs a version's whole data migration whenever its fingerprint changes, and the fingerprint covers every class inutils/v210, so any v210 helper added later in the release would rerun the backfill's join overentity_extension. The marker is written through the migration's own handle, so it commits or rolls back with the step. A failed step records nothing and is retried.Search.⚠️
createdAtis indexed asdate/epoch_millisandcreatedByaskeyword, across 14 index mappings in 4 locales (role has no index). Documents pick the fields up throughJsonUtils.getMap.IndexMappingVersionTrackerwill reindex those indexes on upgrade.Placeholder creation time (review fix).
LifeCycleQueryMixin._build_access_detailsreturneddatetime.minfor a missing timestamp. It now returnsNone, andget_life_cycle_dataskips a table that has neither timestamp. The server keeps each stored aspect when the incoming one is empty, so that patch would change nothing. It also means ingestion can't remove a placeholder it stored earlier; only the migration below does.LifeCycleCreatedSentinelMigration(2.1.0, MySQL and Postgres) removeslifeCycle.createdfromtable_entityrows whose timestamp is negative. Only tables get life-cycle data from that mixin, and no real table predates 1970. I fixed it at the producer rather than with a UI>= 0guard, so API, search and MCP consumers stop seeing year 0001 too.UI.
getTableHeaderInforenderslifeCycle.created.timestampusing the existinglabel.created-timekey, which is already translated in all 20 locales. The guard is!== undefined, so an epoch-0 timestamp still renders.Out of scope:
Table.creationTimefield (it would duplicatelifeCycle.created).lifeCyclecollection beyond BigQuery, Snowflake and Redshift.createDateTime.Tests:
Use cases covered
createdAt == updatedAtandcreatedBy == updatedBy, and both survive a GET.createdAt/createdByleaves them unchanged whileupdatedAtmoves forward.updatedAt/updatedBywhen an entity has no version history.createdAt.lifeCycle.createdis set, omits it when unset, and renders an epoch-0 value.lifeCycle.createdunset when the source reports no creation time, instead of storingdatetime.min.Unit tests
Files:
src/utils/DataAssetsHeader.utils.test.tsx(Table-case assertions plus an epoch-0 case) andsrc/mocks/TableData.mock.ts. Result: 23/23.Coverage %: not measured. The Java changes (
EntityRepository,CreationAuditMigration) are exercised by the integration tests below rather than by unit tests, so there is no JaCoCo number to report.ingestion/tests/unit/topology/database/test_life_cycle_query_mixin.py: two new cases. A missing creation time stays unset instead of becomingdatetime.min, and a table with no timestamps yields nothing. Both fail on the old mixin; 6/6 pass with the fix.openmetadata-service/.../migration/utils/DataMigrationStepTest.javacovers four cases: the step runs and records its marker when none exists, it is skipped while the marker exists, a failure records nothing, and each version gets a distinct marker. 4/4.Backend integration tests
BaseEntityITgainspost_entityCreationAuditIsStamped_200andpatch_entityCreationAuditIsImmutable_200, gated bysupportsCreationAudit. All 15 entity ITs opt in.CreationAuditMigrationITruns the backfill against the real database: oldest-version recovery, the no-history fallback, and idempotency.LifeCycleCreatedSentinelMigrationITruns the placeholder repair against the real database: it removes the placeholder and keeps a real value, idempotently.runOncefor the same step is skipped. That covers the v210 wiring, the marker write and the marker lookup on each engine.mainmerged in, using the reactor build (verify -am) with one Testcontainers stack per run:e4ae268d20):CreationAuditMigrationIT,LifeCycleCreatedSentinelMigrationIT, and the two Table audit tests.-Ppostgres-opensearch9/9 and-Pmysql-elasticsearch9/9, both BUILD SUCCESS, measured just before the latestmainmerge. After that merge (46b3ad0722) I re-ran Postgres: 9/9, together with the gate's unit tests and the framework's migration tests, 24/24.f8db18ae6a):LifeCycleCreatedSentinelMigrationIT,CreationAuditMigrationIT, and the two Table audit tests.-Ppostgres-opensearch7/7 and-Pmysql-elasticsearch7/7, both BUILD SUCCESS.main(aedda77d81):CreationAuditMigrationITplus the audit tests in Table, User, Pipeline and Metric, and CI's failingGlossaryTermResourceIT#patch_removeOneRelationTypeKeepsOtherTypeForSameTermas a control.-Ppostgres-opensearch12/12, BUILD SUCCESS. The glossary failure does not reproduce on this branch.Ingestion integration tests
LifeCycleQueryMixin, which the unit tests above cover. The new fields are not on anycreate*schema.Playwright (UI) tests
playwright/e2e/Pages/TableCreationTime.spec.tscovers the field being shown and being omitted.yarn lint:playwrightreports 0 errors. I did not run it locally, so CI is the first run.table-details-schema.pngis unaffected: that test uses a freshTableClass()with nolifeCycle.Manual testing performed
I did not test against a running stack. To reproduce:
GET /api/v1/tables/{id}on a pre-existing table and check thatcreatedAt/createdByare present.createdAt == updatedAtandcreatedByis the caller. Re-send the same PUT and check thatcreatedAtdoes not change./lifeCycleto{"created": {"timestamp": 1609459200000}}. The Table page header should show Created Time.UI screen recording / screenshots:
TODO: attach a recording of the Table page header showing Created Time for a table whose
lifeCycle.createdis set.Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>My PR is linked to a GitHub issue via
Fixes #<issue-number>above.I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (See the 2.1.0
CreationAuditMigrationandLifeCycleCreatedSentinelMigration.)For UI changes: I attached a screen recording and/or screenshots above. (TODO, see above.)
I have added tests (unit / integration / Playwright as applicable) and listed them above.
The issue properly describes why the new feature is needed, what's the goal, and how we are building it. The direction is in the issue and in the Added creation time in data, user and team entities #24412 review, but the final design (
CreationAudited, surfacinglifeCycle.created) is documented here, not in the issue.I have updated the documentation. A follow-up should document
lifeCycle.createdas where connectors put source creation time.I have added tests around the new logic.
🤖 Generated with Claude Code