Skip to content

0048: Configure product-specific error content - #7288

Open
illume wants to merge 2 commits into
kubernetes-sigs:mainfrom
illume:upstream-0048-product-error-content
Open

0048: Configure product-specific error content#7288
illume wants to merge 2 commits into
kubernetes-sigs:mainfrom
illume:upstream-0048-product-error-content

Conversation

@illume

@illume illume commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Allow products to configure titles and graphics for the generic error and
    not-found pages at build time.
  • Preserve Headlamp's existing content when product values are absent.
  • Keep explicit ErrorPage props higher priority than product defaults.

Source

This upstreams retained patch 0048 from:

The retained patch records original source commit
54f6941bcd764cbe8230d802f2f0946e83222b4e, authored by Joaquim Rocha on
2026-08-01. That source object is no longer available from Azure/aks-desktop,
so PR 823 is the only related Azure pull request that could be verified.

Improvements over the existing changes

  • Add tests for Headlamp's existing error-page defaults in a separate commit
    before the product customization, making fallback regressions explicit.
  • Add component-level tests for configured content and explicit prop priority,
    so build-time env defaults are covered at their actual render call sites.
  • Read product values directly in the 404 and ErrorPage components, avoiding an
    extra helper abstraction and helper-only test file.
  • Update the public ErrorComponentProps TSDoc to describe product defaults
    and Headlamp fallbacks accurately.
  • Raise focused branch coverage to 88.09%; each changed source file is above
    80% branch coverage.

These changes make the upstream version safer to review and maintain while
preserving the behavior of the retained downstream patch.

Testing

  • npm test -- --run src/components/404/index.test.tsx src/components/common/ErrorPage/ErrorPage.test.tsx --coverage --coverage.include=src/components/404/index.tsx --coverage.include=src/components/common/ErrorPage/ErrorPage.tsx --coverage.reporter=text --coverage.thresholds.branches=80
    • 11 tests passed
    • 88.09% branch coverage overall
    • 100% branches for the 404 component
    • 86.84% branches for ErrorPage.tsx
  • npm run tsc
  • npm run build

The existing Playwright test 404 page is present in
e2e-tests/tests/headlamp.spec.ts covers this UI area. It was not run locally
because it requires the deployed Kubernetes e2e environment and token.

Screenshots

Before: default Headlamp content

Default Headlamp not-found title and illustration

After: configured product content

Product-specific not-found title and illustration

The after capture uses representative product values for both the title and
graphic to show the two build-time configuration options together.

Assisted by copilot

Protect existing fallback titles and graphics before product-specific
configuration is introduced.
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 16, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from skoeva and sniok August 16, 2026 14:03
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: illume

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 16, 2026
@illume
illume requested a balanced review from Copilot August 16, 2026 19:04
@illume
illume marked this pull request as draft August 16, 2026 19:04
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 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

Adds build-time product customization for generic error and not-found pages while preserving existing fallbacks and explicit prop priority.

Changes:

  • Adds product error-content configuration helper.
  • Integrates configured titles and graphics into error pages.
  • Adds comprehensive fallback and precedence tests.

Public ErrorComponentProps documentation requires correction. CI checks pass, and commit history is linear and coherent.

Reviewed changes

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

Show a summary per file
File Description
frontend/src/helpers/getProductErrorContent.ts Reads and normalizes product content.
frontend/src/helpers/getProductErrorContent.test.ts Tests configuration normalization.
frontend/src/components/common/ErrorPage/ErrorPage.tsx Applies generic error defaults.
frontend/src/components/common/ErrorPage/ErrorPage.test.tsx Tests defaults and precedence.
frontend/src/components/404/index.tsx Applies not-found defaults.
frontend/src/components/404/index.test.tsx Tests not-found rendering.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/src/components/common/ErrorPage/ErrorPage.tsx Outdated
@illume
illume force-pushed the upstream-0048-product-error-content branch from 646d186 to 534904d Compare August 16, 2026 19:36
@illume
illume requested a balanced review from Copilot August 16, 2026 20:03

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 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread frontend/src/helpers/getProductErrorContent.ts Outdated
Allow downstream products to customize error titles and graphics at build time.

Preserve Headlamp defaults and explicit caller overrides.

Co-authored-by: René Dudfield <renedudfield@microsoft.com>
@illume
illume force-pushed the upstream-0048-product-error-content branch from 534904d to d9e6af3 Compare August 16, 2026 20:10
@illume
illume marked this pull request as ready for review August 16, 2026 20:15
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2026
@illume illume added this to the v0.45.0 milestone Aug 16, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from joaquimrocha August 16, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants