Skip to content

fix: surface refresh and failure states in compliance cards#13165

Merged
kubestellar-hive[bot] merged 1 commit into
kubestellar:mainfrom
Hridyansh7193:fix-compliance-card-refresh-state
May 11, 2026
Merged

fix: surface refresh and failure states in compliance cards#13165
kubestellar-hive[bot] merged 1 commit into
kubestellar:mainfrom
Hridyansh7193:fix-compliance-card-refresh-state

Conversation

@Hridyansh7193
Copy link
Copy Markdown
Contributor

@Hridyansh7193 Hridyansh7193 commented May 11, 2026

Addresses #13141


📝 Summary of Changes

VaultSecrets and ExternalSecrets cards were silently swallowing fetch failures and continuing to display stale install/configuration state as if the data was current.

This PR adds proper refresh/failure state handling and regression coverage for the affected compliance cards.

The update now surfaces:

  • refresh/loading state
  • failed fetch state
  • consecutive failure state
  • stale/unavailable data visibility

The implementation also aligns these cards with the existing loading/error handling patterns already used by TrivyScan, KubescapeScan, and CertManager.


Changes Made

  • Added refresh/failure state tracking for VaultSecrets and ExternalSecrets
  • Wired isRefreshing, isFailed, and consecutiveFailures into useCardLoadingState
  • Added inline error banner with retry support for failed fetches
  • Added auto-refresh using DEFAULT_REFRESH_INTERVAL_MS
  • Prevented stale data from silently appearing healthy/current
  • Added regression tests for healthy, loading, refresh, and failure states
  • Verified no regressions in existing compliance card tests

Checklist

