@skyhook-io/radar-app 1.17.1 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +6 -0
  2. package/package.json +10 -11
  3. package/src/App.tsx +36 -36
  4. package/src/api/client.gitops-destination.test.tsx +55 -0
  5. package/src/api/client.gitopsPoll.test.ts +99 -0
  6. package/src/api/client.helmPreview.test.tsx +48 -0
  7. package/src/api/client.resource-list.test.ts +76 -0
  8. package/src/api/client.resourceAvailability.test.ts +24 -0
  9. package/src/api/client.ts +396 -105
  10. package/src/api/client.workloadRuns.test.ts +53 -0
  11. package/src/api/config.test.ts +23 -1
  12. package/src/api/config.ts +7 -3
  13. package/src/api/diagnose.ts +4 -1
  14. package/src/api/drain-plan.test.ts +70 -40
  15. package/src/api/policy.ts +5 -5
  16. package/src/api/quotas.ts +9 -20
  17. package/src/api/radarFeatures.ts +3 -0
  18. package/src/api/resourceLists.test.ts +84 -0
  19. package/src/api/resourceLists.ts +71 -0
  20. package/src/api/traffic.scope.render.test.tsx +60 -0
  21. package/src/api/traffic.ts +3 -1
  22. package/src/components/cnpg/CNPGSummaryHost.tsx +4 -3
  23. package/src/components/cnpg/CNPGView.tsx +1 -0
  24. package/src/components/compare/CompareResourcePicker.test.tsx +58 -0
  25. package/src/components/compare/CompareViewRoute.tsx +5 -1
  26. package/src/components/compare/useCompareCandidates.ts +1 -1
  27. package/src/components/compare/useCompareLauncher.tsx +4 -2
  28. package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
  29. package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
  30. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
  31. package/src/components/diagnose/InvestigationView.tsx +2 -1
  32. package/src/components/diagnose/StoryExcerpt.tsx +24 -5
  33. package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
  34. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
  35. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -51
  36. package/src/components/diagnose/investigationEvidence/adapters/listCoverage.test.ts +415 -0
  37. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
  38. package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
  39. package/src/components/diagnose/investigationEvidence/adapters/resource.ts +107 -8
  40. package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
  41. package/src/components/diagnose/investigationEvidence/bodies/inventory.tsx +66 -16
  42. package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
  43. package/src/components/diagnose/investigationEvidence/builder.ts +13 -1
  44. package/src/components/diagnose/investigationEvidence/excerpt.ts +2 -0
  45. package/src/components/diagnose/investigationEvidence/observations.ts +21 -0
  46. package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
  47. package/src/components/diagnose/investigationEvidence/projection.test.ts +131 -1
  48. package/src/components/diagnose/investigationEvidence/types.ts +26 -0
  49. package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
  50. package/src/components/diagnose/investigationState.test.ts +36 -1
  51. package/src/components/diagnose/investigationState.ts +8 -0
  52. package/src/components/diagnose/launch.ts +2 -2
  53. package/src/components/diagnose/toolCallLabel.test.ts +9 -0
  54. package/src/components/diagnose/toolCallLabel.ts +2 -0
  55. package/src/components/dock/BottomDock.tsx +6 -3
  56. package/src/components/dock/WorkloadLogsTab.tsx +3 -0
  57. package/src/components/execution/BatchExecutionView.image-browse.test.tsx +46 -0
  58. package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
  59. package/src/components/execution/BatchExecutionView.tsx +28 -11
  60. package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
  61. package/src/components/gitops/GitOpsView.identity.test.tsx +113 -0
  62. package/src/components/gitops/GitOpsView.tsx +69 -40
  63. package/src/components/gitops/useDestinationCluster.ts +2 -1
  64. package/src/components/helm/ArtifactHubSourceSearch.test.tsx +124 -0
  65. package/src/components/helm/ArtifactHubSourceSearch.tsx +240 -0
  66. package/src/components/helm/ChartBrowser.tsx +5 -4
  67. package/src/components/helm/HelmReleaseDrawer.tsx +139 -55
  68. package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
  69. package/src/components/helm/HelmReleaseNotes.tsx +26 -0
  70. package/src/components/helm/OwnedResources.tsx +2 -2
  71. package/src/components/helm/TrackChartSourceDialog.render.test.tsx +295 -50
  72. package/src/components/helm/TrackChartSourceDialog.test.ts +3 -2
  73. package/src/components/helm/TrackChartSourceDialog.tsx +614 -85
  74. package/src/components/helm/ValuesDiffPreview.tsx +4 -1
  75. package/src/components/home/ClusterHealthCard.tsx +4 -4
  76. package/src/components/home/CostCard.test.tsx +100 -0
  77. package/src/components/home/CostCard.tsx +2 -2
  78. package/src/components/home/HelmSummary.tsx +2 -2
  79. package/src/components/home/HomeView.tsx +15 -6
  80. package/src/components/home/MCPSetupDialog.test.tsx +30 -0
  81. package/src/components/home/MCPSetupDialog.tsx +13 -6
  82. package/src/components/home/ProblemsPanel.test.tsx +1 -0
  83. package/src/components/home/mcpToolCatalog.ts +28 -2
  84. package/src/components/issues/IssuesPane.render.test.tsx +21 -0
  85. package/src/components/issues/IssuesPane.tsx +31 -7
  86. package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
  87. package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
  88. package/src/components/issues/uncheckedSources.test.ts +43 -0
  89. package/src/components/issues/uncheckedSources.ts +58 -5
  90. package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
  91. package/src/components/resource/PrometheusCharts.overlays.test.ts +45 -0
  92. package/src/components/resource/PrometheusCharts.tsx +2 -2
  93. package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
  94. package/src/components/resources/ImageFilesystemModal.tsx +11 -4
  95. package/src/components/resources/PodFilesystemModal.tsx +2 -2
  96. package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
  97. package/src/components/resources/ResourcesView.tsx +46 -69
  98. package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
  99. package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
  100. package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
  101. package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
  102. package/src/components/resources/renderers/PodRenderer.tsx +4 -1
  103. package/src/components/settings/MyPermissionsDialog.tsx +12 -9
  104. package/src/components/settings/SettingsDialog.tsx +21 -15
  105. package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
  106. package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
  107. package/src/components/traffic/TrafficSourcePill.test.tsx +110 -0
  108. package/src/components/traffic/TrafficSourcePill.tsx +111 -0
  109. package/src/components/traffic/TrafficView.tsx +21 -67
  110. package/src/components/traffic/trafficFilters.test.ts +20 -1
  111. package/src/components/traffic/trafficFilters.ts +13 -0
  112. package/src/components/ui/DiagnosticsOverlay.test.ts +25 -0
  113. package/src/components/ui/DiagnosticsOverlay.tsx +2 -1
  114. package/src/components/ui/Omnibar.note.test.tsx +141 -0
  115. package/src/components/ui/Omnibar.tsx +89 -14
  116. package/src/components/ui/RadarOmnibar.test.tsx +183 -0
  117. package/src/components/ui/RadarOmnibar.tsx +38 -4
  118. package/src/components/ui/Toast.tsx +1 -1
  119. package/src/components/ui/UpdateNotification.manual.test.tsx +177 -0
  120. package/src/components/ui/UpdateNotification.test.tsx +2 -1
  121. package/src/components/ui/UpdateNotification.tsx +29 -5
  122. package/src/components/ui/omnibar-match.test.ts +37 -0
  123. package/src/components/ui/omnibar-match.ts +23 -0
  124. package/src/components/ui/searchCoverage.fixtures.ts +16 -0
  125. package/src/components/ui/searchCoverageNote.test.ts +245 -0
  126. package/src/components/ui/searchCoverageNote.ts +222 -0
  127. package/src/components/whats-new/WhatsNew.test.ts +10 -0
  128. package/src/components/whats-new/WhatsNew.tsx +5 -4
  129. package/src/components/whats-new/WhatsNewDialog.test.tsx +20 -0
  130. package/src/components/whats-new/releaseNotes.ts +57 -5
  131. package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
  132. package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
  133. package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
  134. package/src/components/workload/NodeDrainStatus.tsx +55 -0
  135. package/src/components/workload/WorkloadView.tsx +43 -5
  136. package/src/context/ConnectionContext.test.ts +27 -1
  137. package/src/context/ConnectionContext.tsx +17 -7
  138. package/src/hooks/useResourceCounts.ts +2 -0
  139. package/src/index.css +2 -4
  140. package/src/index.ts +7 -0
  141. package/src/integrations/resourceHosts.test.tsx +1 -0
  142. package/src/integrations/resourceHosts.tsx +2 -0
  143. package/src/utils/artifacthub.test.ts +18 -0
  144. package/src/utils/artifacthub.ts +9 -0
  145. package/src/utils/navigation.ts +14 -0
  146. package/src/utils/wails-clipboard.ts +4 -2
@@ -1,12 +1,13 @@
1
1
  import { useState, useMemo, useRef, useEffect, useCallback, forwardRef, useImperativeHandle, type ReactNode } from 'react'
2
2
  import { createPortal } from 'react-dom'
3
- import { Search, CornerDownLeft, Loader2, AlertTriangle } from 'lucide-react'
3
+ import { Search, CornerDownLeft, Loader2, AlertTriangle, Info } from 'lucide-react'
4
4
  import { clsx } from 'clsx'
5
5
  import { useAnimatedUnmount } from '../../hooks/useAnimatedUnmount'
6
6
  import { TRANSITION_BACKDROP, TRANSITION_MENU, TW_EASE_UI, overlayExitMs, overlayTransitionStyle } from '../../utils/animation'
7
7
  import { SearchPillInput, type SearchModifier } from '@skyhook-io/k8s-ui'
8
8
  import { getResourceIcon } from '../../utils/resource-icons'
9
9
  import type { SearchHit, SearchMatchedField } from '../../api/client'
10
+ import { contentMatchLabel, partialSearchNotices } from './omnibar-match'
10
11
  import { recordUsageEvent } from '../../api/usage-data'
11
12
  import { bestScore, type CommandItem } from './command-items'
12
13
  import { SearchSyntaxHelp } from './SearchSyntaxHelp'
@@ -28,6 +29,23 @@ export interface OmnibarSearchResult {
28
29
  hits: SearchHit[]
29
30
  total?: number
30
31
  total_matched?: number
32
+ /** "time_limit" when scan report findings were only partly searched. */
33
+ incomplete_findings?: string
34
+ /** Some namespaces' scan reports were left out, access not confirmed yet. */
35
+ access_incomplete?: boolean
36
+ }
37
+
38
+ // A host-provided line about the current search (what was or wasn't searched),
39
+ // shown muted above the results or the empty state. The host interprets its
40
+ // own search response; the omnibar only renders the text and optional action.
41
+ export interface OmnibarNotePart {
42
+ text: string
43
+ action?: { label: string; suffix?: string; onSelect: () => void; keepOpen?: boolean }
44
+ }
45
+
46
+ export interface OmnibarNote extends OmnibarNotePart {
47
+ /** When supplied, renders these parts in order instead of the top-level text/action. */
48
+ parts?: OmnibarNotePart[]
31
49
  }
32
50
 
33
51
  // Health → dot color (summaryContext.health is the same vocabulary as the rest
@@ -83,6 +101,7 @@ function useDebounced<T>(value: T, ms: number): T {
83
101
  }
84
102
 
85
103
  export interface OmnibarHandle {
104
+ addModifier: (modifier: SearchModifier) => void
86
105
  focus: () => void
87
106
  }
88
107
 
@@ -101,6 +120,10 @@ export interface OmnibarProps {
101
120
  isError?: boolean
102
121
  /** True while React Query serves a previous query's data — gates Enter/clicks. */
103
122
  isPlaceholderData?: boolean
123
+ /** Optional note about the current search's coverage, from the host. A
124
+ * note says part of the scope wasn't searched, so an empty result is then
125
+ * qualified rather than reported as no match. */
126
+ note?: OmnibarNote
104
127
  /** Bounded modifier value sets to autocomplete (e.g. { ns: [...], kind: [...] }). */
105
128
  modifierOptions?: Record<string, string[]>
106
129
  /** Namespaces to seed as removable `ns:` pills when the launcher opens empty
@@ -155,6 +178,7 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
155
178
  isFetching = false,
156
179
  isError = false,
157
180
  isPlaceholderData = false,
181
+ note,
158
182
  modifierOptions,
159
183
  seedNamespaces,
160
184
  loadRecents,
@@ -181,7 +205,13 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
181
205
  // whole top bar.
182
206
  const [anchor, setAnchor] = useState<{ centerX: number; top: number; width: number } | null>(null)
183
207
 
184
- useImperativeHandle(ref, () => ({ focus: () => { inputRef.current?.focus(); inputRef.current?.select() } }), [])
208
+ useImperativeHandle(ref, () => ({
209
+ focus: () => { inputRef.current?.focus(); inputRef.current?.select() },
210
+ addModifier: (modifier) => {
211
+ setPills((prev) => prev.some((p) => p.key === modifier.key && p.value === modifier.value) ? prev : [...prev, modifier])
212
+ inputRef.current?.focus()
213
+ },
214
+ }), [])
185
215
 
186
216
  // Usage data: one count per opening, one per opening that searched. Never
187
217
  // the query itself.
@@ -343,6 +373,13 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
343
373
  return Math.max(1, Math.floor(list.clientHeight / rowH) - 1)
344
374
  }
345
375
 
376
+ const close = useCallback(() => {
377
+ setOpen(false)
378
+ setText('')
379
+ setPills([])
380
+ inputRef.current?.blur()
381
+ }, [])
382
+
346
383
  const execute = useCallback((row: Row) => {
347
384
  if (row.kind === 'command') {
348
385
  row.command.action()
@@ -353,15 +390,16 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
353
390
  recordRecent?.({ kind: h.kind, group: h.group, namespace: h.namespace, name: h.name, cluster: h.cluster, clusterName: h.clusterName })
354
391
  onOpenResource(h)
355
392
  }
356
- setOpen(false)
357
- setText('')
358
- setPills([])
359
- inputRef.current?.blur()
360
- }, [onOpenResource, recordRecent, onViewAllResults])
393
+ close()
394
+ }, [onOpenResource, recordRecent, onViewAllResults, close])
361
395
 
362
396
  // The resources shown don't (yet) belong to the current query: the debounce
363
397
  // hasn't fired, the data is React Query placeholder, or results haven't landed.
364
398
  const resourcesStale = searchActive && (debounced !== queryString || isPlaceholderData || (resourceRows.length === 0 && isFetching))
399
+ // A note describes the response it came from: hide it while the shown data
400
+ // belongs to another query, but not during a background refetch of this one.
401
+ const currentData = searchData !== undefined && debounced === queryString && !isPlaceholderData
402
+ const shownNote = searchActive && !isError && currentData ? note : undefined
365
403
 
366
404
  const handleKeyDown = useCallback((e: React.KeyboardEvent) => {
367
405
  if (e.key === 'Escape') { e.preventDefault(); setOpen(false); inputRef.current?.blur(); return }
@@ -382,11 +420,11 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
382
420
  // are in; fall back to the raw query while they're still loading.
383
421
  if (submitToSearch && searchActive) {
384
422
  if (viewAllRow) execute(viewAllRow)
385
- else { onViewAllResults?.(queryString); setOpen(false); setText(''); setPills([]); inputRef.current?.blur() }
423
+ else { onViewAllResults?.(queryString); close() }
386
424
  }
387
425
  }
388
426
  // eslint-disable-next-line react-hooks/exhaustive-deps
389
- }, [rows, selectedIndex, execute, resourcesStale, submitToSearch, searchActive, viewAllRow, onViewAllResults, queryString])
427
+ }, [rows, selectedIndex, execute, close, resourcesStale, submitToSearch, searchActive, viewAllRow, onViewAllResults, queryString])
390
428
 
391
429
  useEffect(() => {
392
430
  listRef.current?.querySelector('[data-selected="true"]')?.scrollIntoView({ block: 'nearest' })
@@ -424,6 +462,7 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
424
462
  const mac = typeof navigator !== 'undefined' && navigator.platform.includes('Mac')
425
463
  const total = searchData?.total ?? 0
426
464
  const totalMatched = searchData?.total_matched ?? 0
465
+ const partialNotices = partialSearchNotices(searchData)
427
466
  const hasNsPill = pills.some((p) => p.key === 'ns')
428
467
  const dropdownOpen = open && !suggesting && (rows.length > 0 || searchActive)
429
468
  // Presence: the scrim and the results panel are menu-kind overlays (140ms
@@ -473,16 +512,22 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
473
512
  {isFetching && <Loader2 className="w-3 h-3 animate-spin" />}
474
513
  {!isFetching && !isError && totalMatched > total && <span className="normal-case font-normal">showing {total} of {totalMatched}</span>}
475
514
  </div>
515
+ {/* Above the rows: with a full page of hits a note below them
516
+ would sit under the fold. */}
517
+ {shownNote && <OmnibarNoteRow note={shownNote} onAction={(action) => {
518
+ action.onSelect()
519
+ if (!action.keepOpen) close()
520
+ }} />}
476
521
  {isError ? (
477
522
  <div className="flex items-center gap-2 px-3 py-2 text-xs text-amber-600 dark:text-amber-400">
478
523
  <AlertTriangle className="w-3.5 h-3.5 shrink-0" /> Search is unavailable right now.
479
524
  </div>
480
- ) : resourceRows.length === 0 && !isFetching ? (
525
+ ) : resourceRows.length === 0 && (!isFetching || currentData) ? (
481
526
  <div className="px-3 py-2 text-xs text-theme-text-tertiary">
482
- No resources match{freeText ? <> “{freeText}”</> : ''}.
527
+ {shownNote ? 'No matches in what Radar searched.' : <>No resources match{freeText ? <> “{freeText}”</> : ''}.</>}
483
528
  {hasNsPill && (
484
529
  <button onMouseDown={(e) => { e.preventDefault(); clearNsPills() }} className="ml-1.5 text-[var(--color-brand)] hover:underline">
485
- Search all namespaces
530
+ Remove namespace filter
486
531
  </button>
487
532
  )}
488
533
  </div>
@@ -491,6 +536,11 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
491
536
  <ResourceRow key={row.id} hit={row.hit} stale={resourcesStale} selected={row.id === selectedId} onSelect={() => selectRow(row.id)} onActivate={() => { if (!resourcesStale) execute(row) }} />
492
537
  ))
493
538
  )}
539
+ {!isFetching && !isError && partialNotices.map((notice) => (
540
+ <div key={notice} className="flex items-start gap-2 px-3 py-1.5 text-xs text-warning-text">
541
+ <AlertTriangle className="w-3 h-3 mt-0.5 shrink-0" /> {notice}
542
+ </div>
543
+ ))}
494
544
  </>
495
545
  )}
496
546
 
@@ -610,11 +660,36 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
610
660
  )
611
661
  })
612
662
 
663
+ function OmnibarNoteRow({ note, onAction }: { note: OmnibarNote; onAction: (action: NonNullable<OmnibarNote['action']>) => void }) {
664
+ return (
665
+ <div className="flex items-start gap-1.5 px-3 py-1.5 text-xs text-theme-text-tertiary">
666
+ <Info className="w-3.5 h-3.5 shrink-0 mt-px" />
667
+ <span>
668
+ {(note.parts ?? [note]).map(({ text, action }, index) => (
669
+ <span key={index}>
670
+ {index > 0 && ' '}
671
+ {text}
672
+ {action && (
673
+ <>
674
+ {' '}
675
+ <button type="button" onMouseDown={(e) => e.preventDefault()} onClick={() => onAction(action)} className="text-[var(--color-brand)] hover:underline">
676
+ {action.label}
677
+ </button>
678
+ {action.suffix}
679
+ </>
680
+ )}
681
+ </span>
682
+ ))}
683
+ </span>
684
+ </div>
685
+ )
686
+ }
687
+
613
688
  function ResourceRow({ hit, selected, stale, onSelect, onActivate }: { hit: SearchHit; selected: boolean; stale?: boolean; onSelect: () => void; onActivate: () => void }) {
614
689
  const Icon = getResourceIcon(hit.kind)
615
690
  const dot = healthDot(hit.summaryContext?.health)
616
691
  const issues = hit.summaryContext?.issueCount ?? 0
617
- const contentOnly = !!hit.matched?.length && hit.matched.every((m) => m.site.startsWith('content:'))
692
+ const contentLabel = contentMatchLabel(hit.matched)
618
693
  return (
619
694
  <button
620
695
  data-selected={selected}
@@ -630,7 +705,7 @@ function ResourceRow({ hit, selected, stale, onSelect, onActivate }: { hit: Sear
630
705
  {hit.namespace ? <> · {highlight(hit.namespace, tokensForSite(hit.matched, 'namespace'))}</> : ''}
631
706
  {hit.clusterName ? <> · <span className="text-theme-text-secondary">{hit.clusterName}</span></> : ''}
632
707
  </span>
633
- {contentOnly && <span className="shrink-0 text-[10px] text-theme-text-tertiary italic">in spec</span>}
708
+ {contentLabel && <span className="shrink-0 text-[10px] text-theme-text-tertiary italic">{contentLabel}</span>}
634
709
  {issues > 0 && <span className="ml-auto shrink-0 text-[10px] font-medium text-amber-600 dark:text-amber-400">{issues} issue{issues === 1 ? '' : 's'}</span>}
635
710
  </button>
636
711
  )
@@ -0,0 +1,183 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot, type Root } from 'react-dom/client'
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
6
+ import type { SearchCoverageEntry } from './searchCoverageNote'
7
+ import { coverageOf } from './searchCoverage.fixtures'
8
+
9
+ vi.mock('../../api/usage-data', () => ({ recordUsageEvent: vi.fn() }))
10
+ vi.mock('../../hooks/useRecentResources', () => ({ loadRecentResources: () => [], recordRecentResource: vi.fn() }))
11
+ vi.mock('../../api/apiResources', async (importOriginal) => ({ ...(await importOriginal<object>()), useAPIResources: () => ({ data: [] }) }))
12
+ vi.mock('./command-items', async (importOriginal) => ({ ...(await importOriginal<object>()), useCommandItems: () => [] }))
13
+ const caps = vi.hoisted(() => ({ data: undefined as undefined | { authEnabled?: boolean } }))
14
+ vi.mock('../../api/client', async (importOriginal) => ({
15
+ ...(await importOriginal<object>()),
16
+ useNamespaceScope: () => ({ data: undefined }),
17
+ useContexts: () => ({ data: [] }),
18
+ useCapabilities: () => caps,
19
+ }))
20
+
21
+ import { RadarOmnibar } from './RadarOmnibar'
22
+
23
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
24
+ let root: Root
25
+ let host: HTMLDivElement
26
+ let unsearched: SearchCoverageEntry[]
27
+ let searches = 0
28
+
29
+ const pending: SearchCoverageEntry[] = [{ kind: '*', group: '', reason: 'kind_sync_pending' }]
30
+ const failed: SearchCoverageEntry[] = [{ kind: 'SpStall', group: 'stall.sp-live.test', reason: 'kind_sync_timed_out' }]
31
+
32
+ beforeEach(() => {
33
+ vi.useFakeTimers()
34
+ caps.data = undefined
35
+ searches = 0
36
+ vi.stubGlobal('fetch', vi.fn(async (input: string) => {
37
+ const url = new URL(input, 'http://localhost')
38
+ if (!url.pathname.endsWith('/search')) throw new Error(`Unexpected request: ${input}`)
39
+ searches++
40
+ return new Response(JSON.stringify({ hits: [], total: 0, searched: 0, total_matched: 0, coverage: coverageOf(unsearched) }), { status: 200 })
41
+ }))
42
+ host = document.createElement('div')
43
+ document.body.appendChild(host)
44
+ root = createRoot(host)
45
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
46
+ const noop = vi.fn()
47
+ act(() => {
48
+ root.render(
49
+ <QueryClientProvider client={client}>
50
+ <RadarOmnibar onOpenResource={noop} onNavigateView={noop} onNavigateKind={noop} onSwitchContext={noop} onSetNamespaces={noop} onToggleTheme={noop} />
51
+ </QueryClientProvider>,
52
+ )
53
+ })
54
+ })
55
+
56
+ afterEach(() => {
57
+ act(() => root.unmount())
58
+ host.remove()
59
+ document.body.innerHTML = ''
60
+ vi.unstubAllGlobals()
61
+ vi.useRealTimers()
62
+ })
63
+
64
+ async function typeQuery(text: string) {
65
+ const input = host.querySelector('input')!
66
+ act(() => input.focus())
67
+ act(() => {
68
+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')!.set!.call(input, text)
69
+ input.dispatchEvent(new Event('input', { bubbles: true }))
70
+ })
71
+ await act(async () => { await vi.advanceTimersByTimeAsync(200) })
72
+ await act(async () => { await vi.advanceTimersByTimeAsync(100) })
73
+ }
74
+
75
+ const advance = (ms: number) => act(async () => { await vi.advanceTimersByTimeAsync(ms) })
76
+ const page = () => document.body.textContent ?? ''
77
+
78
+ describe('RadarOmnibar while results load', () => {
79
+ it('re-queries a loading search and ends on the failure once Radar gives up on the kind', async () => {
80
+ unsearched = pending
81
+ await typeQuery('sp-live')
82
+ expect(page()).toContain('Still loading — results may change.')
83
+
84
+ await advance(25_000)
85
+ expect(searches).toBeGreaterThanOrEqual(5)
86
+ expect(page()).toContain('Still loading — results may change.')
87
+
88
+ // Radar reports a kind that never synced as failed after about 30 s, so
89
+ // the omnibar must still be asking then.
90
+ await advance(6_000)
91
+ unsearched = failed
92
+ await advance(10_000)
93
+ expect(page()).toContain("Couldn't read SpStall; matches of that kind may be missing.")
94
+ expect(page()).not.toContain('Still loading')
95
+
96
+ const settled = searches
97
+ await advance(30_000)
98
+ expect(searches).toBe(settled)
99
+ })
100
+
101
+ it('still catches a kind that fails 30 s after a watch that started late in warm-up', async () => {
102
+ unsearched = pending
103
+ await typeQuery('sp-live')
104
+ await advance(48_000)
105
+ expect(page()).toContain('Still loading — results may change.')
106
+ unsearched = failed
107
+ await advance(6_000)
108
+ expect(page()).toContain("Couldn't read SpStall; matches of that kind may be missing.")
109
+ const settled = searches
110
+ await advance(30_000)
111
+ expect(searches).toBe(settled)
112
+ })
113
+
114
+ it('stops re-querying after its budget and says so', async () => {
115
+ unsearched = pending
116
+ await typeQuery('sp-live')
117
+ await advance(55_000)
118
+ expect(page()).toContain('Still loading — results may change.')
119
+ await advance(6_000)
120
+ expect(page()).toContain('Still loading — try again shortly.')
121
+ const settled = searches
122
+ await advance(30_000)
123
+ expect(searches).toBe(settled)
124
+ })
125
+ })
126
+
127
+ describe('RadarOmnibar namespace notes', () => {
128
+ // Radar decides whether a missing namespace may be named as absent: only a
129
+ // caller who can see every namespace is told it doesn't exist.
130
+ it('says a namespace does not exist when Radar says so, whatever the auth mode', async () => {
131
+ for (const data of [{}, { authEnabled: true }]) {
132
+ caps.data = data
133
+ unsearched = [{ kind: '*', group: '', reason: 'namespace_not_found', namespaces: ['payments-prd'] }]
134
+ await typeQuery(`ns:payments-prd web${'authEnabled' in data ? 's' : ''}`)
135
+ expect(page()).toContain("Namespace 'payments-prd' doesn't exist on this cluster.")
136
+ }
137
+ })
138
+
139
+ it('stays scoped to what the caller can see when Radar does not say', async () => {
140
+ for (const data of [{}, { authEnabled: true }]) {
141
+ caps.data = data
142
+ unsearched = [{ kind: '*', group: '', reason: 'user_namespace_not_visible', namespaces: ['payments-prd'] }]
143
+ await typeQuery(`ns:payments-prd web${'authEnabled' in data ? 's' : ''}`)
144
+ expect(page()).toContain("Namespace 'payments-prd' wasn't found in what you can see.")
145
+ }
146
+ })
147
+ })
148
+
149
+ describe('RadarOmnibar read recovery', () => {
150
+ it.each([
151
+ ['alone', []],
152
+ ['followed by a namespace note', [{ kind: '*', group: '', reason: 'radar_namespace_not_collected', namespaces: ['rel-owner'] }]],
153
+ ['preceded by a loading note', pending],
154
+ ] as [string, SearchCoverageEntry[]][])('adds the suggested kind %s, preserves modifiers and terms, and re-checks while open', async (_, siblings) => {
155
+ unsearched = [{ kind: 'Certificate', group: 'cert-manager.io', reason: 'read_error' }, ...siblings]
156
+ await typeQuery('ns:prod')
157
+ act(() => host.querySelector('input')!.dispatchEvent(new KeyboardEvent('keydown', { key: ' ', bubbles: true })))
158
+ await typeQuery('label:app=web image:nginx renewal')
159
+ expect(page()).toContain("Couldn't read Certificate; matches of that kind may be missing. Search kind:Certificate to re-check.")
160
+ const button = [...document.body.querySelectorAll('button')].find((b) => b.textContent === 'kind:Certificate')!
161
+ expect(button).toBeDefined()
162
+ const recoveryText = "Couldn't read Certificate; matches of that kind may be missing. Search kind:Certificate to re-check."
163
+ const siblingText = siblings === pending ? 'Still loading — results may change.' : siblings.length ? "Namespace 'rel-owner' wasn't searched: Radar here watches only some namespaces." : ''
164
+ expect(button.parentElement!.textContent?.trim()).toBe(recoveryText)
165
+ expect(button.parentElement!.parentElement!.textContent).toBe(siblings === pending ? `${siblingText} ${recoveryText}` : `${recoveryText}${siblingText ? ` ${siblingText}` : ''}`)
166
+ act(() => button.click())
167
+ await advance(300)
168
+ await advance(100)
169
+ const requests = vi.mocked(fetch).mock.calls.map(([input]) => new URL(String(input), 'http://localhost').searchParams.get('q'))
170
+ expect(requests.at(-1)).toBe('ns:prod kind:Certificate label:app=web image:nginx renewal')
171
+ expect(host.querySelector('input')!.value).toContain('renewal')
172
+ expect(page()).toContain("Couldn't read Certificate; matches of that kind may be missing.")
173
+ expect([...document.body.querySelectorAll('button')].some((b) => b.textContent === 'kind:Certificate')).toBe(false)
174
+ expect(page()).not.toContain('to re-check.')
175
+ })
176
+
177
+ it.each(['kind:Certificate renewal', 'k:certificates renewal'])('keeps an explicit failed search honest: %s', async (query) => {
178
+ unsearched = [{ kind: 'Certificate', group: 'cert-manager.io', reason: 'read_error' }]
179
+ await typeQuery(query)
180
+ expect(page()).toContain("Couldn't read Certificate; matches of that kind may be missing.")
181
+ expect(page()).not.toContain('to re-check.')
182
+ })
183
+ })
@@ -1,14 +1,17 @@
1
- import { forwardRef, useMemo, useState } from 'react'
1
+ import { forwardRef, useEffect, useMemo, useState, useRef, useImperativeHandle } from 'react'
2
2
  import { Omnibar, type OmnibarHandle } from './Omnibar'
3
- import { useSearch, useNamespaceScope, useContexts, type SearchHit } from '../../api/client'
3
+ import { useSearch, useNamespaceScope, useContexts, type SearchHit, type SearchResult } from '../../api/client'
4
4
  import { useAPIResources } from '../../api/apiResources'
5
5
  import { loadRecentResources, recordRecentResource } from '../../hooks/useRecentResources'
6
6
  import { useCommandItems, type CommandItemCallbacks } from './command-items'
7
+ import { PENDING_RETRY_BUDGET_MS, PENDING_RETRY_MS, searchCoverageNote } from './searchCoverageNote'
7
8
 
8
9
  interface RadarOmnibarProps extends CommandItemCallbacks {
9
10
  onOpenResource: (hit: SearchHit) => void
10
11
  }
11
12
 
13
+ const stillLoading = (data: SearchResult | undefined) => !!data?.coverage?.gaps.some((gap) => gap.code === 'kind_sync_pending')
14
+
12
15
  // Radar standalone's omnibar: wires the injectable Omnibar to Radar's own hooks
13
16
  // (cluster /api/search, kubeconfig contexts, API discovery, recents). Radar Hub
14
17
  // provides a parallel wrapper over fleet search.
@@ -16,11 +19,30 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
16
19
  { onOpenResource, ...callbacks },
17
20
  ref,
18
21
  ) {
22
+ const omnibarRef = useRef<OmnibarHandle>(null)
23
+ useImperativeHandle(ref, () => ({
24
+ focus: () => omnibarRef.current?.focus(),
25
+ addModifier: (modifier) => omnibarRef.current?.addModifier(modifier),
26
+ }), [])
19
27
  // The omnibar debounces internally and emits the query to search here.
20
28
  const [query, setQuery] = useState('')
21
29
  const [open, setOpen] = useState(false)
30
+ // The query whose still-loading re-queries ran out of budget while open.
31
+ const [exhaustedQuery, setExhaustedQuery] = useState<string | null>(null)
32
+
33
+ const { data: searchData, isFetching, isPlaceholderData, isError } = useSearch(query, {
34
+ enabled: open,
35
+ globalNs: true,
36
+ refetchInterval: (data) => (open && stillLoading(data) && exhaustedQuery !== query ? PENDING_RETRY_MS : false),
37
+ })
38
+ const pending = !isPlaceholderData && stillLoading(searchData)
39
+ useEffect(() => {
40
+ if (!open || !pending) return
41
+ const timer = setTimeout(() => setExhaustedQuery(query), PENDING_RETRY_BUDGET_MS)
42
+ return () => clearTimeout(timer)
43
+ }, [open, pending, query])
44
+ useEffect(() => { if (!open) setExhaustedQuery(null) }, [open])
22
45
 
23
- const { data: searchData, isFetching, isPlaceholderData, isError } = useSearch(query, { enabled: open, globalNs: true })
24
46
  const { data: nsScope } = useNamespaceScope()
25
47
  const { data: apiResources } = useAPIResources()
26
48
  const { data: contexts } = useContexts()
@@ -32,10 +54,21 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
32
54
  }), [nsScope, apiResources])
