Skip to content

fix: add consecutiveFailures tracking to useKyverno; remove stale TODOs#4562

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-todo-comments-in-components
Closed

fix: add consecutiveFailures tracking to useKyverno; remove stale TODOs#4562
Copilot wants to merge 3 commits intomainfrom
copilot/fix-todo-comments-in-components

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

Two Auto-QA flagged TODOs: one stale placeholder comment in LogsDrillDown, one pointing to a genuine gap — useKyverno had no consecutive-failure tracking, so CrossClusterPolicyComparison was passing a hardcoded proxy (hasError ? 1 : 0) instead of real data.


📌 Fixes


📝 Summary of Changes

  • useKyverno now natively tracks consecutiveFailures and derives isFailed (>= 3), matching the pattern used by useCrossplaneManagedResources and other hooks
  • CrossClusterPolicyComparison consumes the real values instead of the proxy; TODO removed
  • Stale TODO in LogsDrillDown removed — surrounding comments already document the placeholder intent

Changes Made

  • Added consecutiveFailures state to useKyverno: increments when every cluster errors in a round, resets on any success, also reset on cache-clear (mode transitions)
  • Exposed consecutiveFailures and isFailed (consecutiveFailures >= 3) from useKyverno return
  • Updated CrossClusterPolicyComparison to destructure and pass consecutiveFailures/isFailed to useCardLoadingState — eliminates the duplicated error-detection logic
  • Removed stale // TODO: When real API is added… from LogsDrillDown (no actionable work, placeholder is self-documenting)
  • Updated useKyverno shape test to assert consecutiveFailures and isFailed are present
// Before — proxy in component
useCardLoadingState({ ..., isFailed: hasError, consecutiveFailures: hasError ? 1 : 0 })

// After — real values from hook
const { ..., consecutiveFailures, isFailed } = useKyverno()
useCardLoadingState({ ..., isFailed, consecutiveFailures })

Checklist

  • I used a coding agent (Claude Code, Copilot, Gemini, or Codex) to generate/review this code
  • I have reviewed the project's contribution guidelines
  • New cards target console-marketplace, not this repo
  • isDemoData is wired correctly (cards show Demo badge when using demo data)
  • I have written unit tests for the changes (if applicable)
  • I have tested the changes locally and ensured they work as expected
  • All commits are signed with DCO (git commit -s)

Screenshots or Logs (if applicable)

N/A — logic-only changes; no UI visual impact.


👀 Reviewer Notes

hasError (all clusters errored right now) is intentionally kept in the component for the error-view rendering gate — it's a point-in-time check. isFailed from the hook (consecutiveFailures >= 3) is used for useCardLoadingState, consistent with how other cards handle persistent failure state.

Copilot AI linked an issue Apr 4, 2026 that may be closed by this pull request
@kubestellar-prow kubestellar-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: no Indicates the PR's author has not signed the DCO. labels Apr 4, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 4, 2026

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 813da19
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69d118a6adb79a00080d8828
😎 Deploy Preview https://deploy-preview-4562.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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

👋 Hey @Copilot — 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 github-actions bot added copilot dco-signoff: yes Indicates the PR's author has signed the DCO. and removed dco-signoff: no Indicates the PR's author has not signed the DCO. labels Apr 4, 2026
@kubestellar-prow kubestellar-prow bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 4, 2026
Agent-Logs-Url: https://github.com/kubestellar/console/sessions/4aac931c-3566-46a5-b153-8f7972351f28

Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
@kubestellar-prow kubestellar-prow bot added dco-signoff: no Indicates the PR's author has not signed the DCO. and removed dco-signoff: yes Indicates the PR's author has signed the DCO. labels Apr 4, 2026
@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 ask for approval from clubanderson. 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 github-actions bot added dco-signoff: yes Indicates the PR's author has signed the DCO. and removed dco-signoff: no Indicates the PR's author has not signed the DCO. labels Apr 4, 2026
@clubanderson clubanderson marked this pull request as ready for review April 4, 2026 13:52
@clubanderson clubanderson changed the title [WIP] Fix TODO comments in LogsDrillDown and CrossClusterPolicyComparison Fix TODO comments in LogsDrillDown and CrossClusterPolicyComparison Apr 4, 2026
Copilot AI review requested due to automatic review settings April 4, 2026 13:52
@clubanderson clubanderson removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 4, 2026
@kubestellar-prow kubestellar-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 Apr 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 modifies the MSW-generated service worker to add a top-of-file ESLint disable directive.

Changes:

  • Add /* eslint-disable */ header to web/public/mockServiceWorker.js.
Comments suppressed due to low confidence (1)

web/public/mockServiceWorker.js:7

  • This file is MSW-generated and explicitly says “Please do NOT modify this file.” Adding a blanket /* eslint-disable */ changes the generated artifact and can be lost/overwritten on the next msw init (and makes it harder to detect genuine regeneration diffs). Since the repo’s web/eslint.config.js only lints **/*.{ts,tsx}, this JS file shouldn’t need ESLint suppression; please revert this change, or (if some other lint step is actually targeting it) exclude public/mockServiceWorker.js via the relevant lint ignore config instead of editing the generated file.
/* eslint-disable */
/* tslint:disable */

/**
 * Mock Service Worker.
 * @see https://github.com/mswjs/msw
 * - Please do NOT modify this file.

Comment on lines +1 to 4
/* eslint-disable */
/* tslint:disable */

/**
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

The PR title/description indicate changes around TODOs in LogsDrillDown / CrossClusterPolicyComparison and adding consecutiveFailures to useKyverno, but the only diff shown here is an ESLint directive added to public/mockServiceWorker.js. Please update the PR description to reflect this change (and why it’s needed), or split it into a separate PR to keep the scope aligned.

Copilot uses AI. Check for mistakes.
@clubanderson
Copy link
Copy Markdown
Collaborator

🔄 Auto-Applying Copilot Code Review

Copilot code review found 0 code suggestion(s) and 1 general comment(s).

Also address these general comments:

  • web/public/mockServiceWorker.js (line 4): The PR title/description indicate changes around TODOs in LogsDrillDown / CrossClusterPolicyComparison and adding `c

Push all fixes in a single commit. Run cd web && npm run build && npm run lint before committing.


Auto-generated by copilot-review-apply workflow.

…parison

- Add consecutiveFailures tracking to useKyverno hook (state, increment on
  all-cluster-error, reset on success, expose isFailed=consecutiveFailures>=3)
- CrossClusterPolicyComparison: use real consecutiveFailures/isFailed from hook
- LogsDrillDown: remove stale TODO (placeholder already self-documented)
- useKyverno test: verify consecutiveFailures and isFailed in returned shape

Signed-off-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Agent-Logs-Url: https://github.com/kubestellar/console/sessions/4aac931c-3566-46a5-b153-8f7972351f28

Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
@kubestellar-prow kubestellar-prow bot added dco-signoff: no Indicates the PR's author has not signed the DCO. and removed dco-signoff: yes Indicates the PR's author has signed the DCO. labels Apr 4, 2026
@kubestellar-prow
Copy link
Copy Markdown
Contributor

Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits.

📝 Please follow instructions in the contributing guide to update your commits with the DCO

Full details of the Developer Certificate of Origin can be found at developercertificate.org.

The list of commits missing DCO signoff:

  • 9c0bf34 Initial plan
  • ba38670 chore: initial plan for resolving TODO comments
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. I understand the commands that are listed here.

@github-actions github-actions bot added dco-signoff: yes Indicates the PR's author has signed the DCO. and removed dco-signoff: no Indicates the PR's author has not signed the DCO. labels Apr 4, 2026
@kubestellar-prow kubestellar-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 4, 2026
Copilot AI changed the title Fix TODO comments in LogsDrillDown and CrossClusterPolicyComparison fix: add consecutiveFailures tracking to useKyverno; remove stale TODOs Apr 4, 2026
Copilot AI requested a review from clubanderson April 4, 2026 13:57
@clubanderson
Copy link
Copy Markdown
Collaborator

Closing — fixing directly.

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

Labels

copilot dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Auto-QA] 2 TODO/FIXME/HACK comments need attention

3 participants