Skip to content

feat(ui): extract remaining pure utils #28791

Merged
shah-harshit merged 7 commits into
mainfrom
feat/extract-remaining-pure-utils
Jun 8, 2026
Merged

feat(ui): extract remaining pure utils #28791
shah-harshit merged 7 commits into
mainfrom
feat/extract-remaining-pure-utils

Conversation

@shah-harshit

Copy link
Copy Markdown
Contributor

Summary

Extract pure (no-React, no-side-effects) functions from 12 large utility files into dedicated *PureUtils.ts modules. All original files re-export every moved symbol for full backward compatibility.

New pure util files

New File Extracted From Key Exports
AgentsStatusWidgetPureUtils.ts AgentsStatusWidgetUtils.tsx getAgentLabelFromType, getAgentStatusLabelFromStatus, getAgentStatusSummary
Alerts/AlertsUtilPure.ts Alerts/AlertsUtil.tsx 20 pure alert helpers (formatters, validators, name generators)
BlockEditorPureUtils.ts BlockEditorUtils.ts Pure block editor utils
ContainerDetailPureUtils.ts ContainerDetailUtils.tsx Pure container detail utils
ContextCenterPureUtils.ts ContextCenterUtils.tsx Pure context center utils
CuratedAssetsPureUtils.ts CuratedAssetsUtils.tsx Pure curated assets utils
CustomizableLandingPagePureUtils.ts CustomizableLandingPageUtils.tsx Pure landing page utils
CustomizePage/CustomizePagePureUtils.ts CustomizePage/CustomizePageUtils.ts Pure customize page utils
DataAssetSummaryPanelPureUtils.ts DataAssetSummaryPanelUtils.tsx getTableFieldsFromTableDetails, getUsageData
CSV/CSVPureUtils.ts CSV/CSV.utils.tsx Pure CSV processing utils
Lineage/LineagePureUtils.ts Lineage/LineageUtils.tsx Pure lineage utils
MetricEntityUtils/MetricPureUtils.ts MetricEntityUtils/MetricUtils.tsx Pure metric utils
UsersPureUtils.ts Users.util.tsx Pure user utils

Guidelines followed

  • Pure utils: no React imports, no JSX, no API calls, no singletons
  • All original files re-export moved symbols (export { fn } from './XxxPureUtils')
  • import type used for all type-only imports
  • No consumer changes required (re-exports ensure backward compat)

Test plan

  • npx tsc --noEmit passes (no new errors in changed files)
  • UI checkstyle passes
  • Existing tests continue to pass (no import paths broken)

🤖 Generated with Claude Code

shah-harshit and others added 2 commits June 8, 2026 11:53
Extract pure functions from 12 utility files into dedicated *PureUtils.ts files.
Original files re-export all moved symbols for backward compatibility.

New pure util files:
- AgentsStatusWidgetPureUtils.ts (getAgentLabelFromType, getAgentStatusLabelFromStatus, getAgentStatusSummary)
- Alerts/AlertsUtilPure.ts (20 pure alert helpers)
- BlockEditorPureUtils.ts (pure block editor utils)
- ContainerDetailPureUtils.ts (pure container detail utils)
- ContextCenterPureUtils.ts (pure context center utils)
- CuratedAssetsPureUtils.ts (pure curated assets utils)
- CustomizableLandingPagePureUtils.ts (pure landing page utils)
- CustomizePage/CustomizePagePureUtils.ts (pure customize page utils)
- DataAssetSummaryPanelPureUtils.ts (pure data asset summary utils)
- CSV/CSVPureUtils.ts (pure CSV processing utils)
- Lineage/LineagePureUtils.ts (pure lineage utils)
- MetricEntityUtils/MetricPureUtils.ts (pure metric utils)
- UsersPureUtils.ts (pure user utils)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shah-harshit shah-harshit requested a review from a team as a code owner June 8, 2026 06:28
@github-actions

