Skip to content

fix: Restore domain display and editing for classifications - #38641

Merged
sweta1308 merged 8 commits into
open-metadata:mainfrom
pcbeingused333:fix/classification-domains-38592
Nov 25, 2026
Merged

sweta1308 merged 8 commits into
open-metadata:mainfrom
pcbeingused333:fix/classification-domains-38592

Conversation

@pcbeingused333

@pcbeingused333 pcbeingused333 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #38592

Describe your changes

The Domains panel on the Classification page did not work: assigned domains did not show, and Apply failed with "An unexpected error occurred" without sending a request.

ClassificationDetails read the domain props from the generic entity context (useGenericDomainLabel), but it renders the GenericProvider itself, further down its own tree. The hook therefore read the default context: no entity type, an empty FQN and ID, and no domains. DomainLabel now gets the classification's domains, FQN, ID and type directly from currentClassification, and saves through its own API path (GET by name, then PATCH /classifications/{id}).

  • If the PATCH fails, the panel keeps the previously saved domains.
  • After a save, the domains are merged into the page's current classification, so the Edit drawer pre-fills the saved domains.
  • The domain editor is hidden on the version history page, as the Owners editor already is, so a historical version cannot change the live classification's domains.

This PR also fixes a flash on the same page: after creating a classification, the page briefly showed the previously selected classification and an empty, loading tags table before the new classification's "Add the first tag" state.

  • TagsPage makes the created classification the current one, with termCount: 0, before navigating to it. The create response carries no termCount.
  • ClassificationDetails renders the empty state directly for a classification known to have no tags, instead of the loading tags table.

Type of change

  • Bug fix

High-level design

N/A for this focused bug fix.

Tests

  • Browser tests (TagsPage.browser.test.tsx), real Tags page with the network mocked:
    • Shows the assigned domain and replaces it through the domain picker; asserts the PATCHed classification and the chips. Fails on main: the assigned domain never renders.
    • Opens the Edit drawer with the domains saved from the panel.
    • Keeps the saved domain on screen when the PATCH is rejected (403).
    • Creates a classification from one that has tags and asserts the tags table never reappears before the empty state. Fails without either of the two flash changes.
  • Jest (ClassificationDetails.test.tsx): renders a classification with an assigned domain, clears it through Apply, and checks the classification is read by name and patched by ID. The version-view test also asserts the domain editor is not rendered.
  • Results: TagsPage.browser.test.tsx 7/7 passed; ClassificationDetails.test.tsx and TagsPage.test.tsx 46/46 passed.
  • Checked manually against a local server: domains display, save and survive a reload, and a new classification opens straight on its empty state.

This change was prepared with the help of an AI coding assistant.

UI recording

Before:

Screen.Recording.2026-11-25.at.5.07.43.PM.mov

After:

Screen.Recording.2026-11-25.at.6.29.32.PM.mov

@pcbeingused333
pcbeingused333 requested a review from a team as a code owner November 25, 2026 03:12
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (no impact map from main yet)

Result: ✅ 1099 passed · 154 skipped

Changed code executed by these browser tests: 6 / 6 lines (100%)

File Changed lines Executed %
src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx 2 2 100%
src/pages/TagsPage/TagsPage.tsx 4 4 100%
Changed files no browser test loads
  • src/components/Classifications/ClassificationDetails/ClassificationDetails.interface.ts

sweta1308 and others added 2 commits November 25, 2026 17:03
Route the Domains panel's save through handleUpdateClassification, as the
Owners panel does, so TagsPage's classification state reflects the new
domains. Add a browser test that renders the assigned domain and replaces
it through the picker.
@sweta1308 sweta1308 added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch labels Nov 25, 2026
…table flash

After creating a classification, make it the current one with termCount 0
instead of leaving the previous classification on screen until the name
fetch lands, and render the empty state directly for a classification known
to have no tags rather than the loading tags table.
Drop the onUpdate route through handleUpdateClassification: that handler
swallows errors, so DomainLabel showed the unsaved selection after a
rejected PATCH. DomainLabel's own API save keeps its previous domains on
failure. Add a browser test for the rejected save.
… sync after a panel save

- Gate the Domains panel editor on !isVersionView, as the Owners widget is,
  so the version history page cannot PATCH the live classification.
- Merge the saved domains into TagsPage's current classification through
  afterDomainUpdateAction, so the Edit drawer pre-fills the saved domains.
- Drive the domain picker in browser tests through openPicker/setSelected,
  and add tests for the version-view gate and the edit-form domains.
sweta1308 and others added 2 commits November 25, 2026 19:45
Key the Domains panel by classification id so a save that resolves after
switching classifications cannot update the new panel, and merge saved
domains into TagsPage state only when the patched id matches the current
classification. Add a browser test that holds the PATCH across a switch.
@gitar-bot

