Skip to content

Fixes #29687: glossary term inverse relation types show wrong perspective - #32891

Queued
anuj-kumary wants to merge 3 commits into
mainfrom
fix/29687-glossary-inverse-relation
Queued

Fixes #29687: glossary term inverse relation types show wrong perspective#32891
anuj-kumary wants to merge 3 commits into
mainfrom
fix/29687-glossary-inverse-relation

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #29687 — When custom glossary term relation types with inverses (e.g. “uses”/“usedIn”) are configured, both sides of a relation can show the same type instead of showing inverses. Editing the type reverts on page refresh. Root cause is UUID-ordering-dependent one pair works, another doesn’t.

Root cause: addTermRelation and matchesRelation compare user-authored relation types against already-inverted display types returned by getRelatedTerms(). When a user sends type "uses" but the existing relation displays as "usedIn" (after inverse resolution), the check incorrectly concludes the relation doesn't exist — potentially creating duplicate relations or failing to find existing ones for removal.

Fix: Add isEquivalentRelationType() that treats a type and its registered inverse as equivalent, and use it in:

  • addTermRelation existence check (prevents duplicate relations across inverse types)
  • matchesRelation (makes removes robust against inverse type mismatches)

The comparison is symmetric (checks inverse in both directions) and safe for unregistered types (catches BadRequestException instead of throwing).

Changes

  • GlossaryTermRepository.java — new isEquivalentRelationType + safeInverseName helpers; updated addTermRelation dedup check and matchesRelation to use them
  • GlossaryTermRelationEdgeIT.java — two new integration tests:
    • customInverseRelationTypesPreserveCorrectPerspective — verifies both sides of narrower/broader relations show the correct perspective type
    • addTermRelationDetectsDuplicateAcrossInverse — verifies the dedup check recognizes inverse types as equivalent

Test plan

  • Existing GlossaryTermRelationEdgeIT tests pass (inverse behavior unchanged for correct cases)
  • New customInverseRelationTypesPreserveCorrectPerspective test passes
  • New addTermRelationDetectsDuplicateAcrossInverse test passes

🤖 Generated with Claude Code

@anuj-kumary
anuj-kumary requested a review from a team as a code owner September 7, 2026 15:24
@github-actions github-actions Bot added the UI UI specific issues label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

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!

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 1e7926c83accad5e95fe070f343510ec0bafc84a in Playwright run 34149366893, attempt 1.

✅ 561 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 44m 56s

⏱️ Max setup 4m 9s · max shard execution 19m 11s · max shard-job elapsed before upload 22m 18s · reporting 3s

🌐 234.33 requests/attempt · 2.81 app boots/UI scenario · 8.43% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 234.33 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.81 per UI scenario (1636 boots / 582 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 145 0 0 0 0 0
✅ Shard chromium-02 125 0 0 0 0 0
✅ Shard chromium-03 133 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

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

anuj-kumary and others added 2 commits September 7, 2026 22:47
…tive

The existence check in `addTermRelation` compared user-authored types
against already-inverted display types from `getRelatedTerms()`, failing
to detect duplicates when the user's type was the inverse of the stored
canonical type. The same mismatch affected `matchesRelation` used by
the remove endpoint. Add `isEquivalentRelationType` that treats a type
and its registered inverse as equivalent for these comparisons.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d types

Address gitar-bot review findings:
- Check inverse in both directions so one-directional custom inverse
  registrations are still deduped/matched
- Guard inverse lookup so unregistered types return no-match instead
  of throwing BadRequestException

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anuj-kumary
anuj-kumary force-pushed the fix/29687-glossary-inverse-relation branch from a48ddde to a7cfbbb Compare September 7, 2026 17:18
@anuj-kumary
anuj-kumary force-pushed the fix/29687-glossary-inverse-relation branch from 77f2856 to 01979eb Compare September 7, 2026 17:38
…both sides

Add E2E tests for #29687 that verify the UI shows the correct relation
perspective on each side of an asymmetric relation (narrower/broader,
hasPart/partOf) and that the correct type persists after page reload.

Uses the base fixture with serverLoadReducers, beforeAll/afterAll API
setup via getDefaultAdminAPIContext, addTermRelation API utility, and
term.visitEntityPage() for navigation — matching the established
GlossaryRelationsGraph test patterns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anuj-kumary
anuj-kumary force-pushed the fix/29687-glossary-inverse-relation branch from 01979eb to 1e7926c Compare September 7, 2026 17:52
@gitar-bot

gitar-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Fixes inconsistent inverse relation display for custom glossary term relation types by making the equivalence check symmetric and safe for unregistered types. isEquivalentRelationType() now treats a type and its registered inverse as equivalent in dedup and removal logic, preventing duplicate relations and edit reversions. No issues found.

Options

Display: compact → Showing less information.

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

@anuj-kumary
anuj-kumary added this pull request to the merge queue Sep 8, 2026
Any commits made after this event will not be merged.
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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glossary Term Relation types - Issue with inverse relation

3 participants