Skip to content

fix(storybook): return 404 for unsupported API versions in baseMocks#4736

Open
kunaldevsahu wants to merge 1 commit intokubernetes-sigs:mainfrom
kunaldevsahu:fix/storybook-404-api-version
Open

fix(storybook): return 404 for unsupported API versions in baseMocks#4736
kunaldevsahu wants to merge 1 commit intokubernetes-sigs:mainfrom
kunaldevsahu:fix/storybook-404-api-version

Conversation

@kunaldevsahu
Copy link

Summary

This PR updates Storybook baseMocks to return a 404 HTTP response
for unsupported API versions instead of throwing a generic network error.
This aligns mock behavior with actual backend responses and improves
error handling consistency.

Related Issue

Fixes #4735

Changes

  • Updated baseMocks to return HTTP 404 for unsupported API versions
  • Replaced generic network error handling logic

Steps to Test

  1. Run Storybook locally
  2. Trigger a request using an unsupported API version
  3. Verify that the response returns a 404 status instead of a network error

Screenshots (if applicable)

N/A

Notes for the Reviewer

  • This change only affects Storybook mock behavior.
  • No backend logic was modified.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 19, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: kunaldevsahu / name: kunaldevsahu (e10105d)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kunaldevsahu
Once this PR has been reviewed and has the lgtm label, please assign yolossn for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot requested a review from sniok February 19, 2026 10:56
@k8s-ci-robot
Copy link
Contributor

Welcome @kunaldevsahu!

It looks like this is your first PR to kubernetes-sigs/headlamp 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/headlamp has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 19, 2026
*/
export const baseMocks = [
http.get('http://localhost:4466/wsMultiplexer', () => HttpResponse.error()),
http.get('http://localhost:4466/wsMultiplexer', () => new HttpResponse(null, { status: 404 })),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the linked issue #4735 describes a problem with apiextensions.k8s.io/v1beta1/customresourcedefinitions endpoints using HttpResponse.error() to simulate network failures instead of returning 404. However, this PR changes the wsMultiplexer endpoint instead. The wsMultiplexer HTTP mock exists intentionally to suppress MSW "unhandled request" warnings for WebSocket URLs — HttpResponse.error() is the correct behavior there since MSW cannot intercept WebSocket upgrade connections via http.get() handlers.

Copy link
Contributor

@skoeva skoeva left a comment

Choose a reason for hiding this comment

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

want to echo the last comment, this PR isn't addressing the root issue

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 21, 2026
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

storybook: Use 404 instead of network error for unsupported API versions in baseMocks

4 participants