Skip to content

feat(codescene): migrate plugin from Material-UI to Backstage UI - #11609

Open
deepthi-28 wants to merge 3 commits into
backstage:mainfrom
deepthi-28:mui-bui-migration-codescene
Open

deepthi-28 wants to merge 3 commits into
backstage:mainfrom
deepthi-28:mui-bui-migration-codescene

Conversation

@deepthi-28

@deepthi-28 deepthi-28 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Hey, I just made a Pull Request!

Migrates the CodeScene plugin from Material-UI to Backstage UI, including the gauge, accessible tooltips, and compatible React/router peers. The public icon retains its existing MUI-based API to avoid a separate API break.

Related to #7869.

image

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Validation: 8 targeted tests, ESLint, Prettier, and immutable lockfile resolution pass. Full type-checking and the details-page test remain blocked by stale installed dependencies: registry downloads return HTTP 403. Light/dark visual verification remains outstanding.

Replace MUI Grid, Typography, Button, Card, Chip and Input with their
Backstage UI equivalents, and lab Alert with the BUI Alert. Convert
makeStyles usages to CSS modules. Drop the @material-ui/lab dependency
and add @backstage/ui.

The icon and gauge components still use Material-UI: CodeSceneIcon
exposes SvgIconProps as public API, and Gauge reads status colours from
the Backstage theme palette, neither of which Backstage UI provides.

Wire a mock CodeScene API into the dev app so the plugin can be
previewed locally without a backend.

Signed-off-by: deepthi-ajith_infosys <[email protected]>
@backstage-goalie

backstage-goalie Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-codescene workspaces/codescene/plugins/codescene minor v0.24.0

@AmbrishRamachandiran AmbrishRamachandiran 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.

Thanks for the migration @deepthi-28! The component mapping looks right against @backstage/[email protected] (Alert with status/title, ButtonLink, Card with href/label, TagGroup/Tag, SearchField with value-based onChange). Adding a mocked CodeSceneApi to the dev app is a nice touch, since it makes the pages reviewable locally.

I left a few comments, mostly to line this up with feedback maintainers have given on other MUI → BUI PRs in this repo:

  • Partial migration: Gauge.tsx (used by CodeHealthKpisCard) still uses MUI makeStyles/Tooltip/useTheme, so @material-ui/core stays a dependency. Could this be completed here?
  • Peer dependencies: @backstage/[email protected] needs React 18 and react-router-dom ^6.30.2, but the plugin still advertises older versions.
  • Changeset: mark it as BREAKING and link to the BUI installation docs, as in the other migrations.
  • Smaller items on the CSS modules, the dev-app stylesheet import, and a filter test.

Could you also link the tracking issue #7869 in the PR description? Maintainers have asked for that on the other migration PRs.

'@backstage-community/plugin-codescene': minor
---

Migrated the CodeScene plugin from Material-UI to Backstage UI.

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.

Could we use the same wording as the other BUI migrations (e.g. apollo-explorer, badges)? Apps now need Backstage UI and its stylesheet installed, so adopters should see it called out as breaking:

