Skip to content

feat(app-defaults): migrate global-header plugin into app-defaults - #5545

Open
debsmita1 wants to merge 5 commits into
redhat-developer:mainfrom
debsmita1:add-GH-to-appdefaults
Open

debsmita1 wants to merge 5 commits into
redhat-developer:mainfrom
debsmita1:add-GH-to-appdefaults

Conversation

@debsmita1

@debsmita1 debsmita1 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Hey, I just made a Pull Request!

Resolves:
https://redhat.atlassian.net/browse/RHIDP-17734
Part of : https://redhat.atlassian.net/browse/RHIDP-17735

Solution description:

Fold the standalone global-header experience into the app-defaults stack by splitting extension APIs from the default UI:

  • app-react — public extension surface: GlobalHeaderComponentBlueprint, GlobalHeaderMenuItemBlueprint, data refs, types, and context hooks (useGlobalHeaderComponents / useGlobalHeaderMenuItems) so other plugins can contribute masthead items without depending on the default implementation.
  • app-defaults — default masthead: globalHeaderModule (app-root wrapper + system icons), globalHeaderPlugin (pluginId: 'global-header' with default toolbar/menu items), and globalHeaderTranslationsModule, all loaded by the app-defaults feature loader.
  • Building-block UI exported from @red-hat-developer-hub/backstage-plugin-app-defaults/global-header-components (GlobalHeaderMenuItem, GlobalHeaderIconButton, GlobalHeaderDropdown, GlobalHeaderCompanyLogo) for custom dropdown/toolbar contributions, with the logo named to avoid clashing with the sidebar CompanyLogo.
  • Opt-out / customize via NFS config (app-root-wrapper:app/global-header and per-item gh-component / gh-menu-item disable/reorder), plus config-driven extras under globalHeader.components / globalHeader.menuItems.
    Docs + changeset covering enable/disable, contribution patterns, and the API split; icons moved to Remix/IconElement where applicable.
# To disable individual menu items
    - gh-menu-item:global-header/settings:
        disabled: true
    - gh-menu-item:global-header/my-profile:
        disabled: true
    - gh-menu-item:global-header/logout:
        disabled: true
    - gh-menu-item:global-header/support-button:
        disabled: true
    - gh-menu-item:global-header/app-launcher-devhub:
        disabled: true
    - gh-menu-item:global-header/app-launcher-rhdh-local:
        disabled: true
        
        
 # Disable the whole global header
    - app-root-wrapper:app/global-header:
        disabled: true

Note: Deprecation of the original plugin will be handled as part of https://redhat.atlassian.net/browse/RHIDP-17736

Screenshots:

Tested on rhdh-local

Screenshot 2026-11-13 at 2 24 26 PM Screenshot 2026-11-13 at 2 24 33 PM

✔️ 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)

@rhdh-gh-app

rhdh-gh-app Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

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
app workspaces/app-defaults/packages/app none v0.0.0
@red-hat-developer-hub/backstage-plugin-app-defaults workspaces/app-defaults/plugins/app-defaults minor v1.13.1
@red-hat-developer-hub/backstage-plugin-app-react workspaces/app-defaults/plugins/app-react minor v1.13.1
@red-hat-developer-hub/backstage-plugin-quickstart workspaces/quickstart/plugins/quickstart patch v2.3.0
@red-hat-developer-hub/backstage-plugin-global-header-test workspaces/test-plugins/plugins/global-header-test patch v0.9.0

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.97%. Comparing base (0988d90) to head (6c92fb4).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5545      +/-   ##
==========================================
- Coverage   66.00%   65.97%   -0.04%     
==========================================
  Files        2808     2881      +73     
  Lines      113150   114139     +989     
  Branches    31708    31989     +281     
==========================================
+ Hits        74689    75306     +617     
- Misses      36649    37015     +366     
- Partials     1812     1818       +6     
Flag Coverage Δ *Carryforward flag
adoption-insights 88.86% <ø> (ø) Carriedforward from 4a1242d
ai-integrations 90.89% <ø> (ø) Carriedforward from 4a1242d
app-defaults 71.61% <42.85%> (-5.65%) ⬇️
augment 46.67% <ø> (ø) Carriedforward from 4a1242d
boost 93.94% <ø> (ø) Carriedforward from 4a1242d
bulk-import 73.13% <ø> (ø) Carriedforward from 4a1242d
cost-management 13.56% <ø> (ø) Carriedforward from 4a1242d
dcm 74.35% <ø> (ø) Carriedforward from 4a1242d
e2e-adoption-insights 60.16% <ø> (ø) Carriedforward from 4a1242d
e2e-extensions 62.87% <ø> (ø) Carriedforward from 4a1242d
e2e-global-header 52.43% <ø> (ø) Carriedforward from 4a1242d
e2e-homepage 61.25% <ø> (ø) Carriedforward from 4a1242d
e2e-intelligent-assistant 46.10% <ø> (ø) Carriedforward from 4a1242d
e2e-orchestrator 49.80% <ø> (ø) Carriedforward from 4a1242d
e2e-orchestrator-plugin 49.79% <ø> (ø) Carriedforward from 4a1242d
e2e-quickstart 54.83% <ø> (ø) Carriedforward from 4a1242d
e2e-scorecard 49.88% <ø> (ø) Carriedforward from 4a1242d
e2e-theme 16.43% <ø> (ø) Carriedforward from 4a1242d
extensions 60.42% <ø> (ø) Carriedforward from 4a1242d
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 4a1242d
global-header 69.15% <ø> (ø) Carriedforward from 4a1242d
homepage 86.56% <ø> (ø) Carriedforward from 4a1242d
install-dynamic-plugins 86.58% <ø> (ø) Carriedforward from 4a1242d
intelligent-assistant 79.92% <ø> (ø) Carriedforward from 4a1242d
konflux 91.98% <ø> (ø) Carriedforward from 4a1242d
lightspeed 69.02% <ø> (ø) Carriedforward from 4a1242d
mcp-integrations 84.46% <ø> (ø) Carriedforward from 4a1242d
orchestrator 77.13% <ø> (ø) Carriedforward from 4a1242d
quickstart 65.83% <ø> (ø)
sandbox 79.56% <ø> (ø) Carriedforward from 4a1242d
scorecard 92.32% <ø> (ø) Carriedforward from 4a1242d
theme 89.01% <ø> (ø) Carriedforward from 4a1242d
translations 7.91% <ø> (ø) Carriedforward from 4a1242d
x2a 81.73% <ø> (ø) Carriedforward from 4a1242d

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0988d90...6c92fb4. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@invincibleJai

Copy link
Copy Markdown
Member

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:19 AM UTC · Completed 10:56 AM UTC

Commit: 508f967 · View workflow run →

Runtime: claude · Model: claude-opus-4-6 · Effort: high · Cost: $15.27

@fullsend-ai-review fullsend-ai-review Bot added the risk/elevated PR risk: elevated label Nov 24, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: elevated (3/5)

Details

A large-scope migration (127 files, 10K+ lines, 3 dependency files changed, large blast radius) in a workspace with high author diversity and many recent regression commits yields an elevated composite score of ~2.90, rounded to 3, despite the absence of protected or security-sensitive paths.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [scope-incomplete] workspaces/app-defaults/plugins/app-defaults/src/global-header/plugin.ts:45 — The PR folds the standalone global-header experience into app-defaults but leaves the standalone workspace at workspaces/global-header/ entirely untouched — no deprecation marker, no @deprecated jsdoc, no migration note. The new plugin uses pluginId: 'global-header' (line 45), identical to the standalone plugin, and both use AppRootWrapperBlueprint.makeWithOverrides({ name: 'global-header' }), producing the same extension ID app-root-wrapper:app/global-header. Any host that loads both simultaneously will hit duplicate pluginId and duplicate extension ID conflicts.
    Remediation: Either add an explicit @deprecated annotation to the standalone global-header plugin and its globalHeaderModule, or document in the PR description that removal/deprecation is in a follow-on PR. Hosts must be told they cannot load both packages simultaneously.

