Skip to content

ui: search export fixes#27407

Merged
harsh-vador merged 7 commits into1.12.6from
ux-search-export-fixes
Apr 16, 2026
Merged

ui: search export fixes#27407
harsh-vador merged 7 commits into1.12.6from
ux-search-export-fixes

Conversation

@harsh-vador
Copy link
Copy Markdown
Contributor

@harsh-vador harsh-vador commented Apr 15, 2026

Describe your changes:

Problem

  1. Export returned only 1000 rows with numeric sort fields (e.g. totalVotes):
    With search_after pagination, if the last doc in the first batch had totalVotes=0, the next cursor asked for docs where totalVotes < 0 — returning empty results and breaking out of the export loop after exactly one batch.

  2. "Visible results" exported wrong data: Exported only the current page (e.g. 15 rows) instead of all assets matching the search in the active tab.

  3. Wrong count in modal: Showed Elasticsearch's default 10k cap instead of the actual tab-specific result count.

Solution

Backend

  • ElasticSearch & OpenSearch: Added a stable tiebreaker sort (name.keyword ASC) whenever isExport=true or the primary sort is _score. This ensures search_after cursors remain unique across batches even when many docs share the same sort value.
  • Consolidated the tiebreaker into a single condition: if (sortField.equalsIgnoreCase(SORT_FIELD_SCORE) || isExport)
  • Extracted SORT_FIELD_SCORE and SORT_TYPE_KEYWORD constants to eliminate magic strings.

Frontend

  • Search mode (?search=... present): "Visible results" now exports all assets of the active tab type matching the query. Tab-specific count is derived from the entityType aggregation buckets of the existing DATA_ASSET count query (no extra API call). No from offset is sent.
  • Browse mode (no search query): Behavior unchanged — exports current page with correct from offset.
  • Added EXPORT_ALL_ASSETS_LIMIT = 200,000 guard with a warning alert and disabled export button when the "All assets" scope exceeds the limit.
  • Dynamic card label: shows active tab name (e.g. "Tables") in search mode, "Visible results" in browse mode.
  • Skeleton loader for the tab count while loading.
  • Modal width increased from 610 → 680.
  • Added data-testid on scope cards for Playwright targeting.
Screenshot 2026-04-15 at 10 26 25 PM

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
Screen.Recording.2026-04-15.at.10.41.15.PM.mov

@harsh-vador harsh-vador self-assigned this Apr 15, 2026
@harsh-vador harsh-vador added the UI UI specific issues label Apr 15, 2026
@harsh-vador harsh-vador requested a review from a team as a code owner April 15, 2026 17:23
@harsh-vador harsh-vador added the safe to test Add this label to run secure Github workflows on PRs label Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

❌ Lint Check Failed — ESLint + Prettier (core-components)

The following files have style issues that need to be fixed:

Fix locally (fast — only for changed files in the branch):

make ui-checkstyle-core-components-changed

Or to fix all files:

make ui-checkstyle-core-components

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

❌ Playwright Lint Check Failed — ESLint + Prettier + Organise Imports

The following files have style issues that need to be fixed:
playwright/e2e/Features/SearchExport.spec.ts playwright/utils/explore.ts

Fix locally (fast — only for changed files in the branch):

make ui-checkstyle-playwright-changed

Or to fix all playwright files:

make ui-checkstyle-playwright

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

❌ Lint Check Failed — ESLint + Prettier + Organise Imports (src)

The following files have style issues that need to be fixed:
src/components/ExploreV1/ExploreV1.component.tsx src/locale/languages/ar-sa.json src/locale/languages/de-de.json src/locale/languages/en-us.json src/locale/languages/es-es.json src/locale/languages/fr-fr.json src/locale/languages/gl-es.json src/locale/languages/he-he.json src/locale/languages/ja-jp.json src/locale/languages/ko-kr.json src/locale/languages/mr-in.json src/locale/languages/nl-nl.json src/locale/languages/pr-pr.json src/locale/languages/pt-br.json src/locale/languages/pt-pt.json src/locale/languages/ru-ru.json src/locale/languages/th-th.json src/locale/languages/tr-tr.json src/locale/languages/zh-cn.json src/locale/languages/zh-tw.json

Fix locally (fast — only for changed files in the branch):

make ui-checkstyle-src-changed

Or to fix all files:

make ui-checkstyle-src

@harsh-vador harsh-vador changed the title Ux search export fixes ui: search export fixes Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

❌ UI Checkstyle Failed

❌ ESLint + Prettier + Organise Imports (src)

One or more source files have linting or formatting issues.

❌ Playwright — ESLint + Prettier + Organise Imports

One or more Playwright test files have linting or formatting issues.

❌ Core Components — ESLint + Prettier

One or more core-component files have linting or formatting issues.


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

make ui-checkstyle-changed

Comment thread openmetadata-ui/src/main/resources/ui/playwright/utils/explore.ts
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 16, 2026

Code Review ✅ Approved 3 resolved / 3 findings

Search export logic now enforces size limits for visible scopes and correctly evaluates tab scope status. Test helpers are updated to ensure synchronization with the export modal state.

✅ 3 resolved
Edge Case: "Visible" scope in search mode has no export size limit guard

📄 openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreV1.component.tsx:205-211 📄 openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreV1.component.tsx:293-294
The EXPORT_ALL_ASSETS_LIMIT (200,000) guard only applies when exportScope === 'all'. In search mode, the "visible" (tab-specific) scope sets params.size = tabAssetsCount with no upper bound. If a tab has, say, 150k matching assets, the export will happily request all 150k rows — which is arguably fine since it's under 200k, but there's no guard if tabAssetsCount itself exceeds 200k (a single entity type could have >200k matches).

Consider applying the same limit check to the visible scope in search mode, or at least capping params.size.

Quality: Test helper openExportScopeModal no longer waits for Export enabled

📄 openmetadata-ui/src/main/resources/ui/playwright/utils/explore.ts:313-316 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/SearchExport.spec.ts:36 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/SearchExport.spec.ts:299
The refactored openExportScopeModal utility (moved to explore.ts) removed the await expect(exportButton).toBeEnabled() wait that the old inline version had. Each test now manually awaits countApiPromise after calling openExportScopeModal, but the test 'Export button opens scope modal with correct options' (line 36) and 'Export downloads CSV with correct filename and closes modal' (line 294) call openExportScopeModal without awaiting a count API response, which could lead to flaky tests if the count is still loading when assertions run.

Bug: isTabScopeDisabled evaluates true even when 'all' scope is selected

📄 openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreV1.component.tsx:213-220
The isTabScopeDisabled memo includes exportScope === 'visible' in its condition, so it's false when 'all' is selected — this is correct. However, there's a subtle UX issue: when the user is in search mode, switches to 'visible', sees the button disabled (0 tab results), then switches back to 'all', the button re-enables correctly. This is fine.

Actually on closer inspection the logic is correct. Disregard — no issue here.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@harsh-vador harsh-vador merged commit e90160e into 1.12.6 Apr 16, 2026
40 of 46 checks passed
@harsh-vador harsh-vador deleted the ux-search-export-fixes branch April 16, 2026 13:52
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.

2 participants