Please ensure the following before submitting your PR:

  • 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](https://github.com/kubestellar/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)

Validation performed:

  • TypeScript: 0 errors
  • New regression tests: passing
  • Existing compliance card tests: passing with no regressions

👀 Reviewer Notes

The primary goal of this change is ensuring stale or failed compliance data is clearly distinguishable from healthy/current state.

The regression tests focus specifically on preventing future compliance cards from silently ignoring refresh/failure metadata.### 📌 Fixes

Fixes #13141


📝 Summary of Changes

VaultSecrets and ExternalSecrets cards were silently swallowing fetch failures and continuing to display stale install/configuration state as if the data was current.

This PR adds proper refresh/failure state handling and regression coverage for the affected compliance cards.

The update now surfaces:

  • refresh/loading state
  • failed fetch state
  • consecutive failure state
  • stale/unavailable data visibility

The implementation also aligns these cards with the existing loading/error handling patterns already used by TrivyScan, KubescapeScan, and CertManager.


Changes Made

  • Added refresh/failure state tracking for VaultSecrets and ExternalSecrets
  • Wired isRefreshing, isFailed, and consecutiveFailures into useCardLoadingState
  • Added inline error banner with retry support for failed fetches
  • Added auto-refresh using DEFAULT_REFRESH_INTERVAL_MS
  • Prevented stale data from silently appearing healthy/current
  • Added regression tests for healthy, loading, refresh, and failure states
  • Verified no regressions in existing compliance card tests

Checklist

Please ensure the following before submitting your PR:

  • 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](https://github.com/kubestellar/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)

Validation performed:

  • TypeScript: 0 errors
  • New regression tests: passing
  • Existing compliance card tests: passing with no regressions

👀 Reviewer Notes

The primary goal of this change is ensuring stale or failed compliance data is clearly distinguishable from healthy/current state.

The regression tests focus specifically on preventing future compliance cards from silently ignoring refresh/failure metadata.

Copilot AI review requested due to automatic review settings May 11, 2026 19:04
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: no Indicates the PR's author has not signed the DCO. label May 11, 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 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

@netlify
Copy link
Copy Markdown

netlify Bot commented May 11, 2026

Deploy Preview for kubestellarconsole canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 2d0e101
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a0229f0a1181e0008d7fa4f
@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👋 Hey @Hridyansh7193 — 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

👋 Welcome to the KubeStellar community! 💖

Thanks and congrats 🎉 for opening your first PR here! We're excited to have you contributing.

Before merge, please ensure:

  • DCO Sign-off — All commits signed with git commit -s (DCO)
  • PR Title — Starts with an emoji: ✨ feature | 🐛 bug fix | 📖 docs | 🌱 infra/tests | ⚠️ breaking

📬 If you're using KubeStellar in your organization, please add your name to our Adopters list. 🙏 It really helps the project gain momentum and credibility — a small contribution back with a big impact.

Resources:

A maintainer will review your PR soon. Hope you have a great time here!

🌟 ~~~~~~~~~~ 🌟

📬 If you like KubeStellar, please ⭐ star ⭐ our repo to support it!

🙏 It really helps the project gain momentum and credibility — a small contribution back with a big impact.

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 updates the VaultSecrets and ExternalSecrets compliance cards to surface refresh/loading and fetch-failure states (including consecutive failures) instead of silently continuing to display potentially stale “healthy” install/configuration UI. It also adds regression tests intended to cover these state transitions.

Changes:

  • Added isRefreshing, fetchError, and consecutiveFailures tracking to VaultSecrets and ExternalSecrets, plus an auto-refresh interval.
  • Wired isRefreshing, isFailed, and consecutiveFailures into useCardLoadingState for CardWrapper-level status visibility.
  • Added new regression tests for error/loading/refresh signaling across affected cards.

Reviewed changes

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

File Description
web/src/components/cards/DataComplianceCards.tsx Adds refresh/failure tracking, retry UI, and interval-based refetch for Vault/ESO cards, reporting status to useCardLoadingState.
web/src/components/cards/__tests__/DataComplianceCards.states.test.tsx Adds regression tests for loading/refresh/failure visibility for VaultSecrets, ExternalSecrets, and CertManager.
Comment on lines +105 to +109
if (anyError && !found && secrets === 0) {
// All clusters failed — mark as failed fetch
setFetchError(true)
setConsecutiveFailures(prev => prev + 1)
} else {
Comment on lines +342 to +345
if (anyError && !found && totalES === 0) {
setFetchError(true)
setConsecutiveFailures(prev => prev + 1)
} else {
Comment on lines +59 to +67
const refetch = useCallback(async () => {
if (isDemoMode || clusters.length === 0 || fetchInProgress.current) return
fetchInProgress.current = true

let cancelled = false
async function detect() {
if (initialLoadDone.current) {
setIsRefreshing(true)
} else {
setIsLoading(true)
let found = false
let totalPods = 0
let readyPods = 0
let secrets = 0

for (const cluster of clusters) {
try {
// Check for Vault pods (helm release or operator)
const podsResult = await kubectlProxy.exec(
['get', 'pods', '-A', '-l', 'app.kubernetes.io/name=vault', '-o', 'json'],
{ context: cluster.name, timeout: KUBECTL_DEFAULT_TIMEOUT_MS }
)
if (podsResult.exitCode === 0 && podsResult.output) {
const data = JSON.parse(podsResult.output)
const items = data.items || []
if (items.length > 0) {
found = true
totalPods += items.length
readyPods += items.filter((p: { status?: { phase?: string } }) =>
p.status?.phase === 'Running'
).length
}
}
}
Comment on lines +130 to +132
setIsLoading(false)
setFetchError(false)
setConsecutiveFailures(0)
Comment on lines +83 to +92
it('reports isFailed=true to useCardLoadingState after errors', async () => {
mockClusters.mockReturnValue([cluster()])
mockKubectlExec.mockRejectedValue(new Error('fail'))

await act(async () => render(<VaultSecrets />))
await waitFor(() => {
expect(mockUseCardLoadingState).toHaveBeenCalledWith(
expect.objectContaining({ isFailed: false })
)
})
Comment on lines +95 to +104
it('reports isRefreshing via useCardLoadingState', async () => {
mockClusters.mockReturnValue([cluster()])
mockKubectlExec.mockResolvedValue({ exitCode: 1, output: '' })

await act(async () => render(<VaultSecrets />))
// After initial load, isRefreshing should be reported
expect(mockUseCardLoadingState).toHaveBeenCalledWith(
expect.objectContaining({ isRefreshing: expect.any(Boolean) })
)
})
Comment on lines +227 to +235
function setupCertManager(overrides = {}) {
mockUseCertManager.mockReturnValue({
status: { ...DEFAULT_CERT_STATUS, ...overrides },
issuers: [],
isLoading: false,
isRefreshing: false,
consecutiveFailures: 0,
isFailed: false,
...overrides,
Signed-off-by: Hridyansh7193 <hridyanshbhadauria@gmail.com>
@Hridyansh7193 Hridyansh7193 force-pushed the fix-compliance-card-refresh-state branch from bfa2dbf to 2d0e101 Compare May 11, 2026 19:11
@kubestellar-prow kubestellar-prow 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 May 11, 2026
@kubestellar-hive kubestellar-hive Bot merged commit 13d3ec9 into kubestellar:main May 11, 2026
28 of 34 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

❌ Post-Merge Verification: failed

Commit: 13d3ec91ed3a616cf3475706b46d24f342f5269f
Specs run: Dashboard.spec.ts smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/25692162710

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tier/2-standard

2 participants