Repository navigation
Fixes #36457, #36458, #36459: keep CSV import rows and versions; drop the year-0001 life cycle placeholder - #36562
Conversation
Both import screens rewrite CRLF and lone CR to LF before handing the file to papaparse, which infers one line separator per file, so a file that mixes line endings parses into one row per line.
… entity updateManyEntitiesForImport stores each replaced entity, with the relationships a PUT or PATCH records, as a history row in the same transaction and before the row update. The imported entity's change description starts from the stored version, so the importer's own edit within the session consolidates against it, and it keeps the per-field change summary.
prepareInternal, which runs for create, PUT, PATCH and bulk create, drops any created, updated or accessed aspect timestamped before 1970, the year-0001 placeholder older ingestion clients send for a source that reported no time, and drops the life cycle when no aspect remains. A PATCH whose life cycle carries nothing but placeholders keeps the stored life cycle, since those clients replace the whole field. The write still succeeds. The table header hides a pre-epoch creation time stored before this rule. Decision: ADR:2026-10-29-lifecycle-timestamps-before-the-epoch-are-dropped-on-write
normalizeCsvLineBreaks treats a quote as opening a quoted cell only at the start of the text, after a comma or after a line break, as papaparse does, so a quote inside an unquoted cell such as 12" pipe stays text. The cell boundary is matched with a capture group because the build targets Safari 16.0.
|
| Count | Rule |
|---|---|
| 3 | react-hooks/exhaustive-deps |
| 2 | openmetadata-imports/no-impure-pure-utils |
| 1 | openmetadata-imports/no-cross-page-imports |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/pages/EntityImport/BulkEntityImportPage/BulkEntityImportPage.tsx:142:1 |
openmetadata-imports/no-cross-page-imports |
Page features must not import another page feature. Move shared code to components, hooks, interfaces, or pure utilities. |
| 🟡 | src/pages/EntityImport/BulkEntityImportPage/BulkEntityImportPage.tsx:874:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has an unnecessary dependency: 'entityType'. Either exclude it or remove the dependency array. |
| 🟡 | src/pages/EntityImport/BulkEntityImportPage/BulkEntityImportPage.tsx:1374:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'handleImportWebsocketResponse' and 'handleResetImportJob'. Either include them or remove the dependency array. |
| 🟡 | src/pages/EntityImport/BulkEntityImportPage/BulkEntityImportPage.tsx:1465:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'filterColumns'. Either include it or remove the dependency array. |
| 🟡 | src/utils/CSV/CSVPureUtils.ts:16:1 |
openmetadata-imports/no-impure-pure-utils |
Pure utilities must not depend on React, UI, state, hooks, pages, or REST clients. Move orchestration/rendering out or move shared types to a lower layer. |
| 🟡 | src/utils/CSV/CSVPureUtils.ts:17:1 |
openmetadata-imports/no-impure-pure-utils |
Pure utilities must not depend on React, UI, state, hooks, pages, or REST clients. Move orchestration/rendering out or move shared types to a lower layer. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed| } | ||
|
|
||
| /** Copies of the stored entities with the relationships a PUT or PATCH records in history. */ | ||
| private List<T> withStoredRelationships(List<T> storedEntities) { |
There was a problem hiding this comment.
I don't think the deep copy is needed here. originals comes from findByNameOrNull → findByName, and the name cache stores JSON, so every lookup returns a new object that nothing else references. After this point the method uses originals only for carryCreationAudit and removeExtensions (by id), and loading relationships onto them doesn't change either one.
Could we hydrate in place and drop the helper?
setFieldsInBulk(putFields, originals);and then storeVersionHistory(originals) inside the transaction.
That saves a full copy of each entity per import batch, which adds up for wide tables. The hydration still needs to happen after authorizeImportedDomains, as it does now, so the domain check keeps comparing the same values.
There was a problem hiding this comment.
Done in 88c595c. The deep copy and its helper are gone, and originals are hydrated in place with setFieldsInBulk(putFields, originals), still after authorizeImportedDomains. I checked the one place that reads them afterwards: removeExtensions filters on getExtension() != null, not only on id. The stored JSON already carries extension, and the hydration keeps it, so that filter selects the same entities as before.
| // round trip runs while the handle is held. | ||
| flushInOneTransaction( | ||
| () -> { | ||
| storeVersionHistory(previousVersions); |
There was a problem hiding this comment.
Since import history is new in this PR: storeVersionHistory serializes each hydrated entity (serializeForVersionHistory) inside flushInOneTransaction, so the JSON work for the whole batch runs while the transaction and connection are held. For wide tables in a large batch, that holds row locks longer.
Could the ids, version extensions and JSON be built before flushInOneTransaction, so only the insertMany runs inside it? The bulk-update caller can keep its current behaviour; this is only about the import path.
There was a problem hiding this comment.
Done in 88c595c. The ids, version extensions and JSON are now built into a VersionHistoryRows record before flushInOneTransaction, so only the insertMany runs inside it. writeBulkVersionHistory builds its rows through the same helper and keeps its behaviour. Ran the import, CSV and bulk-history ITs: 314 run, 0 failures.
|
Test results on Integration tests (mysql-elasticsearch): 314 run, 0 failures, 0 errors, 29 skipped
Playwright ( Gates: |
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
…y-lifecycle-placeholder # Conflicts: # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · Changing entity persistence to drop pre-epoch lifecycle values and write CSV-import snapshots could lose timestamp data or distort version history. Fixes three CSV import and lifecycle bugs: normalizes mixed CRLF/LF line endings before parsing bulk imports, stores replaced entity versions as history rows during CSV import updates, and drops year-0001 life cycle placeholder timestamps on write. The quote-handling issue in the line-break normaliser was resolved, and no open findings remain. ✅ 1 closed✅ Edge Case: Line-break normaliser treats mid-field quotes as quoted cells
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 |
|
|
||
| public final void prepareInternal(T entity, boolean update) { | ||
| validateTags(entity); | ||
| entity.setLifeCycle(LifeCycles.withoutPlaceholderTimestamps(entity.getLifeCycle())); |
|
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
… the year-0001 life cycle placeholder (#36562) (#36830) * Fixes #36457: normalize CSV line endings before parsing an import Both import screens rewrite CRLF and lone CR to LF before handing the file to papaparse, which infers one line separator per file, so a file that mixes line endings parses into one row per line. * Fixes #36458: store the previous version when a CSV import updates an entity updateManyEntitiesForImport stores each replaced entity, with the relationships a PUT or PATCH records, as a history row in the same transaction and before the row update. The imported entity's change description starts from the stored version, so the importer's own edit within the session consolidates against it, and it keeps the per-field change summary. * Fixes #36459: drop life cycle timestamps before the Unix epoch on write prepareInternal, which runs for create, PUT, PATCH and bulk create, drops any created, updated or accessed aspect timestamped before 1970, the year-0001 placeholder older ingestion clients send for a source that reported no time, and drops the life cycle when no aspect remains. A PATCH whose life cycle carries nothing but placeholders keeps the stored life cycle, since those clients replace the whole field. The write still succeeds. The table header hides a pre-epoch creation time stored before this rule. Decision: ADR:2026-10-29-lifecycle-timestamps-before-the-epoch-are-dropped-on-write * Open a quoted CSV cell only at the start of a cell normalizeCsvLineBreaks treats a quote as opening a quoted cell only at the start of the text, after a comma or after a line break, as papaparse does, so a quote inside an unquoted cell such as 12" pipe stays text. The cell boundary is matched with a capture group because the build targets Safari 16.0. * Apply ui-checkstyle to the CSV import tests * Hydrate import originals in place and serialize history before the transaction (cherry picked from commit 8791c16) Co-authored-by: Ram Narayan Balaji <[email protected]>
Hand port of #36562 to 2.0; the automatic backport failed on a conflict. A CSV import update now stores the version it replaces, in the same transaction as the update, and gives the imported entity a change description that points at that version. Before, the import bumped the version without storing the previous one, and the next PATCH rewound the version and overwrote the import's. The import page normalizes CRLF and lone CR line breaks outside quoted cells before papaparse reads the file, so a CSV that mixes line endings keeps every row. 2.0 has no storeVersions helper, so the version rows are written inline the way writeBulkVersionHistory does. #36459 is left out: its server side is already on 2.0 through #37002 and its UI part is 2.1-only.




Describe your changes:
Fixes #36457
Fixes #36458
Fixes #36459
Three fixes found while testing the 2.1 creation audit, one commit each.
#36457: CSV import rows with mixed line endings. Papaparse infers one line separator per file, so an exported file (CRLF) with rows added in another editor (LF) fused the added rows into their neighbours in the bulk import grid.
BulkEntityImportPagenow normalises the line breaks that end rows to LF before parsing (normalizeCsvLineBreaks). Line breaks inside quoted cells are left as they are. The classicEntityImportscreen sends the file to the server unparsed, and Commons CSV already handles mixed endings, so it is unchanged.#36458: CSV import update keeps the version it replaces.
updateManyEntitiesForImportnow stores each replaced entity as a history row, in the same transaction and before the row update (the orderstoreUpdateuses). The row holds the relationships a PUT or PATCH records, hydrated withsetFieldsInBulk(putFields, …)on deep copies. The imported entity gets a change description that starts from the stored version and keeps the per-field change summary, so the importer's own edit within the session consolidates against that version. The history write is shared withwriteBulkVersionHistory(storeVersionHistory), and history goes throughserializeForVersionHistory, so per-type secret stripping applies unchanged.#36459: year-0001
lifeCycleplaceholder.prepareInternaldrops anycreated,updatedoraccessedaspect timestamped before 1970, and drops the life cycle when nothing remains. A timestamp of 0 is kept and nothing is rejected, so older clients keep working. A PATCH whose life cycle carries only placeholders keeps the stored life cycle (preparePatched), because older clients replace the whole field throughpatch_life_cycle. The table header hides a pre-epoch creation time stored before this rule. Recorded inADR:2026-10-29-lifecycle-timestamps-before-the-epoch-are-dropped-on-write.Type of change:
High-level design:
N/A: three bug fixes, each one commit; the design notes are in the description above and in the ADR.
Tests:
Use cases covered
lifeCycle.created = -62135596800000: no created time stored, version unchanged. Mixed with a realaccessed: the placeholder is dropped andaccessedkept. A placeholder-only PATCH on an entity with storedaccessed:accessedkept.Unit tests
LifeCyclesTest(new): 8 passed, 0 failed.CSVPureUtils.test.ts,DataAssetsHeader.utils.test.tsx,BulkEntityImportPage.test.tsx,components/common/EntityImport/**: 10 suites, 120 passed, 0 failed.BulkEntityImportPagecase fails with thenormalizeCsvLineBreakscall removed (checked).Backend integration tests
openmetadata-integration-tests/.DatabaseSchemaResourceIT.test_importCsv_updateKeepsVersionHistory(new). It fails onmainwithtable instance for … and version 0.3 not found, and passes with this change.BaseEntityIT.patch_entityLifeCyclePlaceholderTimestampIsDropped(new, runs for every entity IT; it exercises the 14 entity types that supportlifeCycle).Run locally, each with
-Dit.test=…:*IT#patch_entityLifeCyclePlaceholderTimestampIsDropped+test_importCsv_updateKeepsVersionHistoryDatabaseSchemaResourceIT, ChangeSummaryResourceIT, EntityUpdateLockOrderIT, GlossaryCsvRelationTypesIT, CsvAsyncJobResourceIT, MetricResourceITThe one failure is
CsvAsyncJobResourceIT.test_exportResultIsInTheJobRowAndNotOnLocalDisk. The same class fails 6 of 16 on cleanmain(f99f67a953) on the same machine, with the same404and "job row must hold the compressed payload" errors, so it is not caused by this change.Not run locally: the rest of the impact-mapped IT list.
EntityRepository.javamaps to the whole suite; the merge queue runs it.Ingestion integration tests
Playwright (UI) tests
TableCreationTime.spec.ts, "drops the year-0001 placeholder and keeps the other life cycle times".Run locally against this branch (API :8590, Vite :3090),
PLAYWRIGHT_IS_OSS=true, 2 workers:BulkImport,BulkImportWithDotInName,BulkEditEntity,GlossaryImportExport,ClassificationImportExport,MetricBulkImportExportEdit,CsvJobsTrayTestCaseImportExportBasicTableCreationTime(with the new case)25f32642e3BulkImportandTableCreationTimeis recorded in a comment belowThe self-review fixes changed
normalizeCsvLineBreaks(quote-aware), revertedEntityImport.component.tsxtomain, and kept the stored life cycle on a placeholder-only PATCH. Jest and the ITs above cover those directly.TestCaseImportExportBasicneeds thesample_data.ecommerce_db.shopify.dim_addresstable that CI ingests. Locally it was created fromingestion/examples/sample_databefore the run.Not run: the other specs
make playwright_affectedlists (domain isolation, search, lineage, navbar, policies, …). They appear becauseEntityRepository.javaandDataAssetsHeader.utils.tsxare unmapped, and they do not exercise the changed code.Manual testing performed
OpenMetadataApplicationon its own MySQL database and ES alias, with the UI from Vite.retail_analytics.retail_dw.salesschema. Meera (owner) and Arjun (DataSteward) editedcarrier_invoices.returns_ledgerand its column were created.createdand a realaccessed. The API stored onlyaccessed, and the header shows no created time; a table with a real creation time still shows it.Screenshots
Taken on this branch's build before the self-review fixes; those fixes change only quoted cells and the placeholder-only PATCH, so the behaviour shown is unchanged.
#36457: 4 CRLF rows plus 2 LF rows; the import grid shows all 5 data rows, including the LF-added returns_ledger and its column
#36457: validation passes every row
#36458: after the CSV import the history is 0.4, 0.3, 0.2, 0.1, and 0.3 keeps its description, owner and tag
#36458: version 0.3 (Arjun) still opens in the versions view after the import
#36458: an admin edit straight after the import merged into 0.4, then Meera's edit made 0.5; every version is listed
#36459: a PATCH with the year-0001 created time and a real accessed time stores only accessed
#36459: the table header shows no year-0001 created time
#36459: a table with a real creation time still shows it
UI screen recording:
Not applicable: bug fixes, not a UI feature. The UI changes are the import parser and hiding an invalid date.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.25f32642e3. Fixed one 🔴: a placeholder-only PATCH removed a stored life cycle, sopreparePatchednow keeps it, with a test. Also fixed: the UI wiring test, the quote-aware normaliser, theEntityImportrevert, a papaparse-only test, and a Javadoc. No 🔴 is open.docs/decisions/2026-10-29-lifecycle-timestamps-before-the-epoch-are-dropped-on-write.md.🤖 Generated with Claude Code