Skip to content

fix(ui): show active Explore tab count from its own index, not the aggregate - #31093

Closed
mohityadav766 wants to merge 1 commit into
mainfrom
fix/explore-active-tab-count
Closed

mohityadav766 wants to merge 1 commit into
mainfrom
fix/explore-active-tab-count

Conversation

@mohityadav766

Copy link
Copy Markdown
Member

Describe your changes:

Fixes open-metadata/openmetadata-collate#3851

The Explore tab badges are populated from a single index=dataAsset aggregation (its entityType buckets), while each tab's result list is fetched from that tab's own index (e.g. tableColumn, databaseSchema). The two paths run through different query builders, so the number on the tab you're viewing can diverge from the list it shows:

  • a column search where the dataAsset aggregate counted 1 but the tableColumn index returned 7,381
  • a schema search where the aggregate counted 87 but only ~15 were actually listed

Fix: for the active tab, use its own results total (searchResults.hits.total.value) as the badge count, so the number always matches the list in view. Inactive tabs keep the aggregate estimate (their lists aren't visible to verify anyway), and the active tab stays visible even when its own total is 0.

Supersedes #31019 — tightening the column search builder there regressed exact-FQN column lookups to 0 hits (Playwright SearchRBAC › Table Column); the divergence is a UI counting concern, not a matching one.

Type of change:

  • Bug fix

Tests:

Unit tests

  • generateTabItems: the active tab reports its own results total (not the aggregate), and falls back to the aggregate when no active total is available.

🤖 Generated with Claude Code

…e aggregate

Explore tab badges are read from a single index=dataAsset aggregation, while
each tab's results come from that tab's own index — two different query builders
whose totals can diverge. So the badge on the tab you're viewing could disagree
with the list it shows (e.g. a column or schema search where the aggregate
counted 1/87 but the tab's own index returned 7381/15).

Use the active tab's own results total (searchResults.hits.total.value) for its
badge so the count always matches the list in view; inactive tabs keep the
aggregate estimate, and the active tab stays visible even at 0 results.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@mohityadav766
mohityadav766 requested a review from a team as a code owner August 6, 2026 09:46
Copilot AI review requested due to automatic review settings August 6, 2026 09:46
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • Linked issue open-metadata/openmetadata-collate#3851 does not exist or is not accessible.

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.

@gitar-bot

gitar-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Updates the active Explore tab to display its own results total instead of the aggregate count, ensuring the badge always matches the visible list. 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 👍 / 👎 | Gitar | Powered by Gitar — free for open source

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.

Pull request overview

This PR fixes a UX/counting mismatch on the Explore page by ensuring the active tab’s badge count reflects the total hits from that tab’s own index (so the badge matches the results list), while keeping inactive tabs on the cross-index aggregate estimate.

Changes:

  • Extend generateTabItems to accept the active tab’s hits.total.value and use it as the active badge/count source.
  • Update ExplorePageV1 to pass the active index total and keep the active tab visible even when its total is 0.
  • Add unit tests covering the active-tab-total behavior and the fallback to aggregate counts.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
openmetadata-ui/src/main/resources/ui/src/utils/ExploreUtils.tsx Add active-tab total support to tab item generation and use it for active badge/count.
openmetadata-ui/src/main/resources/ui/src/pages/ExplorePage/ExplorePageV1.component.tsx Pass searchResults.hits.total.value into tab generation and keep active tab from being filtered out at 0 hits.
openmetadata-ui/src/main/resources/ui/src/utils/ExploreUtils.test.ts Add unit tests validating active-tab count uses its own total and falls back to aggregate when missing.

Comment on lines 145 to 149
<span>
{!isNil(searchHitCounts)
? getCountBadge(
searchHitCounts[tabSearchIndex as ExploreSearchIndex],
'',
tabSearchIndex === searchIndex
)
? getCountBadge(tabCount, '', isActiveTab)
: getCountBadge()}
</span>
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — ESLint report could not be read — see the job log.

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.

No machine-readable report was produced.


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

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
66.01% (77627/117597) 49.98% (46859/93749) 51.14% (14079/27526)

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 11c94cce6fab6375a58802d7762add9c245dccb0 in Playwright run 31090542316, attempt 1.

✅ 549 passed · ❌ 0 failed · 🟡 1 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) 1h 3m 39s

⏱️ Max setup 3m 7s · max shard execution 18m 31s · max shard-job elapsed before upload 22m 9s · reporting 5s

🌐 202.97 requests/attempt · 2.83 app boots/UI scenario · 9.54% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 202.97 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.83 per UI scenario (1620 boots / 572 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 130 0 0 0 0 0
🟡 Shard chromium-02 132 0 1 0 0 0
✅ Shard chromium-03 136 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 14 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 10 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 1 flaky test(s) (passed on retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard chromium-02, 1 retry)

📦 Download artifacts

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

@mohityadav766

Copy link
Copy Markdown
Member Author

Superseded by the backend fix in #REPLACE.

Discussed with the team: the aggregate's count of 1 is correct — searching a column's FQN should return that one column. The 7,381 is the bug (the permissive tableColumn builder OR-matched every column sharing a parent-name token). Making the badge show the inflated 7,381 (this PR) fixes the symptom in the wrong direction. The real fix routes column search through the structured builder so tableColumn returns 1, and the existing dataAsset aggregate already matches. Closing in favor of that.

@mohityadav766

Copy link
Copy Markdown
Member Author

(correction: superseded by #31106)

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

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

2 participants