Skip to content

fix(ui): handle malformed JSON in version diff payloads (#28154) - #33580

Open
hadimobarra wants to merge 1 commit into
open-metadata:mainfrom
hadimobarra:fix/28154-safe-version-diff-json
Open

hadimobarra wants to merge 1 commit into
open-metadata:mainfrom
hadimobarra:fix/28154-safe-version-diff-json

Conversation

@hadimobarra

@hadimobarra hadimobarra commented Sep 18, 2026

Copy link
Copy Markdown

Describe your changes:

Fixes #

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

N/A — small change.

Tests:

Use cases covered

Unit tests

Backend integration tests

Ingestion integration tests

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

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.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

RetriggerConfidence Score: 3/5

The PR is not yet safe to merge because malformed version data can suppress valid deletion summaries and misattribute ML-feature changes.

Findings

  1. P1 Valid deletion details disappear
  2. P1 Filtered features become misaligned
Summary

This PR adds validation-backed JSON parsing throughout the entity-version UI so malformed persisted diff payloads no longer crash version pages. It also corrects search-index field lookup and permits numeric version values.

  • Introduces shared safe parsers and shape validators for version diff arrays and objects.
  • Applies them to tags, owners, domains, table constraints, schemas, pipelines, ML features, and search-index fields.
  • Adds regression tests for malformed and unexpectedly shaped payloads.
  • Two data-correctness regressions remain in summary fallback and ML-feature pairing.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Persisted version diff JSON] --> B[Safe JSON parser]
  B --> C{Expected shape?}
  C -->|No| D[Discard malformed payload or item]
  C -->|Yes| E[Typed diff data]
  E --> F[Entity-specific version formatter]
  F --> G[Version timeline and detail UI]
Loading

Reviews (1) · Last reviewed commit: "fix(ui): handle malformed JSON in versio..."

@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.

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot

gitar-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk

Adds defensive handling for malformed JSON in version diff payloads to prevent parsing failures. No issues found.

Review coverage

Rules No rules evaluated

Functional validation Not enabled · Set up

Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Hi @hadimobarra Can you please share issue details in the Github Issue and link it with PR?

: {};

const value = newValueJSON ?? oldValueJSON;
const value = fieldChange.newValue ?? fieldChange.oldValue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Valid deletion details disappear

When a deleted field has an empty or malformed newValue but a valid oldValue, newValue ?? oldValue selects the unusable value before parsing. The parser then returns an empty array or object, so column, tag, and owner deletion summaries omit the deleted names even though valid data is available in oldValue. Select the first value that can be decoded successfully instead.

Comment on lines +113 to +120
const oldDiff = parseVersionDiffArray<MlFeature>(
getChangedEntityOldValue(featureDiff),
isMlFeatureDiff
);
const newDiff = parseVersionDiffArray<MlFeature>(
getChangedEntityNewValue(featureDiff),
isMlFeatureDiff
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Filtered features become misaligned

The old and new ML-feature arrays are filtered independently, but the comparison helpers still pair their entries by array index. If only one side contains a malformed feature among valid entries, later entries shift and a valid feature is compared with another feature's old description or tags. This makes the version history show incorrect changes. Pair features by their stable name instead of their post-filter index.

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