github-actions Bot commented Jun 8, 2026

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. Add a closing reference such as Fixes #12345 to the PR description (accepted keywords: Fixes, Closes, Resolves).

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.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@shah-harshit shah-harshit self-assigned this Jun 8, 2026
@shah-harshit shah-harshit added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Jun 8, 2026
Comment thread openmetadata-ui/src/main/resources/ui/src/utils/BlockEditorPureUtils.ts Outdated
Remove isHTMLString, _convertMarkdownFormatToHtmlString, formatContentForClient
from BlockEditorPureUtils.ts — all three are duplicates of code in BlockEditorUtils.ts,
none were re-exported or consumed anywhere. Pure file now contains only
isDescriptionContentEmpty and getTextFromHtmlString.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
getTierTags moved to TablePureUtils.ts; test was mocking TableUtils (old path)
causing the mock to be ignored and the assertion to fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.17% (67593/106993) 44.09% (37112/84155) 46.51% (11217/24115)

@shah-harshit shah-harshit enabled auto-merge (squash) June 8, 2026 08:02
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
shah-harshit and others added 2 commits June 8, 2026 14:30
Resolved conflict in ContextCenterUtils.tsx: main added functions that our
branch already moved to ContextCenterPureUtils.ts — kept re-export facade.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (13 flaky)

✅ 4270 passed · ❌ 0 failed · 🟡 13 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
✅ Shard 1 301 0 0 4
🟡 Shard 2 804 0 2 9
🟡 Shard 3 801 0 3 8
🟡 Shard 4 843 0 4 12
🟡 Shard 5 720 0 1 47
🟡 Shard 6 801 0 3 8
🟡 13 flaky test(s) (passed on retry)
  • Features/DataQuality/DataQuality.spec.ts › TestCase filters (shard 2, 1 retry)
  • Features/Glossary/GlossaryWorkflow.spec.ts › should start term as Draft when glossary has reviewers (shard 2, 2 retries)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/Table.spec.ts › Table pagination with sorting should works (shard 3, 1 retry)
  • Features/UserProfileOnlineStatus.spec.ts › Should show online status badge on user profile for active users (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Date Time (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Set & Update all CP types on glossaryTerm (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Should clear search and show all properties for apiCollection in right panel (shard 4, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage service type filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (shard 6, 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

@shah-harshit shah-harshit merged commit cb4443b into main Jun 8, 2026
57 of 58 checks passed
@shah-harshit shah-harshit deleted the feat/extract-remaining-pure-utils branch June 8, 2026 14:04
@gitar-bot

gitar-bot Bot commented Jun 8, 2026

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

Refactors 13 utility files by extracting pure logic into dedicated modules with backward-compatible re-exports. Address the duplicate and dead code introduced in BlockEditorPureUtils to ensure consistency with the other modules.

✅ 1 resolved
Quality: BlockEditorPureUtils adds duplicate/divergent + dead code

📄 openmetadata-ui/src/main/resources/ui/src/utils/BlockEditorPureUtils.ts:56-70 📄 openmetadata-ui/src/main/resources/ui/src/utils/BlockEditorPureUtils.ts:92-106 📄 openmetadata-ui/src/main/resources/ui/src/utils/BlockEditorPureUtils.ts:131-145 📄 openmetadata-ui/src/main/resources/ui/src/utils/BlockEditorUtils.ts:14-17 📄 openmetadata-ui/src/main/resources/ui/src/utils/BlockEditorUtils.ts:187
Unlike the other extractions (which move a function and re-export it for backward compatibility), BlockEditorPureUtils.ts introduces a new copy of isHTMLString while the original isHTMLString remains defined in BlockEditorUtils.ts:187 and is NOT re-exported from the pure file. So there are now two independent implementations of isHTMLString that can drift apart. Additionally, formatContentForClient and the private _convertMarkdownFormatToHtmlString introduced in the pure file are not re-exported by BlockEditorUtils.ts and a codebase search finds no consumers of formatContentForClient — they are effectively dead code (and _convertMarkdownFormatToHtmlString duplicates the markdown-to-HTML logic already living in BlockEditorUtils.ts's formatContent). This contradicts the PR's stated guideline that original files re-export every moved symbol, and creates maintenance risk where the two copies diverge. Recommend either: (a) have BlockEditorUtils.ts import/re-export isHTMLString from the pure module and delete the local copy, and wire up formatContentForClient to its intended caller; or (b) drop the currently-unused formatContentForClient/isHTMLString/_convertMarkdownFormatToHtmlString from the pure file until they are actually consumed.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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 skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants