Skip to content

🐛 [scanner] fix: handle null images in buildpacks coverage test#19336

Merged
clubanderson merged 1 commit into
mainfrom
scanner/fix-19334
Jun 21, 2026
Merged

🐛 [scanner] fix: handle null images in buildpacks coverage test#19336
clubanderson merged 1 commit into
mainfrom
scanner/fix-19334

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Fixes #19334

This PR fixes the failing test in the buildpacks-coverage test suite by making two changes:

  1. Test fix: Added missing status: 200 property to the mock fetch response in the "null images in response" test. The hook checks response.status === 404, so the mock needs a status property.

  2. Hook fix: Fixed infinite loop caused by empty array not being considered valid cached data. Changed cache validation from buildpackCache.data.length > 0 to buildpackCache.timestamp > 0. An empty array is valid cached data and should not trigger repeated refetches.

Root cause: When the API returned null for images (which correctly defaulted to [] via data.images || []), the empty array was cached, but the cache validation logic considered it invalid because length === 0. This caused the useEffect to repeatedly call refetch(), creating an infinite loop manifested as "Maximum update depth exceeded" errors.

Testing: All 5 tests in buildpacks-coverage.test.ts now pass.

Signed-off-by: Hive Scanner <hive-scanner@kubestellar.local>
Copilot AI review requested due to automatic review settings June 21, 2026 06:07
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jun 21, 2026
@netlify

netlify Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit e16b924
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a377f8fdc93130008921678
😎 Deploy Preview https://deploy-preview-19336.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson 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

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions

Copy link
Copy Markdown
Contributor

🐝 Hi @clubanderson! I'm kubestellar-hive[bot], an automation bot for this repo.

Trusted users — org members and contributors with write access — can mention @kubestellar-hive in a comment to trigger repo automation.
On issues, that mention queues an automated fix attempt. On pull requests, it records extra context for existing automation.
This is not an interactive Q&A bot, so mentions should be treated as requests for automation rather than a conversation.

Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies.

@kubestellar-prow kubestellar-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Check

All new source files in this PR have corresponding test files.

Checked web/src/hooks/ and web/src/components/ against origin/main.

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

This PR fixes a failing buildpacks coverage test and resolves an infinite refetch loop in the useBuildpackImages MCP hook by treating an empty cached array as valid cached data (when a real cache timestamp exists).

Changes:

  • Update cache validation in useBuildpackImages to use buildpackCache.timestamp > 0 (instead of data.length > 0) so cached empty arrays don’t trigger repeated refetches.
  • Fix the “null images in response” test mock to include status: 200, matching the hook’s reliance on response.status.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
web/src/hooks/mcp/buildpacks.ts Fixes cache-validity logic to prevent infinite refetch when cached images are [].
web/src/hooks/mcp/__tests__/buildpacks-coverage.test.ts Updates fetch mock to include an HTTP status code for the null-images test case.

@clubanderson clubanderson merged commit 1953a58 into main Jun 21, 2026
42 of 51 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the scanner/fix-19334 branch June 21, 2026 06:41
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 1953a58c1ed3303f28eaf939f5817c766de155cf.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: 1953a58c1ed3303f28eaf939f5817c766de155cf
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/27896229675

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

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 1 test failure(s) in Coverage Suite run #3836

2 participants