Suggested change
Migrated the CodeScene plugin from Material-UI to Backstage UI.
**BREAKING** Migrated from Material UI (MUI) to Backstage UI (BUI). This means that Backstage UI is now a requirement for this plugin, see the Backstage UI [installation documentation](https://ui.backstage.io/get-started/installation) for more details.

On the bump level: minor has been accepted for pre-1.0 plugins (this one is 0.22.0) on recent migrations like adr and entity-feedback, though some maintainers have asked for major to move plugins to v1. I'll leave that call to the workspace maintainers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in aa953eb: added the requested BREAKING wording and BUI installation link, plus React/router migration requirements. Kept the pre-1.0 minor bump for maintainer confirmation.

"@backstage/frontend-plugin-api": "backstage:^",
"@backstage/plugin-catalog-react": "backstage:^",
"@backstage/theme": "backstage:^",
"@backstage/ui": "backstage:^",

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.

@backstage/[email protected] (the version resolved in yarn.lock) declares peer dependencies react ^18.0.0, react-dom ^18.0.0, react-router-dom ^6.30.2 and @types/react ^18.0.0. This package still advertises react ^16.13.1 || ^17.0.0 || ^18.0.0 and react-router-dom 6.0.0-beta.0 || ^6.3.0 (peer and dev), and @types/react ^16.13.1 || ^17.0.0 || ^18.0.0. A React 17 app could install it and end up with unmet peers. Could you narrow these, as was requested on the firehydrant migration?

"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.30.2"

and "@types/react": "^18.0.0".

Also, @material-ui/core (next line) is still needed only because of Gauge.tsx and CodeSceneIcon.tsx. See my comment on CodeHealthKpisCard.tsx.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in aa953eb: narrowed React and React DOM peer/dev ranges and React types to ^18.0.0, and React Router DOM to ^6.30.2. Updated the lockfile; immutable resolution passes. MUI core remains only for the public icon API.

<Grid.Root columns={{ sm: '12' }} gap="4">
<Grid.Item colSpan={{ sm: '4' }}>
<div className={styles.gauge}>
<Gauge value={kpi.value} max={10} tooltipText={kpi.description} />

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.

Gauge (src/components/Gauge/Gauge.tsx) is still fully MUI: makeStyles, @material-ui/core/Tooltip, and useTheme().palette for the colours. Since Gauge isn't part of the public exports, it should be possible to migrate it here without an API change:

  • Tooltip: TooltipTrigger + Tooltip from @backstage/ui. This also removes the manual mouseenter/mouseleave + open state handling.
  • Styles: a CSS module (or BUI Box props) instead of makeStyles.
  • Colours: getProgressColor could return BUI tokens (var(--bui-fg-negative), var(--bui-fg-warning), var(--bui-fg-positive)) instead of MUI palette.status.*, which also drops the Palette type import.

Maintainers have asked about partial versus full migration on other PRs (e.g. gcalendar), so it would be good to finish it here, or explain in the PR why it's left out. CodeSceneIcon can reasonably stay on SvgIcon for now, because it's a public export typed with SvgIconProps and changing it would be an API break.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in aa953eb: migrated the gauge to BUI TooltipTrigger/Tooltip, a React Aria Focusable trigger, CSS-module styling, and BUI status-color tokens. Removed MUI theme access and manual hover state/listeners. Added passing keyboard-tooltip and color-threshold tests. The public icon is intentionally unchanged.

@@ -0,0 +1,7 @@
@layer components {

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.

Two small things on the CSS modules:

  1. Maintainers have asked to drop the @layer components wrapper from CSS modules in migration PRs (opencost, entity-validation, explore). The same applies to ProjectsComponent.module.css.
  2. Reviewers have also preferred BUI layout props over new CSS modules where possible. This one could probably be removed completely:
<Box width="100px" height="100%" mt="3" ml="12">
  <Gauge value={kpi.value} max={10} tooltipText={kpi.description} />
</Box>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in aa953eb: removed the KPI CSS module in favor of BUI Box sizing/spacing props and removed the layer wrapper from the project CSS module. The gauge CSS module also uses no layer wrapper.

import { codesceneApiRef, CodeSceneApi } from '../src/api/api';
import { Analysis, Project } from '../src/api/types';
// eslint-disable-next-line @backstage/no-ui-css-imports-in-non-frontend
import '@backstage/ui/css/styles.css';

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.

Nit: I think this import (and the eslint-disable above it) isn't needed. createDevApp from @backstage/[email protected] already lazy-loads @backstage/ui/css/styles.css (dist/devApp/BuiCss.esm.js), and the repo's mui-to-bui-migration skill says to skip the import for createDevApp workspaces.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in aa953eb: removed the redundant dev-app stylesheet import and its ESLint suppression. Added adopter-facing BUI setup instructions to the README.

placeholder="Filter"
onChange={e => setSearchText(e.target.value)}
value={searchText}
onChange={value => setSearchText(value)}

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.

Nit: the onChange contract changed here (MUI Input passed an event, BUI SearchField passes the value), and nothing in ProjectsComponent.test.tsx exercises the filter. Could you add a small regression test, for example two projects where typing into the Filter projects search box hides the one that doesn't match?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in aa953eb: added a passing two-project regression test covering case-insensitive name filtering, multi-term name/description matching, hiding nonmatches, and clearing the search.

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.

🟡 Changes recommended

The new Text components default to inline spans, causing KPI names, scores, and analysis metrics to run together while removing the score heading semantics.

1 open issue
What changed in this PR

Updates the CodeScene plugin’s project and entity views to use Backstage UI while retaining existing Backstage core components.

Changes:

  • Replaces Material-UI layouts, alerts, cards, search input, and typography with Backstage UI components.
  • Moves component styling to CSS modules and adds mock data for local previews.
  • Updates dependencies and includes a minor-release changeset.
File Description
workspaces/​codescene/​yarn.lock Records the updated plugin dependencies.
workspaces/​codescene/​plugins/​codescene/​src/​components/​ProjectsComponent/​ProjectsComponent.tsx Migrates project cards, search, tags, and grid layout.
workspaces/​codescene/​plugins/​codescene/​src/​components/​ProjectsComponent/​ProjectsComponent.module.css Adds scrolling and full-height card styles.
workspaces/​codescene/​plugins/​codescene/​src/​components/​CodeSceneProjectDetailsPage/​CodeSceneProjectDetailsPage.tsx Converts detail-page layout, alerts, and text to BUI.
workspaces/​codescene/​plugins/​codescene/​src/​components/​CodeScenePageComponent/​CodeScenePageComponent.tsx Replaces the page’s outer grid with BUI.
workspaces/​codescene/​plugins/​codescene/​src/​components/​CodeSceneEntityKPICard/​CodeSceneEntityKPICard.tsx Migrates entity KPI layout, alerts, and typography.
workspaces/​codescene/​plugins/​codescene/​src/​components/​CodeSceneEntityFileSummary/​CodeSceneEntityFileSummary.tsx Uses BUI layout and error alerts.
workspaces/​codescene/​plugins/​codescene/​src/​components/​CodeHealthKpisCard/​CodeHealthKpisCard.tsx Migrates KPI layout, text, and configuration link.
workspaces/​codescene/​plugins/​codescene/​src/​components/​CodeHealthKpisCard/​CodeHealthKpisCard.module.css Moves gauge sizing and spacing into CSS.
workspaces/​codescene/​plugins/​codescene/​package.json Adds @backstage/ui and removes @material-ui/lab.
workspaces/​codescene/​plugins/​codescene/​dev/​index.tsx Adds mock API data and a BUI stylesheet import.
workspaces/​codescene/​.changeset/​codescene-mui-to-bui.md Declares a minor release for the UI migration.

Review effort: Balanced

Comment on lines +120 to +121
<Text variant="body-medium">{kpi.name}</Text>
<Text variant="title-small">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in aa953eb: KPI names and analysis metrics now render as paragraphs, and KPI scores retain h6 heading semantics. Added regression assertions to the details-page test. That suite and full type-checking are currently blocked locally by stale installed frontend-plugin-api dependencies; registry downloads return HTTP 403. The other 8 targeted tests, ESLint, and Prettier pass.

@awanlin awanlin self-assigned this Nov 27, 2026

@awanlin awanlin 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.

Thanks for the contribution @deepthi-28, there's a merge conflict that needs to be address. @AmbrishRamachandiran's feedback also needs to be followed along with the Copilot comments.

@AmbrishRamachandiran, thanks for the review, appreciate the initial set of eyes on this 🙏

deepthi-28 and others added 2 commits November 30, 2026 16:22
…into mui-bui-migration-codescene

Signed-off-by: deepthi-ajith_infosys <[email protected]>
Co-authored-by: Copilot <[email protected]>

# Conflicts:
#	workspaces/codescene/plugins/codescene/src/components/CodeSceneEntityFileSummary/CodeSceneEntityFileSummary.tsx
#	workspaces/codescene/plugins/codescene/src/components/CodeSceneEntityKPICard/CodeSceneEntityKPICard.tsx
#	workspaces/codescene/plugins/codescene/src/components/CodeScenePageComponent/CodeScenePageComponent.tsx
#	workspaces/codescene/plugins/codescene/src/components/CodeSceneProjectDetailsPage/CodeSceneProjectDetailsPage.tsx
#	workspaces/codescene/plugins/codescene/src/components/ProjectsComponent/ProjectsComponent.tsx
#	workspaces/codescene/yarn.lock
Signed-off-by: deepthi-ajith_infosys <[email protected]>
Co-authored-by: Copilot <[email protected]>
@deepthi-28

Copy link
Copy Markdown
Contributor Author

@AmbrishRamachandiran @awanlin, both Ambrish’s and Copilot’s feedback have been addressed in aa953eb. Please re-review when you have a chance. Thank you!

@AmbrishRamachandiran AmbrishRamachandiran 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.

Thanks for the thorough update! All my points, and Copilot's, are addressed, and the gauge migration and new tests look good. LGTM 🚀

cc @backstage/community-plugins-maintainers for a final look.

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.

🟡 Changes recommended

Interactive language tags can block project navigation, and the default dev app’s details page throws because codescene.baseUrl is missing.

3 open issues

Review effort: Balanced

.addPage({
element: <CodeSceneProjectDetailsPage />,
element: (
<TestApiProvider apis={[[codesceneApiRef, mockCodeSceneApi]]}>
<CardFooter>
<TagGroup aria-label={`Top languages for ${project.name}`}>
{languages.map(lang => (
<Tag key={lang} size="small">

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants