@skyhook-io/radar-app 1.18.2 → 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.
- package/package.json +4 -4
- package/src/App.tsx +0 -1
- package/src/api/diagnose.test.ts +33 -2
- package/src/api/diagnose.ts +93 -3
- package/src/api/radarFeatures.ts +1 -0
- package/src/components/diagnose/AIMarkdown.tsx +1 -1
- package/src/components/diagnose/ActivityTurn.tsx +34 -14
- package/src/components/diagnose/AgentControls.tsx +53 -6
- package/src/components/diagnose/AgentSetupNotice.tsx +1 -1
- package/src/components/diagnose/AgentSigninNotice.test.tsx +98 -0
- package/src/components/diagnose/AgentSigninNotice.tsx +61 -0
- package/src/components/diagnose/AnalysisStory.test.tsx +22 -0
- package/src/components/diagnose/AnalysisStory.tsx +17 -4
- package/src/components/diagnose/AssessmentCard.tsx +39 -8
- package/src/components/diagnose/DiagnoseContext.capacity.test.tsx +113 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +245 -0
- package/src/components/diagnose/DiagnoseContext.tsx +205 -9
- package/src/components/diagnose/DiagnoseSurface.test.tsx +54 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +93 -21
- package/src/components/diagnose/EvidenceCard.tsx +67 -14
- package/src/components/diagnose/Home.test.tsx +182 -5
- package/src/components/diagnose/Home.tsx +168 -36
- package/src/components/diagnose/InvestigationCapacityNotice.test.tsx +246 -0
- package/src/components/diagnose/InvestigationCapacityNotice.tsx +241 -0
- package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +97 -6
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +57 -0
- package/src/components/diagnose/InvestigationEvidencePane.tsx +59 -11
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +5 -1
- package/src/components/diagnose/InvestigationView.tsx +156 -29
- package/src/components/diagnose/LocalDiagnoseAction.tsx +23 -16
- package/src/components/diagnose/QuestionComposer.test.tsx +553 -0
- package/src/components/diagnose/QuestionComposer.tsx +487 -0
- package/src/components/diagnose/QuestionFocus.test.tsx +38 -0
- package/src/components/diagnose/QuestionFocus.tsx +123 -0
- package/src/components/diagnose/ResourcePicker.tsx +206 -0
- package/src/components/diagnose/StoryExcerpt.tsx +12 -3
- package/src/components/diagnose/assessmentCopy.ts +5 -0
- package/src/components/diagnose/investigationCase.runs.test.tsx +328 -0
- package/src/components/diagnose/investigationCase.ts +33 -1
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +8 -0
- package/src/components/diagnose/investigationEvidence/adapters/posture.ts +29 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +40 -0
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +27 -1
- package/src/components/diagnose/investigationEvidence/bodies/metrics.test.tsx +111 -0
- package/src/components/diagnose/investigationEvidence/bodies/metrics.tsx +67 -16
- package/src/components/diagnose/investigationEvidence/excerpt.test.ts +18 -5
- package/src/components/diagnose/investigationEvidence/excerpt.ts +22 -11
- package/src/components/diagnose/investigationEvidence/index.ts +1 -1
- package/src/components/diagnose/investigationEvidence/navigation.tsx +2 -0
- package/src/components/diagnose/investigationEvidence/types.ts +2 -0
- package/src/components/diagnose/investigationEvidencePartition.ts +6 -1
- package/src/components/diagnose/investigationFocus.test.ts +271 -0
- package/src/components/diagnose/investigationFocus.ts +132 -0
- package/src/components/diagnose/parts.test.tsx +20 -0
- package/src/components/diagnose/questionSuggestions.test.ts +111 -0
- package/src/components/diagnose/questionSuggestions.ts +150 -0
- package/src/components/diagnose/storyParts.test.tsx +13 -0
- package/src/components/diagnose/target.test.ts +143 -2
- package/src/components/diagnose/target.ts +109 -7
- package/src/components/diagnose/testdata/story-runs.json +474 -0
- package/src/components/diagnose/verdictText.test.tsx +87 -0
- package/src/components/diagnose/verdictText.ts +68 -0
- package/src/components/home/ClusterHealthCard.tsx +13 -39
- package/src/components/home/HomeAgentBlock.test.tsx +113 -0
- package/src/components/home/HomeAgentBlock.tsx +94 -0
- package/src/components/home/HomeView.tsx +5 -6
- package/src/components/home/RadarVersionLine.test.tsx +0 -14
- package/src/components/home/RadarVersionLine.tsx +3 -28
- package/src/components/ui/Omnibar.investigate.test.tsx +105 -0
- package/src/components/ui/Omnibar.tsx +47 -3
- package/src/components/ui/RadarOmnibar.test.tsx +1 -0
- package/src/components/ui/RadarOmnibar.tsx +11 -0
- package/src/components/whats-new/WhatsNewDialog.test.tsx +3 -3
- package/src/components/whats-new/releaseNotes.ts +60 -1
- package/src/hooks/useAgentSignin.test.tsx +190 -0
- package/src/hooks/useAgentSignin.ts +160 -0
- package/src/hooks/useApproveAfterSignin.test.tsx +108 -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
|
|
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: () => [] }))
|
|
@@ -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
|
|
@@ -55,6 +56,15 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
|
|
|
55
56
|
}), [nsScope, apiResources])
|
|
56
57
|
|
|
57
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
|
|
58
68
|
const { onNavigateKind } = callbacks
|
|
59
69
|
const note = searchCoverageNote(searchData?.coverage, {
|
|
60
70
|
hits: searchData?.hits,
|
|
@@ -80,6 +90,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
|
|
|
80
90
|
note={note}
|
|
81
91
|
modifierOptions={modifierOptions}
|
|
82
92
|
seedNamespaces={nsScope?.actives}
|
|
93
|
+
onInvestigateQuery={onInvestigateQuery}
|
|
83
94
|
loadRecents={() => loadRecentResources(contextKey)}
|
|
84
95
|
recordRecent={(r) => recordRecentResource(r, contextKey)}
|
|
85
96
|
/>
|
|
@@ -300,11 +300,11 @@ describe('WhatsNew', () => {
|
|
|
300
300
|
expect(seenPosts).toEqual([])
|
|
301
301
|
})
|
|
302
302
|
|
|
303
|
-
it.each(['', '=v1.
|
|
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.
|
|
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.
|
|
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: [
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
5
|
+
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
|
6
|
+
import { useAgentSignin, type AgentSigninCheck } from './useAgentSignin'
|
|
7
|
+
import type { AgentSigninStatus, ExecutionProfile } from '../api/diagnose'
|
|
8
|
+
|
|
9
|
+
const mocks = vi.hoisted(() => ({
|
|
10
|
+
support: 'supported' as 'supported' | 'unsupported' | 'unknown',
|
|
11
|
+
fetch: vi.fn<(agent: string, profile: string, refresh: boolean) => Promise<AgentSigninStatus>>(),
|
|
12
|
+
}))
|
|
13
|
+
vi.mock('../api/client', () => ({
|
|
14
|
+
useRadarFeature: () => ({ support: mocks.support, gatedKey: [], guard: (fn: () => unknown) => fn() }),
|
|
15
|
+
}))
|
|
16
|
+
vi.mock('../api/diagnose', () => ({
|
|
17
|
+
fetchAgentSignin: (agent: string, profile: string, refresh: boolean) => mocks.fetch(agent, profile, refresh),
|
|
18
|
+
}))
|
|
19
|
+
|
|
20
|
+
const signedOut: AgentSigninStatus = { agent: 'claude', state: 'signed-out', signinCmd: 'claude auth login' }
|
|
21
|
+
const signedIn: AgentSigninStatus = { agent: 'claude', state: 'signed-in' }
|
|
22
|
+
|
|
23
|
+
const seen = {} as { latest: AgentSigninCheck }
|
|
24
|
+
function Probe({ agent, profile, enabled }: { agent: string; profile: ExecutionProfile; enabled: boolean }) {
|
|
25
|
+
seen.latest = useAgentSignin(agent, profile, enabled)
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Lets React Query settle: a resolved fetch reaches the component a few
|
|
30
|
+
// ticks later.
|
|
31
|
+
async function settle() {
|
|
32
|
+
for (let i = 0; i < 5; i++) {
|
|
33
|
+
await act(async () => {
|
|
34
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function mount(agent = 'claude', enabled = true, profile: ExecutionProfile = 'safeguarded') {
|
|
40
|
+
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
|
41
|
+
const root = createRoot(document.createElement('div'))
|
|
42
|
+
await act(async () => {
|
|
43
|
+
root.render(
|
|
44
|
+
<QueryClientProvider client={client}>
|
|
45
|
+
<Probe agent={agent} profile={profile} enabled={enabled} />
|
|
46
|
+
</QueryClientProvider>,
|
|
47
|
+
)
|
|
48
|
+
})
|
|
49
|
+
await settle()
|
|
50
|
+
return root
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
55
|
+
})
|
|
56
|
+
afterEach(() => {
|
|
57
|
+
mocks.support = 'supported'
|
|
58
|
+
mocks.fetch.mockReset()
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('reports a signed-out agent with its sign-in command, for the profile in use', async () => {
|
|
62
|
+
mocks.fetch.mockResolvedValue(signedOut)
|
|
63
|
+
const root = await mount('claude', true, 'full-local')
|
|
64
|
+
expect(mocks.fetch).toHaveBeenCalledWith('claude', 'full-local', false)
|
|
65
|
+
expect(seen.latest.status).toEqual(signedOut)
|
|
66
|
+
expect(seen.latest.pending).toBe(false)
|
|
67
|
+
root.unmount()
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it.each<AgentSigninStatus['state']>(['signed-in', 'unknown'])('passes a %s answer through without a sign-in command', async (state) => {
|
|
71
|
+
mocks.fetch.mockResolvedValue({ agent: 'claude', state })
|
|
72
|
+
const root = await mount()
|
|
73
|
+
expect(seen.latest.status?.state).toBe(state)
|
|
74
|
+
expect(seen.latest.status?.signinCmd).toBeUndefined()
|
|
75
|
+
root.unmount()
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('leaves the consent step alone when the check fails', async () => {
|
|
79
|
+
mocks.fetch.mockRejectedValue(new Error('agent sign-in: 501'))
|
|
80
|
+
const root = await mount()
|
|
81
|
+
expect(seen.latest.status).toBeUndefined()
|
|
82
|
+
root.unmount()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('asks nothing when disabled, without an agent, or on a Radar without the endpoint', async () => {
|
|
86
|
+
for (const [agent, enabled, support] of [
|
|
87
|
+
['claude', false, 'supported'],
|
|
88
|
+
['', true, 'supported'],
|
|
89
|
+
['claude', true, 'unsupported'],
|
|
90
|
+
] as const) {
|
|
91
|
+
mocks.support = support
|
|
92
|
+
const root = await mount(agent, enabled)
|
|
93
|
+
expect(seen.latest.status).toBeUndefined()
|
|
94
|
+
expect(await seen.latest.settle()).toBeUndefined()
|
|
95
|
+
root.unmount()
|
|
96
|
+
}
|
|
97
|
+
expect(mocks.fetch).not.toHaveBeenCalled()
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('re-check bypasses the cache and replaces the answer', async () => {
|
|
101
|
+
mocks.fetch.mockResolvedValueOnce(signedOut)
|
|
102
|
+
const root = await mount()
|
|
103
|
+
mocks.fetch.mockResolvedValueOnce(signedIn)
|
|
104
|
+
await act(async () => seen.latest.recheck())
|
|
105
|
+
await settle()
|
|
106
|
+
expect(mocks.fetch).toHaveBeenLastCalledWith('claude', 'safeguarded', true)
|
|
107
|
+
expect(seen.latest.status?.state).toBe('signed-in')
|
|
108
|
+
expect(seen.latest.rechecking).toBe(false)
|
|
109
|
+
root.unmount()
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('a failed re-check becomes unknown rather than refetching the stale answer', async () => {
|
|
113
|
+
// The server's cache would keep answering "signed out" to a plain fetch.
|
|
114
|
+
mocks.fetch.mockImplementation(async (_agent, _profile, refresh) => {
|
|
115
|
+
if (refresh) throw new Error('network')
|
|
116
|
+
return signedOut
|
|
117
|
+
})
|
|
118
|
+
const root = await mount()
|
|
119
|
+
const plainFetches = () => mocks.fetch.mock.calls.filter(([, , refresh]) => !refresh).length
|
|
120
|
+
expect(plainFetches()).toBe(1)
|
|
121
|
+
await act(async () => seen.latest.recheck())
|
|
122
|
+
await settle()
|
|
123
|
+
expect(seen.latest.status?.state).toBe('unknown')
|
|
124
|
+
expect(plainFetches()).toBe(1)
|
|
125
|
+
root.unmount()
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('applies only the newest of overlapping re-checks', async () => {
|
|
129
|
+
mocks.fetch.mockResolvedValueOnce(signedOut)
|
|
130
|
+
const root = await mount()
|
|
131
|
+
let resolveOlder!: (s: AgentSigninStatus) => void
|
|
132
|
+
mocks.fetch.mockImplementationOnce(() => new Promise((resolve) => { resolveOlder = resolve }))
|
|
133
|
+
mocks.fetch.mockResolvedValueOnce(signedIn)
|
|
134
|
+
await act(async () => seen.latest.recheck())
|
|
135
|
+
await act(async () => seen.latest.recheck())
|
|
136
|
+
await settle()
|
|
137
|
+
expect(seen.latest.status?.state).toBe('signed-in')
|
|
138
|
+
await act(async () => resolveOlder(signedOut))
|
|
139
|
+
await settle()
|
|
140
|
+
expect(seen.latest.status?.state).toBe('signed-in')
|
|
141
|
+
expect(seen.latest.rechecking).toBe(false)
|
|
142
|
+
root.unmount()
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it('settle waits for the running check', async () => {
|
|
146
|
+
let resolve!: (s: AgentSigninStatus) => void
|
|
147
|
+
mocks.fetch.mockImplementation(() => new Promise((r) => { resolve = r }))
|
|
148
|
+
const root = await mount()
|
|
149
|
+
expect(seen.latest.pending).toBe(true)
|
|
150
|
+
let settled: AgentSigninStatus | undefined
|
|
151
|
+
const waiting = seen.latest.settle().then((s) => { settled = s })
|
|
152
|
+
await settle()
|
|
153
|
+
expect(settled).toBeUndefined()
|
|
154
|
+
await act(async () => resolve(signedOut))
|
|
155
|
+
await waiting
|
|
156
|
+
expect(settled).toEqual(signedOut)
|
|
157
|
+
expect(mocks.fetch).toHaveBeenCalledTimes(1)
|
|
158
|
+
root.unmount()
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it('settle gives up when the answer never arrives', async () => {
|
|
162
|
+
mocks.fetch.mockImplementation(() => new Promise(() => {}))
|
|
163
|
+
const root = await mount()
|
|
164
|
+
vi.useFakeTimers()
|
|
165
|
+
try {
|
|
166
|
+
let settled = 'waiting' as AgentSigninStatus | undefined | 'waiting'
|
|
167
|
+
const waiting = seen.latest.settle().then((s) => { settled = s })
|
|
168
|
+
await vi.advanceTimersByTimeAsync(2_400)
|
|
169
|
+
expect(settled).toBe('waiting')
|
|
170
|
+
await vi.advanceTimersByTimeAsync(200)
|
|
171
|
+
await waiting
|
|
172
|
+
expect(settled).toBeUndefined()
|
|
173
|
+
} finally {
|
|
174
|
+
vi.useRealTimers()
|
|
175
|
+
}
|
|
176
|
+
root.unmount()
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('checks again when the user comes back to the window while signed out', async () => {
|
|
180
|
+
mocks.fetch.mockResolvedValueOnce(signedOut)
|
|
181
|
+
const root = await mount()
|
|
182
|
+
mocks.fetch.mockResolvedValueOnce(signedIn)
|
|
183
|
+
await act(async () => {
|
|
184
|
+
window.dispatchEvent(new Event('focus'))
|
|
185
|
+
})
|
|
186
|
+
await settle()
|
|
187
|
+
expect(mocks.fetch).toHaveBeenLastCalledWith('claude', 'safeguarded', true)
|
|
188
|
+
expect(seen.latest.status?.state).toBe('signed-in')
|
|
189
|
+
root.unmount()
|
|
190
|
+
})
|