Medium

  • [logic-error] workspaces/app-defaults/plugins/app-defaults/src/global-header/components/SearchComponent/SearchBar.tsx:116 — Stale-closure bug in Enter key handler: the condition on line 114 correctly reads currentHighlight from highlightedIndexRef.current (the ref), but the actual array lookup on line 116 uses highlightedIndex (the state variable captured by the render-time closure). If a highlight change occurs after the last render but before Enter, navigation may go to the wrong result.
    Remediation: Replace results[highlightedIndex] with results[currentHighlight] on line 116.

  • [intent-mismatch] workspaces/app-defaults/.changeset/split-global-header-extensions.md:1 — The PR uses a 'chore' commit prefix, which signals routine maintenance with no user-visible impact. The actual change introduces new public API surface in app-react and a new plugin in app-defaults, correctly versioned as 'minor' in the changeset. The title prefix conflicts with the versioning tier.
    Remediation: Retitle the PR with a 'feat' prefix, e.g. 'feat(app-defaults): migrate global-header plugin into app-defaults'.

  • [duplicate-public-api-identifiers] workspaces/app-defaults/plugins/app-react/src/globalHeader/extensions/dataRefs.ts:31 — The new app-react package publishes globalHeaderComponentDataRef (ID: 'global-header.component') and globalHeaderMenuItemDataRef (ID: 'global-header.menu-item'). The unchanged global-header package already publishes refs with identical string IDs but as separate JavaScript objects. Extensions built against the old package's refs may not attach to the new module's inputs if Backstage resolves by object identity rather than string ID.
    Remediation: Document the migration path: plugins contributing header items must switch their import from the standalone package to app-react.

  • [naming-conventions] workspaces/app-defaults/plugins/app-react/src/globalHeader/extensions/GlobalHeaderComponentBlueprint.ts:41 — The public params interface ToolbarComponentParams does not follow the GlobalHeader prefix convention used by every other public type in this package.
    Remediation: Rename ToolbarComponentParams to GlobalHeaderComponentParams.

  • [naming-conventions] workspaces/app-defaults/plugins/app-react/src/globalHeader/extensions/GlobalHeaderMenuItemBlueprint.ts:45 — The public params interface MenuItemParams is too generic and does not follow the GlobalHeader prefix convention.
    Remediation: Rename MenuItemParams to GlobalHeaderMenuItemParams.

  • [duplicate-config-schema] workspaces/app-defaults/plugins/app-defaults/config.d.ts:240 — The PR adds globalHeader config schema (components and menuItems arrays) identical in structure to the standalone global-header package's config.d.ts. When both packages are loaded during interim migration, Backstage will process duplicate schema definitions.
    Remediation: Document that hosts must not load both packages simultaneously, or add cross-reference comments.

