@skyhook-io/radar-app 1.18.1 → 1.19.0

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 (136) hide show
  1. package/package.json +4 -4
  2. package/src/App.tsx +23 -9
  3. package/src/api/client.deleteResource.test.tsx +111 -0
  4. package/src/api/client.resourceAudit.test.tsx +57 -0
  5. package/src/api/client.resourcePath.test.ts +107 -0
  6. package/src/api/client.ts +136 -37
  7. package/src/api/diagnose.test.ts +33 -2
  8. package/src/api/diagnose.ts +93 -3
  9. package/src/api/radarFeatures.ts +1 -0
  10. package/src/components/capacity/CapacityDemand.tsx +6 -3
  11. package/src/components/capacity/CapacityOverview.tsx +14 -7
  12. package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
  13. package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
  14. package/src/components/capacity/shared.tsx +9 -5
  15. package/src/components/cnpg/CNPGOverview.tsx +4 -1
  16. package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
  17. package/src/components/diagnose/AIMarkdown.tsx +1 -1
  18. package/src/components/diagnose/ActivityTurn.tsx +34 -14
  19. package/src/components/diagnose/AgentControls.tsx +53 -6
  20. package/src/components/diagnose/AgentSetupNotice.tsx +1 -1
  21. package/src/components/diagnose/AgentSigninNotice.test.tsx +98 -0
  22. package/src/components/diagnose/AgentSigninNotice.tsx +61 -0
  23. package/src/components/diagnose/AnalysisStory.test.tsx +22 -0
  24. package/src/components/diagnose/AnalysisStory.tsx +17 -4
  25. package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
  26. package/src/components/diagnose/ApplyDialog.tsx +8 -1
  27. package/src/components/diagnose/AssessmentCard.tsx +99 -8
  28. package/src/components/diagnose/DiagnoseContext.capacity.test.tsx +113 -0
  29. package/src/components/diagnose/DiagnoseContext.question.test.tsx +245 -0
  30. package/src/components/diagnose/DiagnoseContext.tsx +205 -9
  31. package/src/components/diagnose/DiagnoseSurface.test.tsx +54 -0
  32. package/src/components/diagnose/DiagnoseSurface.tsx +98 -21
  33. package/src/components/diagnose/EvidenceCard.tsx +67 -14
  34. package/src/components/diagnose/Home.test.tsx +182 -5
  35. package/src/components/diagnose/Home.tsx +168 -36
  36. package/src/components/diagnose/InvestigationCapacityNotice.test.tsx +246 -0
  37. package/src/components/diagnose/InvestigationCapacityNotice.tsx +241 -0
  38. package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +97 -6
  39. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +119 -2
  40. package/src/components/diagnose/InvestigationEvidencePane.tsx +59 -11
  41. package/src/components/diagnose/InvestigationEvidenceSections.tsx +11 -6
  42. package/src/components/diagnose/InvestigationView.tsx +203 -42
  43. package/src/components/diagnose/LocalDiagnoseAction.tsx +23 -16
  44. package/src/components/diagnose/QuestionComposer.test.tsx +553 -0
  45. package/src/components/diagnose/QuestionComposer.tsx +487 -0
  46. package/src/components/diagnose/QuestionFocus.test.tsx +38 -0
  47. package/src/components/diagnose/QuestionFocus.tsx +123 -0
  48. package/src/components/diagnose/ResourcePicker.tsx +206 -0
  49. package/src/components/diagnose/StoryExcerpt.tsx +12 -3
  50. package/src/components/diagnose/assessmentCopy.ts +16 -0
  51. package/src/components/diagnose/investigationCase.runs.test.tsx +328 -0
  52. package/src/components/diagnose/investigationCase.ts +33 -1
  53. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
  54. package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
  55. package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
  56. package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +8 -0
  57. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
  58. package/src/components/diagnose/investigationEvidence/adapters/posture.ts +29 -1
  59. package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +42 -1
  60. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +29 -2
  61. package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
  62. package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
  63. package/src/components/diagnose/investigationEvidence/bodies/metrics.test.tsx +111 -0
  64. package/src/components/diagnose/investigationEvidence/bodies/metrics.tsx +67 -16
  65. package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
  66. package/src/components/diagnose/investigationEvidence/builder.ts +3 -1
  67. package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
  68. package/src/components/diagnose/investigationEvidence/excerpt.test.ts +18 -5
  69. package/src/components/diagnose/investigationEvidence/excerpt.ts +22 -11
  70. package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
  71. package/src/components/diagnose/investigationEvidence/index.ts +1 -1
  72. package/src/components/diagnose/investigationEvidence/navigation.tsx +2 -0
  73. package/src/components/diagnose/investigationEvidence/observations.ts +7 -3
  74. package/src/components/diagnose/investigationEvidence/projection.test.ts +57 -3
  75. package/src/components/diagnose/investigationEvidence/types.ts +2 -0
  76. package/src/components/diagnose/investigationEvidencePartition.ts +6 -1
  77. package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
  78. package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
  79. package/src/components/diagnose/investigationFocus.test.ts +271 -0
  80. package/src/components/diagnose/investigationFocus.ts +132 -0
  81. package/src/components/diagnose/parts.test.tsx +20 -0
  82. package/src/components/diagnose/questionSuggestions.test.ts +111 -0
  83. package/src/components/diagnose/questionSuggestions.ts +150 -0
  84. package/src/components/diagnose/storyParts.test.tsx +66 -0
  85. package/src/components/diagnose/target.test.ts +143 -2
  86. package/src/components/diagnose/target.ts +109 -7
  87. package/src/components/diagnose/testdata/story-runs.json +474 -0
  88. package/src/components/diagnose/verdictText.test.tsx +87 -0
  89. package/src/components/diagnose/verdictText.ts +68 -0
  90. package/src/components/helm/ChartBrowser.tsx +4 -4
  91. package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
  92. package/src/components/helm/HelmView.tsx +34 -23
  93. package/src/components/helm/InstallWizard.tsx +6 -2
  94. package/src/components/helm/ValuesViewer.test.tsx +1 -0
  95. package/src/components/helm/ValuesViewer.tsx +4 -2
  96. package/src/components/home/ClusterHealthCard.tsx +40 -59
  97. package/src/components/home/HomeAgentBlock.test.tsx +113 -0
  98. package/src/components/home/HomeAgentBlock.tsx +94 -0
  99. package/src/components/home/HomeView.tsx +5 -6
  100. package/src/components/home/MCPSetupDialog.test.tsx +27 -2
  101. package/src/components/home/MCPSetupDialog.tsx +14 -2
  102. package/src/components/home/RadarVersionLine.test.tsx +0 -14
  103. package/src/components/home/RadarVersionLine.tsx +3 -28
  104. package/src/components/home/mcpToolCatalog.ts +29 -2
  105. package/src/components/issues/IssuesPane.render.test.tsx +5 -5
  106. package/src/components/nav/PrimaryNavRail.tsx +34 -2
  107. package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
  108. package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
  109. package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
  110. package/src/components/product-hunt/launchWindow.ts +78 -0
  111. package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
  112. package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
  113. package/src/components/resources/CompositeRenderer.tsx +4 -0
  114. package/src/components/resources/ResourcesView.tsx +1 -1
  115. package/src/components/settings/LocalConnectionSettings.tsx +1 -0
  116. package/src/components/ui/Omnibar.investigate.test.tsx +105 -0
  117. package/src/components/ui/Omnibar.tsx +47 -3
  118. package/src/components/ui/RadarOmnibar.test.tsx +19 -0
  119. package/src/components/ui/RadarOmnibar.tsx +12 -0
  120. package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
  121. package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
  122. package/src/components/ui/UpdateNotification.test.tsx +2 -0
  123. package/src/components/ui/UpdateNotification.tsx +32 -5
  124. package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
  125. package/src/components/whats-new/WhatsNewDialog.test.tsx +3 -3
  126. package/src/components/whats-new/releaseNotes.ts +60 -1
  127. package/src/components/workload/WorkloadView.tsx +10 -4
  128. package/src/components/workspace/layout.tsx +2 -1
  129. package/src/contexts/CapabilitiesContext.tsx +1 -0
  130. package/src/hooks/useAgentSignin.test.tsx +190 -0
  131. package/src/hooks/useAgentSignin.ts +160 -0
  132. package/src/hooks/useApproveAfterSignin.test.tsx +108 -0
  133. package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
  134. package/src/hooks/useGitOpsWriteGuard.ts +25 -3
  135. package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
  136. package/src/index.css +85 -0
@@ -0,0 +1,105 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot, type Root } from 'react-dom/client'
4
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
5
+ import { Omnibar } from './Omnibar'
6
+ import type { SearchHit } from '../../api/client'
7
+
8
+ vi.mock('../../api/usage-data', () => ({ recordUsageEvent: vi.fn() }))
9
+
10
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
11
+ let root: Root
12
+ let host: HTMLDivElement
13
+
14
+ beforeEach(() => {
15
+ vi.useFakeTimers()
16
+ Element.prototype.scrollIntoView = vi.fn()
17
+ host = document.createElement('div')
18
+ document.body.appendChild(host)
19
+ root = createRoot(host)
20
+ })
21
+
22
+ afterEach(() => {
23
+ act(() => root.unmount())
24
+ host.remove()
25
+ document.body.innerHTML = ''
26
+ vi.useRealTimers()
27
+ })
28
+
29
+ function render(onInvestigateQuery: ((query: { text: string; namespaces: string[] }) => void) | undefined, hits: SearchHit[] = []) {
30
+ act(() => {
31
+ root.render(<Omnibar onOpenResource={vi.fn()} commandItems={[]} searchData={{ hits }} onInvestigateQuery={onInvestigateQuery} />)
32
+ })
33
+ }
34
+
35
+ function typeQuery(text: string) {
36
+ const input = host.querySelector('input')!
37
+ act(() => input.focus())
38
+ act(() => {
39
+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')!.set!.call(input, text)
40
+ input.dispatchEvent(new Event('input', { bubbles: true }))
41
+ })
42
+ act(() => { vi.advanceTimersByTime(200) })
43
+ }
44
+
45
+ const investigateButton = () =>
46
+ [...document.body.querySelectorAll('button')].find((b) => b.textContent?.startsWith('Investigate “'))
47
+
48
+ describe('Omnibar investigate row', () => {
49
+ it('hands the typed words to the host as a question', () => {
50
+ const onInvestigate = vi.fn()
51
+ render(onInvestigate)
52
+ typeQuery('checkout returns 502s')
53
+ const row = investigateButton()
54
+ expect(row?.textContent).toContain('Investigate “checkout returns 502s”')
55
+ act(() => { row!.click() })
56
+ expect(onInvestigate).toHaveBeenCalledWith({ text: 'checkout returns 502s', namespaces: [] })
57
+ })
58
+
59
+ it('comes after a resource match', () => {
60
+ render(vi.fn(), [{ score: 1, kind: 'Deployment', group: 'apps', namespace: 'shop', name: 'checkout' }])
61
+ typeQuery('checkout')
62
+ const rows = [...document.body.querySelectorAll('[data-selected]')]
63
+ expect(rows.at(-1)?.textContent).toContain('Investigate “checkout”')
64
+ expect(rows[0]?.textContent).not.toContain('Investigate')
65
+ })
66
+
67
+ it('waits for search results before Enter can ask', () => {
68
+ const onInvestigate = vi.fn()
69
+ act(() => {
70
+ root.render(<Omnibar onOpenResource={vi.fn()} commandItems={[]} searchData={{ hits: [] }} isFetching onInvestigateQuery={onInvestigate} />)
71
+ })
72
+ typeQuery('checkout')
73
+ act(() => {
74
+ host.querySelector('input')!.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true, cancelable: true }))
75
+ })
76
+ expect(onInvestigate).not.toHaveBeenCalled()
77
+ })
78
+
79
+ it('is absent when the host has no question entry', () => {
80
+ render(undefined)
81
+ typeQuery('checkout returns 502s')
82
+ expect(investigateButton()).toBeUndefined()
83
+ })
84
+
85
+ it('carries ns: modifiers as where to start', () => {
86
+ const onInvestigate = vi.fn()
87
+ act(() => {
88
+ root.render(<Omnibar onOpenResource={vi.fn()} commandItems={[]} searchData={{ hits: [] }} seedNamespaces={['payments']} onInvestigateQuery={onInvestigate} />)
89
+ })
90
+ typeQuery('slow checkout')
91
+ expect(investigateButton()?.textContent).toContain('as a question · in payments')
92
+ act(() => { investigateButton()!.click() })
93
+ expect(onInvestigate).toHaveBeenCalledWith({ text: 'slow checkout', namespaces: ['payments'] })
94
+ })
95
+
96
+ it('counts a long namespace list instead of naming it', () => {
97
+ const namespaces = Array.from({ length: 25 }, (_, i) => `ns-${i}`)
98
+ act(() => {
99
+ root.render(<Omnibar onOpenResource={vi.fn()} commandItems={[]} searchData={{ hits: [] }} seedNamespaces={namespaces} onInvestigateQuery={vi.fn()} />)
100
+ })
101
+ typeQuery('pods keep restarting')
102
+ expect(investigateButton()?.textContent).toContain('Investigate “pods keep restarting”')
103
+ expect(investigateButton()?.textContent).toContain('as a question · in 25 namespaces')
104
+ })
105
+ })
@@ -1,6 +1,6 @@
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, Info } from 'lucide-react'
3
+ import { Search, CornerDownLeft, Loader2, AlertTriangle, Info, Sparkles } 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'
@@ -136,6 +136,11 @@ export interface OmnibarProps {
136
136
  * searching, handing the full (uncapped) query off to the host's dedicated
137
137
  * search surface. Omit to keep the omnibar a pure launcher. */
138
138
  onViewAllResults?: (query: string) => void
139
+ /** When set, an "Investigate" row tails the list while there is free text,
140
+ * handing the words, and any `ns:` modifiers as where to start, to the
141
+ * host's AI investigation composer as a question. It is last so a
142
+ * resource or command match always comes first. */
143
+ onInvestigateQuery?: (query: { text: string; namespaces: string[] }) => void
139
144
  /** Empty-launcher content. `true` (default) lists Views + Actions — the
140
145
  * cmd-K menu. `false` shows only Actions so recents/search lead and views
141
146
  * surface on type (use when the views are already always-visible, e.g. a
@@ -153,6 +158,7 @@ type Row =
153
158
  | { id: string; kind: 'resource'; hit: SearchHit; recent?: boolean }
154
159
  | { id: string; kind: 'command'; command: CommandItem }
155
160
  | { id: string; kind: 'viewAll'; query: string; count: number }
161
+ | { id: string; kind: 'investigate'; text: string; namespaces: string[] }
156
162
 
157
163
  const COMMAND_CATEGORY_ORDER = ['Views', 'Resource Kinds', 'Namespaces', 'Clusters', 'Actions']
158
164
  const PAGE = 8
@@ -184,6 +190,7 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
184
190
  loadRecents,
185
191
  recordRecent,
186
192
  onViewAllResults,
193
+ onInvestigateQuery,
187
194
  launcherShowsViews = true,
188
195
  placeholder = 'Search resources & commands…',
189
196
  size = 'default',
@@ -330,9 +337,18 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
330
337
  if (onViewAllResults && searchActive && resourceRows.length > 0) {
331
338
  out.push({ id: 'view-all', kind: 'viewAll', query: queryString, count: searchData?.total_matched ?? resourceRows.length })
332
339
  }
340
+ if (onInvestigateQuery && freeText) {
341
+ out.push({
342
+ id: 'investigate',
343
+ kind: 'investigate',
344
+ text: freeText,
345
+ namespaces: pills.filter((pill) => pill.key === 'ns').map((pill) => pill.value),
346
+ })
347
+ }
333
348
  return out
334
- }, [recentRows, leadingKinds, resourceRows, commandGroups, freeText, pills.length, searchActive, onViewAllResults, queryString, searchData])
349
+ }, [recentRows, leadingKinds, resourceRows, commandGroups, freeText, pills, searchActive, onViewAllResults, onInvestigateQuery, queryString, searchData])
335
350
  const viewAllRow = rows.find((r): r is Extract<Row, { kind: 'viewAll' }> => r.kind === 'viewAll')
351
+ const investigateRow = rows.find((r): r is Extract<Row, { kind: 'investigate' }> => r.kind === 'investigate')
336
352
 
337
353
  // Selection tracked by stable id (not array index) so Enter can never fire a
338
354
  // stale row when the set shifts. Auto-follows the TOP result until the user
@@ -385,13 +401,15 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
385
401
  row.command.action()
386
402
  } else if (row.kind === 'viewAll') {
387
403
  onViewAllResults?.(row.query)
404
+ } else if (row.kind === 'investigate') {
405
+ onInvestigateQuery?.({ text: row.text, namespaces: row.namespaces })
388
406
  } else {
389
407
  const h = row.hit
390
408
  recordRecent?.({ kind: h.kind, group: h.group, namespace: h.namespace, name: h.name, cluster: h.cluster, clusterName: h.clusterName })
391
409
  onOpenResource(h)
392
410
  }
393
411
  close()
394
- }, [onOpenResource, recordRecent, onViewAllResults, close])
412
+ }, [onOpenResource, recordRecent, onViewAllResults, onInvestigateQuery, close])
395
413
 
396
414
  // The resources shown don't (yet) belong to the current query: the debounce
397
415
  // hasn't fired, the data is React Query placeholder, or results haven't landed.
@@ -412,6 +430,9 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
412
430
  const row = rows[selectedIndex]
413
431
  if (row) {
414
432
  if (row.kind === 'resource' && resourcesStale) return
433
+ // Investigate sits first only until results land; an Enter before
434
+ // then is someone looking for a resource, not asking a question.
435
+ if (row.kind === 'investigate' && resourcesStale && !userMovedRef.current) return
415
436
  execute(row)
416
437
  return
417
438
  }
@@ -567,6 +588,29 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
567
588
  <CornerDownLeft className="w-3 h-3 ml-auto shrink-0 text-theme-text-tertiary" />
568
589
  </button>
569
590
  )}
591
+
592
+ {investigateRow && (
593
+ <button
594
+ type="button"
595
+ data-selected={investigateRow.id === selectedId}
596
+ onMouseEnter={() => selectRow(investigateRow.id)}
597
+ onMouseDown={(e) => e.preventDefault()}
598
+ onClick={() => execute(investigateRow)}
599
+ className={clsx('w-full flex items-center gap-2.5 px-3 py-1.5 mt-1 text-left border-t border-theme-border transition-colors', investigateRow.id === selectedId ? 'selection' : 'hover:bg-theme-elevated/40')}
600
+ >
601
+ <Sparkles className="w-4 h-4 shrink-0 text-accent" />
602
+ <span className="min-w-0 truncate text-sm text-theme-text-primary">Investigate “{investigateRow.text}”</span>
603
+ {/* The words come first; a long namespace list must not squeeze them out. */}
604
+ <span className="max-w-[45%] shrink-0 truncate text-xs text-theme-text-tertiary">
605
+ as a question{investigateRow.namespaces.length > 2
606
+ ? ` · in ${investigateRow.namespaces.length} namespaces`
607
+ : investigateRow.namespaces.length > 0
608
+ ? ` · in ${investigateRow.namespaces.join(', ')}`
609
+ : ''}
610
+ </span>
611
+ <CornerDownLeft className="w-3 h-3 ml-auto shrink-0 text-theme-text-tertiary" />
612
+ </button>
613
+ )}
570
614
  </div>