33
55
 
34
56
  const commandItems = useCommandItems(callbacks)
57
+ const { onNavigateKind } = callbacks
58
+ const note = searchCoverageNote(searchData?.coverage, {
59
+ hits: searchData?.hits,
60
+ query,
61
+ recheckKind: (kind) => omnibarRef.current?.addModifier({ key: 'kind', value: kind }),
62
+ pendingExhausted: exhaustedQuery === query,
63
+ openKindList: (kind, group) => {
64
+ const resource = apiResources?.find((r) => r.kind === kind && r.group === group)
65
+ return resource ? () => onNavigateKind(resource.name, resource.group) : undefined
66
+ },
67
+ })
35
68
 
36
69
  return (
37
70
  <Omnibar
38
- ref={ref}
71
+ ref={omnibarRef}
39
72
  onOpenResource={onOpenResource}
40
73
  commandItems={commandItems}
41
74
  onQueryChange={(q, o) => { setQuery(q); setOpen(o) }}
@@ -43,6 +76,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
43
76
  isFetching={isFetching}
44
77
  isError={isError}
45
78
  isPlaceholderData={isPlaceholderData}
79
+ note={note}
46
80
  modifierOptions={modifierOptions}
47
81
  seedNamespaces={nsScope?.actives}
48
82
  loadRecents={() => loadRecentResources(contextKey)}
@@ -1 +1 @@
1
- export { ToastProvider, useToast, showApiError, showApiSuccess } from '@skyhook-io/k8s-ui'
1
+ export { ToastProvider, useToast, showApiError, showApiSuccess, showApiNotice } from '@skyhook-io/k8s-ui'
@@ -0,0 +1,177 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot, type Root } from 'react-dom/client'
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
6
+ import type { VersionInfo } from '../../api/client'
7
+
8
+ vi.mock('../../api/client', () => ({
9
+ useCapabilities: () => ({ data: { deployment: { mode: 'local' } } }),
10
+ useVersionCheck: () => ({ data: { currentVersion: '1.2.3', updateAvailable: false, installMethod: 'desktop' } }),
11
+ useStartDesktopUpdate: () => ({ mutate: vi.fn(), isPending: false }),
12
+ useDesktopUpdateStatus: () => ({ data: undefined }),
13
+ useApplyDesktopUpdate: () => ({ mutate: vi.fn() }),
14
+ }))
15
+
16
+ import { UpdateNotification } from './UpdateNotification'
17
+ import { ToastProvider, showApiNotice } from './Toast'
18
+ import { DURATION_TOAST_EXIT } from '../../utils/animation'
19
+ import { setApiBase } from '../../api/config'
20
+
21
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
22
+
23
+ let root: Root
24
+ let container: HTMLDivElement
25
+ let client: QueryClient
26
+ const current: VersionInfo = { currentVersion: '1.2.3', updateAvailable: false, installMethod: 'desktop' }
27
+
28
+ beforeEach(() => {
29
+ vi.clearAllMocks()
30
+ vi.useFakeTimers()
31
+ setApiBase('/desktop/api')
32
+ client = new QueryClient()
33
+ client.setQueryData(['version-check', '/desktop/api'], current)
34
+ container = document.createElement('div')
35
+ document.body.appendChild(container)
36
+ root = createRoot(container)
37
+ act(() => root.render(
38
+ <QueryClientProvider client={client}>
39
+ <ToastProvider>
40
+ <UpdateNotification />
41
+ <UpdateNotification placement="settings" />
42
+ </ToastProvider>
43
+ </QueryClientProvider>,
44
+ ))
45
+ })
46
+
47
+ afterEach(() => {
48
+ act(() => root.unmount())
49
+ container.remove()
50
+ client.clear()
51
+ setApiBase('/api')
52
+ vi.useRealTimers()
53
+ })
54
+
55
+ describe('manual Desktop version checks', () => {
56
+ it('acknowledges one check even when Settings is also mounted', () => {
57
+ act(() => { window.dispatchEvent(new Event('radar:check-for-updates')) })
58
+ expect(container.querySelectorAll('[role="status"]')).toHaveLength(1)
59
+ expect(container.textContent).toContain('Checking for updates…')
60
+ })
61
+
62
+ it('reports an up-to-date result once', () => {
63
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: current })) })
64
+ expect(container.querySelectorAll('[role="status"]')).toHaveLength(1)
65
+ expect(container.textContent).toContain("You're up to date")
66
+ expect(container.textContent).toContain('Radar 1.2.3')
67
+ })
68
+
69
+ it('publishes a fresh available update and clears its dismissal', () => {
70
+ localStorage.setItem('radar-update-dismissed', '1.3.0')
71
+ const info = { ...current, updateAvailable: true, latestVersion: '1.3.0' }
72
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: info })) })
73
+ expect(client.getQueryData(['version-check', '/desktop/api'])).toEqual(info)
74
+ expect(localStorage.getItem('radar-update-dismissed')).toBeNull()
75
+ expect(container.textContent).toContain('Radar 1.3.0 is available')
76
+ })
77
+
78
+ it('reports failure without replacing known version data', () => {
79
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: { ...current, error: 'offline' } })) })
80
+ expect(container.querySelector('[role="status"]')?.textContent).toContain('Could not check for updates')
81
+ expect(container.textContent).toContain('offline')
82
+ expect(container.textContent).not.toContain("You're up to date")
83
+ expect(client.getQueryData(['version-check', '/desktop/api'])).toEqual(current)
84
+ })
85
+
86
+ it('does not claim a development build is up to date', () => {
87
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: { ...current, currentVersion: '1.3.0-37-g8b325b372', buildChannel: 'development', latestVersion: '1.3.0' } })) })
88
+ expect(container.textContent).not.toContain("You're up to date")
89
+ expect(container.textContent).toContain('Latest Radar release: 1.3.0')
90
+ expect(container.textContent).toContain('You are running a development build.')
91
+ })
92
+
93
+ it('discards an automatic response that races with the manual result', async () => {
94
+ let resolveAutomatic!: (value: VersionInfo) => void
95
+ const pending = client.fetchQuery({
96
+ queryKey: ['version-check', '/desktop/api'],
97
+ queryFn: () => new Promise<VersionInfo>(resolve => { resolveAutomatic = resolve }),
98
+ staleTime: 0,
99
+ }).catch(() => undefined)
100
+ const info = { ...current, updateAvailable: true, latestVersion: '1.3.0' }
101
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: info })) })
102
+ resolveAutomatic(current)
103
+ await pending
104
+ expect(client.getQueryData(['version-check', '/desktop/api'])).toEqual(info)
105
+ })
106
+
107
+ it('lets the initial automatic fetch finish when a manual check fails', async () => {
108
+ client.removeQueries({ queryKey: ['version-check', '/desktop/api'], exact: true })
109
+ let resolveAutomatic!: (value: VersionInfo) => void
110
+ const pending = client.fetchQuery({
111
+ queryKey: ['version-check', '/desktop/api'],
112
+ queryFn: () => new Promise<VersionInfo>(resolve => { resolveAutomatic = resolve }),
113
+ })
114
+ act(() => {
115
+ window.dispatchEvent(new Event('radar:check-for-updates'))
116
+ window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: { ...current, error: 'offline' } }))
117
+ })
118
+ resolveAutomatic(current)
119
+ await pending
120
+ expect(client.getQueryData(['version-check', '/desktop/api'])).toEqual(current)
121
+ })
122
+ })
123
+
124
+
125
+ describe('manual check toast lifecycle', () => {
126
+ it('updates the same toast element after a slow check and starts the result timer then', () => {
127
+ act(() => { window.dispatchEvent(new Event('radar:check-for-updates')) })
128
+ const toast = container.querySelector('[role="status"]')
129
+ act(() => { vi.advanceTimersByTime(9000) })
130
+ expect(container.querySelector('[role="status"]')).toBe(toast)
131
+ expect(toast?.textContent).toContain('Checking for updates…')
132
+
133
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: current })) })
134
+ expect(container.querySelector('[role="status"]')).toBe(toast)
135
+ expect(toast?.textContent).toContain("You're up to date")
136
+ expect(container.textContent).not.toContain('Checking for updates…')
137
+ expect(container.querySelectorAll('[role="status"]')).toHaveLength(1)
138
+ act(() => { vi.advanceTimersByTime(6999) })
139
+ expect(container.querySelector('[role="status"]')).toBe(toast)
140
+ act(() => { vi.advanceTimersByTime(1 + DURATION_TOAST_EXIT) })
141
+ expect(container.querySelector('[role="status"]')).toBeNull()
142
+ })
143
+
144
+ it('replaces progress with an error in the same toast', () => {
145
+ act(() => { window.dispatchEvent(new Event('radar:check-for-updates')) })
146
+ const toast = container.querySelector('[role="status"]')
147
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: { ...current, error: 'offline' } })) })
148
+ expect(container.querySelector('[role="status"]')).toBe(toast)
149
+ expect(container.textContent).not.toContain('Checking for updates…')
150
+ expect(container.querySelectorAll('[role="status"], [role="alert"]')).toHaveLength(1)
151
+ act(() => { vi.advanceTimersByTime(9999) })
152
+ expect(container.querySelector('[role="status"]')).toBe(toast)
153
+ act(() => { vi.advanceTimersByTime(1 + DURATION_TOAST_EXIT) })
154
+ expect(container.querySelector('[role="status"]')).toBeNull()
155
+ })
156
+
157
+ it('does not let a previous result timer dismiss the next check', () => {
158
+ act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: current })) })
159
+ act(() => { vi.advanceTimersByTime(7100) })
160
+ act(() => { window.dispatchEvent(new Event('radar:check-for-updates')) })
161
+ const toast = container.querySelector('[role="status"]')
162
+ act(() => { vi.advanceTimersByTime(9000) })
163
+ expect(container.querySelector('[role="status"]')).toBe(toast)
164
+ expect(toast?.textContent).toContain('Checking for updates…')
165
+ expect(toast?.classList.contains('animate-out')).toBe(false)
166
+ })
167
+
168
+ it('keeps ordinary toasts independent and auto-dismisses them', () => {
169
+ act(() => {
170
+ showApiNotice('First notice', undefined, 'info')
171
+ showApiNotice('Second notice', undefined, 'info')
172
+ })
173
+ expect(container.querySelectorAll('[role="status"]')).toHaveLength(2)
174
+ act(() => { vi.advanceTimersByTime(7000 + DURATION_TOAST_EXIT) })
175
+ expect(container.querySelectorAll('[role="status"]')).toHaveLength(0)
176
+ })
177
+ })