@skyhook-io/radar-app 1.18.2 → 1.20.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/README.md +1 -1
- package/package.json +7 -7
- package/src/App.tsx +31 -6
- package/src/api/application-evidence.ts +63 -0
- package/src/api/argoSync.test.ts +22 -0
- package/src/api/client.audit-gating.test.tsx +48 -0
- package/src/api/client.kueuePosition.test.ts +32 -0
- package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
- package/src/api/client.resource-identity.test.ts +3 -0
- package/src/api/client.resourceIssues.test.tsx +239 -0
- package/src/api/client.resourcePath.test.ts +3 -0
- package/src/api/client.ts +285 -55
- package/src/api/config.ts +21 -0
- package/src/api/diagnose.test.ts +33 -2
- package/src/api/diagnose.ts +97 -3
- package/src/api/radarFeatures.render.test.tsx +33 -1
- package/src/api/radarFeatures.test.ts +47 -0
- package/src/api/radarFeatures.ts +41 -1
- package/src/api/rbac.settled.test.tsx +42 -0
- package/src/api/rbac.test.ts +18 -0
- package/src/api/rbac.ts +37 -7
- package/src/api/traffic.ts +9 -4
- package/src/api/usage-data.fixtures.ts +3 -1
- package/src/api/usage-data.test.tsx +134 -0
- package/src/api/usage-data.ts +35 -7
- package/src/api/workloadPodsPolling.test.ts +26 -0
- package/src/components/CloudConnectFlow.test.tsx +86 -0
- package/src/components/CloudConnectFlow.tsx +65 -27
- package/src/components/CloudFunnelButton.test.tsx +140 -5
- package/src/components/CloudFunnelButton.tsx +50 -9
- package/src/components/ConnectionErrorView.test.tsx +34 -0
- package/src/components/ConnectionErrorView.tsx +35 -11
- package/src/components/ContextSwitcher.tsx +5 -2
- package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
- package/src/components/SwitchAwareConnectionError.tsx +85 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
- package/src/components/capacity/CapacityDemand.tsx +3 -2
- package/src/components/capacity/demandSummary.test.ts +38 -0
- package/src/components/capacity/shared.tsx +12 -1
- package/src/components/cost/ApplicationCostTab.tsx +4 -0
- package/src/components/cost/CostTrendChart.tsx +2 -0
- package/src/components/cost/WorkloadCostTab.tsx +4 -0
- package/src/components/cost/source.test.ts +5 -0
- package/src/components/cost/source.ts +11 -0
- package/src/components/diagnose/AIMarkdown.tsx +4 -1
- package/src/components/diagnose/ActivityTurn.tsx +34 -14
- package/src/components/diagnose/AgentControls.tsx +53 -6
- package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
- package/src/components/diagnose/AgentSetupNotice.tsx +22 -4
- 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/ContinueInAgentButton.mounted.test.tsx +182 -0
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
- package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
- 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 +272 -10
- package/src/components/diagnose/DiagnoseSurface.test.tsx +54 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +151 -134
- package/src/components/diagnose/EvidenceCard.tsx +67 -14
- package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
- package/src/components/diagnose/Home.test.tsx +208 -5
- package/src/components/diagnose/Home.tsx +187 -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 +50 -23
- package/src/components/diagnose/InvestigationView.tsx +249 -54
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
- package/src/components/diagnose/LocalDiagnoseAction.tsx +365 -39
- package/src/components/diagnose/NextStepJump.test.tsx +92 -0
- package/src/components/diagnose/NextStepJump.tsx +75 -0
- package/src/components/diagnose/QuestionComposer.test.tsx +553 -0
- package/src/components/diagnose/QuestionComposer.tsx +495 -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/exampleInvestigation.events.json +191 -0
- package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
- package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
- package/src/components/diagnose/exampleInvestigation.ts +121 -0
- package/src/components/diagnose/investigationCase.runs.test.tsx +328 -0
- package/src/components/diagnose/investigationCase.test.tsx +9 -1
- package/src/components/diagnose/investigationCase.ts +33 -1
- package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +58 -2
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -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/builder.ts +30 -0
- 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/observations.ts +121 -2
- package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
- package/src/components/diagnose/investigationEvidence/types.ts +7 -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/investigationState.ts +28 -0
- package/src/components/diagnose/lastInvestigation.test.ts +95 -0
- package/src/components/diagnose/lastInvestigation.ts +58 -0
- package/src/components/diagnose/launch.test.ts +125 -1
- package/src/components/diagnose/launch.ts +57 -10
- 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/toolCallLabel.test.ts +10 -4
- package/src/components/diagnose/verdictText.test.tsx +87 -0
- package/src/components/diagnose/verdictText.ts +68 -0
- package/src/components/execution/BatchExecutionView.tsx +24 -11
- package/src/components/execution/JobSetAdmission.test.tsx +42 -0
- package/src/components/execution/JobSetAdmission.tsx +18 -3
- package/src/components/execution/JobSetMemberComparison.tsx +2 -1
- package/src/components/execution/runState.test.ts +14 -0
- package/src/components/execution/runState.ts +8 -0
- package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
- package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
- package/src/components/gitops/GitOpsView.tsx +86 -17
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
- package/src/components/gitops/destination-toast.test.ts +1 -1
- package/src/components/gitops/destination-toast.ts +2 -2
- package/src/components/home/ClusterHealthCard.tsx +13 -39
- package/src/components/home/HomeAgentBlock.test.tsx +141 -0
- package/src/components/home/HomeAgentBlock.tsx +103 -0
- package/src/components/home/HomeDiagramCard.tsx +47 -0
- package/src/components/home/HomeView.tsx +86 -47
- package/src/components/home/MCPSetupDialog.test.tsx +95 -5
- package/src/components/home/MCPSetupDialog.tsx +30 -5
- package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
- package/src/components/home/ProblemsPanel.test.tsx +3 -1
- package/src/components/home/RadarVersionLine.test.tsx +0 -14
- package/src/components/home/RadarVersionLine.tsx +3 -28
- package/src/components/home/TopologyPreview.test.tsx +73 -0
- package/src/components/home/TopologyPreview.tsx +120 -233
- package/src/components/home/TrafficSummary.test.tsx +63 -0
- package/src/components/home/TrafficSummary.tsx +135 -138
- package/src/components/home/mcpToolCatalog.ts +23 -10
- package/src/components/issues/IssuesPane.test.ts +11 -0
- package/src/components/issues/IssuesPane.tsx +15 -5
- package/src/components/issues/uncheckedSources.test.ts +20 -1
- package/src/components/issues/uncheckedSources.ts +18 -0
- package/src/components/kueue/KueuePendingPosition.tsx +35 -0
- package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
- package/src/components/kueue/useRelatedReads.test.ts +56 -0
- package/src/components/kueue/useRelatedReads.ts +205 -0
- package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
- package/src/components/logs/MultiPodLogsTab.tsx +120 -0
- package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
- package/src/components/logs/PodLogsUnavailable.tsx +21 -0
- package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
- package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
- package/src/components/logs/RayClusterLogsTab.tsx +109 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
- package/src/components/logs/rayClusterPods.ts +32 -0
- package/src/components/outageSince.test.ts +21 -0
- package/src/components/outageSince.ts +10 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
- package/src/components/resource/PrometheusCharts.tsx +3 -40
- package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
- package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
- package/src/components/resources/crd/host.tsx +14 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
- package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
- package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
- package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
- package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
- package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
- package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
- package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
- package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
- package/src/components/traffic/TrafficView.tsx +3 -3
- 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/ui/command-items-crd.test.tsx +23 -0
- package/src/components/ui/command-items.ts +2 -1
- package/src/components/useContextSwitchFlow.test.tsx +61 -0
- package/src/components/useContextSwitchFlow.tsx +21 -4
- package/src/components/whats-new/WhatsNew.test.ts +10 -3
- package/src/components/whats-new/WhatsNew.tsx +5 -1
- package/src/components/whats-new/WhatsNewDialog.test.tsx +18 -4
- package/src/components/whats-new/releaseNotes.ts +136 -4
- package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
- package/src/components/workload/RelatedFindingsSection.tsx +80 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +85 -98
- package/src/components/workload/issueResourceOpener.test.ts +20 -0
- package/src/components/workload/issueResourceOpener.ts +17 -0
- package/src/context/ConnectionContext.tsx +133 -60
- package/src/context/ConnectionProvider.retry.test.tsx +176 -0
- package/src/context/ContextSwitchContext.tsx +14 -1
- package/src/context/DiagnoseCustomization.tsx +3 -0
- package/src/context/clusterConnected.ts +10 -0
- package/src/contexts/CapabilitiesContext.tsx +6 -4
- 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/useElementSize.ts +30 -0
- package/src/integrations/resourceHost.test.tsx +1 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +21 -4
- package/src/integrations/resourceHosts.tsx +12 -0
- package/src/main.tsx +5 -0
- package/src/utils/related-findings.ts +46 -0
|
@@ -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
|
}>({});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { relatedFindingLimitations } from "../../../utils/related-findings";
|
|
2
|
+
import { uncheckedSourceLines } from "../../issues/uncheckedSources";
|
|
3
|
+
import { type UncheckedSource } from "../../../api/client";
|
|
1
4
|
import {
|
|
2
5
|
type HPADiagnosisState,
|
|
3
6
|
type Issue,
|
|
7
|
+
type RelatedFindingsGroup,
|
|
4
8
|
type IssueRecentChange,
|
|
5
9
|
type Topology,
|
|
6
10
|
defaultConditionTone,
|
|
@@ -13,6 +17,7 @@ import {
|
|
|
13
17
|
type DiagnosisChangeContext,
|
|
14
18
|
type DiagnosisEvidenceLimitationBase,
|
|
15
19
|
type DiagnosisPodLogEntry,
|
|
20
|
+
type DiagnosisResourceRef,
|
|
16
21
|
diagnosisSeverityTone,
|
|
17
22
|
} from "../diagnoseEvidenceTypes";
|
|
18
23
|
import { getCrossplaneConditionTone } from "@skyhook-io/k8s-ui/components/resources/resource-utils-crossplane";
|
|
@@ -20,7 +25,15 @@ import { investigationResourceEvidenceSummary } from "../investigationResourceEv
|
|
|
20
25
|
import { kindToPluralWithGroup } from "../../../utils/navigation";
|
|
21
26
|
import { pluralToKind } from "@skyhook-io/k8s-ui";
|
|
22
27
|
import { stableHash } from "./identity";
|
|
23
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
issue,
|
|
30
|
+
nonEmptyString,
|
|
31
|
+
nonNegativeInteger,
|
|
32
|
+
parseJSON,
|
|
33
|
+
record,
|
|
34
|
+
resourceRef,
|
|
35
|
+
stringArray,
|
|
36
|
+
} from "./parse";
|
|
24
37
|
import {
|
|
25
38
|
type InvestigationEventEvidence,
|
|
26
39
|
type InvestigationEvidenceGroup,
|
|
@@ -287,6 +300,8 @@ export class ProjectionBuilder {
|
|
|
287
300
|
readonly projectedSources = new Set<string>();
|
|
288
301
|
readonly checkedSources = new Set<string>();
|
|
289
302
|
readonly limitedSources = new Set<string>();
|
|
303
|
+
readonly connectorRecoveryBySource = new Map<string, DiagnosisResourceRef>();
|
|
304
|
+
|
|
290
305
|
readonly semanticCoverageBySource = new Map<
|
|
291
306
|
string,
|
|
292
307
|
Set<InvestigationSemanticDomain>
|
|
@@ -513,6 +528,14 @@ export function addNarrowHint(
|
|
|
513
528
|
source: InvestigationEvidenceSource,
|
|
514
529
|
value: Record<string, unknown>,
|
|
515
530
|
): void {
|
|
531
|
+
if (value.relatedIssuesTruncated === true) {
|
|
532
|
+
builder.limit(
|
|
533
|
+
source,
|
|
534
|
+
"Related Issues",
|
|
535
|
+
"Radar returned part of the related Issues; more findings may exist.",
|
|
536
|
+
"truncated",
|
|
537
|
+
);
|
|
538
|
+
}
|
|
516
539
|
if (nonEmptyString(value.narrowHint)) {
|
|
517
540
|
const label = investigationResultLabel(source);
|
|
518
541
|
builder.limit(
|
|
@@ -524,12 +547,26 @@ export function addNarrowHint(
|
|
|
524
547
|
);
|
|
525
548
|
}
|
|
526
549
|
}
|
|
550
|
+
export function addUncheckedIssueLimitations(
|
|
551
|
+
builder: ProjectionBuilder,
|
|
552
|
+
source: InvestigationEvidenceSource,
|
|
553
|
+
gaps: UncheckedSource[] | undefined,
|
|
554
|
+
): void {
|
|
555
|
+
for (const line of uncheckedSourceLines(gaps)) {
|
|
556
|
+
builder.limit(source, "Issue scan", line, "unknown");
|
|
557
|
+
}
|
|
558
|
+
}
|
|
527
559
|
function addResourceContextLimitations(
|
|
528
560
|
builder: ProjectionBuilder,
|
|
529
561
|
source: InvestigationEvidenceSource,
|
|
530
562
|
context: InvestigationResourceContext | undefined,
|
|
531
563
|
): void {
|
|
532
564
|
if (!context) return;
|
|
565
|
+
addUncheckedIssueLimitations(
|
|
566
|
+
builder,
|
|
567
|
+
source,
|
|
568
|
+
context.issueSummary?.unchecked,
|
|
569
|
+
);
|
|
533
570
|
for (const value of Array.isArray(context.omitted) ? context.omitted : []) {
|
|
534
571
|
const omitted = record(value);
|
|
535
572
|
if (
|
|
@@ -673,7 +710,9 @@ export function addResourceObservation(
|
|
|
673
710
|
(available !== undefined && available < desired) ||
|
|
674
711
|
(replicas?.unavailable ?? 0) > 0);
|
|
675
712
|
const adverseCondition = (context?.statusSummary?.conditions ?? []).some(
|
|
676
|
-
(condition) =>
|
|
713
|
+
(condition) =>
|
|
714
|
+
(getCrossplaneConditionTone(resource, condition) ??
|
|
715
|
+
defaultConditionTone(condition)) === "fail",
|
|
677
716
|
);
|
|
678
717
|
const gitOpsAdverse = Boolean(
|
|
679
718
|
gitOpsDiagnosis &&
|
|
@@ -734,6 +773,7 @@ export function addResourceObservation(
|
|
|
734
773
|
},
|
|
735
774
|
});
|
|
736
775
|
addResourceContextLimitations(builder, source, context);
|
|
776
|
+
addRelatedFindings(builder, source, context, relevance);
|
|
737
777
|
}
|
|
738
778
|
// The live Pod spec differing from its template is context, not a fault, so
|
|
739
779
|
// it reads as a line on the resource card rather than a finding of its own.
|
|
@@ -755,6 +795,7 @@ export function addIssueObservation(
|
|
|
755
795
|
value: Issue,
|
|
756
796
|
producerRelevance: InvestigationEvidenceRelevance = "broader",
|
|
757
797
|
pods?: string[],
|
|
798
|
+
associatedVia?: DiagnosisResourceRef,
|
|
758
799
|
): void {
|
|
759
800
|
const matchesTarget = resourceMatchesTarget(builder.target, {
|
|
760
801
|
kind: value.kind,
|
|
@@ -777,6 +818,7 @@ export function addIssueObservation(
|
|
|
777
818
|
data: {
|
|
778
819
|
type: "issue",
|
|
779
820
|
issue: value,
|
|
821
|
+
...(associatedVia ? { associatedVia } : {}),
|
|
780
822
|
relevance,
|
|
781
823
|
...(pods && pods.length > 0 ? { pods } : {}),
|
|
782
824
|
},
|
|
@@ -1017,3 +1059,80 @@ export function invalidPayload(
|
|
|
1017
1059
|
"unknown",
|
|
1018
1060
|
);
|
|
1019
1061
|
}
|
|
1062
|
+
|
|
1063
|
+
function addRelatedFindings(
|
|
1064
|
+
builder: ProjectionBuilder,
|
|
1065
|
+
source: InvestigationEvidenceSource,
|
|
1066
|
+
context: InvestigationResourceContext | undefined,
|
|
1067
|
+
relevance: InvestigationEvidenceRelevance,
|
|
1068
|
+
): void {
|
|
1069
|
+
const raw = context?.relatedFindings;
|
|
1070
|
+
if (raw === undefined) return;
|
|
1071
|
+
if (!Array.isArray(raw)) {
|
|
1072
|
+
invalidPayload(builder, source, "Related findings");
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
for (const entry of raw) {
|
|
1076
|
+
const value = record(entry);
|
|
1077
|
+
const associatedVia = resourceRef(value?.associatedVia);
|
|
1078
|
+
const kinds = record(value?.kinds);
|
|
1079
|
+
const findingsRaw = value?.findings;
|
|
1080
|
+
const findings = Array.isArray(findingsRaw)
|
|
1081
|
+
? findingsRaw.map(issue).filter((item): item is Issue => Boolean(item))
|
|
1082
|
+
: [];
|
|
1083
|
+
if (
|
|
1084
|
+
!value ||
|
|
1085
|
+
!associatedVia ||
|
|
1086
|
+
!kinds ||
|
|
1087
|
+
!nonNegativeInteger(kinds.count) ||
|
|
1088
|
+
kinds.count === 0 ||
|
|
1089
|
+
kinds.extent !== undefined ||
|
|
1090
|
+
(kinds.names !== undefined &&
|
|
1091
|
+
(!Array.isArray(kinds.names) ||
|
|
1092
|
+
kinds.names.length !== kinds.count ||
|
|
1093
|
+
!kinds.names.every((item) => {
|
|
1094
|
+
const ref = record(item);
|
|
1095
|
+
return (
|
|
1096
|
+
ref &&
|
|
1097
|
+
nonEmptyString(ref.kind) &&
|
|
1098
|
+
(ref.group === undefined || typeof ref.group === "string")
|
|
1099
|
+
);
|
|
1100
|
+
}))) ||
|
|
1101
|
+
!Array.isArray(value.gaps) ||
|
|
1102
|
+
!value.gaps.every((gap) => nonEmptyString(record(gap)?.code)) ||
|
|
1103
|
+
!nonNegativeInteger(value.checked) ||
|
|
1104
|
+
!nonNegativeInteger(value.unknown) ||
|
|
1105
|
+
value.unknown > value.checked ||
|
|
1106
|
+
(value.truncated !== undefined && typeof value.truncated !== "boolean") ||
|
|
1107
|
+
(findingsRaw !== undefined &&
|
|
1108
|
+
(!Array.isArray(findingsRaw) || findings.length !== findingsRaw.length))
|
|
1109
|
+
) {
|
|
1110
|
+
invalidPayload(builder, source, "Related findings group");
|
|
1111
|
+
continue;
|
|
1112
|
+
}
|
|
1113
|
+
for (const finding of findings) {
|
|
1114
|
+
addIssueObservation(
|
|
1115
|
+
builder,
|
|
1116
|
+
source,
|
|
1117
|
+
finding,
|
|
1118
|
+
relevance === "target" ? "producer-related" : "broader",
|
|
1119
|
+
undefined,
|
|
1120
|
+
associatedVia,
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
const group = {
|
|
1124
|
+
...value,
|
|
1125
|
+
associatedVia,
|
|
1126
|
+
findings,
|
|
1127
|
+
} as unknown as RelatedFindingsGroup;
|
|
1128
|
+
const anchor = `${associatedVia.kind} ${associatedVia.namespace ? associatedVia.namespace + "/" : ""}${associatedVia.name}${associatedVia.group ? " (" + associatedVia.group + ")" : ""}`;
|
|
1129
|
+
for (const limit of relatedFindingLimitations(group)) {
|
|
1130
|
+
builder.limit(
|
|
1131
|
+
source,
|
|
1132
|
+
`Related findings via ${anchor}`,
|
|
1133
|
+
limit.message,
|
|
1134
|
+
limit.kind,
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
@@ -2926,11 +2926,93 @@ describe("failedStepMessage", () => {
|
|
|
2926
2926
|
);
|
|
2927
2927
|
});
|
|
2928
2928
|
it("keeps any other failure text as it came", () => {
|
|
2929
|
-
expect(
|
|
2930
|
-
"user_forbidden: your role cannot list pods",
|
|
2931
|
-
);
|
|
2929
|
+
expect(
|
|
2930
|
+
failedStepMessage("user_forbidden: your role cannot list pods"),
|
|
2931
|
+
).toBe("user_forbidden: your role cannot list pods");
|
|
2932
2932
|
expect(failedStepMessage('{"error":"no code"}')).toBe(
|
|
2933
2933
|
'{"error":"no code"}',
|
|
2934
2934
|
);
|
|
2935
2935
|
});
|
|
2936
2936
|
});
|
|
2937
|
+
|
|
2938
|
+
describe("Kueue diagnosis evidence boundaries", () => {
|
|
2939
|
+
it.each(["get_resource", "diagnose"])(
|
|
2940
|
+
"preserves unchecked Issues in %s",
|
|
2941
|
+
(name) => {
|
|
2942
|
+
const resource = {
|
|
2943
|
+
apiVersion: "kueue.x-k8s.io/v1beta2",
|
|
2944
|
+
kind: "Workload",
|
|
2945
|
+
metadata: { namespace: "shop", name: "run" },
|
|
2946
|
+
};
|
|
2947
|
+
const result = project([
|
|
2948
|
+
tool("batch", name, {
|
|
2949
|
+
resource,
|
|
2950
|
+
resourceContext: {
|
|
2951
|
+
tier: "diagnostic",
|
|
2952
|
+
issueSummary: {
|
|
2953
|
+
count: 0,
|
|
2954
|
+
unchecked: [
|
|
2955
|
+
{
|
|
2956
|
+
source: "kueue",
|
|
2957
|
+
reason: "caller_access_denied",
|
|
2958
|
+
kinds: [{ group: "kueue.x-k8s.io", kind: "ClusterQueue" }],
|
|
2959
|
+
},
|
|
2960
|
+
],
|
|
2961
|
+
},
|
|
2962
|
+
},
|
|
2963
|
+
relatedIssues: [],
|
|
2964
|
+
...(name === "diagnose"
|
|
2965
|
+
? {
|
|
2966
|
+
coverage:
|
|
2967
|
+
"Cached resource only. Pods, runtime logs and metrics were not collected.",
|
|
2968
|
+
}
|
|
2969
|
+
: {}),
|
|
2970
|
+
}),
|
|
2971
|
+
]);
|
|
2972
|
+
expect(
|
|
2973
|
+
result.limitations.some(
|
|
2974
|
+
(limit) =>
|
|
2975
|
+
limit.source === "Issue scan" &&
|
|
2976
|
+
limit.message.includes("can't read ClusterQueues"),
|
|
2977
|
+
),
|
|
2978
|
+
).toBe(true);
|
|
2979
|
+
if (name === "diagnose") {
|
|
2980
|
+
expect(
|
|
2981
|
+
result.limitations.some(
|
|
2982
|
+
(limit) =>
|
|
2983
|
+
limit.source === "Diagnosis coverage" &&
|
|
2984
|
+
limit.message.includes(
|
|
2985
|
+
"runtime logs and metrics were not collected",
|
|
2986
|
+
),
|
|
2987
|
+
),
|
|
2988
|
+
).toBe(true);
|
|
2989
|
+
expect(
|
|
2990
|
+
groupsOf(result.groups, "receipt").some(
|
|
2991
|
+
(group) => group.latest.title === "No warning events",
|
|
2992
|
+
),
|
|
2993
|
+
).toBe(false);
|
|
2994
|
+
}
|
|
2995
|
+
},
|
|
2996
|
+
);
|
|
2997
|
+
});
|
|
2998
|
+
|
|
2999
|
+
it("does not turn unchecked Kueue scans into no-issue receipts", () => {
|
|
3000
|
+
const result = project([
|
|
3001
|
+
tool("partial", "issues", {
|
|
3002
|
+
issues: [],
|
|
3003
|
+
total: 0,
|
|
3004
|
+
total_matched: 0,
|
|
3005
|
+
unchecked_sources: [
|
|
3006
|
+
{
|
|
3007
|
+
source: "kueue",
|
|
3008
|
+
reason: "kind_sync_pending",
|
|
3009
|
+
kinds: [{ kind: "Workload", group: "kueue.x-k8s.io" }],
|
|
3010
|
+
},
|
|
3011
|
+
],
|
|
3012
|
+
}),
|
|
3013
|
+
]);
|
|
3014
|
+
expect(
|
|
3015
|
+
result.limitations.some((limit) => limit.source === "Issue scan"),
|
|
3016
|
+
).toBe(true);
|
|
3017
|
+
expect(groupsOf(result.groups, "receipt")).toHaveLength(0);
|
|
3018
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Issue, type IssueRecentChange } from "@skyhook-io/k8s-ui";
|
|
2
|
+
import { type UncheckedSource } from "../../../api/client";
|
|
2
3
|
import { type TimeSeries } from "@skyhook-io/k8s-ui/components/charts";
|
|
3
4
|
import {
|
|
4
5
|
type DiagnosisChangeContext,
|
|
@@ -103,12 +104,14 @@ export interface InvestigationResourceContext extends DiagnosisResourceContext {
|
|
|
103
104
|
highestSeverity?: string;
|
|
104
105
|
topReason?: string;
|
|
105
106
|
bySource?: Record<string, number>;
|
|
107
|
+
unchecked?: UncheckedSource[];
|
|
106
108
|
};
|
|
107
109
|
auditSummary?: {
|
|
108
110
|
count: number;
|
|
109
111
|
highestSeverity?: string;
|
|
110
112
|
topFinding?: string;
|
|
111
113
|
};
|
|
114
|
+
relatedFindings?: unknown;
|
|
112
115
|
policySummary?: unknown;
|
|
113
116
|
podSummary?: unknown;
|
|
114
117
|
templateDivergence?: {
|
|
@@ -381,6 +384,8 @@ export type InvestigationEvidenceData =
|
|
|
381
384
|
| {
|
|
382
385
|
type: "issue";
|
|
383
386
|
issue: Issue;
|
|
387
|
+
/** Association anchor; parent verification cannot establish recovery of this issue. */
|
|
388
|
+
associatedVia?: DiagnosisResourceRef;
|
|
384
389
|
/**
|
|
385
390
|
* A broad `issues` query can return failures from other resources. Keep
|
|
386
391
|
* those factual observations, but do not let agent selection alone imply
|
|
@@ -560,6 +565,8 @@ export interface InvestigationMetricsEvidence {
|
|
|
560
565
|
selectorsUnknown?: boolean;
|
|
561
566
|
subject?: DiagnosisResourceRef;
|
|
562
567
|
pods?: number;
|
|
568
|
+
/** The pods a diagnose chart summed, by name, when its bundle listed them all. */
|
|
569
|
+
podNames?: string[];
|
|
563
570
|
partial?: boolean;
|
|
564
571
|
}
|
|
565
572
|
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
|