Skip to content

[2.0] Fixes #36457, #36458: keep CSV import rows and versions - #38192

Merged
yan-3005 merged 1 commit into
2.0from
backport/2.0/pr-36562
Nov 19, 2026
Merged

yan-3005 merged 1 commit into
2.0from
backport/2.0/pr-36562

Conversation

@yan-3005

@yan-3005 yan-3005 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #36458
Fixes #36457

Backport of #36562 to 2.0. The automatic backport failed on a conflict (2.1 went in as #36830). 2.0 has diverged from main around version history, so this is a hand port of the two fixes whose bugs exist on 2.0.

#36458: a CSV import update loses the version it replaces. On 2.0, a CSV import that updates an existing entity bumps its version but never stores the version it replaces. History goes v0.4, v0.2, v0.1, and the next PATCH lowers the version back to 0.3 and overwrites the import's version. PUT keeps every version.

The fix, in updateManyEntitiesForImport:

  • load the originals with the PUT fields and store them as version rows, in the same transaction as the update;
  • set a change description that points at the stored version, so an edit later in the same session merges into the import's version instead of rewinding it.

What differs from main:

  • 2.0 has no storeVersions/VersionRows helpers and no MaskedFields filtering of history. The version rows are built inline with 2.0's serializeForVersionHistory and entityExtensionDAO().insertMany, the same way writeBulkVersionHistory does it on 2.0.
  • 2.0 still uses removeExtensions + storeExtensions on this path (with the custom-property-only delete from Backport #31863 + #32113 to 2.0: keep table constraints and FK edges on recursive CSV import #37244). Loading the originals' PUT fields doesn't change what that deletes: extension is stored in the entity JSON, so findByName already returned it.

#36457: a CSV that mixes CRLF and LF line endings loses rows. Papaparse infers one line separator for the whole file, so rows ending in the minority separator merge into their neighbours. The import page now normalizes line breaks outside quoted cells before parsing (normalizeCsvLineBreaks). CSVPureUtils.test.ts doesn't exist on 2.0; it's added with only the normalizeCsvLineBreaks tests, since main's other tests there cover helpers 2.0 doesn't have.

Not in this backport: #36459 (year-0001 life cycle placeholder). The server side is already on 2.0 through #37002 (LifeCycles.withoutPlaceholderTimestamps). The UI part guards the table created-time in the entity header, which only exists from 2.1. The ADR and the lifecycle IT in BaseEntityIT go with it.

Type of change:

  • Bug fix

Tests:

Run locally on this branch:

  • DatabaseSchemaResourceIT on MySQL + Elasticsearch: 85 run, 0 failures, 0 errors, 7 skipped. That includes the new test_importCsv_updateKeepsVersionHistory, which checks that after an import update the history is v0.4, v0.3, v0.2, v0.1 with v0.3 intact, that an edit in the same session doesn't rewind it, and that a later edit by another user adds v0.5.
  • DatabaseSchemaResourceIT#test_importCsv_updateKeepsVersionHistory on Postgres + OpenSearch: 1 run, 0 failures.
  • Jest: CSVPureUtils.test.ts and BulkEntityImportPage.test.tsx, 41 run, 0 failures, including the new mixed-line-endings upload test.
  • UI checkstyle (organize-imports, ESLint, Prettier) on the changed UI files: no diff.

The same change passed on main (#36562) and 2.1 (#36830).

Checklist:

  • My PR title is [2.0] Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have added tests and listed them above.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

Address the two explicit repository requirements before merging.

Findings

  1. P2 History storage repeats existing code ▶
  2. P2 New variables lack required `final` ▶

Summary

This backport preserves the version replaced by a CSV import and keeps rows separate when an uploaded CSV mixes line endings.

  • CSV updates keep the version they replace.
  • Uploaded CSVs keep their rows when line endings differ.

Two repository code requirements still need to be addressed.

Reviews (1) · Last reviewed commit: "[2.0] Fixes #36457, #36458: keep CSV imp..." · Reviewed by Greptile

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.
@yan-3005
yan-3005 requested review from a team as code owners November 19, 2026 09:04
@yan-3005
yan-3005 requested review from harshach and removed request for a team November 19, 2026 09:04
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

CSV imports now persist prior entity snapshots and reset change descriptions transactionally; mistakes could corrupt version history or later version sequencing.

Backport to 2.0 fixing CSV import version history loss (#36458) and dropped rows from mixed CRLF/LF line endings (#36457). Import updates now store the replaced version in the same transaction, and line breaks outside quoted cells are normalized before parsing. No issues found.

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

@yan-3005
yan-3005 merged commit efb5bab into 2.0 Nov 19, 2026
72 of 77 checks passed
@yan-3005
yan-3005 deleted the backport/2.0/pr-36562 branch November 19, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants