@skyhook-io/radar-app 1.18.0 → 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.
Files changed (126) hide show
  1. package/README.md +6 -0
  2. package/package.json +2 -3
  3. package/src/App.tsx +43 -12
  4. package/src/api/client.deleteResource.test.tsx +111 -0
  5. package/src/api/client.gitops-destination.test.tsx +55 -0
  6. package/src/api/client.resource-list.test.ts +76 -0
  7. package/src/api/client.resourceAudit.test.tsx +57 -0
  8. package/src/api/client.resourcePath.test.ts +107 -0
  9. package/src/api/client.ts +197 -57
  10. package/src/api/quotas.ts +9 -20
  11. package/src/api/radarFeatures.ts +2 -0
  12. package/src/api/resourceLists.test.ts +84 -0
  13. package/src/api/resourceLists.ts +71 -0
  14. package/src/components/capacity/CapacityDemand.tsx +6 -3
  15. package/src/components/capacity/CapacityOverview.tsx +14 -7
  16. package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
  17. package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
  18. package/src/components/capacity/shared.tsx +9 -5
  19. package/src/components/cnpg/CNPGOverview.tsx +4 -1
  20. package/src/components/cnpg/CNPGView.tsx +1 -0
  21. package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
  22. package/src/components/compare/CompareResourcePicker.test.tsx +58 -0
  23. package/src/components/compare/CompareViewRoute.tsx +5 -1
  24. package/src/components/compare/useCompareCandidates.ts +1 -1
  25. package/src/components/compare/useCompareLauncher.tsx +4 -2
  26. package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
  27. package/src/components/diagnose/ApplyDialog.tsx +8 -1
  28. package/src/components/diagnose/AssessmentCard.tsx +60 -0
  29. package/src/components/diagnose/DiagnoseSurface.tsx +5 -0
  30. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +62 -2
  31. package/src/components/diagnose/InvestigationEvidenceSections.tsx +6 -5
  32. package/src/components/diagnose/InvestigationView.tsx +47 -13
  33. package/src/components/diagnose/StoryExcerpt.tsx +24 -5
  34. package/src/components/diagnose/assessmentCopy.ts +11 -0
  35. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
  36. package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
  37. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
  38. package/src/components/diagnose/investigationEvidence/adapters/listCoverage.test.ts +415 -0
  39. package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +2 -1
  40. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +2 -1
  41. package/src/components/diagnose/investigationEvidence/adapters/resource.ts +107 -8
  42. package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
  43. package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
  44. package/src/components/diagnose/investigationEvidence/bodies/inventory.tsx +66 -16
  45. package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
  46. package/src/components/diagnose/investigationEvidence/builder.ts +16 -2
  47. package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
  48. package/src/components/diagnose/investigationEvidence/excerpt.ts +2 -0
  49. package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
  50. package/src/components/diagnose/investigationEvidence/observations.ts +8 -3
  51. package/src/components/diagnose/investigationEvidence/projection.test.ts +81 -4
  52. package/src/components/diagnose/investigationEvidence/types.ts +15 -0
  53. package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
  54. package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
  55. package/src/components/diagnose/storyParts.test.tsx +53 -0
  56. package/src/components/diagnose/toolCallLabel.test.ts +9 -0
  57. package/src/components/diagnose/toolCallLabel.ts +2 -0
  58. package/src/components/execution/BatchExecutionView.image-browse.test.tsx +46 -0
  59. package/src/components/execution/BatchExecutionView.tsx +6 -4
  60. package/src/components/gitops/GitOpsView.identity.test.tsx +113 -0
  61. package/src/components/gitops/GitOpsView.tsx +62 -40
  62. package/src/components/gitops/useDestinationCluster.ts +2 -1
  63. package/src/components/helm/ArtifactHubSourceSearch.test.tsx +124 -0
  64. package/src/components/helm/ArtifactHubSourceSearch.tsx +240 -0
  65. package/src/components/helm/ChartBrowser.tsx +9 -8
  66. package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
  67. package/src/components/helm/HelmView.tsx +34 -23
  68. package/src/components/helm/InstallWizard.tsx +6 -2
  69. package/src/components/helm/TrackChartSourceDialog.render.test.tsx +269 -96
  70. package/src/components/helm/TrackChartSourceDialog.tsx +607 -104
  71. package/src/components/helm/ValuesViewer.test.tsx +1 -0
  72. package/src/components/helm/ValuesViewer.tsx +4 -2
  73. package/src/components/home/ClusterHealthCard.tsx +28 -21
  74. package/src/components/home/MCPSetupDialog.test.tsx +27 -2
  75. package/src/components/home/MCPSetupDialog.tsx +14 -2
  76. package/src/components/home/mcpToolCatalog.ts +39 -2
  77. package/src/components/issues/IssuesPane.render.test.tsx +5 -5
  78. package/src/components/nav/PrimaryNavRail.tsx +34 -2
  79. package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
  80. package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
  81. package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
  82. package/src/components/product-hunt/launchWindow.ts +78 -0
  83. package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
  84. package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
  85. package/src/components/resource/PrometheusCharts.overlays.test.ts +45 -0
  86. package/src/components/resource/PrometheusCharts.tsx +2 -2
  87. package/src/components/resources/CompositeRenderer.tsx +4 -0
  88. package/src/components/resources/ResourcesView.tsx +30 -68
  89. package/src/components/resources/renderers/PodRenderer.tsx +4 -1
  90. package/src/components/settings/LocalConnectionSettings.tsx +1 -0
  91. package/src/components/settings/MyPermissionsDialog.tsx +12 -9
  92. package/src/components/traffic/TrafficSourcePill.test.tsx +110 -0
  93. package/src/components/traffic/TrafficSourcePill.tsx +111 -0
  94. package/src/components/traffic/TrafficView.tsx +9 -55
  95. package/src/components/ui/DiagnosticsOverlay.test.ts +25 -0
  96. package/src/components/ui/DiagnosticsOverlay.tsx +2 -1
  97. package/src/components/ui/Omnibar.note.test.tsx +141 -0
  98. package/src/components/ui/Omnibar.tsx +82 -18
  99. package/src/components/ui/RadarOmnibar.test.tsx +201 -0
  100. package/src/components/ui/RadarOmnibar.tsx +39 -4
  101. package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
  102. package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
  103. package/src/components/ui/UpdateNotification.manual.test.tsx +177 -0
  104. package/src/components/ui/UpdateNotification.test.tsx +4 -1
  105. package/src/components/ui/UpdateNotification.tsx +61 -10
  106. package/src/components/ui/omnibar-match.test.ts +15 -8
  107. package/src/components/ui/omnibar-match.ts +11 -6
  108. package/src/components/ui/searchCoverage.fixtures.ts +16 -0
  109. package/src/components/ui/searchCoverageNote.test.ts +245 -0
  110. package/src/components/ui/searchCoverageNote.ts +222 -0
  111. package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
  112. package/src/components/whats-new/WhatsNew.test.ts +10 -0
  113. package/src/components/whats-new/WhatsNew.tsx +5 -4
  114. package/src/components/whats-new/WhatsNewDialog.test.tsx +20 -0
  115. package/src/components/whats-new/releaseNotes.ts +57 -5
  116. package/src/components/workload/WorkloadView.tsx +18 -6
  117. package/src/components/workspace/layout.tsx +2 -1
  118. package/src/contexts/CapabilitiesContext.tsx +1 -0
  119. package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
  120. package/src/hooks/useGitOpsWriteGuard.ts +25 -3
  121. package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
  122. package/src/hooks/useResourceCounts.ts +2 -0
  123. package/src/index.css +87 -4
  124. package/src/index.ts +7 -0
  125. package/src/utils/artifacthub.test.ts +18 -0
  126. package/src/utils/artifacthub.ts +9 -0
