Skip to content

Fix: align glossary term relation type colors with design system#27142

Merged
sonika-shah merged 12 commits intomainfrom
fix/glossary-relation-type-colors
Apr 13, 2026
Merged

Fix: align glossary term relation type colors with design system#27142
sonika-shah merged 12 commits intomainfrom
fix/glossary-relation-type-colors

Conversation

@sonika-shah
Copy link
Copy Markdown
Collaborator

@sonika-shah sonika-shah commented Apr 7, 2026

Fixes #3344

Summary

  • Root cause: System-defined relation types (relatedTo, synonym, antonym, broader, narrower, partOf, hasPart, calculatedFrom, usedToCalculate, seeAlso) were initialised with old Ant Design palette colors (#1890ff, #722ed1, …) when the feature launched. The frontend RELATION_META constants were later updated to the new design-system colors (#1570ef, #b42318, …), but the stored backend values were never synced. Because renderColorBadge used record.color (from the backend) unconditionally, the stale colors always won.
  • Frontend fix: renderColorBadge now treats RELATION_META as authoritative for system-defined types — correct colors show immediately regardless of what is stored in the DB.
  • Backend fix: Default colors in SettingsCache.java updated for brand-new installations.
  • DB migration (2.0.0): postDataMigrationSQLScript.sql added for both MySQL and PostgreSQL. Updates only the color field of each named system-defined type using JSON path lookups — custom relation types added by users are untouched.

Color mapping

Relation type Old (Ant Design) New (Design System)
relatedTo #1890ff #1570ef
synonym #722ed1 #b42318
antonym #f5222d #b54708
broader #597ef7 #067647
narrower #85a5ff #4e5ba6
partOf #13c2c2 #026aa2
hasPart #36cfc9 #155eef
calculatedFrom #faad14 #6938ef
usedToCalculate #ffc53d #ba24d5
seeAlso #eb2f96 #c11574

Test plan

  • Frontend unit tests (GlossaryTermRelationSettings.test.tsx):
    • System-defined type with stale backend color (#1890ff) renders the design-system label, not the raw hex
    • Custom type renders its user-set color
    • Type with no color renders
  • Integration test (GlossaryTermRelationSettingsIT#test_systemDefinedRelationTypesHaveCorrectDesignSystemColors): asserts each of the 10 system-defined types returns the expected design-system hex from the settings API
  • Existing integration tests in GlossaryTermRelationSettingsIT continue to pass
  • For existing deployments: run the 2.0.0 migration SQL or delete the glossaryTermRelationSettings row and restart the server — relation type colors in Settings UI should match the expected values

System-defined relation types (relatedTo, synonym, antonym, etc.) were
initialized with old Ant Design palette colors (#1890ff, #722ed1, …) while
the frontend RELATION_META constants had been updated to the new design
system colors (#1570ef, #b42318, …). Because renderColorBadge used
record.color (from the backend) unconditionally, the stale Ant Design
colors were always displayed instead of the intended ones.

- Frontend: renderColorBadge now treats RELATION_META as authoritative for
  system-defined types so the correct design-system color is always shown,
  regardless of what color value is stored in the backend.
- Backend (SettingsCache.java): default colors updated for new installs.
- DB migration (2.0.0): postDataMigrationSQLScript added for MySQL and
  PostgreSQL to update colors in existing deployments without touching
  user-added custom relation types.
- Tests: unit tests for renderColorBadge color-resolution logic; integration
  test asserting all ten system-defined types return the expected hex values
  from the API.

Fixes #openmetadata/OpenMetadata
@sonika-shah sonika-shah requested a review from a team as a code owner April 7, 2026 19:05
Copilot AI review requested due to automatic review settings April 7, 2026 19:05
@github-actions github-actions bot added backend safe to test Add this label to run secure Github workflows on PRs labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Aligns system-defined glossary term relation type colors with the current design system by making the UI prefer frontend constants for system types, updating backend defaults for new installs, and providing DB migrations to sync existing stored settings.

Changes:

  • UI: Prefer RELATION_META colors for isSystemDefined relation types when rendering the color badge.
  • Backend: Update default system-defined relation type colors in SettingsCache for fresh installations.
  • Migrations + tests: Add MySQL/Postgres post-migration scripts for 2.0.0 and add unit/integration tests to validate the corrected colors.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
openmetadata-ui/src/main/resources/ui/src/pages/GlossaryTermRelationSettings/GlossaryTermRelationSettings.tsx Ensures system-defined types render design-system colors regardless of stale DB values.
openmetadata-ui/src/main/resources/ui/src/pages/GlossaryTermRelationSettings/GlossaryTermRelationSettings.test.tsx Adds unit tests for system-defined vs custom color rendering behavior.
openmetadata-service/src/main/java/org/openmetadata/service/resources/settings/SettingsCache.java Updates default colors for system-defined glossary term relation types for new installs.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/GlossaryTermRelationSettingsIT.java Adds integration test asserting design-system colors are returned by the settings API.
bootstrap/sql/migrations/native/2.0.0/postgres/postDataMigrationSQLScript.sql Postgres migration to update stored system-defined relation type colors in settings JSON.
bootstrap/sql/migrations/native/2.0.0/mysql/postDataMigrationSQLScript.sql MySQL migration to update stored system-defined relation type colors in settings JSON.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🟡 Playwright Results — all passed (27 flaky)

✅ 3597 passed · ❌ 0 failed · 🟡 27 flaky · ⏭️ 207 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 454 0 3 2
🟡 Shard 2 641 0 2 32
🟡 Shard 3 643 0 6 26
🟡 Shard 4 619 0 8 47
🟡 Shard 5 607 0 2 67
🟡 Shard 6 633 0 6 33
🟡 27 flaky test(s) (passed on retry)
  • Features/CustomizeDetailPage.spec.ts › Pipeline - customization should work (shard 1, 1 retry)
  • Flow/Tour.spec.ts › Tour should work from URL directly (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/ChangeSummaryBadge.spec.ts › Automated badge should appear on entity description with Automated source (shard 2, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/UserProfileOnlineStatus.spec.ts › Should show online status badge on user profile for active users (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Table (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for File (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Rename domain with owners and experts preserves assignments (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Verify Domain entity API calls do not include invalid domains field in tag assets (shard 4, 1 retry)
  • Pages/DomainUIInteractions.spec.ts › Add expert to domain via UI (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Glossary Term Add, Update and Remove for child entities (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Glossary Term Add, Update and Remove (shard 4, 1 retry)
  • Pages/ExploreTree.spec.ts › Verify Database and Database Schema available in explore tree (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Add and Remove Assets (shard 5, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/ServiceEntity.spec.ts › User as Owner Add, Update and Remove (shard 6, 1 retry)
  • Pages/UserDetails.spec.ts › Create team with domain and verify visibility of inherited domain in user profile after team removal (shard 6, 1 retry)
  • Pages/Users.spec.ts › Create and Delete user (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

…te 1.13.0 migration; Remove glossary term relation migrations mistakenly re-added in 1.13.0 and update relation type colors in the 1.14.0 migration INSERT to use design system tokens instead of old Ant Design colors.
Copilot AI review requested due to automatic review settings April 10, 2026 10:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

anuj-kumary
anuj-kumary previously approved these changes Apr 13, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 13, 2026 06:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@sonika-shah
Copy link
Copy Markdown
Collaborator Author

sonika-shah commented Apr 13, 2026

Regarding the frontend unit test removal — discussed with the team, the test file is not required for this PR. The color logic is covered by the backend integration test (GlossaryTermRelationSettingsIT.java) which validates that all 10 system-defined relation types have the correct design-system colors. The frontend change is a straightforward priority swap in renderColorBadge (prefer RELATION_META for system-defined types) and does not warrant a separate unit test.

cc - @gitar-bot please update the comment accordingly #27142 (comment)

@github-actions
Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.89% (59751/93521) 43.62% (31232/71591) 46.75% (9395/20093)

@gitar-bot
Copy link
Copy Markdown

gitar-bot bot commented Apr 13, 2026

Code Review ⚠️ Changes requested 1 resolved / 2 findings

Aligns glossary term relation type colors with the design system but deletes the only frontend unit test file for GlossaryTermRelationSettings without providing a replacement, leaving critical functionality untested.

⚠️ Quality: Deleted only frontend unit test file with no replacement

The latest commit removes GlossaryTermRelationSettings.test.tsx (169 lines), which was the only unit test covering the frontend component. The PR description explicitly lists frontend unit tests in the test plan (system-defined type rendering stale backend color, custom type rendering, no-color fallback), yet this commit deletes them entirely.

The Java integration test (GlossaryTermRelationSettingsIT.java) covers backend behavior but cannot verify frontend-specific logic like the renderColorBadge callback that was modified in this PR (the system-defined vs custom color priority logic).

If the test was removed intentionally (e.g., moved to another PR or replaced by E2E tests), please note that in the PR description. Otherwise, the renderColorBadge change — which is the core frontend fix — now has zero automated test coverage.

✅ 1 resolved
Bug: Migration scripts removed — existing deployments keep stale colors

📄 openmetadata-ui/src/main/resources/ui/src/pages/GlossaryTermRelationSettings/GlossaryTermRelationSettings.tsx:221-223
The first two commits (4c08d1f, d84d391) removed the MySQL and PostgreSQL postDataMigrationSQLScript.sql files that would have updated the stored color values in the glossaryTermRelationSettings row during a 2.0.0 upgrade. Without these migration scripts, existing deployments will retain the old Ant Design hex values in the database.

The frontend renderColorBadge fix (preferring RELATION_META for system-defined types) masks this on the UI side, but the backend settings API will still return the old colors to any other consumer (e.g., API clients, mobile apps, custom integrations). The PR summary even says the migration is part of the fix, and the integration test test_systemDefinedRelationTypesHaveCorrectDesignSystemColors will fail on upgraded environments because the DB row was never patched.

If the scripts were intentionally removed (e.g., to ship them in a later PR or a different migration version), please note that in the PR description. Otherwise, the migration SQL files should be restored.

🤖 Prompt for agents
Code Review: Aligns glossary term relation type colors with the design system but deletes the only frontend unit test file for GlossaryTermRelationSettings without providing a replacement, leaving critical functionality untested.

1. ⚠️ Quality: Deleted only frontend unit test file with no replacement

   The latest commit removes `GlossaryTermRelationSettings.test.tsx` (169 lines), which was the only unit test covering the frontend component. The PR description explicitly lists frontend unit tests in the test plan (system-defined type rendering stale backend color, custom type rendering, no-color fallback), yet this commit deletes them entirely.
   
   The Java integration test (`GlossaryTermRelationSettingsIT.java`) covers backend behavior but cannot verify frontend-specific logic like the `renderColorBadge` callback that was modified in this PR (the system-defined vs custom color priority logic).
   
   If the test was removed intentionally (e.g., moved to another PR or replaced by E2E tests), please note that in the PR description. Otherwise, the `renderColorBadge` change — which is the core frontend fix — now has zero automated test coverage.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants