Skip to content

Fixes #27257: Test library improvement - #33620

Merged
TeddyCr merged 20 commits into
mainfrom
agent/issue-27257
Sep 23, 2026
Merged

TeddyCr merged 20 commits into
mainfrom
agent/issue-27257

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request was opened by an olivaw agent. It is an input to review, not an approved change — read the diff, not this description.

Fixes #27257

Screen.Recording.2026-09-21.at.8.58.13.PM.mov

What olivaw checked (machine-observed, §8.2/A.1)

  • diff: non-empty
  • build: not_run
  • tests: not_run
  • base: c50cee57038cf9d67b3bb40a5f8fce3829e3c0ad
  • head: 4b50b1baeea260a7b3ea0063adf1b79c1d58c816

No build or test command is configured for this workspace, so only the diff's existence was checked. Set run_config.build_cmd/test_cmd to have olivaw verify its own work.

What the agent says it did (unverified)

Committed on agent/issue-27257. Here's what landed.

Search

GET /v1/dataQuality/testDefinitions takes a new q param that maps onto ListFilter's existing nameFilter condition — a case-insensitive match against both name and displayName. Because ListFilter.getCondition() feeds every listing path, search composes with the entity-type / test-platform filters and works across pages.

It had to be server-side: the listing is cursor-paged at 15 rows, so filtering what's already fetched would only search the current page. Fetching everything instead isn't an option either — useTestDefinitionRowPermissions issues a permission query per row.

On the UI, both Test Library surfaces (the app-mode TestDefinitionFilterBar and the classic TestDefinitionList) get a debounced search box via the existing useListSearchInput atom, backed by a q URL param.

Sort by display name

TestDefinitionDAO's keyset SQL now orders by LOWER(COALESCE(NULLIF(displayName,''), name)), and TestDefinitionRepository.getCursorValue builds cursors from the same key so paging walks that sequence. I also re-pointed getCursorAtOffset at it — the distributed indexers seed a partition from that offset lookup and then page forward through listAfter, so leaving it on name order would have made partitions skip or repeat rows.

Decisions worth flagging

  • The sort key reads both halves out of json, not the name column. On MySQL, COALESCE across a JSON_UNQUOTE result and a VARCHAR column raises "Illegal mix of collations". Documented at the constant.
  • "Clear all" clears the search term in the same URL update as the quick filters. useTableFilters merges each call against the URL as it stands, so two calls in one tick would rebuild from the pre-navigation state and put the filters back. There's a test pinning the single-update behaviour.
  • No new i18n keys — label.search-entity and label.test-definition-plural already existed, so no locale files needed touching.

Verification

  • mvn -pl openmetadata-service -am install -DskipTests → BUILD SUCCESS; spotless made no changes.
  • 127 jest tests pass across the 7 Test Library suites (plus src/pages/TestLibrary); tsc --noEmit and eslint are clean on every changed file.

The SQL ordering itself is only compile-verified — there's no MySQL or Postgres in this environment, so the two dialect variants haven't been executed against a real database.

RetriggerConfidence Score: 4/5

The behavioral changes appear sound, but the explicit design-system icon-import requirement must be satisfied before merging.

Findings

  1. P2 Icon Bypasses Design System ▶
  2. P2 Cleanup Failures Go Unnoticed ▶
  3. P2 Icons Bypass Design System ▶
Summary

This PR adds server-side search and configurable sorting for Test Library definitions, aligns keyset cursors with each selected ordering, and connects the behavior to both Test Library interfaces.

  • Adds search across displayed test-definition fields and filtering through the list API.
  • Adds display-name, entity-type, and test-platform sorting with forward and backward cursor pagination.
  • Adds debounced URL-backed search and sortable Test Library UI controls.
  • Expands integration, unit, and Playwright coverage, including the latest route-lifecycle fix.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  UI[Test Library search and sort controls] --> API[Test Definition list API]
  API --> Filter[ListFilter search and sort parameters]
  Filter --> DAO[Dialect-specific filtering and ordering]
  DAO --> Page[Keyset-paged definitions]
  Page --> Cursor[Repository cursor from active sort key]
  Cursor --> UI
Loading

Reviews (11) · Last reviewed commit: "fix(playwright): stop unrouting a route ..."

The Test Library listing paged through test definitions in `name` order with
no way to look one up, which stops scaling once a deployment adds its own
rules on top of the shipped catalog.

Adds a `q` query param to `GET /v1/dataQuality/testDefinitions` that reuses
the existing `nameFilter` condition (name OR display name, case-insensitive)
so the search runs in SQL and combines with the entity-type / test-platform
filters. Filtering client side would only ever search the page already
fetched, since the listing is cursor-paged.