Low

  • [test-integrity] workspaces/app-defaults/plugins/app-defaults/src/global-header/components/SearchComponent/SearchBar.test.tsx:191 — The Enter-key navigation test only exercises the unhighlighted path. The stale-closure bug in SearchBar.tsx line 116 is not covered by any test.
    Remediation: Add a test that highlights a specific option and presses Enter.

  • [test-integrity] workspaces/app-defaults/plugins/app-defaults/src/global-header/components/Divider/Divider.test.tsx:24 — The test contains a debug() call that prints the full DOM tree to stdout on every test run, adding noise to CI logs.
    Remediation: Remove the debug() call on line 24.

  • [scope-creep] workspaces/app-defaults/packages/app/src/modules/drawer-demo/HelpDrawerMenuItem.tsx:91 — The drawer-demo HelpDrawerMenuItem icon changed from 'support' to 'help', a UI change bundled into a migration PR without mention in the changeset.

  • [edge-case] workspaces/app-defaults/plugins/app-defaults/src/global-header/components/GlobalHeaderDropdown.tsx:187 — The dropdownContent JSX element is created on every render regardless of whether contentInValidityProbe is true.

  • [edge-case] workspaces/app-defaults/plugins/app-defaults/src/global-header/hooks/useNotificationCount.ts:40 — The unread notification count derived from notifications.length may cap at the page-size limit if the notifications API applies one.

  • [nil-handling] workspaces/app-defaults/plugins/app-defaults/src/global-header/components/CompanyLogo/CompanyLogo.tsx:79 — Non-null assertions themeId! and themeVariant! suppress TypeScript's null-safety checks on values that can be undefined.
    Remediation: Remove the ! assertions and use optional chaining.

  • [guest-detection] workspaces/app-defaults/plugins/app-defaults/src/global-header/components/MyProfileMenuItem.tsx — Guest detection uses includes('/guest') substring matching which could match unintended entity refs (e.g., 'user:default/guestbook-admin'). Impact is cosmetic only. Migrated existing behavior.

  • [scope-creep] workspaces/quickstart/.changeset/waving-hand-quickstart-icon.md:1 — The quickstart workspace icon alias change belongs to a different workspace with its own release lifecycle. The PR bundles two workspace changesets without explaining why they must ship together.

  • [missing-coverage] workspaces/app-defaults/plugins/app-defaults/README.md:149 — The Usage section says 'Static: import appDefaultsModule' but does not mention that the static path now also requires importing the global header modules. The new Global Header section covers manual registration but is not cross-referenced from the Static usage section.
    Remediation: Add a cross-reference from the Static usage line to the Global Header section.

  • [public-api-unreachable-error] workspaces/app-defaults/plugins/app-react/src/globalHeader/extensions/GlobalHeaderComponentBlueprint.ts:79 — resolveToolbarComponent() contains a throw that is unreachable because the factory only calls it when hasCustomUi is true.
    Remediation: Remove the dead throw branch or restructure the call.

  • [public-interface-inconsistency] workspaces/app-defaults/plugins/app-defaults/report-global-header-components.api.md:70 — HeaderIconButtonProps requires to: string as mandatory, but the data model allows click-only toolbar items via onClick. External consumers cannot use GlobalHeaderIconButton for click-only behaviors.
    Remediation: Make to optional and render a plain button when absent.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:

  • workspaces/app-defaults/packages/app/src/modules/drawer-demo/HelpDrawerMenuItem.tsx (file-level): Line 91 · [low] scope-creep

The drawer-demo HelpDrawerMenuItem icon changed from 'support' to 'help', a UI change bundled into a migration PR without mention in the changeset.

  • workspaces/app-defaults/plugins/app-defaults/README.md (file-level): Line 149 · [low] missing-coverage

The Usage section says 'Static: import appDefaultsModule' but does not mention that the static path now also requires importing the global header modules. The new Global Header section covers manual registration but is not cross-referenced from the Static usage section.

Suggested fix: Add a cross-reference from the Static usage line to the Global Header section.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