@@ -0,0 +1,28 @@
1
+ {
2
+ "resource": {
3
+ "apiVersion": "s3.example.crossplane.io/v1",
4
+ "kind": "Bucket",
5
+ "metadata": {
6
+ "name": "archive",
7
+ "namespace": "shop",
8
+ "annotations": { "crossplane.io/paused": "true" }
9
+ },
10
+ "spec": { "providerConfigRef": { "name": "fixture" } },
11
+ "status": {
12
+ "conditions": [
13
+ { "type": "Ready", "status": "True", "reason": "Available" },
14
+ { "type": "Synced", "status": "False", "reason": "ReconcilePaused", "message": "Fixture controller pause observation" }
15
+ ]
16
+ }
17
+ },
18
+ "resourceContext": {
19
+ "tier": "basic",
20
+ "statusSummary": {
21
+ "conditions": [
22
+ { "type": "Ready", "status": "True", "reason": "Available" },
23
+ { "type": "Synced", "status": "False", "reason": "ReconcilePaused", "message": "Fixture controller pause observation" }
24
+ ]
25
+ }
26
+ },
27
+ "warnings": []
28
+ }
@@ -1,3 +1,4 @@
1
+ import { getCrossplanePauseState, isManagedResource, isComposite } from "@skyhook-io/k8s-ui/components/resources/resource-utils-crossplane";
1
2
  import type { MetricsChangeCoverage } from "../../investigationMetrics";
