Skip to content

fix(ui): distinguish composite unique constraints - #37750

Merged
IceS2 merged 6 commits into
mainfrom
assess-constraint-issue
Nov 18, 2026
Merged

IceS2 merged 6 commits into
mainfrom
assess-constraint-issue

Conversation

@IceS2

@IceS2 IceS2 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Composite UNIQUE membership currently uses the same column-row indicator as individual uniqueness, and deduplicating by constraint type hides overlapping groups. Keep the existing glyphs before the column name and identify each composite group with a small blue badge containing the snowflake and a letter. Standalone constraint icons keep their existing appearance. A column in two groups shows separate A and B indicators, each with its own tooltip. The same group has the same letter across all its member columns.

Earlier indicator, before the group-letter revision:

image

Type of change:

  • Bug fix

High-level design:

prepareConstraintIcon assigns letters across the table’s composite UNIQUE constraints before selecting the groups containing each column. Each matching group gets a separate icon and letter inside the existing design-system blue Badge, with its column list in the tooltip and accessible name. The badge uses the requested light fill (#EFF8FF), border (#B2DDFF), and icon/letter color (#175CD3) through existing tokens. Letters follow table-constraint order and continue after Z as AA, AB, and so on. Individual uniqueness stays unlettered. The schema name container uses its available width so overlapping indicators stay together before the column name. Column names and constraint indicators share a horizontal centerline in the Columns and version-history views. Version history assigns letters from one shared list of current, added, and deleted groups before rendering each column’s diff badges.

Two new translation keys are synchronized and translated across the locale files. This change requires no schema, backend, ingestion, or data migration changes.

Tests:

Use cases covered

  • A column belonging to two composite UNIQUE groups shows A and B, with separate tooltips that exclude unrelated groups.
  • A group keeps its letter across member columns, including when a column belongs only to group B. Labels continue correctly beyond Z.
  • Individual uniqueness remains distinct, including when both individual and composite constraints are represented at table level.
  • A column-level NOT_NULL indicator remains visible alongside composite membership.
  • Keyboard focus opens the composite tooltip; Escape dismisses it.

Unit tests

yarn test src/components/Entity/VersionTable/VersionTable.test.tsx src/utils/TableUtils.test.tsx src/components/Database/SchemaTable/SchemaTable.test.tsx --watch=false --runInBand — 194 passed across 3 suites. New version-history cases cover overlapping additions, unchanged preceding groups, mixed additions/deletions, and removal of all groups. Coverage percentage was not collected.

Backend integration tests

Not applicable — no backend or API changes. The unchanged backend was built locally to run a matching application instance.

Ingestion integration tests

Not applicable — no ingestion changes.

Playwright (UI) tests

PLAYWRIGHT_IS_OSS=true yarn playwright:run playwright/e2e/Features/TableConstraint.spec.ts --project=chromium --workers=1 — 4 stages passed, including authentication setup, entity setup, the constraint flow, and cleanup. The run covers the letter indicator and its keyboard tooltip; the final name-container spacing and blue badge styling were checked in Waterfox.

The existing constraint flow checks the visible group letter, composite tooltip contents through keyboard focus, and dismissal through Escape. The full impact-mapped suite remains pending; make playwright_affected reports shared-helper mapping gaps and a broad selection.

Visual regression baselines

Linux visual baseline refresh remains pending. Keeping this PR as a draft for UI review.

Other validation

  • Production UI build, focused ESLint/import organization/Prettier, locale synchronization, license checks, and design-token audit passed.
  • Application type checking with --declaration false --declarationMap false currently reports TS18048 in unchanged src/utils/queryBuilderWidgets/OMSelectWidget.tsx:59 (item.label possibly undefined). No errors are reported in the files changed here.
  • Self-review of the follow-up against REVIEW.md: 79f49a2baa5. The group-letter finding in table version history is addressed by a shared label source, with regression coverage in VersionTable.test.tsx. Shared renderer and letter-label logic map to TableUtils.test.tsx and TableConstraint.spec.ts; name-cell rendering maps to SchemaTable.test.tsx; grouped icon rendering maps to ConstraintIcon.test.tsx.

Manual testing performed

  1. Ran the existing source-built backend with the updated production UI in an isolated local Docker stack with PostgreSQL and Elasticsearch.
  2. Seeded invented tables covering individual uniqueness and two overlapping composite groups.
  3. Inspected the actual table in Waterfox: the shared column shows A and B, the other members show the matching letters, and hovering each indicator shows only its group. Verified the exact requested blue badge fill, border, icon and letter colors, unchanged neutral standalone uniqueness, 12px letters, separate group tooltips, an inline layout without wrapping the demo column names, and matching centerlines for names and constraint indicators.

UI screen recording:

Not applicable — standalone correction to existing constraint indicators and tooltips. The running application was reviewed locally in Waterfox.

Checklist:

  • Added regression tests for the changed behavior.
  • Reviewed the committed diff against REVIEW.md.
  • Preserved existing API and schema contracts; no migration needed.
  • Synchronized and translated the new locale keys.
  • Linux visual baselines and broader impacted checks remain pending.

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge.

Summary

Composite UNIQUE groups now have separate lettered badges and tooltips, while standalone uniqueness keeps its existing appearance.

  • Columns in overlapping unique groups get separate letter badges.
  • Composite unique constraints get their own tooltip title.

The previous version-history finding is fixed. No new actionable issues were found.

Reviews (4) · Last reviewed commit: "fix(ui): keep composite labels consisten..." · Reviewed by Greptile

@IceS2
IceS2 marked this pull request as ready for review November 13, 2026 10:01
@IceS2
IceS2 requested a review from a team as a code owner November 13, 2026 10:01
@IceS2
IceS2 requested review from ShaileshParmar11 and a balanced review from Copilot November 13, 2026 10:01
@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.

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 12:44

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 13:40

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 13:46

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 14:31

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 18, 2026

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

Composite-constraint badges and tooltips alter UI interpretation; incorrect group labels could mislead users about which columns jointly define uniqueness.

Distinguishes composite UNIQUE groups in the table UI with lettered blue badges and per-group tooltips, while individual uniqueness stays unlettered. Group letters are now resolved consistently even when only a subset of groups is passed in, addressing the letter mismatch finding. No open issues remain.

✅ 1 closed
✅ Bug: Group letters follow the subset passed in, not the full table list

📄 openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx:370-374 📄 openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx:405-419
prepareConstraintIcon picks each group's letter from its index in whatever tableConstraints it receives (TableUtils.tsx:370-374, 411). VersionTable.component.tsx does not pass the table's full list when a constraint diff exists. It builds addedTableConstraint and deletedTableConstraint for each column, keeping only the constraints that include that column, and passes those instead.

Example: groups (warehouse_id, item_code) and (item_code, locale) are both added in a version. The locale row gets a one-item list, so its group is labelled A, while the item_code row labels the same group B. The added and deleted icons are also lettered separately, so two different groups can both show A. This breaks the PR's promise that a group keeps the same letter on every member column, and the version history shows misleading labels.

Fix: let callers pass the table-wide composite constraint list, or a precomputed label map keyed by the group's columns, as a separate input. Version views can then label diffed groups from one shared ordering.

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

@IceS2
IceS2 merged commit 2790240 into main Nov 18, 2026
53 of 56 checks passed
@IceS2
IceS2 deleted the assess-constraint-issue branch November 18, 2026 14:52
chirag-madlani added a commit that referenced this pull request Nov 19, 2026
…37750) (#38178)

* fix(ui): distinguish composite unique constraints (#37750)

* fix(ui): distinguish composite unique constraints

* fix(ui): identify composite unique groups with letters

* fix(ui): style composite unique indicators as blue badges

* fix(ui): keep composite labels consistent in table history

(cherry picked from commit 2790240)

* test(ui): adapt composite unique constraint tests to antd tooltips on 2.0

---------

Co-authored-by: IceS2 <[email protected]>
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.

3 participants