@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.
- package/package.json +4 -4
- package/src/App.tsx +23 -9
- 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/api/diagnose.test.ts +33 -2
- package/src/api/diagnose.ts +93 -3
- package/src/api/radarFeatures.ts +1 -0
- 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/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/ApplyDialog.test.tsx +10 -0
- package/src/components/diagnose/ApplyDialog.tsx +8 -1
- package/src/components/diagnose/AssessmentCard.tsx +99 -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 +98 -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 +119 -2
- package/src/components/diagnose/InvestigationEvidencePane.tsx +59 -11
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +11 -6
- package/src/components/diagnose/InvestigationView.tsx +203 -42
- 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 +16 -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/changes.ts +36 -1
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
- package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +8 -0
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
- package/src/components/diagnose/investigationEvidence/adapters/posture.ts +29 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +42 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +29 -2
- 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/metrics.test.tsx +111 -0
- package/src/components/diagnose/investigationEvidence/bodies/metrics.tsx +67 -16
- 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/excerpt.test.ts +18 -5
- package/src/components/diagnose/investigationEvidence/excerpt.ts +22 -11
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/index.ts +1 -1
- package/src/components/diagnose/investigationEvidence/navigation.tsx +2 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +7 -3
- package/src/components/diagnose/investigationEvidence/projection.test.ts +57 -3
- package/src/components/diagnose/investigationEvidence/types.ts +2 -0
- package/src/components/diagnose/investigationEvidencePartition.ts +6 -1
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
- package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
- 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 +66 -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/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 +40 -59
- 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/MCPSetupDialog.test.tsx +27 -2
- package/src/components/home/MCPSetupDialog.tsx +14 -2
- package/src/components/home/RadarVersionLine.test.tsx +0 -14
- package/src/components/home/RadarVersionLine.tsx +3 -28
- 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/Omnibar.investigate.test.tsx +105 -0
- package/src/components/ui/Omnibar.tsx +47 -3
- package/src/components/ui/RadarOmnibar.test.tsx +19 -0
- package/src/components/ui/RadarOmnibar.tsx +12 -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/whats-new/WhatsNewDialog.test.tsx +3 -3
- package/src/components/whats-new/releaseNotes.ts +60 -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/useAgentSignin.test.tsx +190 -0
- package/src/hooks/useAgentSignin.ts +160 -0
- package/src/hooks/useApproveAfterSignin.test.tsx +108 -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
|
@@ -14,6 +14,8 @@ import type {
|
|
|
14
14
|
DiagnosisResourceRef,
|
|
15
15
|
DiagnosisScalerRef,
|
|
16
16
|
} from "../../diagnoseEvidenceTypes";
|
|
17
|
+
import { getCrossplanePauseState, isManagedResource, isComposite } from "@skyhook-io/k8s-ui/components/resources/resource-utils-crossplane";
|
|
18
|
+
import { CrossplanePauseChip, CrossplanePauseNotice } from "@skyhook-io/k8s-ui/components/resources/renderers/CrossplanePauseContext";
|
|
17
19
|
import { InvestigationResourceEvidence } from "../../InvestigationResourceEvidence";
|
|
18
20
|
import { EvidenceNavigationContext } from "../navigation";
|
|
19
21
|
import {
|
|
@@ -131,6 +133,7 @@ export function CrashBody({ data }: { data: EvidenceDataOf<"crash"> }) {
|
|
|
131
133
|
|
|
132
134
|
export function ResourceBody({ data }: { data: EvidenceDataOf<"resource"> }) {
|
|
133
135
|
const replicas = data.resourceContext?.workloadSummary?.replicas;
|
|
136
|
+
const crossplane = isManagedResource(data.resource) || isComposite(data.resource) || getCrossplanePauseState(data.resource) === "acknowledged";
|
|
134
137
|
// SealedSecret's dedicated body renders the resource's conditions beside
|
|
135
138
|
// its controller state, so repeating the derived summary here adds noise.
|
|
136
139
|
const conditions =
|
|
@@ -145,6 +148,7 @@ export function ResourceBody({ data }: { data: EvidenceDataOf<"resource"> }) {
|
|
|
145
148
|
return (
|
|
146
149
|
<div className="space-y-3">
|
|
147
150
|
<InvestigationResourceEvidence resource={data.resource} />
|
|
151
|
+
{crossplane && getCrossplanePauseState(data.resource) ? <div className="space-y-1.5"><CrossplanePauseChip state={getCrossplanePauseState(data.resource)} compact /><CrossplanePauseNotice data={data.resource} /></div> : null}
|
|
148
152
|
{data.gitOpsDiagnosis ? (
|
|
149
153
|
<GitOpsStatusBody status={data.gitOpsDiagnosis} />
|
|
150
154
|
) : null}
|
|
@@ -182,7 +186,7 @@ export function ResourceBody({ data }: { data: EvidenceDataOf<"resource"> }) {
|
|
|
182
186
|
className="flex min-w-0 items-start gap-2 text-xs"
|
|
183
187
|
>
|
|
184
188
|
<StatusDot
|
|
185
|
-
tone={conditionStatusTone(condition)}
|
|
189
|
+
tone={conditionStatusTone(condition, data.resource)}
|
|
186
190
|
className="mt-1 shrink-0"
|
|
187
191
|
/>
|
|
188
192
|
<p className="min-w-0 text-theme-text-secondary">
|
|
@@ -213,7 +213,9 @@ export function projectInvestigationEvidence(
|
|
|
213
213
|
source,
|
|
214
214
|
investigationResultLabel(source),
|
|
215
215
|
"Only part of this investigation result was saved, so Radar could not summarize it here.",
|
|
216
|
-
|
|
216
|
+
// Nothing of the result is shown, so this is an unknown, not a
|
|
217
|
+
// sampling cap that still shows part of the answer.
|
|
218
|
+
"unknown",
|
|
217
219
|
);
|
|
218
220
|
continue;
|
|
219
221
|
}
|
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
Info,
|
|
8
8
|
SquareArrowOutUpRight,
|
|
9
9
|
} from "lucide-react";
|
|
10
|
+
import { getCrossplaneConditionTone } from "@skyhook-io/k8s-ui/components/resources/resource-utils-crossplane";
|
|
10
11
|
import { defaultConditionTone, displayKind } from "@skyhook-io/k8s-ui";
|
|
11
12
|
import type {
|
|
12
13
|
InvestigationEvidenceData,
|
|
14
|
+
InvestigationKubernetesResource,
|
|
13
15
|
InvestigationEvidenceGroup,
|
|
14
16
|
InvestigationEvidenceObservation,
|
|
15
17
|
InvestigationEvidenceSource,
|
|
@@ -149,8 +151,11 @@ export function ResourceFact({
|
|
|
149
151
|
export function conditionStatusTone(condition: {
|
|
150
152
|
type: string;
|
|
151
153
|
status: string;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
reason?: string;
|
|
155
|
+
}, resource?: InvestigationKubernetesResource): "healthy" | "degraded" | "unhealthy" | "unknown" | "neutral" {
|
|
156
|
+
switch (getCrossplaneConditionTone(resource, condition) ?? defaultConditionTone(condition)) {
|
|
157
|
+
case "neutral":
|
|
158
|
+
return "neutral";
|
|
154
159
|
case "ok":
|
|
155
160
|
return "healthy";
|
|
156
161
|
case "warning":
|
|
@@ -30,16 +30,29 @@ describe("storyExcerpt", () => {
|
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
it("shows a chart
|
|
33
|
+
it("shows a placed chart whatever its role, folding a compact one the story does not rest on", () => {
|
|
34
34
|
const metrics = observation({ type: "metrics", origin: "query" } as never);
|
|
35
35
|
expect(
|
|
36
36
|
storyExcerpt(metrics, [{ role: "context" }], { compact: false }),
|
|
37
|
-
).
|
|
37
|
+
).toEqual({ kind: "chart", size: "short", folded: false });
|
|
38
|
+
expect(
|
|
39
|
+
storyExcerpt(metrics, [{ role: "rules_out" }], { compact: true }),
|
|
40
|
+
).toEqual({ kind: "chart", size: "short", folded: true });
|
|
41
|
+
// The agent marks a card compact for the prose's flow, so a symptom
|
|
42
|
+
// placed compact still starts open.
|
|
38
43
|
expect(
|
|
39
|
-
storyExcerpt(metrics, [{ role: "symptom" }], { compact:
|
|
40
|
-
).toEqual({ kind: "chart" });
|
|
44
|
+
storyExcerpt(metrics, [{ role: "symptom" }], { compact: true }),
|
|
45
|
+
).toEqual({ kind: "chart", size: "full", folded: false });
|
|
41
46
|
expect(
|
|
42
|
-
storyExcerpt(metrics, [{ role: "
|
|
47
|
+
storyExcerpt(metrics, [{ role: "context" }, { role: "cause" }], {
|
|
48
|
+
compact: true,
|
|
49
|
+
}),
|
|
50
|
+
).toEqual({ kind: "chart", size: "full", folded: false });
|
|
51
|
+
expect(
|
|
52
|
+
storyExcerpt(metrics, [{ role: "cause" }], {
|
|
53
|
+
compact: true,
|
|
54
|
+
preview: true,
|
|
55
|
+
}),
|
|
43
56
|
).toBeUndefined();
|
|
44
57
|
});
|
|
45
58
|
|
|
@@ -19,15 +19,18 @@ export const VISIBLE_LOG_EVIDENCE_LINES = 12;
|
|
|
19
19
|
* What a card placed in the story shows inline, under its header, before the
|
|
20
20
|
* fold. The citation decides it: the lines Radar selected, the row a subject
|
|
21
21
|
* names, the workload's own row in a ranking, the findings on it, or the
|
|
22
|
-
* chart
|
|
23
|
-
*
|
|
22
|
+
* chart. The role the agent gave the card never hides any of it; it only
|
|
23
|
+
* sizes a chart, full height for what the story rests on and short for the
|
|
24
|
+
* rest. A compact marker starts a chart folded behind the card's chevron,
|
|
25
|
+
* except one the story rests on. Nothing here is the agent's text; every
|
|
26
|
+
* excerpt is a slice of Radar's record.
|
|
24
27
|
*/
|
|
25
28
|
export type StoryExcerpt =
|
|
26
29
|
| { kind: "lines"; head: string[]; rest: string[] }
|
|
27
30
|
| { kind: "rows"; entries: ReturnType<typeof namedInventoryRows> }
|
|
28
31
|
| { kind: "ranking"; rows: InvestigationRankingRow[] }
|
|
29
32
|
| { kind: "posture"; findings: InvestigationPostureFinding[] }
|
|
30
|
-
| { kind: "chart" };
|
|
33
|
+
| { kind: "chart"; size: "full" | "short"; folded: boolean };
|
|
31
34
|
|
|
32
35
|
export interface StoryExcerptItem {
|
|
33
36
|
role?: DiagnosisEvidenceRole;
|
|
@@ -37,7 +40,7 @@ export interface StoryExcerptItem {
|
|
|
37
40
|
export function storyExcerpt(
|
|
38
41
|
observation: InvestigationEvidenceObservation,
|
|
39
42
|
items: readonly StoryExcerptItem[],
|
|
40
|
-
options: { compact: boolean; scopeNamespace?: string },
|
|
43
|
+
options: { compact: boolean; preview?: boolean; scopeNamespace?: string },
|
|
41
44
|
): StoryExcerpt | undefined {
|
|
42
45
|
const data = observation.data;
|
|
43
46
|
// The lines are the card: a compact log card keeps them.
|
|
@@ -48,6 +51,21 @@ export function storyExcerpt(
|
|
|
48
51
|
if (lines.length === 0) return undefined;
|
|
49
52
|
return { kind: "lines", head: lines.slice(-2), rest: lines.slice(0, -2) };
|
|
50
53
|
}
|
|
54
|
+
// So is the chart: a compact card drops the agent's note, not Radar's
|
|
55
|
+
// record. Compact folds the chart, but the agent marks cards compact for
|
|
56
|
+
// the prose's flow, not their weight, so a cause or symptom stays open.
|
|
57
|
+
// Only the collapsed preview, which bounds its height, leaves it out.
|
|
58
|
+
if (data.type === "metrics") {
|
|
59
|
+
if (options.preview) return undefined;
|
|
60
|
+
const rests = items.some(
|
|
61
|
+
(item) => item.role === "cause" || item.role === "symptom",
|
|
62
|
+
);
|
|
63
|
+
return {
|
|
64
|
+
kind: "chart",
|
|
65
|
+
size: rests ? "full" : "short",
|
|
66
|
+
folded: options.compact && !rests,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
51
69
|
if (options.compact) return undefined;
|
|
52
70
|
const named = (row: { kind: string; namespace?: string; name: string }) =>
|
|
53
71
|
items.some(
|
|
@@ -59,13 +77,6 @@ export function storyExcerpt(
|
|
|
59
77
|
item.subject.namespace === row.namespace),
|
|
60
78
|
);
|
|
61
79
|
switch (data.type) {
|
|
62
|
-
case "metrics":
|
|
63
|
-
// A chart placed as the cause or the symptom is the card.
|
|
64
|
-
return items.some(
|
|
65
|
-
(item) => item.role === "cause" || item.role === "symptom",
|
|
66
|
-
)
|
|
67
|
-
? { kind: "chart" }
|
|
68
|
-
: undefined;
|
|
69
80
|
case "inventory": {
|
|
70
81
|
const entries = namedInventoryRows(
|
|
71
82
|
data.resources as InvestigationResourceSummary[],
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// absent here is internal: exported from its own file only so a sibling can
|
|
4
4
|
// reach it, and free to move between files without affecting a caller.
|
|
5
5
|
|
|
6
|
-
export { metricsScope } from "./adapters/prometheus";
|
|
6
|
+
export { metricsScope, metricsSelectedPod } from "./adapters/prometheus";
|
|
7
7
|
export { projectInvestigationEvidence } from "./builder";
|
|
8
8
|
export {
|
|
9
9
|
investigationActivitySourceDomId,
|
|
@@ -23,4 +23,6 @@ export const EvidenceNavigationContext = createContext<{
|
|
|
23
23
|
caseByGroup?: ReadonlyMap<string, InvestigationCaseItem[]>;
|
|
24
24
|
/** The hypothesis each `rules_out` item excludes, keyed by item. */
|
|
25
25
|
excludedByItem?: ReadonlyMap<string, string>;
|
|
26
|
+
/** The story card a reference just navigated to, so a folded chart opens. */
|
|
27
|
+
storyReveal?: { domId: string; requestId: number };
|
|
26
28
|
}>({});
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type DiagnosisPodLogEntry,
|
|
16
16
|
diagnosisSeverityTone,
|
|
17
17
|
} from "../diagnoseEvidenceTypes";
|
|
18
|
+
import { getCrossplaneConditionTone } from "@skyhook-io/k8s-ui/components/resources/resource-utils-crossplane";
|
|
18
19
|
import { investigationResourceEvidenceSummary } from "../investigationResourceEvidenceModel";
|
|
19
20
|
import { kindToPluralWithGroup } from "../../../utils/navigation";
|
|
20
21
|
import { pluralToKind } from "@skyhook-io/k8s-ui";
|
|
@@ -101,7 +102,8 @@ export function addTopologyLimitations(
|
|
|
101
102
|
source,
|
|
102
103
|
"Topology coverage",
|
|
103
104
|
warning,
|
|
104
|
-
|
|
105
|
+
!partiality.requiresNamespaceFilter &&
|
|
106
|
+
(normalized.includes("large graph") || normalized.includes("too large"))
|
|
105
107
|
? "truncated"
|
|
106
108
|
: "unknown",
|
|
107
109
|
);
|
|
@@ -135,7 +137,9 @@ export function addTopologyLimitations(
|
|
|
135
137
|
source,
|
|
136
138
|
"Topology scale",
|
|
137
139
|
scaleDetails.join(" "),
|
|
138
|
-
|
|
140
|
+
// A graph that was never built shows nothing, so it is an unknown; the
|
|
141
|
+
// other notes describe a graph that is shown with detail grouped.
|
|
142
|
+
partiality.requiresNamespaceFilter ? "unknown" : "truncated",
|
|
139
143
|
);
|
|
140
144
|
}
|
|
141
145
|
|
|
@@ -669,7 +673,7 @@ export function addResourceObservation(
|
|
|
669
673
|
(available !== undefined && available < desired) ||
|
|
670
674
|
(replicas?.unavailable ?? 0) > 0);
|
|
671
675
|
const adverseCondition = (context?.statusSummary?.conditions ?? []).some(
|
|
672
|
-
(condition) => defaultConditionTone(condition) === "fail",
|
|
676
|
+
(condition) => (getCrossplaneConditionTone(resource, condition) ?? defaultConditionTone(condition)) === "fail",
|
|
673
677
|
);
|
|
674
678
|
const gitOpsAdverse = Boolean(
|
|
675
679
|
gitOpsDiagnosis &&
|
|
@@ -279,6 +279,7 @@ describe("strict evidence adapters", () => {
|
|
|
279
279
|
expect.objectContaining({
|
|
280
280
|
source: "Issue-related changes",
|
|
281
281
|
kind: "unknown",
|
|
282
|
+
presentation: "history",
|
|
282
283
|
message: expect.stringContaining("incomplete for part of the window"),
|
|
283
284
|
}),
|
|
284
285
|
]);
|
|
@@ -1856,7 +1857,8 @@ describe("strict evidence adapters", () => {
|
|
|
1856
1857
|
),
|
|
1857
1858
|
]);
|
|
1858
1859
|
expect(result.groups).toHaveLength(0);
|
|
1859
|
-
expect(result.limitations[0]).toMatchObject({ kind: "
|
|
1860
|
+
expect(result.limitations[0]).toMatchObject({ kind: "unknown" });
|
|
1861
|
+
expect(result.limitations[0].presentation).toBeUndefined();
|
|
1860
1862
|
expect(result.limitations[0].source).toBe("Issue scan");
|
|
1861
1863
|
expect(result.limitations[0].message).toContain(
|
|
1862
1864
|
"Only part of this investigation result was saved",
|
|
@@ -2096,6 +2098,56 @@ describe("honest zero and partial-result states", () => {
|
|
|
2096
2098
|
);
|
|
2097
2099
|
});
|
|
2098
2100
|
|
|
2101
|
+
it("tells admission history bounds apart from failed or unchecked admission reads", () => {
|
|
2102
|
+
const started =
|
|
2103
|
+
"Radar has recorded changes only since 2026-10-27T23:42:31Z; earlier changes in the window are unknown.";
|
|
2104
|
+
const watched =
|
|
2105
|
+
"Radar has watched MutatingWebhookConfigurations only since 2026-10-27T23:42:37Z; earlier changes in the window are unknown.";
|
|
2106
|
+
const evicted =
|
|
2107
|
+
"Radar has evicted older change history; earlier changes in the window are unknown.";
|
|
2108
|
+
const denied =
|
|
2109
|
+
"ValidatingWebhookConfiguration changes are not readable by the caller.";
|
|
2110
|
+
const failed =
|
|
2111
|
+
"Radar failed to record a MutatingWebhookConfiguration change at 2026-10-28T00:00:00Z; changes in the window may be missing.";
|
|
2112
|
+
const admission = (incomplete: string) =>
|
|
2113
|
+
project([
|
|
2114
|
+
tool("changes", "get_changes", {
|
|
2115
|
+
changes: [],
|
|
2116
|
+
clusterScopedChanges: { changes: [], incomplete },
|
|
2117
|
+
}),
|
|
2118
|
+
]).limitations.filter(
|
|
2119
|
+
(entry) => entry.source === "Cluster-scoped admission changes",
|
|
2120
|
+
);
|
|
2121
|
+
|
|
2122
|
+
expect(admission(`${started} ${watched} ${evicted}`)).toEqual([
|
|
2123
|
+
expect.objectContaining({
|
|
2124
|
+
kind: "unknown",
|
|
2125
|
+
presentation: "history",
|
|
2126
|
+
message: `${started} ${watched} ${evicted}`,
|
|
2127
|
+
}),
|
|
2128
|
+
]);
|
|
2129
|
+
// The producer keeps the startup notes beside another gap; the gap stays
|
|
2130
|
+
// an open question and only the bounds become history.
|
|
2131
|
+
const mixed = admission(`${denied} ${failed} ${started}`);
|
|
2132
|
+
expect(mixed).toEqual([
|
|
2133
|
+
expect.objectContaining({
|
|
2134
|
+
kind: "unknown",
|
|
2135
|
+
message: `${denied} ${failed}`,
|
|
2136
|
+
}),
|
|
2137
|
+
expect.objectContaining({
|
|
2138
|
+
kind: "unknown",
|
|
2139
|
+
presentation: "history",
|
|
2140
|
+
message: started,
|
|
2141
|
+
}),
|
|
2142
|
+
]);
|
|
2143
|
+
expect(mixed[0].presentation).toBeUndefined();
|
|
2144
|
+
const uncached = admission(
|
|
2145
|
+
"Current ValidatingWebhookConfigurations are not cached, so their scope could not be checked; their changes are listed as may_apply.",
|
|
2146
|
+
);
|
|
2147
|
+
expect(uncached).toHaveLength(1);
|
|
2148
|
+
expect(uncached[0].presentation).toBeUndefined();
|
|
2149
|
+
});
|
|
2150
|
+
|
|
2099
2151
|
it("creates receipts only for confirmed complete zero-result reads", () => {
|
|
2100
2152
|
const result = project([
|
|
2101
2153
|
tool("diagnose", "diagnose", {
|
|
@@ -2337,13 +2389,15 @@ describe("honest zero and partial-result states", () => {
|
|
|
2337
2389
|
});
|
|
2338
2390
|
expect(result.limitations).toEqual(
|
|
2339
2391
|
expect.arrayContaining([
|
|
2392
|
+
// The graph was never built, so these are unknowns, not caps on a
|
|
2393
|
+
// graph that is shown.
|
|
2340
2394
|
expect.objectContaining({
|
|
2341
2395
|
source: "Topology coverage",
|
|
2342
|
-
kind: "
|
|
2396
|
+
kind: "unknown",
|
|
2343
2397
|
}),
|
|
2344
2398
|
expect.objectContaining({
|
|
2345
2399
|
source: "Topology scale",
|
|
2346
|
-
kind: "
|
|
2400
|
+
kind: "unknown",
|
|
2347
2401
|
message: expect.stringContaining("namespace-scoped topology search"),
|
|
2348
2402
|
}),
|
|
2349
2403
|
]),
|
|
@@ -560,6 +560,8 @@ export interface InvestigationMetricsEvidence {
|
|
|
560
560
|
selectorsUnknown?: boolean;
|
|
561
561
|
subject?: DiagnosisResourceRef;
|
|
562
562
|
pods?: number;
|
|
563
|
+
/** The pods a diagnose chart summed, by name, when its bundle listed them all. */
|
|
564
|
+
podNames?: string[];
|
|
563
565
|
partial?: boolean;
|
|
564
566
|
}
|
|
565
567
|
export interface InvestigationEvidenceObservation {
|
|
@@ -96,6 +96,11 @@ export function partitionInvestigationEvidence(
|
|
|
96
96
|
* target is folded into a second tier. Broader results stay cited-only.
|
|
97
97
|
*/
|
|
98
98
|
inventory = false,
|
|
99
|
+
/**
|
|
100
|
+
* The run stopped without an assessment, so nothing will ever be cited:
|
|
101
|
+
* broader results are all it has to show, and are not withheld.
|
|
102
|
+
*/
|
|
103
|
+
showUncited = false,
|
|
99
104
|
) {
|
|
100
105
|
// Selection: legacy root-cause links plus every placed agent item, of any
|
|
101
106
|
// role (placement promotes a group into main the way a citation does; the
|
|
@@ -126,7 +131,7 @@ export function partitionInvestigationEvidence(
|
|
|
126
131
|
// reader knows the agent ran queries it did not build its case on.
|
|
127
132
|
let hiddenMetrics = 0;
|
|
128
133
|
for (const group of groups) {
|
|
129
|
-
const broader = group.latest.relevance === "broader";
|
|
134
|
+
const broader = group.latest.relevance === "broader" && !showUncited;
|
|
130
135
|
// Citations select tool results, not individual rows in a broad search.
|
|
131
136
|
// Only a focused, unambiguous fact can be promoted by a source citation.
|
|
132
137
|
// An agent item names this observation when its subject does, or when the
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import type { HPADiagnosisState } from "@skyhook-io/k8s-ui";
|
|
3
3
|
import {
|
|
4
|
+
assessmentLimitLines,
|
|
4
5
|
evidenceDisplaySnapshot,
|
|
5
6
|
groupEvidenceCoverage,
|
|
6
7
|
} from "./investigationEvidencePresentation";
|
|
@@ -446,12 +447,45 @@ describe("coverage presentation", () => {
|
|
|
446
447
|
limitation("Container logs", "Connection timed out", "error"),
|
|
447
448
|
]);
|
|
448
449
|
expect(groups[0].hasError).toBe(true);
|
|
449
|
-
expect(groups[0].bookkeepingOnly).toBe(false);
|
|
450
|
-
expect(groups[1].bookkeepingOnly).toBe(true);
|
|
451
450
|
expect(groups[0].summary).toContain("Forbidden");
|
|
452
451
|
expect(groups[0].summary).toContain("Connection timed out");
|
|
453
452
|
expect(groups[0].limitations).toHaveLength(3);
|
|
454
453
|
});
|
|
454
|
+
it("folds a source into the routine line only when every limit on it is routine", () => {
|
|
455
|
+
const watched =
|
|
456
|
+
"Radar has watched MutatingWebhookConfigurations only since 2026-10-27T23:42:37Z; earlier changes in the window are unknown.";
|
|
457
|
+
const failed =
|
|
458
|
+
"Radar failed to record a MutatingWebhookConfiguration change at 2026-10-28T00:00:00Z; changes in the window may be missing.";
|
|
459
|
+
const routineOnly = assessmentLimitLines([
|
|
460
|
+
limitation("Container logs", "Logs sampled", "truncated"),
|
|
461
|
+
limitation("Cluster-scoped admission changes", watched, "unknown", true),
|
|
462
|
+
limitation(
|
|
463
|
+
"Recent changes",
|
|
464
|
+
"Secret object history incomplete",
|
|
465
|
+
"unknown",
|
|
466
|
+
true,
|
|
467
|
+
),
|
|
468
|
+
]);
|
|
469
|
+
expect(routineOnly.open).toEqual([]);
|
|
470
|
+
expect(routineOnly.routine).toEqual([
|
|
471
|
+
"Container logs: Only part of the logs was checked.",
|
|
472
|
+
`Cluster-scoped admission changes: ${watched}`,
|
|
473
|
+
"Recent changes: Change history is incomplete.",
|
|
474
|
+
]);
|
|
475
|
+
// A failed read keeps its source open, whole, so the line is the one
|
|
476
|
+
// Captured results shows and its dedupe still matches.
|
|
477
|
+
const mixed = assessmentLimitLines([
|
|
478
|
+
limitation("Container logs", "Logs sampled", "truncated"),
|
|
479
|
+
limitation("Container logs", "Forbidden: cannot read pod logs", "error"),
|
|
480
|
+
limitation("Cluster-scoped admission changes", watched, "unknown", true),
|
|
481
|
+
limitation("Cluster-scoped admission changes", failed, "unknown"),
|
|
482
|
+
]);
|
|
483
|
+
expect(mixed.open).toEqual([
|
|
484
|
+
"Container logs: Forbidden: cannot read pod logs",
|
|
485
|
+
`Cluster-scoped admission changes: ${watched} · ${failed}`,
|
|
486
|
+
]);
|
|
487
|
+
expect(mixed.routine).toEqual([]);
|
|
488
|
+
});
|
|
455
489
|
it("keeps history-only neutral and unknown limitations verbatim", () => {
|
|
456
490
|
expect(
|
|
457
491
|
groupEvidenceCoverage([
|
|
@@ -105,8 +105,37 @@ export interface EvidenceCoverageGroup {
|
|
|
105
105
|
limitations: InvestigationEvidenceLimitation[];
|
|
106
106
|
hasError: boolean;
|
|
107
107
|
historyOnly: boolean;
|
|
108
|
-
/** Every entry is a sampling cap or a history bound:
|
|
109
|
-
|
|
108
|
+
/** Every entry is a sampling cap or a history bound: routine, not an open question. */
|
|
109
|
+
routineOnly: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** A sampling cap or a history bound: bookkeeping for the record, not an open question. */
|
|
113
|
+
function routineLimitation(entry: InvestigationEvidenceLimitation): boolean {
|
|
114
|
+
return (
|
|
115
|
+
entry.kind === "truncated" ||
|
|
116
|
+
(entry.kind === "unknown" && entry.presentation === "history")
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Radar's own limits for the assessment headline, one line per source.
|
|
122
|
+
* `open` holds reads Radar could not complete, which qualify the answer and
|
|
123
|
+
* sit under Still open; `routine` holds sampling caps and history bounds,
|
|
124
|
+
* which hold on most runs and are shown folded beneath it. A source with
|
|
125
|
+
* anything else keeps its whole line open, so the line matches the one
|
|
126
|
+
* Captured results groups and is not repeated there.
|
|
127
|
+
*/
|
|
128
|
+
export function assessmentLimitLines(
|
|
129
|
+
limitations: InvestigationEvidenceLimitation[],
|
|
130
|
+
): { open: string[]; routine: string[] } {
|
|
131
|
+
const open: string[] = [];
|
|
132
|
+
const routine: string[] = [];
|
|
133
|
+
for (const group of groupEvidenceCoverage(limitations)) {
|
|
134
|
+
const line = `${group.label}: ${group.summary}`;
|
|
135
|
+
if (group.routineOnly) routine.push(line);
|
|
136
|
+
else open.push(line);
|
|
137
|
+
}
|
|
138
|
+
return { open, routine };
|
|
110
139
|
}
|
|
111
140
|
|
|
112
141
|
/** Group the presentation, not the underlying limitations or health qualification. */
|
|
@@ -126,11 +155,7 @@ export function groupEvidenceCoverage(
|
|
|
126
155
|
(entry) => entry.kind === "unknown" && entry.presentation === "history",
|
|
127
156
|
);
|
|
128
157
|
const truncated = entries.some((entry) => entry.kind === "truncated");
|
|
129
|
-
const ordinaryLimits = entries.every(
|
|
130
|
-
(entry) =>
|
|
131
|
-
entry.kind === "truncated" ||
|
|
132
|
-
(entry.kind === "unknown" && entry.presentation === "history"),
|
|
133
|
-
);
|
|
158
|
+
const ordinaryLimits = entries.every(routineLimitation);
|
|
134
159
|
let summary: string;
|
|
135
160
|
if (errors.length) {
|
|
136
161
|
// Never replace permission/transport failures with a benign sampling note.
|
|
@@ -160,7 +185,7 @@ export function groupEvidenceCoverage(
|
|
|
160
185
|
limitations: entries,
|
|
161
186
|
hasError: errors.length > 0,
|
|
162
187
|
historyOnly,
|
|
163
|
-
|
|
188
|
+
routineOnly: ordinaryLimits,
|
|
164
189
|
};
|
|
165
190
|
})
|
|
166
191
|
.sort(
|