Skip to content

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

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

debsmita1 wants to merge 6 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 34.21053% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.97%. Comparing base (be80b36) to head (25a26cc).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5545      +/-   ##
==========================================
- Coverage   66.01%   65.97%   -0.04%     
==========================================
  Files        2808     2881      +73     
  Lines      113174   114159     +985     
  Branches    31692    31982     +290     
==========================================
+ Hits        74709    75316     +607     
- Misses      36648    37021     +373     
- Partials     1817     1822       +5     
Flag Coverage Δ *Carryforward flag
adoption-insights 88.86% <ø> (ø) Carriedforward from be80b36
ai-integrations 90.89% <ø> (ø) Carriedforward from be80b36
app-defaults 71.41% <34.21%> (-5.88%) ⬇️
augment 46.67% <ø> (ø) Carriedforward from be80b36
boost 93.94% <ø> (ø) Carriedforward from be80b36
bulk-import 73.13% <ø> (ø) Carriedforward from be80b36
cost-management 13.56% <ø> (ø) Carriedforward from be80b36
dcm 74.35% <ø> (ø) Carriedforward from be80b36
e2e-adoption-insights 60.16% <ø> (ø) Carriedforward from be80b36
e2e-extensions 62.87% <ø> (ø) Carriedforward from be80b36
e2e-global-header 52.43% <ø> (ø) Carriedforward from be80b36
e2e-homepage 61.25% <ø> (ø) Carriedforward from be80b36
e2e-intelligent-assistant 46.10% <ø> (ø) Carriedforward from be80b36
e2e-orchestrator 49.80% <ø> (ø) Carriedforward from be80b36
e2e-orchestrator-plugin 49.79% <ø> (ø) Carriedforward from be80b36
e2e-quickstart 54.83% <ø> (ø) Carriedforward from be80b36
e2e-scorecard 49.88% <ø> (ø) Carriedforward from be80b36
e2e-theme 16.43% <ø> (ø) Carriedforward from be80b36
extensions 60.42% <ø> (ø) Carriedforward from be80b36
global-floating-action-button 71.18% <ø> (ø) Carriedforward from be80b36
global-header 69.15% <ø> (ø) Carriedforward from be80b36
homepage 86.65% <ø> (ø) Carriedforward from be80b36
install-dynamic-plugins 86.58% <ø> (ø) Carriedforward from be80b36
intelligent-assistant 79.92% <ø> (ø) Carriedforward from be80b36
konflux 91.98% <ø> (ø) Carriedforward from be80b36
lightspeed 69.02% <ø> (ø) Carriedforward from be80b36
mcp-integrations 84.46% <ø> (ø) Carriedforward from be80b36
orchestrator 77.13% <ø> (ø) Carriedforward from be80b36
quickstart 65.83% <ø> (ø)
sandbox 79.56% <ø> (ø) Carriedforward from be80b36
scorecard 92.32% <ø> (ø) Carriedforward from be80b36
theme 89.01% <ø> (ø) Carriedforward from be80b36
translations 7.91% <ø> (ø) Carriedforward from be80b36
x2a 81.73% <ø> (ø) Carriedforward from be80b36

*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 be80b36...25a26cc. 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.

@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch 2 times, most recently 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 4 times, most recently from 72b5c58 to 6c92fb4 Compare November 25, 2026 07:14
@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
@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch 2 times, most recently from 904b4a1 to 489aa5b Compare November 25, 2026 10:50
debsmita1 and others added 5 commits November 25, 2026 16:28
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>
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

Copy link
Copy Markdown
Member Author

/fs-review

@debsmita1
debsmita1 force-pushed the add-GH-to-appdefaults branch from 489aa5b to 25a26cc Compare November 25, 2026 15:00
@sonarqubecloud

Copy link
Copy Markdown

@ciiay ciiay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Request changes

Solid migration overall (API split into app-react, default masthead in app-defaults, standalone workspace removed/archived). Please address the following before merge.

Blocker

  1. Check codecov.yml matches overlay metadata is failing
    The PR hand-moves workspaces/app-defaults/ from Tech-Preview → GA in component_management. That block is generated from overlay support: metadata (scripts/generate-codecov-components.sh --check). Either:
    • revert the GA promotion and only keep flag/path updates for the deleted global-header workspace, or
    • promote app-defaults in the overlay repo first, then regenerate with --write.

Should fix

  1. SearchBar Enter-key stale closure (migrated pre-existing bug)
    In SearchBar.tsx, the Enter handler reads highlightedIndexRef.current for the condition but still indexes with state highlightedIndex. Use results[currentHighlight] and add a highlighted+Enter unit test.

  2. Public param type names
    New public API from app-react exports ToolbarComponentParams / MenuItemParams. Rename to GlobalHeaderComponentParams / GlobalHeaderMenuItemParams before first publish — renaming after release is harder.

  3. Divider.test.tsx still calls debug()
    Drops full DOM to CI logs on every run; remove it while touching the file.

  4. PR description is stale
    Description says deprecation is deferred to RHIDP-17736, but this PR already removes the workspace and archives the package. Align the description (and clarify what 17736 still covers, e.g. npm deprecate / product cutover).

  5. Docs: Static usage
    README Usage still says “import appDefaultsModule” without noting that the static path also needs the three global-header modules (or the feature loader). Cross-link from Static usage to the Global Header section.


Nits / Fullsend findings that are obsolete or non-blocking can wait. Please re-run /fs-review after the push — the prior CHANGES_REQUESTED was against an older SHA before the workspace deletion.

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.

3 participants