Skip to content

Fixes #36885: hide the domain edit on a tag of a disabled classification - #36886

Merged
anuj-kumary merged 6 commits into
mainfrom
fix/tag-page-disabled-domain-edit
Nov 3, 2026
Merged

anuj-kumary merged 6 commits into
mainfrom
fix/tag-page-disabled-domain-edit

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #36885

When a Classification is disabled, its tags should open read-only. On the Tag detail page the owner control was hidden, but the Add Domain button still showed for users who hold EditDomains, admins included.

Why: #33471 added the EditDomains operation and switched the generic domain widget (DomainWidget → useGenericDomainLabel) from canEditAll to canEditDomains (EditAll || EditDomains). TagPage hands its GenericProvider a set of permissions that forces EditAll and EditOwners off when the tag is disabled or deleted, but it didn't cover EditDomains, so the raw permission still reached the widget.

What:

  • TagPage now gates EditDomains with isEditable && canEditDomains, the prioritized flag useEntityPermissions already returns. A disabled or deleted tag denies the domain edit. An enabled tag keeps its own permission, including an explicit EditDomains: false under EditAll: true (deny wins). This matches ClassificationDetails, which uses isEditable && flags.canEditDomains.
  • Tags.spec.ts now waits for the lazy domain widget before asserting add-domain is not visible.

Why the spec passed until now: the bug has existed since #33471 (Oct 16), and Tags.spec runs in most merge-queue runs, where it kept passing. The widgets on the Tag page are React.lazy. waitForAllLoadersToDisappear doesn't wait for their skeleton, and expect(...).not.toBeVisible() passes as soon as the element is absent. So whenever the domain widget hadn't mounted yet at Tags.spec.ts:193, the check passed without testing anything. It's a timing race, not a regression. The same code both passed and failed on Nov 2: #36858's own merge group failed, while #36695's group, built on top of #36858's commit (298565b4), passed. With the new wait, the spec now checks the real behaviour on every run.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • On a tag of a disabled classification, a user with EditAll, EditOwners and EditDomains gets no owner or domain edit control.
  • An enabled tag with EditAll: true, EditDomains: false keeps the domain edit denied (field-level deny wins).

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated: src/pages/TagPage/TagPage.test.tsx. New cases denies owner and domain edits on a disabled tag even with EditDomains and keeps an explicit EditDomains deny on an enabled tag with EditAll check the permissions TagPage passes to GenericProvider.
  • Without the fix, the new test fails with exactly the CI symptom ({"EditAll": false, "EditDomains": true, "EditOwners": false}). With it, all 12 TagPage tests pass.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Files updated: playwright/e2e/Pages/Tags.spec.ts. Before the existing not.toBeVisible checks (Tags.spec.ts:193), it now waits for the domain widget (KnowledgePanel.Domain) to render, so they can't pass vacuously. I haven't run it locally; the merge queue runs it.

Manual testing performed

Diagnosed from the merge-queue logs on #36858 (runs 41524642539 and 41574791631). The add-domain button resolved visible on the disabled tag's page in every attempt.

UI screen recording:

Not applicable — permission-gating bug fix with no new UI. The behaviour is covered by the unit test above and the existing Playwright spec.

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.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md and fixed every 🔴 finding, or answered it on the line below. Two-line gate plus one test; no findings.

  • Decision check: no durable decision. This applies the existing disabled-aware gating to the operation Fixes 33420: authorize the target domain when an asset is reassigned #33471 added.

  • I have added a test that covers the exact scenario we are fixing.

TagPage forces EditAll and EditOwners off for a disabled or deleted tag,
but EditDomains, added in #33471 and read by the generic domain widget,
passed through, so admins still saw Add Domain.
@anuj-kumary anuj-kumary added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels Nov 3, 2026
@anuj-kumary
anuj-kumary requested a review from a team as a code owner November 3, 2026 05:05
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

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

@anuj-kumary anuj-kumary self-assigned this Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 1024 → 1028
- 4 added, 0 removed, 37 changed spec-list

New source→spec entries:
  openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaTable/ColumnCustomPropertyCell.tsx
  openmetadata-ui/src/main/resources/ui/src/components/common/Form/JSONSchema/JsonSchemaWidgets/LdapRoleMappingWidget/LdapRoleMappingWidget.tsx
  openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/components/AccessTokenRow.tsx
  openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/access-control/AccessControlRulesTable.tsx

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/e2e/fixtures/pages.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/Entity.interface.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/fixtures/isolatedUser.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/aiProfile.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/apiResponse.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/customProperty.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/dragDrop.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts
  … and 27 more

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 3 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 3 warning(s) across 1 changed file(s).

Count Rule
3 react-hooks/exhaustive-deps
All findings
Location Rule Message
🟡 src/pages/TagPage/TagPage.tsx:351:9 react-hooks/exhaustive-deps The 'activeTabHandler' function makes the dependencies of useCallback Hook (at line 517) change on every render. To fix this, wrap the definition of 'activeTabH
🟡 src/pages/TagPage/TagPage.tsx:746:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'fetchFeedCount'. Either include it or remove the dependency array.
🟡 src/pages/TagPage/TagPage.tsx:826:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.16% (137684/169629) 68.12% (49499/72660) 71.16% (27841/39122)

…Tags.spec

Gate the prioritized EditDomains value instead of OR-ing it with EditAll,
so a field-level deny still wins on an enabled tag. The spec's
not.toBeVisible check passed vacuously while the lazy domain widget had
not mounted; wait for the widget first.
ui-checkstyle bans getPrioritizedEditPermission in components; the hook
already exposes the same prioritized value as a named flag.
@anuj-kumary
anuj-kumary enabled auto-merge November 3, 2026 05:58
@anuj-kumary
anuj-kumary added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 3, 2026
@github-actions github-actions Bot added the merge conflict Conflicts with the latest main; removed from the merge queue label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — merge_conflict (2026-11-03T16:11:50Z)

The entry left the queue before it was built, so no checks ran against it.

Conflicts with the latest main — rebase, then re-queue.

@github-actions github-actions Bot removed the merge conflict Conflicts with the latest main; removed from the merge queue label Nov 3, 2026
@anuj-kumary
anuj-kumary enabled auto-merge (squash) November 3, 2026 17:01
@gitar-bot

gitar-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Changing TagPage's EditDomains gate alters permission decisions; disabled tags may lose domain-edit controls, preventing users from making needed domain updates.

Hides the Add Domain control on tags of disabled classifications by gating EditDomains with isEditable && canEditDomains in TagPage, and makes the Tags.spec Playwright check wait for the lazy domain widget before asserting visibility. An earlier issue where EditDomains OR'd with EditAll overrode an explicit domain deny on enabled tags was resolved. No open issues found.

✅ 1 closed
✅ Bug: EditDomains OR with EditAll overrides explicit domain deny on enabled tags

📄 openmetadata-ui/src/main/resources/ui/src/pages/TagPage/TagPage.tsx:297-298 📄 openmetadata-ui/src/main/resources/ui/src/pages/TagPage/TagPage.test.tsx:498-512
The new line EditDomains: isEditable && (tagCanEditAll || tagPermissions.EditDomains) also changes enabled tags. Take a policy with EditAll: true, EditDomains: false. Before this change, ...tagPermissions passed EditDomains: false through unchanged, and getDerivedPermissionFlags in useGenericDomainLabel denied the edit, because getPrioritizedEditPermission lets the field key win over EditAll. Now the key is rewritten to true, so the Add Domain button appears for a user whose policy withholds domain reassignment. That goes against the deny-wins rule (permissionPolicy.ts (b), PermissionDerivation.test.ts:41-62) and against the PR's own constraint that enabled tags keep their permissions unchanged. ClassificationDetails avoids this by using isEditable && flags.canEditDomains, not a raw OR.

The fix is to gate the prioritized value with isEditable and let the downstream derivation do the rest. The new test only covers the disabled case, so add a case for an enabled tag with EditAll: true, EditDomains: false that asserts the domain edit is hidden.

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

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@anuj-kumary
anuj-kumary merged commit 8281dd5 into main Nov 3, 2026
66 checks passed
@anuj-kumary
anuj-kumary deleted the fix/tag-page-disabled-domain-edit branch November 3, 2026 17:54
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.

Add Domain button still shown on a tag of a disabled classification

2 participants