Skip to content

🌱 fix: log errors previously swallowed in silent catches#21289

Merged
clubanderson merged 3 commits into
mainfrom
scanner/fix-21287
Jul 19, 2026
Merged

🌱 fix: log errors previously swallowed in silent catches#21289
clubanderson merged 3 commits into
mainfrom
scanner/fix-21287

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Fixes #21287

Summary

Replaces empty .catch(() => {}) handlers in source files with logger.warn calls so errors are surfaced in the console rather than silently discarded.

Files changed

  • web/src/components/cards/cardRegistry.index.ts — prefetch chunk failures now logged
  • web/src/components/layout/SidebarCustomizer.tsx — AI icon suggestion failures now logged
  • web/src/hooks/useStellarSource.ts — Stellar API call failures (getWatches, listSolves, listActivity) now logged
  • web/src/lib/cache/cacheCore.ts — IDB worker writes and auto-refresh refetch failures now logged

No behavior changes beyond adding logging.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Copilot AI review requested due to automatic review settings July 19, 2026 14:12
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jul 19, 2026
@netlify

netlify Bot commented Jul 19, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 316569c
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a5d2c60fc81a10008e6d6e0
😎 Deploy Preview https://deploy-preview-21289.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 eeshaansa 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Auto Test Generator

The following new files have no corresponding test file:

  • web/src/components/cards/cardRegistry.index.ts

Please add tests or apply the needs-tests label to track this PR.

@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.

@github-actions

Copy link
Copy Markdown
Contributor

♿ Accessibility Audit (WCAG 2.1 AA)

✅ No WCAG 2.1 AA violations detected in audited routes.


Powered by axe-core. Target: WCAG 2.1 AA compliance.

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 aims to eliminate previously-silent promise rejections by replacing empty .catch(() => {}) handlers with logger.warn(...) calls across the frontend, so failures surface in the console.

Changes:

  • Add warning logs for failed card chunk prefetches (cardRegistry.index.ts).
  • Add warning log when AI icon suggestion fails in the sidebar customizer (SidebarCustomizer.tsx).
  • Add warning logs for Stellar SSE-triggered refresh failures and cache auto-refresh/IDB worker failures (useStellarSource.ts, cacheCore.ts).

Build/lint are validated by CI on the PR.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
web/src/lib/cache/cacheCore.ts Logs IDB worker write failures and cache refetch/auto-refresh failures (but currently contains a broken refetch/registerRefetch block that must be fixed).
web/src/hooks/useStellarSource.ts Logs Stellar API refresh failures triggered by SSE events (but currently contains malformed handler registration that must be fixed).
web/src/components/layout/SidebarCustomizer.tsx Logs failures from suggestDashboardIcon instead of swallowing errors.
web/src/components/cards/cardRegistry.index.ts Logs failures when prefetching dynamic card chunks and demo startup chunks.

Comment on lines 594 to 598
const dataAge = lastRefresh ? Date.now() - lastRefresh : Infinity
const hasFreshData = !state.isLoading && !state.isRefreshing && dataAge < baseInterval
if (!hasFreshData) {
refetch().catch(() => {})
}
}

const unregisterRefetch = registerRefetch(`cache:${key}`, refetch)
refetch().catch((e) => logger.warn(`[Cache] Initial refetch failed for ${key}:`, e))(`cache:${key}`, refetch)

Comment on lines 248 to 252
on<{ id: string; summary: string; suggest?: string }>('observation', payload => {
setNudge({ id: payload.id, summary: payload.summary, suggest: payload.suggest, ts: new Date().toISOString() })
stellarApi.getWatches().then(setWatches).catch(() => {})
})
on<{ notifications?: StellarNotification[]; watches?: StellarWatch[]; pendingActions?: StellarAction[]; operationalState?: StellarOperationalState }>('initial_batch', batch => {
stellarApi.getWatches().then(setWatches).catch((e) => logger.warn('[StellarSource] Failed to refresh watches on observation:', e)); pendingActions?: StellarAction[]; operationalState?: StellarOperationalState }>('initial_batch', batch => {
if (batch.notifications) setNotifications(sortNotificationsByCreatedAt(batch.notifications))
if (batch.watches) setWatches(batch.watches)
Comment on lines 270 to 276
on<{ solveId: string; eventId: string }>('solve_started', payload => {
setSolveProgress(prev => ({
...prev,
[payload.eventId]: { solveId: payload.solveId, eventId: payload.eventId, step: 'reading', message: 'Solve started — Stellar is on it.', actionsTaken: 0, status: 'running' },
}))
stellarApi.listSolves().then(setSolves).catch(() => {})
})
on<StellarSolveProgress>('solve_progress', payload => setSolveProgress(prev => ({ ...prev, [payload.eventId]: payload })))
stellarApi.listSolves().then(setSolves).catch((e) => logger.warn('[StellarSource] Failed to refresh solves on solve_started:', e)), payload => setSolveProgress(prev => ({ ...prev, [payload.eventId]: payload })))
on<{ solveId: string; eventId: string; status: string; summary: string }>('solve_complete', payload => {

@clubanderson clubanderson left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[quality] LGTM with two nits (comment mode; self-approve blocked)

Clean, targeted diff — replaces 9 silent .catch(() => {}) handlers with logger.warn(...) calls that include descriptive prefixes ([CardRegistry], [SidebarCustomizer], [StellarSource], [Cache]) and the underlying error. Zero behavior change beyond emitting log lines, which is the correct scope for a "surface swallowed errors" PR.

Concerns

  1. Inconsistent logging system in cacheCore.ts. In CacheStore.set() the outer error path already uses console.error(\[Cache] Failed to save ${this.key}:`, e)(existing code, line 143 in the diff context), and the new IDB inner-catch useslogger.warn(`[Cache] IDB worker write failed for ${this.key}:`, e). Same file, same try block, two different logging systems, two different severity levels. Options: switch the outer to logger.error`, or leave the outer alone but flag the discrepancy in a follow-up. Not blocking, but worth deciding on before this becomes an entrenched pattern.

  2. SidebarCustomizer.tsx import placement — the new import { logger } from '../../lib/logger' is appended at the end of the import block after the ./sidebar-customizer/* sibling imports. Existing style in this file appears to group ../../ before ./. Trivial ESLint-fixable, but worth being consistent.

Non-blocking suggestion — coverage for the log path

None of the four changed files gets a test verifying logger.warn was called on failure. This is exactly quality's domain, and a 3-line vitest per file would lock the behavior:

it('logs when card chunk prefetch fails', async () => {
  const warnSpy = vi.spyOn(logger, 'warn')
  CARD_CHUNK_PRELOADERS['badType'] = () => Promise.reject(new Error('boom'))
  prefetchCardChunks(['badType'])
  await vi.waitFor(() => expect(warnSpy).toHaveBeenCalledWith(
    '[CardRegistry] Failed to prefetch card chunk:', 'badType', expect.any(Error)
  ))
})

Without this, a future refactor could silently break the logging (revert to .catch(() => {})) and nothing would notice. Follow-up PR is fine.

Positive observations

  • All 9 changed sites use consistent (e) => logger.warn('[Scope] Description:', e) shape. Easy to grep for.
  • No PII risk: none of the logged messages include user tokens, cluster credentials, or namespace names beyond variable references (this.key, key, type) that a support engineer already needs.
  • Descriptive scope prefixes ([CardRegistry], [StellarSource], [Cache]) will make log triage easier.
  • Log level is warn, not error — appropriate for background prefetch/refresh failures that don't break the user's current interaction.

Bead filed. Not merging.


Filed by quality agent (ACMM L4/L6 — full mode)

Copilot AI and others added 3 commits July 19, 2026 15:56
Signed-off-by: GitHub Copilot <223556219+Copilot@users.noreply.github.com>
…acheCore

Prior commit's substitutions accidentally merged separate SSE handlers and the initial-refetch block, leaving 22 TypeScript syntax errors. Restore the deleted lines so build-gate passes.

Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add missing 'key' dep to reset-interval-on-refetch useEffect, which was
introduced in the useEffect split but omitted from the dependency array.
This brings the react-hooks/exhaustive-deps count back to the baseline.

Also rebased onto origin/main (0f81cb0) to pick up PR #21290 changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Scanner <scanner@kubestellar.io>
@github-actions github-actions Bot added the ai-generated Pull request generated by AI label Jul 19, 2026
@clubanderson
clubanderson merged commit 68ec239 into main Jul 19, 2026
42 of 46 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-21287 branch July 19, 2026 20:54
@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 Verification: cancelled

Commit: 68ec239ba1ea356e8a478cd1ac11024673db5f5d
Specs run: Dashboard.spec.ts navbar-responsive.spec.ts smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/29703397599

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 68ec239ba1ea356e8a478cd1ac11024673db5f5d.

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

Labels

ai-generated Pull request generated by AI 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. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Auto-QA] Silent failures in error handling detected

3 participants