@skyhook-io/radar-app 1.18.1 → 1.18.2
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 +1 -1
- package/src/App.tsx +23 -8
- package/src/api/client.deleteResource.test.tsx +111 -0
- package/src/api/client.resourceAudit.test.tsx +57 -0
- package/src/api/client.resourcePath.test.ts +107 -0
- package/src/api/client.ts +136 -37
- package/src/components/capacity/CapacityDemand.tsx +6 -3
- package/src/components/capacity/CapacityOverview.tsx +14 -7
- package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
- package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
- package/src/components/capacity/shared.tsx +9 -5
- package/src/components/cnpg/CNPGOverview.tsx +4 -1
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
- package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
- package/src/components/diagnose/ApplyDialog.tsx +8 -1
- package/src/components/diagnose/AssessmentCard.tsx +60 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +5 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +62 -2
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +6 -5
- package/src/components/diagnose/InvestigationView.tsx +47 -13
- package/src/components/diagnose/assessmentCopy.ts +11 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
- package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
- package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
- package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
- package/src/components/diagnose/investigationEvidence/builder.ts +3 -1
- package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/observations.ts +7 -3
- package/src/components/diagnose/investigationEvidence/projection.test.ts +57 -3
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
- package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
- package/src/components/diagnose/storyParts.test.tsx +53 -0
- package/src/components/helm/ChartBrowser.tsx +4 -4
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
- package/src/components/helm/HelmView.tsx +34 -23
- package/src/components/helm/InstallWizard.tsx +6 -2
- package/src/components/helm/ValuesViewer.test.tsx +1 -0
- package/src/components/helm/ValuesViewer.tsx +4 -2
- package/src/components/home/ClusterHealthCard.tsx +28 -21
- package/src/components/home/MCPSetupDialog.test.tsx +27 -2
- package/src/components/home/MCPSetupDialog.tsx +14 -2
- package/src/components/home/mcpToolCatalog.ts +29 -2
- package/src/components/issues/IssuesPane.render.test.tsx +5 -5
- package/src/components/nav/PrimaryNavRail.tsx +34 -2
- package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
- package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
- package/src/components/product-hunt/launchWindow.ts +78 -0
- package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
- package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
- package/src/components/resources/CompositeRenderer.tsx +4 -0
- package/src/components/resources/ResourcesView.tsx +1 -1
- package/src/components/settings/LocalConnectionSettings.tsx +1 -0
- package/src/components/ui/RadarOmnibar.test.tsx +18 -0
- package/src/components/ui/RadarOmnibar.tsx +1 -0
- package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
- package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
- package/src/components/ui/UpdateNotification.test.tsx +2 -0
- package/src/components/ui/UpdateNotification.tsx +32 -5
- package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
- package/src/components/workload/WorkloadView.tsx +10 -4
- package/src/components/workspace/layout.tsx +2 -1
- package/src/contexts/CapabilitiesContext.tsx +1 -0
- package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
- package/src/hooks/useGitOpsWriteGuard.ts +25 -3
- package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
- package/src/index.css +85 -0
|
@@ -65,6 +65,7 @@ export function ResultCard({
|
|
|
65
65
|
readOnlyAssessment = false,
|
|
66
66
|
revisedAfter,
|
|
67
67
|
assessmentLimits,
|
|
68
|
+
assessmentRoutineLimits,
|
|
68
69
|
assessmentCopy,
|
|
69
70
|
healthSignals,
|
|
70
71
|
onRevealSource,
|
|
@@ -88,6 +89,8 @@ export function ResultCard({
|
|
|
88
89
|
revisedAfter?: string;
|
|
89
90
|
/** Reads Radar could not complete for this assessment; listed under Still open. */
|
|
90
91
|
assessmentLimits?: string[];
|
|
92
|
+
/** Sampling caps and history bounds Radar hit; folded beneath Still open. */
|
|
93
|
+
assessmentRoutineLimits?: string[];
|
|
91
94
|
assessmentCopy?: Pick<AssessmentCopyRadar, "context" | "receipts">;
|
|
92
95
|
healthSignals?: InvestigationHealthSignal[];
|
|
93
96
|
onRevealSource?: (sourceId: string) => void;
|
|
@@ -150,6 +153,7 @@ export function ResultCard({
|
|
|
150
153
|
storyInline={storyInline}
|
|
151
154
|
revisedAfter={revisedAfter}
|
|
152
155
|
assessmentLimits={assessmentLimits}
|
|
156
|
+
assessmentRoutineLimits={assessmentRoutineLimits}
|
|
153
157
|
assessmentCopy={assessmentCopy}
|
|
154
158
|
healthSignals={healthSignals}
|
|
155
159
|
onRevealSource={onRevealSource}
|
|
@@ -183,6 +187,7 @@ export function ResultCard({
|
|
|
183
187
|
storyInline={storyInline}
|
|
184
188
|
revisedAfter={revisedAfter}
|
|
185
189
|
assessmentLimits={assessmentLimits}
|
|
190
|
+
assessmentRoutineLimits={assessmentRoutineLimits}
|
|
186
191
|
assessmentCopy={assessmentCopy}
|
|
187
192
|
/>
|
|
188
193
|
{section === "full" && (diagnosis.steps?.length ?? 0) > 0 ? (
|
|
@@ -234,6 +239,7 @@ export function ResultCard({
|
|
|
234
239
|
readOnlyAssessment={readOnlyAssessment}
|
|
235
240
|
revisedAfter={revisedAfter}
|
|
236
241
|
assessmentLimits={assessmentLimits}
|
|
242
|
+
assessmentRoutineLimits={assessmentRoutineLimits}
|
|
237
243
|
assessmentCopy={assessmentCopy}
|
|
238
244
|
/>
|
|
239
245
|
);
|
|
@@ -277,6 +283,7 @@ function AssessmentHeadline({
|
|
|
277
283
|
tone,
|
|
278
284
|
revisedAfter,
|
|
279
285
|
limits = [],
|
|
286
|
+
routineLimits = [],
|
|
280
287
|
signals,
|
|
281
288
|
flags,
|
|
282
289
|
copy,
|
|
@@ -286,6 +293,8 @@ function AssessmentHeadline({
|
|
|
286
293
|
revisedAfter?: string;
|
|
287
294
|
/** Reads Radar could not complete for this assessment, one line each. */
|
|
288
295
|
limits?: string[];
|
|
296
|
+
/** Sampling caps and history bounds, one line each; folded beneath Still open. */
|
|
297
|
+
routineLimits?: string[];
|
|
289
298
|
/** Adverse Radar cards the agent explained, with its position; first in Still open. */
|
|
290
299
|
signals?: { text: string; onReveal?: () => void }[];
|
|
291
300
|
/** Adverse Radar cards nothing explains; shown above a healthy verdict, copied with it. */
|
|
@@ -312,6 +321,7 @@ function AssessmentHeadline({
|
|
|
312
321
|
<CopyButton
|
|
313
322
|
text={assessmentCopyText(diagnosis, {
|
|
314
323
|
limits,
|
|
324
|
+
routineLimits,
|
|
315
325
|
signals: (signals ?? []).map((signal) => signal.text),
|
|
316
326
|
flags,
|
|
317
327
|
...copy,
|
|
@@ -398,6 +408,44 @@ function AssessmentHeadline({
|
|
|
398
408
|
</ul>
|
|
399
409
|
</div>
|
|
400
410
|
) : null}
|
|
411
|
+
{routineLimits.length > 0 ? (
|
|
412
|
+
<RoutineLimits lines={routineLimits} />
|
|
413
|
+
) : null}
|
|
414
|
+
</div>
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Radar's ordinary limits — a capped sample, history that starts when Radar
|
|
419
|
+
// started watching — hold on most runs and rarely bear on the cause. They stay
|
|
420
|
+
// above the fold, and in the channel copy, but folded to one muted line so the
|
|
421
|
+
// agent's own open questions lead.
|
|
422
|
+
function RoutineLimits({ lines }: { lines: string[] }) {
|
|
423
|
+
const [open, setOpen] = useState(false);
|
|
424
|
+
const id = useId();
|
|
425
|
+
return (
|
|
426
|
+
<div data-assessment-routine-limits>
|
|
427
|
+
<button
|
|
428
|
+
type="button"
|
|
429
|
+
aria-expanded={open}
|
|
430
|
+
aria-controls={id}
|
|
431
|
+
onClick={() => setOpen(!open)}
|
|
432
|
+
className="flex items-center gap-1 text-[11px] text-theme-text-tertiary hover:text-theme-text-secondary"
|
|
433
|
+
>
|
|
434
|
+
<CollapseChevron open={open} className="h-3 w-3" />
|
|
435
|
+
Radar's coverage · {lines.length} routine{" "}
|
|
436
|
+
{lines.length === 1 ? "limit" : "limits"}
|
|
437
|
+
</button>
|
|
438
|
+
<div id={id}>
|
|
439
|
+
<Collapse open={open}>
|
|
440
|
+
<ul className="mt-1 space-y-0.5 pl-4 text-[11px] text-theme-text-tertiary">
|
|
441
|
+
{lines.map((line, index) => (
|
|
442
|
+
<li key={`routine-${index}`} className="[overflow-wrap:anywhere]">
|
|
443
|
+
{line}
|
|
444
|
+
</li>
|
|
445
|
+
))}
|
|
446
|
+
</ul>
|
|
447
|
+
</Collapse>
|
|
448
|
+
</div>
|
|
401
449
|
</div>
|
|
402
450
|
);
|
|
403
451
|
}
|
|
@@ -893,6 +941,7 @@ function DiagnosisResult({
|
|
|
893
941
|
readOnlyAssessment = false,
|
|
894
942
|
revisedAfter,
|
|
895
943
|
assessmentLimits,
|
|
944
|
+
assessmentRoutineLimits,
|
|
896
945
|
assessmentCopy,
|
|
897
946
|
}: {
|
|
898
947
|
diagnosis: Diagnosis;
|
|
@@ -910,6 +959,8 @@ function DiagnosisResult({
|
|
|
910
959
|
revisedAfter?: string;
|
|
911
960
|
/** Reads Radar could not complete for this assessment; listed under Still open. */
|
|
912
961
|
assessmentLimits?: string[];
|
|
962
|
+
/** Sampling caps and history bounds Radar hit; folded beneath Still open. */
|
|
963
|
+
assessmentRoutineLimits?: string[];
|
|
913
964
|
assessmentCopy?: Pick<AssessmentCopyRadar, "context" | "receipts">;
|
|
914
965
|
}) {
|
|
915
966
|
// The story contract: a summary headline above, the story rendered by the
|
|
@@ -1076,6 +1127,7 @@ function DiagnosisResult({
|
|
|
1076
1127
|
tone="cause"
|
|
1077
1128
|
revisedAfter={revisedAfter}
|
|
1078
1129
|
limits={assessmentLimits}
|
|
1130
|
+
routineLimits={assessmentRoutineLimits}
|
|
1079
1131
|
copy={assessmentCopy}
|
|
1080
1132
|
/>
|
|
1081
1133
|
</div>
|
|
@@ -1255,6 +1307,7 @@ export function AllClearCard({
|
|
|
1255
1307
|
storyInline = false,
|
|
1256
1308
|
revisedAfter,
|
|
1257
1309
|
assessmentLimits,
|
|
1310
|
+
assessmentRoutineLimits,
|
|
1258
1311
|
assessmentCopy,
|
|
1259
1312
|
healthSignals,
|
|
1260
1313
|
onRevealSource,
|
|
@@ -1272,6 +1325,8 @@ export function AllClearCard({
|
|
|
1272
1325
|
revisedAfter?: string;
|
|
1273
1326
|
/** Reads Radar could not complete for this assessment; listed under Still open. */
|
|
1274
1327
|
assessmentLimits?: string[];
|
|
1328
|
+
/** Sampling caps and history bounds Radar hit; folded beneath Still open. */
|
|
1329
|
+
assessmentRoutineLimits?: string[];
|
|
1275
1330
|
assessmentCopy?: Pick<AssessmentCopyRadar, "context" | "receipts">;
|
|
1276
1331
|
/** Adverse Radar cards with the agent's position on each (story shape). */
|
|
1277
1332
|
healthSignals?: InvestigationHealthSignal[];
|
|
@@ -1376,6 +1431,7 @@ export function AllClearCard({
|
|
|
1376
1431
|
revisedAfter={revisedAfter}
|
|
1377
1432
|
flags={flagged.map(healthFlagSentence)}
|
|
1378
1433
|
limits={assessmentLimits}
|
|
1434
|
+
routineLimits={assessmentRoutineLimits}
|
|
1379
1435
|
copy={assessmentCopy}
|
|
1380
1436
|
signals={stillOpenSignals}
|
|
1381
1437
|
/>
|
|
@@ -1459,6 +1515,7 @@ export function InconclusiveCard({
|
|
|
1459
1515
|
storyInline = false,
|
|
1460
1516
|
revisedAfter,
|
|
1461
1517
|
assessmentLimits,
|
|
1518
|
+
assessmentRoutineLimits,
|
|
1462
1519
|
assessmentCopy,
|
|
1463
1520
|
}: {
|
|
1464
1521
|
diagnosis: Diagnosis;
|
|
@@ -1470,6 +1527,8 @@ export function InconclusiveCard({
|
|
|
1470
1527
|
assessmentAction?: ReactNode;
|
|
1471
1528
|
/** Reads Radar could not complete for this assessment; listed under Still open. */
|
|
1472
1529
|
assessmentLimits?: string[];
|
|
1530
|
+
/** Sampling caps and history bounds Radar hit; folded beneath Still open. */
|
|
1531
|
+
assessmentRoutineLimits?: string[];
|
|
1473
1532
|
assessmentCopy?: Pick<AssessmentCopyRadar, "context" | "receipts">;
|
|
1474
1533
|
}) {
|
|
1475
1534
|
const storyShape = diagnosisHasStoryShape(diagnosis);
|
|
@@ -1496,6 +1555,7 @@ export function InconclusiveCard({
|
|
|
1496
1555
|
tone="inconclusive"
|
|
1497
1556
|
revisedAfter={revisedAfter}
|
|
1498
1557
|
limits={assessmentLimits}
|
|
1558
|
+
routineLimits={assessmentRoutineLimits}
|
|
1499
1559
|
copy={assessmentCopy}
|
|
1500
1560
|
/>
|
|
1501
1561
|
) : null}
|
|
@@ -466,6 +466,10 @@ export function DiagnoseSurface({
|
|
|
466
466
|
setMaximized,
|
|
467
467
|
],
|
|
468
468
|
);
|
|
469
|
+
const revealDestination = useCallback(
|
|
470
|
+
() => revealInvestigationDestination(setMaximized, d.dismissForNavigation, narrow),
|
|
471
|
+
[d.dismissForNavigation, narrow, setMaximized],
|
|
472
|
+
);
|
|
469
473
|
const openEvidenceTimeline = useCallback(
|
|
470
474
|
(scope: InvestigationTimelineScope) => {
|
|
471
475
|
if (!onOpenTimeline) return;
|
|
@@ -578,6 +582,7 @@ export function DiagnoseSurface({
|
|
|
578
582
|
maximized={maximized}
|
|
579
583
|
onOpenResource={onOpenResource ? openEvidenceResource : undefined}
|
|
580
584
|
onOpenTimeline={onOpenTimeline ? openEvidenceTimeline : undefined}
|
|
585
|
+
onRevealDestination={revealDestination}
|
|
581
586
|
/>
|
|
582
587
|
) : d.activeRunId && !d.runsLoaded ? (
|
|
583
588
|
// Deep-linked to a run before the list has ever loaded: show the load
|
|
@@ -1982,7 +1982,7 @@ describe("InvestigationEvidencePane honest result states", () => {
|
|
|
1982
1982
|
projection.limitations.every((item) => item.presentation === "history"),
|
|
1983
1983
|
).toBe(true);
|
|
1984
1984
|
const html = render(projection);
|
|
1985
|
-
expect(html).toContain("
|
|
1985
|
+
expect(html).toContain("Radar's coverage · 1 routine limit<");
|
|
1986
1986
|
expect(html).not.toContain("Evidence coverage is incomplete");
|
|
1987
1987
|
expect(html).not.toContain("access restrictions");
|
|
1988
1988
|
const header = html.match(
|
|
@@ -2029,10 +2029,70 @@ describe("InvestigationEvidencePane honest result states", () => {
|
|
|
2029
2029
|
);
|
|
2030
2030
|
const html = render(projection);
|
|
2031
2031
|
expect(html).toContain("Evidence coverage is incomplete");
|
|
2032
|
-
expect(html).not.toContain("
|
|
2032
|
+
expect(html).not.toContain("routine limit");
|
|
2033
2033
|
expect(investigationEvidenceCoverageLimited(projection)).toBe(true);
|
|
2034
2034
|
});
|
|
2035
2035
|
|
|
2036
|
+
it("calls sampling caps and history bounds routine, in a neutral tone, and still lists each", () => {
|
|
2037
|
+
const projection = project(
|
|
2038
|
+
tool("empty-history", "get_changes", { changes: [] }),
|
|
2039
|
+
tool("issues-capped", "issues", {
|
|
2040
|
+
issues: [],
|
|
2041
|
+
total: 0,
|
|
2042
|
+
total_matched: 0,
|
|
2043
|
+
recent_changes_truncated: true,
|
|
2044
|
+
}),
|
|
2045
|
+
);
|
|
2046
|
+
expect(
|
|
2047
|
+
projection.limitations.every(
|
|
2048
|
+
(item) =>
|
|
2049
|
+
item.kind === "truncated" ||
|
|
2050
|
+
(item.kind === "unknown" && item.presentation === "history"),
|
|
2051
|
+
),
|
|
2052
|
+
).toBe(true);
|
|
2053
|
+
const html = render(projection);
|
|
2054
|
+
const header =
|
|
2055
|
+
html.match(
|
|
2056
|
+
/<button[^>]*aria-controls="investigation-evidence-coverage"[\s\S]*?<\/button>/,
|
|
2057
|
+
)?.[0] ?? "";
|
|
2058
|
+
expect(header).toContain("Radar's coverage · 2 routine limits");
|
|
2059
|
+
expect(header).not.toContain("Evidence coverage is incomplete");
|
|
2060
|
+
expect(header).not.toContain("text-red");
|
|
2061
|
+
expect(header).not.toContain("text-amber");
|
|
2062
|
+
// Folded, not dropped: every source keeps its row inside the strip.
|
|
2063
|
+
const region = html.slice(
|
|
2064
|
+
html.indexOf('id="investigation-evidence-coverage"'),
|
|
2065
|
+
);
|
|
2066
|
+
expect(region).toContain("Recent changes");
|
|
2067
|
+
expect(region).toContain("Issue-related changes");
|
|
2068
|
+
});
|
|
2069
|
+
|
|
2070
|
+
it("keeps a real failure red and first even when the other limits are routine", () => {
|
|
2071
|
+
const projection = project(
|
|
2072
|
+
tool("empty-history", "get_changes", { changes: [] }),
|
|
2073
|
+
tool(
|
|
2074
|
+
"denied-logs",
|
|
2075
|
+
"get_pod_logs",
|
|
2076
|
+
{ error: "pods/log is forbidden" },
|
|
2077
|
+
{ isError: true },
|
|
2078
|
+
),
|
|
2079
|
+
);
|
|
2080
|
+
const html = render(projection);
|
|
2081
|
+
const header =
|
|
2082
|
+
html.match(
|
|
2083
|
+
/<button[^>]*aria-controls="investigation-evidence-coverage"[\s\S]*?<\/button>/,
|
|
2084
|
+
)?.[0] ?? "";
|
|
2085
|
+
expect(header).toContain("Evidence coverage is incomplete");
|
|
2086
|
+
expect(header).toContain("text-red-400");
|
|
2087
|
+
expect(header).not.toContain("routine limit");
|
|
2088
|
+
const region = html.slice(
|
|
2089
|
+
html.indexOf('id="investigation-evidence-coverage"'),
|
|
2090
|
+
);
|
|
2091
|
+
expect(region.indexOf("pods/log is forbidden")).toBeLessThan(
|
|
2092
|
+
region.indexOf("Recent changes"),
|
|
2093
|
+
);
|
|
2094
|
+
});
|
|
2095
|
+
|
|
2036
2096
|
it("summarizes incomplete coverage and points to Activity for review", () => {
|
|
2037
2097
|
const projection = project(
|
|
2038
2098
|
tool(
|
|
@@ -271,8 +271,9 @@ export function CoverageStrip({
|
|
|
271
271
|
onOpenChange: (open: boolean) => void;
|
|
272
272
|
}) {
|
|
273
273
|
const hasError = groups.some((group) => group.hasError);
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
// Sampling caps and history bounds read as routine, as in the assessment
|
|
275
|
+
// headline; any other gap keeps the alert treatment.
|
|
276
|
+
const quiet = groups.every((group) => group.routineOnly);
|
|
276
277
|
const { elementRef, revealAfterToggle } =
|
|
277
278
|
useDisclosureReveal<HTMLDivElement>();
|
|
278
279
|
const regionId = "investigation-evidence-coverage";
|
|
@@ -314,11 +315,11 @@ export function CoverageStrip({
|
|
|
314
315
|
: "font-semibold text-theme-text-primary",
|
|
315
316
|
)}
|
|
316
317
|
>
|
|
317
|
-
{
|
|
318
|
-
?
|
|
318
|
+
{quiet
|
|
319
|
+
? `Radar's coverage · ${groups.length} routine ${groups.length === 1 ? "limit" : "limits"}`
|
|
319
320
|
: "Evidence coverage is incomplete"}
|
|
320
321
|
</span>
|
|
321
|
-
{!
|
|
322
|
+
{!open && summary ? (
|
|
322
323
|
<span className="line-clamp-2 text-xs text-theme-text-tertiary [overflow-wrap:anywhere]">
|
|
323
324
|
{summary}
|
|
324
325
|
</span>
|
|
@@ -60,7 +60,10 @@ import {
|
|
|
60
60
|
} from "react";
|
|
61
61
|
import { useQueryClient } from "@tanstack/react-query";
|
|
62
62
|
import { useNavigate } from "react-router-dom";
|
|
63
|
-
import { Badge, gitOpsRouteForOwner, type GitOpsWrite } from "@skyhook-io/k8s-ui";
|
|
63
|
+
import { Badge, gitOpsRouteForOwner, type GitOpsOwnerRef, type GitOpsWrite } from "@skyhook-io/k8s-ui";
|
|
64
|
+
import { useResource } from "../../api/client";
|
|
65
|
+
import { getApiBase } from "../../api/config";
|
|
66
|
+
import { kindToPluralWithGroup } from "../../utils/navigation";
|
|
64
67
|
import { useGitOpsWriteGuard } from "../../hooks/useGitOpsWriteGuard";
|
|
65
68
|
import {
|
|
66
69
|
Send,
|
|
@@ -114,7 +117,7 @@ import { formatInvestigationTarget } from "./target";
|
|
|
114
117
|
import { parseContextName } from "../../utils/context-name";
|
|
115
118
|
import type { InvestigationSourceExcerpt } from "./investigationSourceFocus";
|
|
116
119
|
import { diagnosisHasStoryShape } from "./investigationStory";
|
|
117
|
-
import {
|
|
120
|
+
import { assessmentLimitLines } from "./investigationEvidencePresentation";
|
|
118
121
|
|
|
119
122
|
const RECHECK_QUESTION =
|
|
120
123
|
"Did the fix resolve the issue? Re-check the resource's current status and health now, and say whether it's healthy.";
|
|
@@ -275,6 +278,7 @@ export function InvestigationView({
|
|
|
275
278
|
maximized,
|
|
276
279
|
onOpenResource,
|
|
277
280
|
onOpenTimeline,
|
|
281
|
+
onRevealDestination,
|
|
278
282
|
}: {
|
|
279
283
|
run: RunSummary;
|
|
280
284
|
agentLabel: string;
|
|
@@ -283,6 +287,8 @@ export function InvestigationView({
|
|
|
283
287
|
onOpenResource?: (ref: DiagnosisResourceRef) => void;
|
|
284
288
|
/** Opens Radar's Timeline filtered to the resource a changes card is about. */
|
|
285
289
|
onOpenTimeline?: (scope: InvestigationTimelineScope) => void;
|
|
290
|
+
/** Makes a page this view navigates to visible: restores or closes the panel. */
|
|
291
|
+
onRevealDestination?: () => void;
|
|
286
292
|
}) {
|
|
287
293
|
const { kind, namespace, name } = run;
|
|
288
294
|
const {
|
|
@@ -963,12 +969,29 @@ export function InvestigationView({
|
|
|
963
969
|
declaredManager: run.managedBy,
|
|
964
970
|
enabled: confirmApply,
|
|
965
971
|
});
|
|
972
|
+
const applyTarget = useResource<unknown>(
|
|
973
|
+
confirmApply ? kindToPluralWithGroup(kind, run.group) : "",
|
|
974
|
+
namespace,
|
|
975
|
+
name,
|
|
976
|
+
run.group || undefined,
|
|
977
|
+
{ enabled: confirmApply, cacheScope: getApiBase() },
|
|
978
|
+
);
|
|
966
979
|
const navigateRouter = useNavigate();
|
|
967
980
|
const {
|
|
968
981
|
owner: applyOwner,
|
|
969
982
|
ownerVerified: applyOwnerVerified,
|
|
970
983
|
helmOwner: applyHelmOwner,
|
|
971
984
|
} = applyOwnership;
|
|
985
|
+
// A page opened from the Apply dialog replaces it, and the panel makes
|
|
986
|
+
// room so the page isn't left underneath.
|
|
987
|
+
const openFromApply = useCallback(
|
|
988
|
+
(path: string) => {
|
|
989
|
+
setConfirmApply(false);
|
|
990
|
+
onRevealDestination?.();
|
|
991
|
+
navigateRouter(path);
|
|
992
|
+
},
|
|
993
|
+
[navigateRouter, onRevealDestination],
|
|
994
|
+
);
|
|
972
995
|
const openApplyOwner = useMemo(() => {
|
|
973
996
|
// A host without resource navigation (Radar Hub's fleet Diagnose panel)
|
|
974
997
|
// has no route for the owner either.
|
|
@@ -976,16 +999,20 @@ export function InvestigationView({
|
|
|
976
999
|
const owner = applyOwner;
|
|
977
1000
|
const helmOwner = applyHelmOwner;
|
|
978
1001
|
if (owner && applyOwnerVerified) {
|
|
979
|
-
return () =>
|
|
1002
|
+
return () => openFromApply(gitOpsRouteForOwner(owner));
|
|
980
1003
|
}
|
|
981
1004
|
if (helmOwner) {
|
|
982
1005
|
return () =>
|
|
983
|
-
|
|
1006
|
+
openFromApply(
|
|
984
1007
|
`/helm?release=${encodeURIComponent(`${helmOwner.namespace}/${helmOwner.name}`)}`,
|
|
985
1008
|
);
|
|
986
1009
|
}
|
|
987
1010
|
return undefined;
|
|
988
|
-
}, [applyOwner, applyOwnerVerified, applyHelmOwner,
|
|
1011
|
+
}, [applyOwner, applyOwnerVerified, applyHelmOwner, openFromApply, onOpenResource]);
|
|
1012
|
+
const openApplyManager = useMemo(
|
|
1013
|
+
() => (onOpenResource ? (owner: GitOpsOwnerRef) => openFromApply(gitOpsRouteForOwner(owner)) : undefined),
|
|
1014
|
+
[openFromApply, onOpenResource],
|
|
1015
|
+
);
|
|
989
1016
|
const [pendingFix, setPendingFix] = useState("");
|
|
990
1017
|
const requestApply = (fix: string) => {
|
|
991
1018
|
if (interactionsBlocked) return;
|
|
@@ -1502,12 +1529,10 @@ export function InvestigationView({
|
|
|
1502
1529
|
currentAssessment?.diagnosis?.omittedEntries)
|
|
1503
1530
|
? assessmentSourcesNode
|
|
1504
1531
|
: undefined;
|
|
1505
|
-
const assessmentLimits = useMemo(() => {
|
|
1506
|
-
const lines =
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
.filter((group) => !group.historyOnly && !group.bookkeepingOnly)
|
|
1510
|
-
.map((group) => `${group.label}: ${group.summary}`);
|
|
1532
|
+
const { assessmentLimits, assessmentRoutineLimits } = useMemo(() => {
|
|
1533
|
+
const { open: lines, routine } = assessmentLimitLines(
|
|
1534
|
+
currentAssessmentProjection.limitations,
|
|
1535
|
+
);
|
|
1511
1536
|
// Two coverage gaps carry no limitation of their own; name the one that
|
|
1512
1537
|
// applies.
|
|
1513
1538
|
const gaps = investigationEvidenceCoverageGaps(
|
|
@@ -1520,7 +1545,7 @@ export function InvestigationView({
|
|
|
1520
1545
|
lines.push(
|
|
1521
1546
|
"Radar's full diagnose of this workload was not collected, so this check is partial",
|
|
1522
1547
|
);
|
|
1523
|
-
return lines;
|
|
1548
|
+
return { assessmentLimits: lines, assessmentRoutineLimits: routine };
|
|
1524
1549
|
}, [currentAssessmentProjection, kind]);
|
|
1525
1550
|
const healthSignals = useMemo(
|
|
1526
1551
|
() =>
|
|
@@ -2412,6 +2437,9 @@ export function InvestigationView({
|
|
|
2412
2437
|
assessmentLimits={
|
|
2413
2438
|
storyShape ? assessmentLimits : undefined
|
|
2414
2439
|
}
|
|
2440
|
+
assessmentRoutineLimits={
|
|
2441
|
+
storyShape ? assessmentRoutineLimits : undefined
|
|
2442
|
+
}
|
|
2415
2443
|
assessmentCopy={assessmentCopy}
|
|
2416
2444
|
healthSignals={storyShape ? healthSignals : undefined}
|
|
2417
2445
|
onRevealSource={viewEvidenceSource}
|
|
@@ -2540,7 +2568,11 @@ export function InvestigationView({
|
|
|
2540
2568
|
: undefined
|
|
2541
2569
|
}
|
|
2542
2570
|
storyShell={storyShell}
|
|
2543
|
-
summarizedLimits={
|
|
2571
|
+
summarizedLimits={
|
|
2572
|
+
storyShape
|
|
2573
|
+
? [...assessmentLimits, ...assessmentRoutineLimits]
|
|
2574
|
+
: undefined
|
|
2575
|
+
}
|
|
2544
2576
|
collecting={
|
|
2545
2577
|
explanationRequest?.status !== "running" &&
|
|
2546
2578
|
(requestPending ||
|
|
@@ -2583,8 +2615,10 @@ export function InvestigationView({
|
|
|
2583
2615
|
]?.precondition
|
|
2584
2616
|
: undefined
|
|
2585
2617
|
}
|
|
2618
|
+
resourceData={applyTarget.data}
|
|
2586
2619
|
gitOpsGuard={applyGitOpsGuard}
|
|
2587
2620
|
onOpenGitOpsOwner={openApplyOwner}
|
|
2621
|
+
onOpenGitOpsManager={openApplyManager}
|
|
2588
2622
|
confidence={turns[lastRemediationIdx]?.diagnosis?.confidence}
|
|
2589
2623
|
/>
|
|
2590
2624
|
</div>
|
|
@@ -10,6 +10,8 @@ import { storyPlainText } from "./investigationStory";
|
|
|
10
10
|
export interface AssessmentCopyRadar {
|
|
11
11
|
/** Reads Radar could not complete, as shown in Still open. */
|
|
12
12
|
limits?: readonly string[];
|
|
13
|
+
/** Sampling caps and history bounds, as folded beneath Still open. */
|
|
14
|
+
routineLimits?: readonly string[];
|
|
13
15
|
/** Adverse Radar cards the agent explained, as shown in Still open. */
|
|
14
16
|
signals?: readonly string[];
|
|
15
17
|
/** Adverse Radar cards nothing explains, as shown above a healthy verdict. */
|
|
@@ -143,6 +145,15 @@ export function assessmentCopyText(
|
|
|
143
145
|
);
|
|
144
146
|
} else parts.push(["Next steps:", ...steps].join("\n"));
|
|
145
147
|
}
|
|
148
|
+
// Routine limits travel with the paste, after what a reader acts on.
|
|
149
|
+
const routine = (radar.routineLimits ?? []).filter((item) => item.trim());
|
|
150
|
+
if (routine.length > 0)
|
|
151
|
+
parts.push(
|
|
152
|
+
[
|
|
153
|
+
"Radar's coverage (routine limits):",
|
|
154
|
+
...routine.map((item) => `- ${item}`),
|
|
155
|
+
].join("\n"),
|
|
156
|
+
);
|
|
146
157
|
if (radar.context)
|
|
147
158
|
parts.push(
|
|
148
159
|
"Full analysis and every captured result: open the investigation in Radar.",
|
|
@@ -70,6 +70,32 @@ export function adaptChanges(
|
|
|
70
70
|
|
|
71
71
|
const CLUSTER_SCOPED_LABEL = "Cluster-scoped admission changes";
|
|
72
72
|
|
|
73
|
+
// The sentences internal/meaningfulchanges/cluster_scoped.go writes when the
|
|
74
|
+
// window only starts before Radar's recorded history: Radar started, began
|
|
75
|
+
// watching a kind, or evicted older events. The producer joins them into
|
|
76
|
+
// `incomplete` with failures (a denied kind, an uncached scope, a failed
|
|
77
|
+
// recording), which stay open questions; only these exact bounds are history.
|
|
78
|
+
const ADMISSION_HISTORY_SENTENCES = [
|
|
79
|
+
/^Radar has recorded changes only since \S+; earlier changes in the window are unknown\.$/,
|
|
80
|
+
/^Radar has watched \w+ only since \S+; earlier changes in the window are unknown\.$/,
|
|
81
|
+
/^Radar has evicted older change history; earlier changes in the window are unknown\.$/,
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
/** Splits the producer's `incomplete` text into history bounds and everything else. */
|
|
85
|
+
function splitAdmissionIncomplete(text: string): {
|
|
86
|
+
history: string;
|
|
87
|
+
other: string;
|
|
88
|
+
} {
|
|
89
|
+
const history: string[] = [];
|
|
90
|
+
const other: string[] = [];
|
|
91
|
+
for (const sentence of text.trim().split(/(?<=\.)\s+/)) {
|
|
92
|
+
if (ADMISSION_HISTORY_SENTENCES.some((pattern) => pattern.test(sentence)))
|
|
93
|
+
history.push(sentence);
|
|
94
|
+
else other.push(sentence);
|
|
95
|
+
}
|
|
96
|
+
return { history: history.join(" "), other: other.join(" ") };
|
|
97
|
+
}
|
|
98
|
+
|
|
73
99
|
// Admission configuration changes that apply, or may apply, to the queried
|
|
74
100
|
// namespace. Each row's summary carries why it is listed, because the
|
|
75
101
|
// applicability is the point: the row itself is a cluster-scoped object.
|
|
@@ -106,7 +132,16 @@ export function addClusterScopedChanges(
|
|
|
106
132
|
builder.limit(source, CLUSTER_SCOPED_LABEL, value.error, "error");
|
|
107
133
|
}
|
|
108
134
|
if (nonEmptyString(value.incomplete)) {
|
|
109
|
-
|
|
135
|
+
const { history, other } = splitAdmissionIncomplete(value.incomplete);
|
|
136
|
+
if (other) builder.limit(source, CLUSTER_SCOPED_LABEL, other, "unknown");
|
|
137
|
+
if (history)
|
|
138
|
+
builder.limit(
|
|
139
|
+
source,
|
|
140
|
+
CLUSTER_SCOPED_LABEL,
|
|
141
|
+
history,
|
|
142
|
+
"unknown",
|
|
143
|
+
"history",
|
|
144
|
+
);
|
|
110
145
|
}
|
|
111
146
|
const notListed = stringArray(value.not_listed) ?? [];
|
|
112
147
|
if (notListed.length > 0 || value.truncated === true) {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { expect, it } from "vitest";
|
|
3
|
+
import paused from "./testdata/crossplane-paused-get-resource.json";
|
|
4
|
+
import { groupsOf, project, tool } from "../evidenceFixtures";
|
|
5
|
+
import { ResourceBody } from "../bodies/workload";
|
|
6
|
+
import { evidenceHasDetails } from "../bodies";
|
|
7
|
+
import { conditionStatusTone } from "../cardParts";
|
|
8
|
+
|
|
9
|
+
function card(payload: typeof paused) {
|
|
10
|
+
return groupsOf(project([tool("captured-pause", "get_resource", payload)]).groups, "resource")[0].latest;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
it("keeps a captured get_resource pause neutral with its raw observation and visible context", () => {
|
|
14
|
+
const captured = card(paused);
|
|
15
|
+
expect(captured.tone).toBe("neutral");
|
|
16
|
+
expect(captured.data.type).toBe("resource");
|
|
17
|
+
if (captured.data.type !== "resource") throw new Error("Expected resource evidence");
|
|
18
|
+
expect(evidenceHasDetails(captured.data)).toBe(true);
|
|
19
|
+
const html = renderToStaticMarkup(<ResourceBody data={captured.data} />);
|
|
20
|
+
expect(html).toContain("Paused");
|
|
21
|
+
expect(html).toContain("controller last reported reconciliation paused");
|
|
22
|
+
expect(html).toContain("Synced=False");
|
|
23
|
+
expect(html).toContain("ReconcilePaused");
|
|
24
|
+
expect(html).toContain("Readiness and errors are last reported");
|
|
25
|
+
expect(conditionStatusTone(paused.resource.status.conditions[1], captured.data.resource)).toBe("neutral");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("keeps a captured independent readiness error adverse and visible alongside pause", () => {
|
|
29
|
+
const payload = structuredClone(paused);
|
|
30
|
+
const failed = { type: "Ready", status: "False", reason: "Unavailable", message: "Fixture access denied" };
|
|
31
|
+
payload.resource.status.conditions[0] = failed;
|
|
32
|
+
payload.resourceContext.statusSummary.conditions[0] = failed;
|
|
33
|
+
const captured = card(payload);
|
|
34
|
+
expect(captured.tone).toBe("warning");
|
|
35
|
+
if (captured.data.type !== "resource") throw new Error("Expected resource evidence");
|
|
36
|
+
const html = renderToStaticMarkup(<ResourceBody data={captured.data} />);
|
|
37
|
+
expect(html).toContain("Ready=False");
|
|
38
|
+
expect(html).toContain("Fixture access denied");
|
|
39
|
+
expect(html).toContain("Paused");
|
|
40
|
+
expect(conditionStatusTone(failed, captured.data.resource)).toBe("unhealthy");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("keeps a requested pause with a reconciliation error adverse", () => {
|
|
44
|
+
const payload = structuredClone(paused);
|
|
45
|
+
payload.resource.status.conditions[1].reason = "ReconcileError";
|
|
46
|
+
payload.resourceContext.statusSummary.conditions[1].reason = "ReconcileError";
|
|
47
|
+
const captured = card(payload);
|
|
48
|
+
expect(captured.tone).toBe("warning");
|
|
49
|
+
if (captured.data.type !== "resource") throw new Error("Expected resource evidence");
|
|
50
|
+
const html = renderToStaticMarkup(<ResourceBody data={captured.data} />);
|
|
51
|
+
expect(html).toContain("Pause requested");
|
|
52
|
+
expect(html).toContain("recorded conditions do not confirm the pause");
|
|
53
|
+
expect(html).toContain("ReconcileError");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("keeps uncorroborated controller pause adverse without inventing a resume failure", () => {
|
|
57
|
+
const payload = structuredClone(paused);
|
|
58
|
+
payload.resource.metadata.annotations["crossplane.io/paused"] = "false";
|
|
59
|
+
const captured = card(payload);
|
|
60
|
+
expect(captured.tone).toBe("warning");
|
|
61
|
+
if (captured.data.type !== "resource") throw new Error("Expected resource evidence");
|
|
62
|
+
const html = renderToStaticMarkup(<ResourceBody data={captured.data} />);
|
|
63
|
+
expect(html).toContain("ReconcilePaused");
|
|
64
|
+
expect(html).not.toContain("controller last reported reconciliation paused");
|
|
65
|
+
expect(conditionStatusTone(payload.resource.status.conditions[1], captured.data.resource)).toBe("unhealthy");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
it("keeps captured pause context before a resource has composition references", () => {
|
|
70
|
+
const payload = { ...paused, resource: { ...paused.resource, kind: "EarlyXR", spec: {} } };
|
|
71
|
+
const captured = groupsOf(project([tool("early-pause", "get_resource", payload)]).groups, "resource")[0].latest;
|
|
72
|
+
expect(captured.tone).toBe("neutral");
|
|
73
|
+
if (captured.data.type !== "resource") throw new Error("Expected resource evidence");
|
|
74
|
+
expect(renderToStaticMarkup(<ResourceBody data={captured.data} />)).toContain("controller last reported reconciliation paused");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("keeps the captured deletion caution with recorded pause context", () => {
|
|
78
|
+
const payload = { ...paused, resource: { ...paused.resource, metadata: { ...paused.resource.metadata, deletionTimestamp: "2026-10-26T08:00:00Z" } } };
|
|
79
|
+
const captured = card(payload);
|
|
80
|
+
expect(captured.tone).toBe("neutral");
|
|
81
|
+
if (captured.data.type !== "resource") throw new Error("Expected resource evidence");
|
|
82
|
+
const html = renderToStaticMarkup(<ResourceBody data={captured.data} />);
|
|
83
|
+
expect(html).toContain("Deletion has been requested. Paused reconciliation may defer");
|
|
84
|
+
expect(html).toContain("controller last reported reconciliation paused");
|
|
85
|
+
});
|
|
@@ -148,6 +148,7 @@ export function adaptIssues(
|
|
|
148
148
|
"Issue-related changes",
|
|
149
149
|
"Radar's change history is incomplete for part of the window, so earlier changes may be missing.",
|
|
150
150
|
"unknown",
|
|
151
|
+
"history",
|
|
151
152
|
);
|
|
152
153
|
}
|
|
153
154
|
if (nonEmptyString(value.recent_changes_error)) {
|
|
@@ -974,7 +974,8 @@ describe("query_prometheus evidence", () => {
|
|
|
974
974
|
]);
|
|
975
975
|
expect(groupsOf(projection.groups, "metrics")).toHaveLength(0);
|
|
976
976
|
expect(projection.limitations).toHaveLength(1);
|
|
977
|
-
expect(projection.limitations[0].kind).toBe("
|
|
977
|
+
expect(projection.limitations[0].kind).toBe("unknown");
|
|
978
|
+
expect(projection.limitations[0].presentation).toBeUndefined();
|
|
978
979
|
expect(projection.limitations[0].message).toContain("812 series");
|
|
979
980
|
expect(projection.limitations[0].message).toContain(
|
|
980
981
|
"812 distinct pod values",
|
|
@@ -747,7 +747,8 @@ export function adaptQueryPrometheus(
|
|
|
747
747
|
source,
|
|
748
748
|
"Prometheus query",
|
|
749
749
|
`The result of \`${value.query}\` was too large to keep${parts.length ? ` (${parts.join(", ")})` : ""}, so Radar cannot chart it.${note ? ` ${note}` : ""}`,
|
|
750
|
-
|
|
750
|
+
// No series is kept, so this is an unknown, not a sample of the answer.
|
|
751
|
+
"unknown",
|
|
751
752
|
);
|
|
752
753
|
return;
|
|
753
754
|
}
|