571
615
  <div className="flex items-center gap-3 px-3 py-1.5 border-t border-theme-border text-[11px] text-theme-text-tertiary">
572
616
  <span className="flex items-center gap-1">
@@ -7,6 +7,7 @@ import type { SearchCoverageEntry } from './searchCoverageNote'
7
7
  import { coverageOf } from './searchCoverage.fixtures'
8
8
 
9
9
  vi.mock('../../api/usage-data', () => ({ recordUsageEvent: vi.fn() }))
10
+ vi.mock('../diagnose/DiagnoseContext', () => ({ useDiagnose: () => ({ available: false, questions: false, openQuestion: vi.fn() }) }))
10
11
  vi.mock('../../hooks/useRecentResources', () => ({ loadRecentResources: () => [], recordRecentResource: vi.fn() }))
11
12
  vi.mock('../../api/apiResources', async (importOriginal) => ({ ...(await importOriginal<object>()), useAPIResources: () => ({ data: [] }) }))
12
13
  vi.mock('./command-items', async (importOriginal) => ({ ...(await importOriginal<object>()), useCommandItems: () => [] }))
@@ -31,6 +32,7 @@ const failed: SearchCoverageEntry[] = [{ kind: 'SpStall', group: 'stall.sp-live.
31
32
 
32
33
  beforeEach(() => {
33
34
  vi.useFakeTimers()
35
+ Element.prototype.scrollIntoView = vi.fn()
34
36
  caps.data = undefined
35
37
  searches = 0
36
38
  vi.stubGlobal('fetch', vi.fn(async (input: string) => {
@@ -76,6 +78,23 @@ const advance = (ms: number) => act(async () => { await vi.advanceTimersByTimeAs
76
78
  const page = () => document.body.textContent ?? ''
77
79
 
78
80
  describe('RadarOmnibar while results load', () => {
81
+ it('requests status context and accepts a full summary from an older Radar', async () => {
82
+ unsearched = []
83
+ vi.mocked(fetch).mockImplementationOnce(async () => new Response(JSON.stringify({
84
+ hits: [{ kind: 'Pod', namespace: 'shop', name: 'legacy-pod', score: 1, summaryContext: {
85
+ health: 'unhealthy', issueCount: 2, managedBy: { kind: 'Deployment', name: 'legacy-owner' },
86
+ } }],
87
+ total: 1, searched: 1, total_matched: 1, coverage: coverageOf([]),
88
+ }), { status: 200 }))
89
+ await typeQuery('legacy-pod')
90
+
91
+ const request = new URL(String(vi.mocked(fetch).mock.calls[0][0]), 'http://localhost')
92
+ expect(request.searchParams.get('context')).toBe('status')
93
+ expect(page()).toContain('legacy-pod')
94
+ expect(page()).toContain('2 issues')
95
+ expect(page()).not.toContain('legacy-owner')
96
+ })
97
+
79
98
  it('re-queries a loading search and ends on the failure once Radar gives up on the kind', async () => {
80
99
  unsearched = pending
81
100
  await typeQuery('sp-live')
@@ -5,6 +5,7 @@ import { useAPIResources } from '../../api/apiResources'
5
5
  import { loadRecentResources, recordRecentResource } from '../../hooks/useRecentResources'
6
6
  import { useCommandItems, type CommandItemCallbacks } from './command-items'
7
7
  import { PENDING_RETRY_BUDGET_MS, PENDING_RETRY_MS, searchCoverageNote } from './searchCoverageNote'
8
+ import { useDiagnose } from '../diagnose/DiagnoseContext'
8
9
 
9
10
  interface RadarOmnibarProps extends CommandItemCallbacks {
10
11
  onOpenResource: (hit: SearchHit) => void
@@ -31,6 +32,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
31
32
  const [exhaustedQuery, setExhaustedQuery] = useState<string | null>(null)
32
33
 
33
34
  const { data: searchData, isFetching, isPlaceholderData, isError } = useSearch(query, {
35
+ context: 'status',
34
36
  enabled: open,
35
37
  globalNs: true,
36
38
  refetchInterval: (data) => (open && stillLoading(data) && exhaustedQuery !== query ? PENDING_RETRY_MS : false),
@@ -54,6 +56,15 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
54
56
  }), [nsScope, apiResources])
55
57
 
56
58
  const commandItems = useCommandItems(callbacks)
59
+ // Words that find nothing (or more than a lookup) can become a question;
60
+ // the composer opens with them so where and since when stay visible.
61
+ const diagnose = useDiagnose()
62
+ const onInvestigateQuery = diagnose.available && diagnose.questions
63
+ ? // The omnibar seeds its ns: pills from the namespace picker, so no pill
64
+ // means the engineer cleared the scope: start across the cluster.
65
+ ({ text, namespaces }: { text: string; namespaces: string[] }) =>
66
+ diagnose.openQuestion({ text, namespaces })
67
+ : undefined
57
68
  const { onNavigateKind } = callbacks
58
69
  const note = searchCoverageNote(searchData?.coverage, {
59
70
  hits: searchData?.hits,
@@ -79,6 +90,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
79
90
  note={note}
80
91
  modifierOptions={modifierOptions}
81
92
  seedNamespaces={nsScope?.actives}
93
+ onInvestigateQuery={onInvestigateQuery}
82
94
  loadRecents={() => loadRecentResources(contextKey)}
83
95
  recordRecent={(r) => recordRecentResource(r, contextKey)}
84
96
  />
@@ -0,0 +1,39 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot, type Root } from 'react-dom/client'
4
+ import { afterEach, expect, it } from 'vitest'
5
+ import { SearchSyntaxHelp } from './SearchSyntaxHelp'
6
+
7
+ let root: Root | undefined
8
+ let host: HTMLDivElement | undefined
9
+ afterEach(() => {
10
+ act(() => root?.unmount())
11
+ host?.remove()
12
+ })
13
+
14
+ function render() {
15
+ host = document.createElement('div')
16
+ document.body.appendChild(host)
17
+ root = createRoot(host)
18
+ act(() => root!.render(<SearchSyntaxHelp />))
19
+ return host.querySelector('button')!
20
+ }
21
+
22
+ const cardShown = () => document.body.textContent?.includes('Search syntax') ?? false
23
+
24
+ it('toggles on a click with no pointer before it (assistive activation)', () => {
25
+ const button = render()
26
+ act(() => button.click())
27
+ expect(cardShown()).toBe(true)
28
+ expect(button.getAttribute('aria-expanded')).toBe('true')
29
+ act(() => button.click())
30
+ expect(cardShown()).toBe(false)
31
+ })
32
+
33
+ it('keeps a hover-opened card open on the click that follows', () => {
34
+ const button = render()
35
+ act(() => { button.dispatchEvent(new MouseEvent('mouseover', { bubbles: true, relatedTarget: document.body })) })
36
+ expect(cardShown()).toBe(true)
37
+ act(() => button.click())
38
+ expect(cardShown()).toBe(true)
39
+ })
@@ -2,6 +2,7 @@ import { useState, useRef, useEffect, useCallback } from 'react'
2
2
  import { createPortal } from 'react-dom'
3
3
  import { HelpCircle } from 'lucide-react'
4
4
  import { clsx } from 'clsx'
5
+ import { isTouchIntent } from '@skyhook-io/k8s-ui'
5
6
 
6
7
  // The query operators recognized by the search engine (internal/search/parse.go).
7
8
  const OPERATORS: { syntax: string; desc: string }[] = [
@@ -16,6 +17,10 @@ const OPERATORS: { syntax: string; desc: string }[] = [
16
17
  // reference tooltip, not a second click-to-open panel stacked over the results).
17
18
  // Self-contained + portaled to <body> so the header's stacking context can't
18
19
  // trap it; a short close grace lets the pointer travel onto the card.
20
+ // A tap also fires mouseenter, and the "?" can sit right under the finger
21
+ // that just opened the search box, so hover ignores a tap's side effects. A
22
+ // click (a tap, or assistive-technology activation) toggles the card, except
23
+ // right after a mouse hover opened it; a tap elsewhere closes it.
19
24
  export function SearchSyntaxHelp() {
20
25
  const [open, setOpen] = useState(false)
21
26
  const btnRef = useRef<HTMLButtonElement>(null)
@@ -24,11 +29,22 @@ export function SearchSyntaxHelp() {
24
29
  const [anchor, setAnchor] = useState<{ right: number; top: number } | null>(null)
25
30
 
26
31
  const show = useCallback(() => { clearTimeout(closeTimer.current); setOpen(true) }, [])
32
+ const openedByHover = useRef(false)
27
33
  const scheduleHide = useCallback(() => {
28
34
  clearTimeout(closeTimer.current)
29
35
  closeTimer.current = setTimeout(() => setOpen(false), 120)
30
36
  }, [])
31
37
 
38
+ useEffect(() => {
39
+ if (!open) return
40
+ const onDown = (e: globalThis.PointerEvent) => {
41
+ const t = e.target as Node
42
+ if (!btnRef.current?.contains(t) && !popRef.current?.contains(t)) setOpen(false)
43
+ }
44
+ document.addEventListener('pointerdown', onDown)
45
+ return () => document.removeEventListener('pointerdown', onDown)
46
+ }, [open])
47
+
32
48
  useEffect(() => () => clearTimeout(closeTimer.current), [])
33
49
 
34
50
  useEffect(() => {
@@ -53,8 +69,13 @@ export function SearchSyntaxHelp() {
53
69
  type="button"
54
70
  tabIndex={-1}
55
71
  aria-label="Search syntax help"
56
- onMouseEnter={show}
57
- onMouseLeave={scheduleHide}
72
+ aria-expanded={open}
73
+ onMouseEnter={() => { if (!isTouchIntent()) { openedByHover.current = !open; show() } }}
74
+ onMouseLeave={() => { openedByHover.current = false; scheduleHide() }}
75
+ onClick={() => {
76
+ if (openedByHover.current) { openedByHover.current = false; return }
77
+ setOpen((o) => !o)
78
+ }}
58
79
  onMouseDown={(e) => e.preventDefault()}
59
80
  className={clsx('shrink-0 rounded p-0.5 cursor-help transition-colors', open ? 'text-theme-text-secondary' : 'text-theme-text-tertiary hover:text-theme-text-secondary')}
60
81
  >
@@ -13,6 +13,8 @@ vi.mock('../../api/client', () => ({
13
13
  updateAvailable: true,
14
14
  installMethod: 'direct',
15
15
  releaseUrl: 'https://github.com/skyhook-io/radar/releases/tag/v1.3.0',
16
+ // Off, so the Product Hunt launch day doesn't take the corner whatever today is.
17
+ productHuntLaunch: { enabled: false, url: '', start: '0001-01-01T00:00:00Z', end: '0001-01-01T00:00:00Z' },
16
18
  },
17
19
  }),
18
20
  useStartDesktopUpdate: () => ({ mutate: vi.fn(), isPending: false }),
@@ -16,6 +16,8 @@ import { WithTooltip } from './Tooltip'
16
16
  import { TRANSITION_MENU, overlayExitMs, overlayTransitionStyle } from '../../utils/animation'
17
17
  import { useAnimatedUnmount } from '../../hooks/useAnimatedUnmount'
18
18
  import { IN_CLUSTER_UPGRADE_URL } from '../../utils/version'
19
+ import { LAUNCH_NOTICE_DISMISSED_EVENT, launchNoticeHoldsCorner, launchPhase, resolveLaunch } from '../product-hunt/launchWindow'
20
+ import { USAGE_PROMPT_VISIBILITY_EVENT, usagePromptOnScreen } from '../usage-data/UsageDataPrompt'
19
21
 
20
22
  const DISMISSED_KEY = 'radar-update-dismissed'
21
23
 
@@ -94,6 +96,23 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
94
96
  }
95
97
  }, [queryClient, inSettings, showToast])
96
98
 
99
+ // Runs until the launch window is over, so a notice already on screen when
100
+ // the launch day starts steps aside too.
101
+ const launch = resolveLaunch(versionInfo?.productHuntLaunch)
102
+ const [launchNow, setLaunchNow] = useState(() => Date.now())
103
+ const launchWindowOpen = launchPhase(launch, launchNow) !== null
104
+ const launchHoldsCorner = launchNoticeHoldsCorner(launch, launchNow)
105
+ useEffect(() => {
106
+ if (inSettings || !launchWindowOpen) return
107
+ const recheck = () => setLaunchNow(Date.now())
108
+ window.addEventListener(LAUNCH_NOTICE_DISMISSED_EVENT, recheck)
109
+ const poll = window.setInterval(recheck, 60_000)
110
+ return () => {
111
+ window.removeEventListener(LAUNCH_NOTICE_DISMISSED_EVENT, recheck)
112
+ window.clearInterval(poll)
113
+ }
114
+ }, [inSettings, launchWindowOpen])
115
+
97
116
  // Log version check errors for debugging
98
117
  useEffect(() => {
99
118
  if (versionInfo?.error) {
@@ -101,13 +120,21 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
101
120
  }
102
121
  }, [versionInfo?.error])
103
122
 
104
- // Check if this version was already dismissed
123
+ // Dismissal is per release: a newer one found while the page is open shows again.
105
124
  useEffect(() => {
106
- if (versionInfo?.latestVersion && isUpdateDismissed(versionInfo.latestVersion)) {
107
- setDismissed(true)
108
- }
125
+ if (versionInfo?.latestVersion) setDismissed(isUpdateDismissed(versionInfo.latestVersion))
109
126
  }, [versionInfo?.latestVersion])
110
127
 
128
+ // The first-run usage card shares the corner; an update found while it is
129
+ // open waits for it.
130
+ const [usagePromptShowing, setUsagePromptShowing] = useState(usagePromptOnScreen)
131
+ useEffect(() => {
132
+ if (inSettings) return
133
+ const onUsagePrompt = () => setUsagePromptShowing(usagePromptOnScreen())
134
+ window.addEventListener(USAGE_PROMPT_VISIBILITY_EVENT, onUsagePrompt)
135
+ return () => window.removeEventListener(USAGE_PROMPT_VISIBILITY_EVENT, onUsagePrompt)
136
+ }, [inSettings])
137
+
111
138
  // Stop polling when update reaches a terminal state
112
139
  useEffect(() => {
113
140
  if (updateStatus?.state === 'error' || updateStatus?.state === 'idle') {
@@ -149,7 +176,7 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
149
176
  // Shared in-cluster viewers get a persistent Home notice instead of a
150
177
  // floating action prompt they may not be able to act on.
151
178
  const available = !!versionInfo?.updateAvailable && deploymentMode !== undefined && deploymentMode !== 'cloud'
152
- const show = available && deploymentMode !== 'in-cluster' && (inSettings ? expanded : !dismissed)
179
+ const show = available && deploymentMode !== 'in-cluster' && (inSettings ? expanded : !dismissed && !launchHoldsCorner && !usagePromptShowing)
153
180
  // Presence outlives `show` by the menu exit so a dismiss fades the chip out
154
181
  // instead of snapping it away; the enter runs the same transition in reverse.
155
182
  const { shouldRender, isOpen } = useAnimatedUnmount(show, overlayExitMs('menu'))
@@ -4,6 +4,7 @@ import { BarChart3, X } from 'lucide-react'
4
4
  import { useMarkUsagePromptShown, useSetUsageData, type UsageDataStatus } from '../../api/usage-data'
5
5
  import { useVersionCheck } from '../../api/client'
6
6
  import { isUpdateDismissed } from '../ui/UpdateNotification'
7
+ import { launchNoticeHoldsCorner, resolveLaunch } from '../product-hunt/launchWindow'
7
8
  import { UsageDataAnswered, UsageDataBlurb } from './UsageDataAsk'
8
9
  import { useAnimatedUnmount } from '../../hooks/useAnimatedUnmount'
9
10
  import { TRANSITION_MENU, overlayExitMs, overlayTransitionStyle } from '../../utils/animation'
@@ -13,6 +14,14 @@ import { TRANSITION_MENU, overlayExitMs, overlayTransitionStyle } from '../../ut
13
14
  export const FIRST_RUN_PROMPT_DELAY_MS = 15_000
14
15
  const THANKS_MS = 4_000
15
16
 
17
+ // The server stops offering the prompt the moment it is shown, so other corner
18
+ // cards read whether it is on screen from here instead.
19
+ let promptOnScreen = false
20
+ export const USAGE_PROMPT_VISIBILITY_EVENT = 'radar:usage-prompt-visibility'
21
+ export function usagePromptOnScreen(): boolean {
22
+ return promptOnScreen
23
+ }
24
+
16
25
  // The update notice uses the same corner. One nudge at a time.
17
26
  export function updateNoticeVisible(latest: string | undefined, updateAvailable: boolean | undefined): boolean {
18
27
  return !!updateAvailable && !!latest && !isUpdateDismissed(latest)
@@ -64,7 +73,7 @@ export function UsageDataPrompt({ status }: { status: UsageDataStatus | undefine
64
73
  const eligible = shouldShowFirstRunPrompt({
65
74
  status,
66
75
  ready,
67
- updateNoticeShowing: updateNoticeVisible(versionInfo?.latestVersion, versionInfo?.updateAvailable),
76
+ updateNoticeShowing: updateNoticeVisible(versionInfo?.latestVersion, versionInfo?.updateAvailable) || launchNoticeHoldsCorner(resolveLaunch(versionInfo?.productHuntLaunch), Date.now()),
68
77
  })
69
78
  useEffect(() => {
70
79
  if (eligible && !recorded.current) {
@@ -81,6 +90,15 @@ export function UsageDataPrompt({ status }: { status: UsageDataStatus | undefine
81
90
  }, [answer])
82
91
 
83
92
  const show = latched && !dismissed && cardStillAsking(status, answer)
93
+ useEffect(() => {
94
+ if (!show) return
95
+ promptOnScreen = true
96
+ window.dispatchEvent(new Event(USAGE_PROMPT_VISIBILITY_EVENT))
97
+ return () => {
98
+ promptOnScreen = false
99
+ window.dispatchEvent(new Event(USAGE_PROMPT_VISIBILITY_EVENT))
100
+ }
101
+ }, [show])
84
102
  const { shouldRender, isOpen } = useAnimatedUnmount(show, overlayExitMs('menu'))
85
103
  if (!shouldRender) return null
86
104
 
@@ -300,11 +300,11 @@ describe('WhatsNew', () => {
300
300
  expect(seenPosts).toEqual([])
301
301
  })
302
302
 
303
- it.each(['', '=v1.18', '=1.18', '=v1.18.0'])('previews v1.18 on a Git development build with ?whats-new%s', async suffix => {
303
+ it.each(['', '=v1.19', '=1.19', '=v1.19.0'])('previews v1.19 on a Git development build with ?whats-new%s', async suffix => {
304
304
  setCatalog(...SHIPPED)
305
- serverState = { currentVersion: 'v1.17.0-113-gb49561b78', storage: 'server', seenVersion: 'v1.17.0', priorInstall: true }
305
+ serverState = { currentVersion: 'v1.18.0-113-gb49561b78', storage: 'server', seenVersion: 'v1.18.0', priorInstall: true }
306
306
  await render(`/resources/pods?whats-new${suffix}`)
307
- expect(dialog()?.textContent).toContain("What's new in Radar v1.18")
307
+ expect(dialog()?.textContent).toContain("What's new in Radar v1.19")
308
308
  expect(dialog()?.textContent).toContain(SHIPPED[0].highlights[0].title)
309
309
  await clickGotIt()
310
310
  expect(seenPosts).toEqual([])
@@ -1,5 +1,5 @@
1
1
  import type { LucideIcon } from 'lucide-react'
2
- import { Bot, Database, GitCompareArrows, HardDrive, Hourglass, Layers, Network, RefreshCcw, Scale, ScrollText, Search, SlidersHorizontal, Undo2 } from 'lucide-react'
2
+ import { BellOff, Bot, Database, GitCompareArrows, HardDrive, Hourglass, Layers, MessageCircleQuestionMark, Network, RefreshCcw, Scale, ScanSearch, ScrollText, Search, ShieldAlert, SlidersHorizontal, Undo2 } from 'lucide-react'
3
3
  import { compareVersions } from '../../utils/version'
4
4
 
5
5
  export interface ReleaseHighlight {
@@ -48,6 +48,65 @@ export const CHANGELOG_URL = 'https://radarhq.io/changelog'
48
48
  // major release must have its own entry: scripts/check-whats-new.sh refuses to
49
49
  // release one without it.
50
50
  export const RELEASE_NOTES: ReleaseNotes[] = [
51
+ {
52
+ version: 'v1.19.0',
53
+ highlights: [
54
+ {
55
+ id: 'investigate-a-question',
56
+ icon: MessageCircleQuestionMark,
57
+ title: 'Start an AI investigation from a question',
58
+ description: 'Describe what you see, like "checkout is slow", with or without a resource, and choose where to start and how far back to look.',
59
+ leadDescription: "When Radar runs locally, investigations no longer need a resource to start. On the Investigations page, describe what you are seeing, choose the namespaces to start in and how far back to look, and optionally pin a resource by typing @. Or type a symptom into the Omnibar to open the composer with your words. Findings now lead with the verdict and show more of the metrics charts the agent cited inline, and Radar's routine read limits no longer crowd out the open questions.",
60
+ importance: 9,
61
+ },
62
+ {
63
+ id: 'mcp-delete-exec-tools',
64
+ icon: Bot,
65
+ title: 'New MCP tools: delete and exec',
66
+ description: "delete_resource previews a deletion's likely impact and requires confirmation before deleting. Opt-in exec_pod runs one command in a container.",
67
+ importance: 7,
68
+ },
69
+ {
70
+ id: 'read-coverage',
71
+ icon: ScanSearch,
72
+ title: "Answers say what Radar couldn't see",
73
+ description: "Resource tables, search and MCP tools say when an answer is partial and why, so neither you nor an agent reads a gap as absence.",
74
+ importance: 6,
75
+ },
76
+ {
77
+ id: 'issues-new-checks',
78
+ icon: ShieldAlert,
79
+ title: 'New issue checks',
80
+ description: 'Issues now flag expired TLS certificates in use, dropped Traefik routes, Pods stuck on readiness gates, blocked Argo CD auto-sync and failed canaries.',
81
+ importance: 6,
82
+ path: '/issues',
83
+ cta: 'Open Issues',
84
+ },
85
+ {
86
+ id: 'issues-fewer-false-alarms',
87
+ icon: BellOff,
88
+ title: 'Fewer false alarms',
89
+ description: 'Issues stop flagging completed Pods, in-budget Deployment rollout dips, expected pause and deletion conditions, and recovered Cluster API Machines.',
90
+ importance: 6,
91
+ },
92
+ {
93
+ id: 'custom-resource-changes',
94
+ icon: GitCompareArrows,
95
+ title: 'Custom-resource history names changed fields',
96
+ description: 'Change history names the custom-resource fields that changed, with values when safe to show. get_changes for a kind also returns creates and deletes.',
97
+ importance: 5,
98
+ },
99
+ ],
100
+ improvements: [
101
+ 'The Delete dialog previews owned objects, GitOps cleanup and storage at risk',
102
+ 'Phone layouts for Home, Issues, Resources, Topology, Helm and Capacity',
103
+ 'Native views for OpenTelemetry Operator collectors and Flagger canaries',
104
+ 'Related Resources and Managed By tell owners apart from GitOps managers',
105
+ 'Investigations check Claude Code and Codex sign-in, and let you stop a run when all slots are busy',
106
+ 'The install script verifies checksums; Helm installs check repository checksums when published',
107
+ 'Windows desktop updates work again; --no-version-check turns off automatic checks',
108
+ ],
109
+ },
51
110
  {
52
111
  version: 'v1.18.0',
53
112
  highlights: [