2
3
  import type {
3
4
  InvestigationEvidenceData,
@@ -109,6 +110,7 @@ export function evidenceHasDetails(
109
110
  case "resource": {
110
111
  const replicas = data.resourceContext?.workloadSummary?.replicas;
111
112
  return Boolean(
113
+ ((isManagedResource(data.resource) || isComposite(data.resource) || getCrossplanePauseState(data.resource) === "acknowledged") && getCrossplanePauseState(data.resource)) ||
112
114
  investigationResourceEvidenceHasDetails(data.resource) ||
113
115
  replicas?.desired !== undefined ||
114
116
  data.resourceContext?.statusSummary?.conditions?.length ||
@@ -9,9 +9,6 @@ import {
9
9
  import { listingRowNamesSubject, sameKind } from "../../investigationCase";
10
10
  import type { EvidenceDataOf } from "../cardParts";
11
11
 
12
- // The rows the citations on a card name, in citation order: one row when the
13
- // name picks exactly one entry, otherwise a line saying the entry is absent
14
- // or which entries the name could mean.
15
12
  export function listingScopeNamespace(
16
13
  source: InvestigationEvidenceSource,
17
14
  ): string | undefined {
@@ -19,24 +16,45 @@ export function listingScopeNamespace(
19
16
  return typeof namespace === "string" && namespace ? namespace : undefined;
20
17
  }
21
18
 
19
+ export interface NamedInventoryRow {
20
+ key: string;
21
+ label: string;
22
+ matches: number;
23
+ row?: InvestigationResourceSummary;
24
+ /** No row matches, and the subject's namespace is one the listing did not read. */
25
+ notRead?: string;
26
+ /**
27
+ * No row matches, on a listing that read `count` namespaces without naming
28
+ * them. With a `namespace`, the subject's namespace may not have been one
29
+ * of them; without, the subject is only known to be absent from those.
30
+ */
31
+ readUnnamed?: { count: number; namespace?: string };
32
+ /**
33
+ * No row matches a subject that names no namespace, on a listing that read
34
+ * only these namespaces.
35
+ */
36
+ readOnlyIn?: readonly string[];
37
+ }
38
+
39
+ // The rows the citations on a card name, in citation order: one row when the
40
+ // name picks exactly one entry, otherwise a line saying the entry is absent,
41
+ // that where it would be was not read, or which entries the name could mean.
22
42
  export function namedInventoryRows(
23
43
  resources: InvestigationResourceSummary[],
24
44
  items: readonly { subject?: DiagnosisEvidenceSubject }[],
25
45
  /** The namespace the listing call was scoped to; rows omit it then. */
26
46
  scopeNamespace?: string,
27
- ): {
28
- key: string;
29
- label: string;
30
- matches: number;
31
- row?: InvestigationResourceSummary;
32
- }[] {
47
+ /** Set when Radar's collector read the listed kind only in these namespaces. */
48
+ namespacesRead?: readonly string[],
49
+ namespacesReadOmitted = 0,
50
+ ): NamedInventoryRow[] {
51
+ const observedNamespaces = new Set(
52
+ resources
53
+ .map((resource) => resource.namespace ?? scopeNamespace)
54
+ .filter(Boolean),
55
+ );
33
56
  const seen = new Set<string>();
34
- const out: {
35
- key: string;
36
- label: string;
37
- matches: number;
38
- row?: InvestigationResourceSummary;
39
- }[] = [];
57
+ const out: NamedInventoryRow[] = [];
40
58
  for (const item of items) {
41
59
  const subject = item.subject;
42
60
  if (!subject?.name) continue;
@@ -64,11 +82,36 @@ export function namedInventoryRows(
64
82
  declaringObject(resource) ||
65
83
  (resource.namespace ?? scopeNamespace) === namespace),
66
84
  );
85
+ // A name the rows lack is absent only where the listing looked.
86
+ const unread = namespacesRead && matches.length === 0;
67
87
  out.push({
68
88
  key,
69
89
  label: namespace ? `${namespace}/${subject.name}` : subject.name,
70
90
  matches: matches.length,
71
91
  row: matches.length === 1 ? matches[0] : undefined,
92
+ notRead:
93
+ unread &&
94
+ namespace &&
95
+ namespacesReadOmitted === 0 &&
96
+ !namespacesRead.includes(namespace) &&
97
+ !observedNamespaces.has(namespace)
98
+ ? namespace
99
+ : undefined,
100
+ readOnlyIn:
101
+ unread && !namespace && namespacesReadOmitted === 0
102
+ ? namespacesRead
103
+ : undefined,
104
+ readUnnamed:
105
+ unread &&
106
+ namespacesReadOmitted > 0 &&
107
+ (!namespace ||
108
+ (!namespacesRead.includes(namespace) &&
109
+ !observedNamespaces.has(namespace)))
110
+ ? {
111
+ count: namespacesRead.length + namespacesReadOmitted,
112
+ namespace,
113
+ }
114
+ : undefined,
72
115
  });
73
116
  }
74
117
  return out;
@@ -143,7 +186,7 @@ export function InventoryBody({
143
186
  ...lead,
144
187
  ...data.resources.filter((resource) => !lead.includes(resource)),
145
188
  ];
146
- return (
189
+ const list = (
147
190
  <div className="max-h-72 overflow-y-auto rounded-md border border-theme-border">
148
191
  {rows.map((resource, index) => (
149
192
  <InventoryRow
@@ -155,4 +198,11 @@ export function InventoryBody({
155
198
  ))}
156
199
  </div>
157
200
  );
201
+ if (!data.coverageNote) return list;
202
+ return (
203
+ <div className="flex flex-col gap-2">
204
+ <p className="text-xs text-theme-text-secondary">{data.coverageNote}</p>
205
+ {list}
206
+ </div>
207
+ );
158
208
  }
@@ -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">
@@ -203,7 +203,7 @@ export function projectInvestigationEvidence(
203
203
  builder.limit(
204
204
  source,
205
205
  investigationResultLabel(source),
206
- item.result || "This investigation step failed.",
206
+ failedStepMessage(item.result) || "This investigation step failed.",
207
207
  "error",
208
208
  );
209
209
  continue;
@@ -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
- "truncated",
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
  }
@@ -440,3 +442,15 @@ export function projectInvestigationEvidence(
440
442
  },
441
443
  };
442
444
  }
445
+
446
+ // A resource read's failure arrives as its JSON body ({error, error_code,
447
+ // coverage?}); Findings shows the explanation, not the JSON.
448
+ export function failedStepMessage(
449
+ result: string | undefined,
450
+ ): string | undefined {
451
+ if (!result) return result;
452
+ const body = record(parseJSON(result));
453
+ return nonEmptyString(body?.error) && typeof body.error_code === "string"
454
+ ? body.error
455
+ : result;
456
+ }
@@ -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
- }): "healthy" | "degraded" | "unhealthy" | "unknown" {
153
- switch (defaultConditionTone(condition)) {
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":
@@ -71,6 +71,8 @@ export function storyExcerpt(
71
71
  data.resources as InvestigationResourceSummary[],
72
72
  items,
73
73
  options.scopeNamespace,
74
+ data.namespacesRead,
75
+ data.namespacesReadOmitted,
74
76
  );
75
77
  return entries.length > 0 ? { kind: "rows", entries } : undefined;
76
78
  }
@@ -384,7 +384,7 @@ describe("investigation evidence provenance", () => {
384
384
  expect(validated.limitations).toEqual([
385
385
  expect.objectContaining({
386
386
  source: "Resource details",
387
- kind: "truncated",
387
+ kind: "unknown",
388
388
  }),
389
389
  ]);
390
390
 
@@ -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
- normalized.includes("large graph") || normalized.includes("too large")
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
- "truncated",
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
 
@@ -190,6 +194,7 @@ const INVESTIGATION_RESULT_LABELS: Readonly<Record<string, string>> = {
190
194
  top_resources: "Resource ranking",
191
195
  get_cluster_audit: "Posture findings",
192
196
  get_cluster_upgrade_readiness: "Upgrade readiness",
197
+ get_runtime_versions: "Runtime versions",
193
198
  list_helm_releases: "Helm releases",
194
199
  list_packages: "Installed packages",
195
200
  search: "Search results",
@@ -668,7 +673,7 @@ export function addResourceObservation(
668
673
  (available !== undefined && available < desired) ||
669
674
  (replicas?.unavailable ?? 0) > 0);
670
675
  const adverseCondition = (context?.statusSummary?.conditions ?? []).some(
671
- (condition) => defaultConditionTone(condition) === "fail",
676
+ (condition) => (getCrossplaneConditionTone(resource, condition) ?? defaultConditionTone(condition)) === "fail",
672
677
  );
673
678
  const gitOpsAdverse = Boolean(
674
679
  gitOpsDiagnosis &&
@@ -1,5 +1,6 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import { projectInvestigationEvidence } from "./index";
3
+ import { failedStepMessage } from "./builder";
3
4
  import {
4
5
  completeLogProof,
5
6
  criticalIssue,
@@ -278,6 +279,7 @@ describe("strict evidence adapters", () => {
278
279
  expect.objectContaining({
279
280
  source: "Issue-related changes",
280
281
  kind: "unknown",
282
+ presentation: "history",
281
283
  message: expect.stringContaining("incomplete for part of the window"),
282
284
  }),
283
285
  ]);
@@ -1855,7 +1857,8 @@ describe("strict evidence adapters", () => {
1855
1857
  ),
1856
1858
  ]);
1857
1859
  expect(result.groups).toHaveLength(0);
1858
- expect(result.limitations[0]).toMatchObject({ kind: "truncated" });
1860
+ expect(result.limitations[0]).toMatchObject({ kind: "unknown" });
1861
+ expect(result.limitations[0].presentation).toBeUndefined();
1859
1862
  expect(result.limitations[0].source).toBe("Issue scan");
1860
1863
  expect(result.limitations[0].message).toContain(
1861
1864
  "Only part of this investigation result was saved",
@@ -2095,6 +2098,56 @@ describe("honest zero and partial-result states", () => {
2095
2098
  );
2096
2099
  });
2097
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
+
2098
2151
  it("creates receipts only for confirmed complete zero-result reads", () => {
2099
2152
  const result = project([
2100
2153
  tool("diagnose", "diagnose", {
@@ -2265,7 +2318,7 @@ describe("honest zero and partial-result states", () => {
2265
2318
  truncated: true,
2266
2319
  narrowHint: "subgraph capped at 25 nodes",
2267
2320
  omitted: [
2268
- { field: "uses.secrets", reason: "rbac_denied" },
2321
+ { field: "uses.secrets", reason: "user_forbidden" },
2269
2322
  { field: "referencedBy", reason: "budget_exceeded" },
2270
2323
  ],
2271
2324
  }),
@@ -2336,13 +2389,15 @@ describe("honest zero and partial-result states", () => {
2336
2389
  });
2337
2390
  expect(result.limitations).toEqual(
2338
2391
  expect.arrayContaining([
2392
+ // The graph was never built, so these are unknowns, not caps on a
2393
+ // graph that is shown.
2339
2394
  expect.objectContaining({
2340
2395
  source: "Topology coverage",
2341
- kind: "truncated",
2396
+ kind: "unknown",
2342
2397
  }),
2343
2398
  expect.objectContaining({
2344
2399
  source: "Topology scale",
2345
- kind: "truncated",
2400
+ kind: "unknown",
2346
2401
  message: expect.stringContaining("namespace-scoped topology search"),
2347
2402
  }),
2348
2403
  ]),
@@ -2857,3 +2912,25 @@ describe("namespace listings", () => {
2857
2912
  ).toEqual(["capi-system", "shop"]);
2858
2913
  });
2859
2914
  });
2915
+
2916
+ describe("failedStepMessage", () => {
2917
+ it("shows a coded read failure's explanation, not its JSON body", () => {
2918
+ const body = JSON.stringify({
2919
+ error:
2920
+ 'namespace "beta" is not among the namespaces you can see, or does not exist',
2921
+ error_code: "user_namespace_not_visible",
2922
+ coverage: { status: "partial", scope: { type: "namespaces" }, gaps: [] },
2923
+ });
2924
+ expect(failedStepMessage(body)).toBe(
2925
+ 'namespace "beta" is not among the namespaces you can see, or does not exist',
2926
+ );
2927
+ });
2928
+ it("keeps any other failure text as it came", () => {
2929
+ expect(failedStepMessage("user_forbidden: your role cannot list pods")).toBe(
2930
+ "user_forbidden: your role cannot list pods",
2931
+ );
2932
+ expect(failedStepMessage('{"error":"no code"}')).toBe(
2933
+ '{"error":"no code"}',
2934
+ );
2935
+ });
2936
+ });
@@ -459,6 +459,21 @@ export type InvestigationEvidenceData =
459
459
  type: "inventory";
460
460
  resources: InvestigationResourceSummary[];
461
461
  scope: string;
462
+ /**
463
+ * Set only when Radar's collector read the kind in just these
464
+ * namespaces: a name missing from the rows is unknown outside them.
465
+ */
466
+ namespacesRead?: string[];
467
+ /**
468
+ * Namespaces read that the listing doesn't name, because there were too
469
+ * many to list; they were read, so they are not a gap.
470
+ */
471
+ namespacesReadOmitted?: number;
472
+ /**
473
+ * Radar's own sentence for a partial or narrowed list: what it didn't
474
+ * read and why, shown with the rows so they never read as everything.
475
+ */
476
+ coverageNote?: string;
462
477
  }
463
478
  | {
464
479
  type: "ranking";
@@ -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: bookkeeping for the record, not an open question. */
109
- bookkeepingOnly: boolean;
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
- bookkeepingOnly: ordinaryLimits,
188
+ routineOnly: ordinaryLimits,
164
189
  };
165
190
  })
166
191
  .sort(
@@ -144,6 +144,41 @@ describe("ResultCard under the story contract", () => {
144
144
  expect(html).toContain("Previous logs: could not be read");
145
145
  });
146
146
 
147
+ it("folds Radar's routine limits into one muted line beneath Still open", () => {
148
+ const routine = [
149
+ "Cluster-scoped admission changes: Radar has recorded changes only since 2026-10-27T23:42:31Z; earlier changes in the window are unknown.",
150
+ "Container logs: Only part of the logs was checked.",
151
+ ];
152
+ const html = renderToStaticMarkup(
153
+ <ResultCard
154
+ diagnosis={storyDiagnosis}
155
+ section="conclusion"
156
+ assessmentRoutineLimits={routine}
157
+ />,
158
+ );
159
+ const stillOpen = html.slice(
160
+ html.indexOf("data-assessment-unresolved"),
161
+ html.indexOf("data-assessment-routine-limits"),
162
+ );
163
+ expect(stillOpen).toContain("Whether the Atlas password was rotated");
164
+ expect(stillOpen).not.toContain("Radar has recorded changes only since");
165
+ expect(html).toContain("Radar&#x27;s coverage · 2 routine limits");
166
+ expect(html).toContain('aria-expanded="false"');
167
+ // Folded, never dropped: the lines stay in the document for the disclosure.
168
+ expect(html).toContain("Radar has recorded changes only since");
169
+
170
+ // Without open questions the folded line still renders on its own.
171
+ const alone = renderToStaticMarkup(
172
+ <ResultCard
173
+ diagnosis={{ ...storyDiagnosis, unresolved: [] }}
174
+ section="conclusion"
175
+ assessmentRoutineLimits={routine.slice(1)}
176
+ />,
177
+ );
178
+ expect(alone).not.toContain("data-assessment-unresolved");
179
+ expect(alone).toContain("Radar&#x27;s coverage · 1 routine limit<");
180
+ });
181
+
147
182
  it("says nothing when the agent listed nothing unresolved: the certainty word carries it", () => {
148
183
  const html = renderToStaticMarkup(
149
184
  <ResultCard
@@ -283,6 +318,24 @@ describe("assessmentCopyText", () => {
283
318
  text.indexOf("Still open:"),
284
319
  );
285
320
  });
321
+ it("copies routine limits after the steps, apart from Still open", () => {
322
+ const text = assessmentCopyText(storyDiagnosis, {
323
+ limits: ["Previous logs: could not be read"],
324
+ routineLimits: ["Recent changes: Change history is incomplete."],
325
+ });
326
+ expect(text).toContain(
327
+ "Radar's coverage (routine limits):\n- Recent changes: Change history is incomplete.",
328
+ );
329
+ const stillOpen = text.slice(
330
+ text.indexOf("Still open:"),
331
+ text.indexOf("\n\n", text.indexOf("Still open:")),
332
+ );
333
+ expect(stillOpen).toContain("- Previous logs: could not be read");
334
+ expect(stillOpen).not.toContain("Change history is incomplete");
335
+ expect(text.indexOf("Next steps:")).toBeLessThan(
336
+ text.indexOf("Radar's coverage"),
337
+ );
338
+ });
286
339
  it("names the recommended step and counts the rest for a legacy remediation list", () => {
287
340
  const text = assessmentCopyText(
288
341
  {