Skip to content

Upgrade CodeMirror v5 to v6#27467

Open
Copilot wants to merge 9 commits intomainfrom
copilot/upgrade-codemirror-to-6-0-0
Open

Upgrade CodeMirror v5 to v6#27467
Copilot wants to merge 9 commits intomainfrom
copilot/upgrade-codemirror-to-6-0-0

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

  • Investigate workflow failures on branch
  • Identify root cause: All 5 CI failures caused by "Team Label" gate (lewagon/wait-on-check-action) — not code issues
  • Verify code checks pass locally (ESLint ✅, TypeScript ✅, Jest ✅)
  • Fix Create teams page similar to tags #1: Import ordering — organize-imports reorders @uiw/react-codemirror alphabetically before antd and @lezer/highlight before @toast-ui/editor
  • Fix Replace catalog to openmetadata #2: Code review feedback — simplify early return in runHighlight
  • Confirm all 52 unit tests pass (SchemaEditor + CodeEditor + ContractYaml)
  • Run parallel validation — Code Review ✅, CodeQL ✅

fixes 3721


Summary by Gitar

  • Component enhancements:
    • Updated SchemaEditor and CodeEditor to support dynamic line numbers and line wrapping via options.
    • Added support for readOnly: 'nocursor' as a valid configuration option.
  • Testing infrastructure:
    • Introduced fillCodeMirrorEditor utility in Playwright to standardize interaction with CM6 editors.
    • Added unit tests for SchemaEditor and CodeEditor covering prop handling and configuration.
  • Fixes:
    • Improved Playwright selectors for entity and tag selection to be more robust.
    • Fixed runHighlight to correctly include React keys for code fragments.

This will update automatically on new commits.

Copilot AI and others added 5 commits April 17, 2026 09:28
- Replace codemirror@5, react-codemirror2, @types/codemirror with CM6 packages
- Add @uiw/react-codemirror, @codemirror/lang-*, @codemirror/language, etc.
- Rewrite SchemaEditor.tsx and CodeEditor.tsx for CM6 API
- Replace runMode with highlightCode in CustomHtmlRederer
- Update CSMode enum with language extension mapping utilities

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/b0dbef9d-c059-4c2c-b51b-a087e2dc0964

Co-authored-by: siddhant1 <30566406+siddhant1@users.noreply.github.com>
- Replace all .CodeMirror* CSS classes with .cm-editor/.cm-* equivalents
- Rewrite SchemaEditor.test.tsx and CodeEditor.test.tsx mocks for CM6
- Update all 12 Playwright test files with CM6 selectors
- Update Jest config transformIgnorePatterns for CM6 ESM packages
- Remove stale codemirror/addon CSS imports from ParameterForm and ProfilerSettingsModal

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/b0dbef9d-c059-4c2c-b51b-a087e2dc0964

Co-authored-by: siddhant1 <30566406+siddhant1@users.noreply.github.com>
- Fix highlightCode import (from @lezer/highlight, not @codemirror/language)
- Remove duplicate declarations in CustomHtmlRederer.tsx
- Fix onClick type mismatch in CodeEditor.tsx
- Remove 'codemirror' from tsconfig types array (CM6 has built-in types)
- Fix requestAnimationFrame mock in SchemaEditor.test.tsx

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/b0dbef9d-c059-4c2c-b51b-a087e2dc0964

Co-authored-by: siddhant1 <30566406+siddhant1@users.noreply.github.com>
@harsh-vador harsh-vador marked this pull request as ready for review April 17, 2026 10:07
@harsh-vador harsh-vador requested a review from a team as a code owner April 17, 2026 10:07
@harsh-vador harsh-vador added the safe to test Add this label to run secure Github workflows on PRs label Apr 17, 2026
Move @uiw/react-codemirror import before antd (alphabetical) in
CodeEditor.tsx and SchemaEditor.tsx. Move @lezer/highlight before
@toast-ui/editor in CustomHtmlRederer.tsx.

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/53a7e75c-6f72-4a2c-b275-a91a8edfad1d

Co-authored-by: siddhant1 <30566406+siddhant1@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 17, 2026 12:34
…nsion

Directly return array literal instead of creating intermediate array
and pushing to it.

Agent-Logs-Url: https://github.com/open-metadata/OpenMetadata/sessions/53a7e75c-6f72-4a2c-b275-a91a8edfad1d

Co-authored-by: siddhant1 <30566406+siddhant1@users.noreply.github.com>
@github-actions

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings April 20, 2026 11:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 20, 2026

Code Review ✅ Approved 3 resolved / 3 findings

CodeMirror v6 migration completes with native prop handling for line numbers, wrapping, and read-only states. All previous configuration discrepancies and React key warnings are resolved.

✅ 3 resolved
Bug: Top-level readOnly prop and CM5 string values silently ignored

📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaEditor/SchemaEditor.tsx:57 📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaEditor/CodeEditor.tsx:55 📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaEditor/SchemaEditor.interface.ts:24 📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaEditor/SchemaEditor.interface.ts:28
Two related issues with read-only handling:

  1. SchemaEditorProps defines a top-level readOnly?: boolean prop (line 24 of interface), but neither SchemaEditor.tsx nor CodeEditor.tsx destructure or use it. CodeWidget.tsx passes readOnly={disabled} as a direct prop, which is now silently ignored — the editor will be editable when it should be read-only.

  2. QueryCard.tsx:248 passes readOnly: isEditMode ? false : 'nocursor' inside options. The CM5 string value 'nocursor' was valid in v5 but the new code checks options?.readOnly === true, which is false for 'nocursor'. This means the query viewer will be editable when not in edit mode, breaking the read-only behavior.

Both issues cause editors to be editable when they should be locked.

Bug: Missing React key prop on plain code block fragment

📄 openmetadata-ui/src/main/resources/ui/src/components/common/RichTextEditor/CustomHtmlRederer/CustomHtmlRederer.tsx:174
In CustomHtmlRederer.tsx line 174, the fallback plain code block creates a React.Fragment without a key prop: [<React.Fragment>{codeText}</React.Fragment>]. While it's a single-element array so React won't warn currently, this is inconsistent with the runHighlight function which properly keys all fragments, and could cause issues if the array is later combined with other elements.

Bug: options.lineNumbers and options.lineWrapping are silently ignored

📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaEditor/SchemaEditor.interface.ts:26-27 📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaEditor/SchemaEditor.tsx:59-70 📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaEditor/CodeEditor.tsx:57-66
The SchemaEditorProps interface defines lineNumbers and lineWrapping in the options type, but neither SchemaEditor.tsx nor CodeEditor.tsx reads these values to conditionally add/remove the corresponding CM6 extensions. SchemaEditor always enables both lineNumbers() and EditorView.lineWrapping, while CodeEditor always disables both. No current callers override these, but the interface suggests they should be configurable. Either wire them into the extensions array or remove them from the interface to avoid confusion.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace catalog to openmetadata Create teams page similar to tags

4 participants