Orders the listing by display name, falling back to name. The keyset
comparisons in TestDefinitionDAO and the page cursors built by
TestDefinitionRepository.getCursorValue move to that key together, and
getCursorAtOffset is re-pointed at it so keyset partitioning still seeds
itself on the same sequence.

On the UI side both Test Library surfaces (the app-mode filter bar and the
classic list) grow a debounced search box backed by a `q` url param, and
"clear all" now drops the search term in the same url update as the quick
filters.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 19, 2026 00:35

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 reached their quota limit.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Sep 19, 2026
@github-actions

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: 780 → 780
- 0 added, 0 removed, 12 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/constant/config.ts
  openmetadata-ui/src/main/resources/ui/playwright/constant/permission.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/access-control/PoliciesClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/access-control/RolesClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/fixtures/base.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/glossary/Glossary.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/glossary/GlossaryTerm.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/user/UserClass.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/admin.ts
  … and 2 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

Copilot AI review requested due to automatic review settings September 19, 2026 00:35

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 reached their quota limit.

@greptile-apps

greptile-apps Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.

  • P1 Stale searches overwrite results openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionList/useTestDefinitionData.ts:87 ▶

    Each debounced search change starts a new request, and every response replaces the rows and paging state without checking whether it is still current. If an older request resolves after the latest one, it overwrites the latest results, leaving the URL and search input showing one term while the table displays another term's rows. Abort the previous request or guard each state update with a request identity.

  • P2 Icon Bypasses Design System openmetadata-ui/src/main/resources/ui/src/components/observability/TestLibrary/TestLibraryPage.tsx:14 ▶

    This file imports Plus directly from @untitledui/icons. The repository requires application icons to be imported through @openmetadata/ui-core-components/icons so icon dependencies remain aligned with the design system. This requirement must be satisfied before merging.

    import { Plus } from '@openmetadata/ui-core-components/icons';
    

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 72%
72.48% (103709/143081) 57.6% (63182/109681) 58.64% (20671/35245)

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 reached their quota limit.

EntityRepository seeds an uncursored first page with an empty cursor
name. That is an ascending-only sentinel: `key > ''` admits every row
but its descending mirror `key < ''` admits none, so every descending
listing came back empty. The keyset predicate is now dropped entirely
when there is no cursor to walk past, which also stops ascending from
silently skipping rows whose sort key really is the empty string - a
definition declaring no test platforms.

The testPlatforms fixtures gave two rows the same platform, so they tied
on the sort key and fell back to a random UUID; the assertion over that
pair passed or failed by chance. Each fixture now carries a distinct
value for every sortable column.

Also guards the paging walk against comparing two empty lists, which is
how the empty descending listing slipped past it.

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 reached their quota limit.

Every sort, filter and search change set isLoading, and the table
rendered items={isLoading ? [] : rows} with skeletons as the empty
state - so the rows were torn out and replaced by five grey bars on
each interaction. Nothing reloads (useTableFilters navigates with
replace), but three things blanking at once read as a page reload.

The data hook now distinguishes the first load, which genuinely has
nothing to show, from a refetch. Skeletons are for the first load only;
a refetch dims the existing rows in place and marks the container
aria-busy, so the state still reaches a screen reader without a visual
placeholder.

This covers filtering and searching too, not just sorting - they go
through the same refetch path.

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 reached their quota limit.

Keeping the previous rows mounted left their enable, edit and delete
controls live while the next query was in flight. Acting on one patches
a definition the list has already moved on from, and the arriving
response overwrites the toggle, so a successful edit reads as if it had
reverted.

Disabled rather than pointer-events-none, so the controls leave the tab
order too instead of staying keyboard-reachable while looking inert.

Addresses the 'Stale Rows Stay Actionable' review finding, which the
previous commit introduced.

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 reached their quota limit.

Covers the listing end to end: server-side search, sorting by Name,
Entity Type and Test Platforms in both directions, the URL backing all
of it, pagination resetting on a sort change, and the rows staying
visible but inert while a refetch is in flight.

Three fixtures are created via the API sharing a uuid marker, and the
search narrows the listing to exactly those rows so the order can be
asserted absolutely rather than against the seeded catalog. Their
display names sort the opposite way to their internal names, so an
ordering that fell back to the name column fails rather than passing by
coincidence. The entity type assertions read the entity type column
rather than the row names, because two fixtures tie on that key and
break on a random id.

The refetch test gates the listing response behind a promise it releases
itself, so the in-flight state is observed without a timer.

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 reached their quota limit.

@github-actions

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: 796 → 796
- 0 added, 0 removed, 11 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/constant/config.ts
  openmetadata-ui/src/main/resources/ui/playwright/support/fixtures/base.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/admin.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/testDefinitionFilter.ts
  openmetadata-ui/src/main/resources/ui/src/components/PaginationComponent/PaginationComponent.tsx
  openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionList/TestDefinitionTable.component.tsx
  openmetadata-ui/src/main/resources/ui/src/components/common/NextPrevious/NextPrevious.tsx
  openmetadata-ui/src/main/resources/ui/src/components/common/NextPreviousWithOffset/NextPreviousWithOffset.tsx
  … and 1 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

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 reached their quota limit.

Comment on lines +137 to +141
for (const id of createdIds) {
await apiContext.delete(
`${TEST_DEFINITION_API}/${id}?hardDelete=true&recursive=false`
);
}

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.

P2 Cleanup Failures Go Unnoticed

Each hard-delete response is discarded, so a non-2xx response is treated as successful cleanup. This can leave test definitions in the shared Test Library catalog and contaminate later pagination or permissions tests. Assert that every cleanup request succeeds so fixture leaks fail visibly.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 5 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), 5 warning(s) across 3 changed file(s).

Count Rule
2 react-hooks/exhaustive-deps
1 openmetadata-imports/no-circular-imports
1 openmetadata-imports/no-lower-layer-page-imports
1 openmetadata-imports/no-rest-ui-imports
All findings
Location Rule Message
🟡 src/components/TestLibrary/TestDefinitionList/useTestDefinitionData.ts:145:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'fetchTestDefinitions'. Either include it or remove the dependency array.
🟡 src/components/TestLibrary/TestDefinitionList/useTestDefinitionListPage.ts:144:5 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'handlePageChangeCallback'. Either include it or remove the dependency array.
🟡 src/rest/testAPI.ts:47:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/rest/testAPI.ts:47:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/rest/testAPI.ts:47:1 openmetadata-imports/no-rest-ui-imports REST clients must not import UI or state-layer modules. Move shared request/response types to the interface layer.

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

make ui-checkstyle-changed

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 reached their quota limit.

The refetch is supposed to hold the retained rows' controls shut, but the
row cells live in a react-aria collection that serves cached nodes unless
`items` or `dependencies` change. A refetch changes neither - the rows are
the previous query's - so the cells kept the `disabled` value they were
built with and the edit/delete buttons stayed live for the whole refetch.

Add `isRefetching` to the Table.Body dependencies so the collection is
rebuilt when the flag flips.

The Playwright test caught this; the jest tests did not, because every one
of them mounted straight into the refetching state, where the rows are
built disabled on the first render. Cover the transition instead, in both
directions.

Also move the E2E control assertions onto `_aaa`. `_zzz` runs on the Soda
platform, so its Enabled toggle is disabled either way - the assertion
passed without the refetch, and the matching `toBeEnabled()` after the
response landed could never have passed.

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 reached their quota limit.

import { FileShield02 } from '@untitledui/icons';
import { Button, Space, Switch, Tooltip, Typography } from 'antd';
import { useMemo } from 'react';
import { useCallback, useMemo } from 'react';

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.

P2 Icons Bypass Design System

This table imports FileShield02 directly from @untitledui/icons and imports the edit and delete icons directly from SVG asset paths. The repository requires application icons and assets to go through the design-system layer so their dependencies remain consistent across upgrades. This requirement must be satisfied before merging. The same direct-import pattern also remains in the changed filter bar and Test Library page.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

… a request

Dropping an interceptor makes Playwright auto-continue the route that handler
still owns (Page.removeRequestInterceptor ->
notifyRoutesInFlightAboutRemovedHandler -> Route.continue({isFallback: true})),
so the handler's own continue() then hit "Route is already handled!". Wait for
the released response instead and leave the handler installed - with the gate
resolved it passes every request straight through.

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 reached their quota limit.

@gitar-bot

gitar-bot Bot commented Sep 23, 2026

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

🟡 Medium risk · Server-side search and cursor sorting change Test Definition listing and pagination behavior.

Adds server-side search and sortable cursor-paginated Test Library listings with debounced UI controls and comprehensive test coverage. The search refetch does not cancel stale in-flight responses, but this is accepted without a fix for this PR.

✅ 1 closed
Closed: Bug: Search refetch does not cancel stale in-flight responses

📄 openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionList/useTestDefinitionData.ts:75-89 📄 openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionList/useTestDefinitionData.ts:108-117
The new server-side search drives a refetch whenever urlParams.q changes (useTestDefinitionData effect deps include urlParams.q). The fetch pipeline sets results with setTestDefinitions(data) unconditionally when the promise resolves, with no request-sequence guard or AbortController. The debounce in useListSearchInput reduces but does not eliminate overlap: on a slow connection a query for an earlier term can resolve after a later term's request, leaving the list showing rows for a superseded search. Track the latest request (e.g. an incrementing ref/AbortController) and ignore responses that are no longer current before calling setTestDefinitions.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

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

Labels

Ingestion 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.

Test library improvement

6 participants