navigate(searchLink);
} else if (currentHighlight !== -1) {
navigate(
results[highlightedIndex]?.document?.location ?? searchLink,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] logic-error

Stale-closure bug in Enter key handler: the condition on line 114 correctly reads currentHighlight from highlightedIndexRef.current (the ref), but the actual array lookup on line 116 uses highlightedIndex (the state variable captured by the render-time closure). If a highlight change occurs after the last render but before Enter, navigation may go to the wrong result.

Suggested fix: Replace results[highlightedIndex] with results[currentHighlight] on line 116.

* @public
*/
export const globalHeaderComponentDataRef =
createExtensionDataRef<GlobalHeaderComponentData>().with({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] duplicate-public-api-identifiers

The new app-react package publishes globalHeaderComponentDataRef (ID: 'global-header.component') and globalHeaderMenuItemDataRef (ID: 'global-header.menu-item'). The unchanged global-header package already publishes refs with identical string IDs but as separate JavaScript objects. Extensions built against the old package's refs may not attach to the new module's inputs if Backstage resolves by object identity rather than string ID.

Suggested fix: Document the migration path: plugins contributing header items must switch their import from the standalone package to app-react.

*
* @public
*/
export interface ToolbarComponentParams {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] naming-conventions

The public params interface ToolbarComponentParams does not follow the GlobalHeader prefix convention used by every other public type in this package.

Suggested fix: Rename ToolbarComponentParams to GlobalHeaderComponentParams.


const fetchUnreadCount = async () => {
try {
const { notifications } = await notificationsApi.getNotifications({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] edge-case

The unread notification count derived from notifications.length may cap at the page-size limit if the notifications API applies one.

const logoURI =
(typeof logoURLs === 'string' ? logoURLs : null) ??
(typeof logoURLs === 'object'
? logoURLs?.[themeId!] ?? logoURLs?.[themeVariant!]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] nil-handling

Non-null assertions themeId! and themeVariant! suppress TypeScript's null-safety checks on values that can be undefined.

Suggested fix: Remove the ! assertions and use optional chaining.

@@ -0,0 +1,5 @@
---

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] scope-creep

The quickstart workspace icon alias change belongs to a different workspace with its own release lifecycle. The PR bundles two workspace changesets without explaining why they must ship together.

if (params.component) {
return resolveSyncComponent(node, params.component);
}
throw new Error(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] public-api-unreachable-error

resolveToolbarComponent() contains a throw that is unreachable because the factory only calls it when hasCustomUi is true.

Suggested fix: Remove the dead throw branch or restructure the call.

size?: 'small' | 'medium' | 'large';
title: string;
titleKey?: string;
to: string;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] public-interface-inconsistency

HeaderIconButtonProps requires to: string as mandatory, but the data model allows click-only toolbar items via onClick. External consumers cannot use GlobalHeaderIconButton for click-only behaviors.

Suggested fix: Make to optional and render a plain button when absent.

@debsmita1 debsmita1 changed the title chore(app-defaults): migrate global-header plugin into app-defaults feat(app-defaults): migrate global-header plugin into app-defaults Nov 24, 2026
@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch from 508f967 to 938354e Compare November 24, 2026 17:59
@debsmita1
debsmita1 requested review from a team as code owners November 24, 2026 17:59
@github-actions

Copy link
Copy Markdown
Contributor

This pull request adds a new top-level directory under workspaces/. Please follow Submitting a Pull Request for a New Workspace in CONTRIBUTING.md.

Drop workspaces/global-header now that global header lives inside the
app-defaults plugin (src/global-header). Archive the discontinued
@red-hat-developer-hub/backstage-plugin-global-header package and update
CODEOWNERS, labels, codecov, catalog, and renovate paths accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch from 938354e to e1775cb Compare November 24, 2026 18:11
Park the global-header fixture plugin in a dedicated test-plugins workspace
now that the standalone global-header workspace is gone.

Co-authored-by: Cursor <cursoragent@cursor.com>
@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch from e1775cb to 4a1242d Compare November 24, 2026 18:16
@debsmita1 debsmita1 changed the title feat(app-defaults): migrate global-header plugin into app-defaults [WIP] feat(app-defaults): migrate global-header plugin into app-defaults Nov 24, 2026
@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch 3 times, most recently from f4b6a41 to 72b5c58 Compare November 25, 2026 06:12
@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch from 72b5c58 to 6c92fb4 Compare November 25, 2026 07:14
@sonarqubecloud

Copy link
Copy Markdown

@debsmita1 debsmita1 changed the title [WIP] feat(app-defaults): migrate global-header plugin into app-defaults feat(app-defaults): migrate global-header plugin into app-defaults Nov 25, 2026
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.

2 participants