gitar-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 2 closed / 2 findings

Restoring classification-domain editing sends PATCH updates and changes domain associations, so a mistaken selection could misclassify related tags.

Restores domain display and editing on the Classification page by reading domains from the classification itself and saving through its own PATCH path, with failed saves keeping the previously saved domains. Also fixes a flash of the tags table when creating a new classification, and hides the domain editor on the version history page. Resolved: a failed domain save no longer shows the new domains, and a late domain save can no longer write onto another classification. No issues remain open.

✅ 2 closed
✅ Bug: Failed domain save still shows the new domains

📄 openmetadata-ui/src/main/resources/ui/src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx:816-821
The new onUpdate calls handleUpdateClassification. TagsPage documents that handler as the non-throwing version for inline edits: it catches every error from updateClassification and resolves anyway (TagsPage.tsx, handleUpdateClassification). saveDomainViaOnUpdate in DomainSyncUtils.ts only skips setActiveDomain(selectedDomain) when onUpdate rejects.

So when the PATCH fails (403, conflict or network error), the user gets an error toast, but the Domains widget still shows the selection as if it had been saved. The domains prop never changes, so the sync effect never resets the widget, and the wrong domains stay on screen until the page reloads.

Fix: give the domain editor a save path that rejects on failure. For example, pass a throwing update prop down from TagsPage (updateClassification), or have this callback re-throw when the update fails.

✅ Edge Case: Domain save callback can write domains onto another classification

📄 openmetadata-ui/src/main/resources/ui/src/pages/TagsPage/TagsPage.tsx:404-408 📄 openmetadata-ui/src/main/resources/ui/src/components/Classifications/ClassificationDetails/ClassificationDetails.tsx:812-814 📄 openmetadata-ui/src/main/resources/ui/src/components/Classifications/ClassificationDetails/ClassificationDetails.interface.ts:34
handleClassificationDomainsUpdate merges the saved domains into whatever classification is current when the PATCH resolves (prev && { ...prev, domains }). It never checks that prev is the classification that was patched. Here is how it goes wrong: a user clicks Apply on classification A and selects classification B in the left panel before the GET+PATCH in saveDomainViaApi finishes. B's state then gets A's domains. B's Domains panel shows them, the Edit drawer pre-fills them, and saving that drawer would write them to B on the server. The fix is to pass the patched entity's id from afterDomainUpdateAction (updated.id) and merge only when prev.id matches.

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

@sweta1308
sweta1308 merged commit bacceff into open-metadata:main Nov 25, 2026
53 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.0 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.1 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 2.1 opened as #38725. Claude resolved a cherry-pick conflict to build it. It merges itself once the checks pass, so read the diff now if this change is a sensitive one.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 2.0 failed. The conflict could not be resolved, so this change is not on that branch. Resolver run.

Rohit0301 pushed a commit that referenced this pull request Nov 26, 2026
…38725)

* fix: restore domain display and editing for classifications

* fix(ui): save classification domains through the page's update handler

Route the Domains panel's save through handleUpdateClassification, as the
Owners panel does, so TagsPage's classification state reflects the new
domains. Add a browser test that renders the assigned domain and replaces
it through the picker.

* fix(ui): open a new classification on its empty state without a tags table flash

After creating a classification, make it the current one with termCount 0
instead of leaving the previous classification on screen until the name
fetch lands, and render the empty state directly for a classification known
to have no tags rather than the loading tags table.

* fix(ui): keep the saved classification domains when a domain save fails

Drop the onUpdate route through handleUpdateClassification: that handler
swallows errors, so DomainLabel showed the unsaved selection after a
rejected PATCH. DomainLabel's own API save keeps its previous domains on
failure. Add a browser test for the rejected save.

* fix(ui): keep classification domains read-only in version view and in sync after a panel save

- Gate the Domains panel editor on !isVersionView, as the Owners widget is,
  so the version history page cannot PATCH the live classification.
- Merge the saved domains into TagsPage's current classification through
  afterDomainUpdateAction, so the Edit drawer pre-fills the saved domains.
- Drive the domain picker in browser tests through openPicker/setSelected,
  and add tests for the version-view gate and the edit-form domains.

* fix(ui): keep a late domain save from landing on another classification

Key the Domains panel by classification id so a save that resolves after
switching classifications cannot update the new panel, and merge saved
domains into TagsPage state only when the patched id matches the current
classification. Add a browser test that holds the PATCH across a switch.

---------



(cherry picked from commit bacceff)

Co-authored-by: Alex Castillo González <82875882+pcbeingused333@users.noreply.github.com>
Co-authored-by: Sweta Agarwalla <swetaagarwalla13@gmail.com>
Co-authored-by: Sweta Agarwalla <105535990+sweta1308@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Domain panel does not work on the Classification page

4 participants