@skyhook-io/radar-app 1.19.0 → 1.20.1

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 (198) hide show
  1. package/README.md +1 -1
  2. package/package.json +5 -5
  3. package/src/App.tsx +37 -9
  4. package/src/api/application-evidence.ts +63 -0
  5. package/src/api/argoSync.test.ts +22 -0
  6. package/src/api/client.audit-gating.test.tsx +48 -0
  7. package/src/api/client.kueuePosition.test.ts +32 -0
  8. package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
  9. package/src/api/client.resource-identity.test.ts +3 -0
  10. package/src/api/client.resourceIssues.test.tsx +239 -0
  11. package/src/api/client.resourcePath.test.ts +3 -0
  12. package/src/api/client.ts +353 -64
  13. package/src/api/config.ts +21 -0
  14. package/src/api/diagnose.ts +4 -0
  15. package/src/api/helmInventory.test.tsx +108 -0
  16. package/src/api/radarFeatures.render.test.tsx +33 -1
  17. package/src/api/radarFeatures.test.ts +47 -0
  18. package/src/api/radarFeatures.ts +42 -1
  19. package/src/api/rbac.settled.test.tsx +42 -0
  20. package/src/api/rbac.test.ts +18 -0
  21. package/src/api/rbac.ts +37 -7
  22. package/src/api/traffic.ts +9 -4
  23. package/src/api/usage-data.fixtures.ts +3 -1
  24. package/src/api/usage-data.test.tsx +134 -0
  25. package/src/api/usage-data.ts +35 -7
  26. package/src/api/workloadPodsPolling.test.ts +26 -0
  27. package/src/components/CloudConnectFlow.test.tsx +86 -0
  28. package/src/components/CloudConnectFlow.tsx +65 -27
  29. package/src/components/CloudFunnelButton.test.tsx +140 -5
  30. package/src/components/CloudFunnelButton.tsx +50 -9
  31. package/src/components/ConnectionErrorView.test.tsx +34 -0
  32. package/src/components/ConnectionErrorView.tsx +35 -11
  33. package/src/components/ContextSwitcher.tsx +5 -2
  34. package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
  35. package/src/components/SwitchAwareConnectionError.tsx +85 -0
  36. package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
  37. package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
  38. package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
  39. package/src/components/capacity/CapacityDemand.tsx +3 -2
  40. package/src/components/capacity/demandSummary.test.ts +38 -0
  41. package/src/components/capacity/shared.tsx +12 -1
  42. package/src/components/cost/ApplicationCostTab.tsx +4 -0
  43. package/src/components/cost/CostTrendChart.tsx +2 -0
  44. package/src/components/cost/WorkloadCostTab.tsx +4 -0
  45. package/src/components/cost/source.test.ts +5 -0
  46. package/src/components/cost/source.ts +11 -0
  47. package/src/components/curl/ServiceCurlAvailability.test.tsx +32 -0
  48. package/src/components/curl/ServiceCurlButton.tsx +2 -2
  49. package/src/components/diagnose/AIMarkdown.tsx +3 -0
  50. package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
  51. package/src/components/diagnose/AgentSetupNotice.tsx +21 -3
  52. package/src/components/diagnose/ContinueInAgentButton.mounted.test.tsx +182 -0
  53. package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
  54. package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
  55. package/src/components/diagnose/DiagnoseContext.question.test.tsx +1 -1
  56. package/src/components/diagnose/DiagnoseContext.tsx +68 -2
  57. package/src/components/diagnose/DiagnoseSurface.tsx +58 -113
  58. package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
  59. package/src/components/diagnose/Home.test.tsx +26 -0
  60. package/src/components/diagnose/Home.tsx +20 -1
  61. package/src/components/diagnose/InvestigationEvidenceSections.tsx +45 -22
  62. package/src/components/diagnose/InvestigationView.tsx +94 -26
  63. package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
  64. package/src/components/diagnose/LocalDiagnoseAction.tsx +354 -35
  65. package/src/components/diagnose/NextStepJump.test.tsx +92 -0
  66. package/src/components/diagnose/NextStepJump.tsx +75 -0
  67. package/src/components/diagnose/QuestionComposer.tsx +8 -0
  68. package/src/components/diagnose/exampleInvestigation.events.json +191 -0
  69. package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
  70. package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
  71. package/src/components/diagnose/exampleInvestigation.ts +121 -0
  72. package/src/components/diagnose/investigationCase.test.tsx +50 -1
  73. package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
  74. package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +72 -0
  75. package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +50 -2
  76. package/src/components/diagnose/investigationEvidence/adapters/helm.ts +51 -16
  77. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -0
  78. package/src/components/diagnose/investigationEvidence/adapters/listings.ts +34 -4
  79. package/src/components/diagnose/investigationEvidence/adapters/resource.ts +3 -2
  80. package/src/components/diagnose/investigationEvidence/builder.ts +30 -0
  81. package/src/components/diagnose/investigationEvidence/observations.ts +121 -2
  82. package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
  83. package/src/components/diagnose/investigationEvidence/types.ts +5 -0
  84. package/src/components/diagnose/investigationState.ts +28 -0
  85. package/src/components/diagnose/lastInvestigation.test.ts +95 -0
  86. package/src/components/diagnose/lastInvestigation.ts +58 -0
  87. package/src/components/diagnose/launch.test.ts +125 -1
  88. package/src/components/diagnose/launch.ts +57 -10
  89. package/src/components/diagnose/toolCallLabel.test.ts +10 -4
  90. package/src/components/execution/BatchExecutionView.tsx +24 -11
  91. package/src/components/execution/JobSetAdmission.test.tsx +42 -0
  92. package/src/components/execution/JobSetAdmission.tsx +18 -3
  93. package/src/components/execution/JobSetMemberComparison.tsx +2 -1
  94. package/src/components/execution/runState.test.ts +14 -0
  95. package/src/components/execution/runState.ts +8 -0
  96. package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
  97. package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
  98. package/src/components/gitops/GitOpsView.tsx +86 -17
  99. package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
  100. package/src/components/gitops/destination-toast.test.ts +1 -1
  101. package/src/components/gitops/destination-toast.ts +2 -2
  102. package/src/components/helm/HelmDrawerFrame.tsx +101 -0
  103. package/src/components/helm/HelmDrawerRouting.test.tsx +86 -0
  104. package/src/components/helm/HelmReleaseDrawer.tsx +23 -86
  105. package/src/components/helm/HelmView.tsx +213 -71
  106. package/src/components/helm/ObservedHelmNotice.tsx +146 -0
  107. package/src/components/helm/ObservedHelmRelease.test.tsx +261 -0
  108. package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +80 -0
  109. package/src/components/helm/ObservedHelmReleaseDrawer.tsx +228 -0
  110. package/src/components/helm/OwnedResources.tsx +4 -2
  111. package/src/components/home/ClusterHealthCard.restricted.test.tsx +76 -0
  112. package/src/components/home/ClusterHealthCard.tsx +28 -5
  113. package/src/components/home/HelmSummary.tsx +23 -4
  114. package/src/components/home/HelmSummary.unread.test.ts +16 -0
  115. package/src/components/home/HomeAgentBlock.test.tsx +31 -3
  116. package/src/components/home/HomeAgentBlock.tsx +20 -4
  117. package/src/components/home/HomeDiagramCard.tsx +47 -0
  118. package/src/components/home/HomeView.tsx +81 -41
  119. package/src/components/home/MCPSetupDialog.test.tsx +126 -10
  120. package/src/components/home/MCPSetupDialog.tsx +33 -5
  121. package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
  122. package/src/components/home/ProblemsPanel.test.tsx +3 -1
  123. package/src/components/home/TopologyPreview.test.tsx +73 -0
  124. package/src/components/home/TopologyPreview.tsx +120 -233
  125. package/src/components/home/TrafficSummary.test.tsx +63 -0
  126. package/src/components/home/TrafficSummary.tsx +135 -138
  127. package/src/components/home/mcpToolCatalog.ts +67 -14
  128. package/src/components/issues/IssuesPane.test.ts +11 -0
  129. package/src/components/issues/IssuesPane.tsx +15 -5
  130. package/src/components/issues/uncheckedSources.test.ts +22 -1
  131. package/src/components/issues/uncheckedSources.ts +21 -0
  132. package/src/components/kueue/KueuePendingPosition.tsx +35 -0
  133. package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
  134. package/src/components/kueue/useRelatedReads.test.ts +56 -0
  135. package/src/components/kueue/useRelatedReads.ts +205 -0
  136. package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
  137. package/src/components/logs/MultiPodLogsTab.tsx +120 -0
  138. package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
  139. package/src/components/logs/PodLogsUnavailable.tsx +21 -0
  140. package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
  141. package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
  142. package/src/components/logs/RayClusterLogsTab.tsx +109 -0
  143. package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
  144. package/src/components/logs/rayClusterPods.ts +32 -0
  145. package/src/components/outageSince.test.ts +21 -0
  146. package/src/components/outageSince.ts +10 -0
  147. package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
  148. package/src/components/resource/PrometheusCharts.tsx +3 -40
  149. package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
  150. package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
  151. package/src/components/resources/crd/host.tsx +14 -0
  152. package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
  153. package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
  154. package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
  155. package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
  156. package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
  157. package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
  158. package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
  159. package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
  160. package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
  161. package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
  162. package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
  163. package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
  164. package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
  165. package/src/components/resources/renderers/ServiceRenderer.test.tsx +15 -2
  166. package/src/components/resources/renderers/ServiceRenderer.tsx +1 -1
  167. package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.test.tsx +160 -0
  168. package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.tsx +128 -0
  169. package/src/components/traffic/TrafficView.tsx +3 -3
  170. package/src/components/ui/command-items-crd.test.tsx +23 -0
  171. package/src/components/ui/command-items.ts +2 -1
  172. package/src/components/useContextSwitchFlow.test.tsx +61 -0
  173. package/src/components/useContextSwitchFlow.tsx +21 -4
  174. package/src/components/whats-new/WhatsNew.test.ts +10 -3
  175. package/src/components/whats-new/WhatsNew.tsx +5 -1
  176. package/src/components/whats-new/WhatsNewDialog.test.tsx +17 -3
  177. package/src/components/whats-new/releaseNotes.ts +77 -4
  178. package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
  179. package/src/components/workload/RelatedFindingsSection.tsx +80 -0
  180. package/src/components/workload/WorkloadView.test.ts +10 -1
  181. package/src/components/workload/WorkloadView.tsx +85 -98
  182. package/src/components/workload/issueResourceOpener.test.ts +20 -0
  183. package/src/components/workload/issueResourceOpener.ts +17 -0
  184. package/src/context/ConnectionContext.tsx +133 -60
  185. package/src/context/ConnectionProvider.retry.test.tsx +176 -0
  186. package/src/context/ContextSwitchContext.tsx +14 -1
  187. package/src/context/DiagnoseCustomization.tsx +3 -0
  188. package/src/context/clusterConnected.ts +10 -0
  189. package/src/contexts/CapabilitiesContext.tsx +8 -4
  190. package/src/hooks/useElementSize.ts +30 -0
  191. package/src/hooks/useResolvedGitOpsOwner.test.ts +22 -0
  192. package/src/hooks/useResolvedGitOpsOwner.ts +6 -3
  193. package/src/integrations/resourceHost.test.tsx +1 -0
  194. package/src/integrations/resourceHost.ts +5 -1
  195. package/src/integrations/resourceHosts.test.tsx +21 -4
  196. package/src/integrations/resourceHosts.tsx +17 -0
  197. package/src/main.tsx +5 -0
  198. package/src/utils/related-findings.ts +46 -0
@@ -457,6 +457,22 @@ describe("listing cards (helm releases, packages, search)", () => {
457
457
  ]);
458
458
  });
459
459
 
460
+ it.each([[[]], [[{ name: "shop", namespace: "shop", chart: "shop" }]]])(
461
+ "keeps a partial Helm read's limits with its rows: %j",
462
+ (observed) => {
463
+ const summary = "Partial: 0 releases read from Helm and 1 observed.";
464
+ const projection = project([
465
+ tool("helm", "list_helm_releases", { summary, releases: [], observed }),
466
+ ]);
467
+ expect(projection.limitations).toEqual(
468
+ expect.arrayContaining([
469
+ expect.objectContaining({ source: "Helm releases", kind: "unknown" }),
470
+ ]),
471
+ );
472
+ expect(JSON.stringify(projection.limitations)).toContain(summary);
473
+ },
474
+ );
475
+
460
476
  it("lists Helm releases with their status and chart", () => {
461
477
  const projection = project([
462
478
  tool(
@@ -497,6 +513,62 @@ describe("listing cards (helm releases, packages, search)", () => {
497
513
  expect(data.resources[1].issue).toBe("0/1 pods ready");
498
514
  });
499
515
 
516
+ it("lists observed Helm releases without a status of their own", () => {
517
+ const projection = project([
518
+ tool("helm", "list_helm_releases", {
519
+ summary: "Partial: 1 releases read from Helm and 1 observed.",
520
+ releases: [{ name: "podinfo", namespace: "shop", chart: "podinfo", chartVersion: "6.15.0", status: "failed", revision: 3 }],
521
+ observed: [{ name: "redis", namespace: "team-b", chart: "redis", chartVersion: "19.0.1", resourceCount: 2, healthIssue: "ImagePullBackOff" }],
522
+ storageDenied: { count: 1, names: ["team-b"] },
523
+ }),
524
+ ]);
525
+ const [group] = groupsOf(projection.groups, "inventory");
526
+ const data = group.latest.data;
527
+ if (data.type !== "inventory") throw new Error("expected inventory");
528
+ expect(data.resources.map((row) => row.status)).toEqual([
529
+ "failed · podinfo 6.15.0",
530
+ "status unknown · redis 19.0.1",
531
+ ]);
532
+ expect(data.resources[1].issue).toBe("ImagePullBackOff");
533
+ });
534
+
535
+ it("shows an observed get_helm_release as an observed row with its limits", () => {
536
+ const summary = "Observed: Helm's release Secrets can't be read here.";
537
+ const projection = project([
538
+ tool("helm", "get_helm_release", {
539
+ summary,
540
+ observed: { name: "redis", namespace: "team-b", chart: "redis", chartVersion: "19.0.1", resourceCount: 2, resources: [] },
541
+ }),
542
+ ]);
543
+ const [group] = groupsOf(projection.groups, "inventory");
544
+ const data = group.latest.data;
545
+ if (data.type !== "inventory") throw new Error("expected inventory");
546
+ expect(data.resources.map((row) => row.status)).toEqual(["status unknown · redis 19.0.1"]);
547
+ expect(JSON.stringify(projection.limitations)).toContain(summary);
548
+ expect(JSON.stringify(projection.limitations)).not.toContain("couldn't summarize");
549
+ });
550
+
551
+ it.each([
552
+ ["owns the target", "api", "producer-related"],
553
+ ["doesn't own it", "worker", "broader"],
554
+ ])("ranks an observed Helm release by whether it %s", (_, name, relevance) => {
555
+ const projection = project([
556
+ tool("diag", "diagnose", targetBundle),
557
+ tool("helm", "get_helm_release", {
558
+ summary: "Observed: Helm's release Secrets can't be read here.",
559
+ observed: {
560
+ name: "shop",
561
+ namespace: "shop",
562
+ chart: "shop",
563
+ resourceCount: 1,
564
+ resources: [{ kind: "Deployment", apiVersion: "apps/v1", namespace: "shop", name }],
565
+ },
566
+ }),
567
+ ]);
568
+ const [group] = groupsOf(projection.groups, "inventory");
569
+ expect(group.latest.relevance).toBe(relevance);
570
+ });
571
+
500
572
  it("lists packages with their version and sources", () => {
501
573
  const projection = project([
502
574
  tool(
@@ -251,6 +251,15 @@ export function adaptDiagnose(
251
251
  : "producer-related";
252
252
  };
253
253
  addNarrowHint(builder, source, value);
254
+ const resourceOnly = nonEmptyString(value.coverage);
255
+ if (resourceOnly) {
256
+ builder.limit(
257
+ source,
258
+ "Diagnosis coverage",
259
+ value.coverage as string,
260
+ "unknown",
261
+ );
262
+ }
254
263
 
255
264
  const relatedRaw = value.relatedIssues;
256
265
  const related = Array.isArray(relatedRaw)
@@ -330,6 +339,9 @@ export function adaptDiagnose(
330
339
  source.confirmedSuccess &&
331
340
  related.length === 0 &&
332
341
  relatedValid &&
342
+ (context?.relatedFindings === undefined ||
343
+ (Array.isArray(context.relatedFindings) &&
344
+ context.relatedFindings.length === 0)) &&
333
345
  isDiagnosableWorkloadKind(resource.kind)
334
346
  ) {
335
347
  const scope = scopeFromArgs(source);
@@ -358,6 +370,42 @@ export function adaptDiagnose(
358
370
  bundleRelevance,
359
371
  );
360
372
 
373
+ if (
374
+ apiVersionToGroup(resource.apiVersion) === "kafka.strimzi.io" &&
375
+ (resource.kind === "KafkaConnector" || resource.kind === "KafkaConnect")
376
+ ) {
377
+ const snapshot = record(value.operatorSnapshot);
378
+ if (
379
+ !snapshot ||
380
+ !["observed", "failing", "recovered", "unknown"].includes(
381
+ String(snapshot.state),
382
+ ) ||
383
+ typeof snapshot.generationCurrent !== "boolean"
384
+ ) {
385
+ invalidPayload(builder, source, "Operator snapshot");
386
+ } else if (snapshot.state === "unknown") {
387
+ builder.limit(
388
+ source,
389
+ "Operator snapshot",
390
+ `Operator status is unverifiable: ${nonEmptyString(snapshot.reason) ? snapshot.reason : "unknown"}. Missing findings do not establish application health.`,
391
+ "unknown",
392
+ );
393
+ } else if (
394
+ resource.kind === "KafkaConnector" &&
395
+ source.confirmedSuccess &&
396
+ snapshot.state === "recovered" &&
397
+ snapshot.generationCurrent === true
398
+ ) {
399
+ builder.connectorRecoveryBySource.set(source.id, {
400
+ group: "kafka.strimzi.io",
401
+ kind: "KafkaConnector",
402
+ namespace: resource.metadata.namespace,
403
+ name: resource.metadata.name,
404
+ });
405
+ }
406
+ return;
407
+ }
408
+
361
409
  if (Array.isArray(blockersRaw)) {
362
410
  for (const { blocker, pods, foldedInto } of blockerGroups) {
363
411
  if (foldedInto) continue;
@@ -643,7 +691,7 @@ export function adaptDiagnose(
643
691
  `events:diagnose:${scopeFromArgs(source)}`,
644
692
  typeof value.eventsTotalGroups !== "number" ||
645
693
  value.eventsTotalGroups <= events.length,
646
- true,
694
+ !resourceOnly,
647
695
  relatedRelevance,
648
696
  );
649
697
  } else {
@@ -660,7 +708,7 @@ export function adaptDiagnose(
660
708
  [],
661
709
  `events:diagnose:${scopeFromArgs(source)}`,
662
710
  true,
663
- true,
711
+ !resourceOnly,
664
712
  relatedRelevance,
665
713
  );
666
714
  } else if (eventsRaw !== undefined) {
@@ -15,6 +15,7 @@ import {
15
15
  InvestigationHelmRevision,
16
16
  InvestigationHelmHook,
17
17
  } from "../types";
18
+ import { adaptListHelmReleases } from "./listings";
18
19
 
19
20
  function helmOwnedResource(
20
21
  value: unknown,
@@ -124,12 +125,61 @@ function helmOperation(value: unknown): InvestigationHelmOperation | undefined {
124
125
  return undefined;
125
126
  return candidate as unknown as InvestigationHelmOperation;
126
127
  }
128
+ // The release manages the target when the target is among the resources
129
+ // Helm rendered for it; a release is never the investigated object itself.
130
+ // Without an API version the owned row cannot tell colliding kinds apart
131
+ // (CNPG vs CAPI Cluster), so it establishes nothing.
132
+ function releaseRelevance(
133
+ builder: ProjectionBuilder,
134
+ resources: readonly InvestigationHelmOwnedResource[],
135
+ ): InvestigationEvidenceRelevance {
136
+ return resources.some(
137
+ (owned) =>
138
+ owned.apiVersion !== undefined &&
139
+ resourceMatchesTarget(builder.target, {
140
+ kind: owned.kind,
141
+ group: apiVersionToGroup(owned.apiVersion),
142
+ namespace: owned.namespace || undefined,
143
+ name: owned.name,
144
+ }),
145
+ )
146
+ ? "producer-related"
147
+ : "broader";
148
+ }
149
+
127
150
  export function adaptHelmRelease(
128
151
  builder: ProjectionBuilder,
129
152
  source: InvestigationEvidenceSource,
130
153
  payload: unknown,
131
154
  ): void {
132
155
  const value = record(payload);
156
+ // Without Helm's Secrets the release comes from its objects, with no status
157
+ // or history: it reads as list_helm_releases' observed rows do. The call's
158
+ // namespace is where Helm stores the release, which a Flux HelmRelease can
159
+ // set apart from the release's own, so the card is scoped to the release.
160
+ const observed = record(value?.observed);
161
+ if (value && observed && nonEmptyString(value.summary)) {
162
+ adaptListHelmReleases(
163
+ builder,
164
+ {
165
+ ...source,
166
+ args: JSON.stringify({
167
+ namespace: observed.namespace,
168
+ name: observed.name,
169
+ }),
170
+ },
171
+ { summary: value.summary, releases: [], observed: [observed] },
172
+ releaseRelevance(
173
+ builder,
174
+ (Array.isArray(observed.resources) ? observed.resources : [])
175
+ .map(helmOwnedResource)
176
+ .filter((item): item is InvestigationHelmOwnedResource =>
177
+ Boolean(item),
178
+ ),
179
+ ),
180
+ );
181
+ return;
182
+ }
133
183
  if (
134
184
  !value ||
135
185
  !nonEmptyString(value.name) ||
@@ -207,22 +257,7 @@ export function adaptHelmRelease(
207
257
  ...(hooks ? { hooks } : {}),
208
258
  ...(values ? { values } : {}),
209
259
  };
210
- // The release manages the target when the target is among the resources
211
- // Helm rendered for it; a release is never the investigated object itself.
212
- // Without an API version the owned row cannot tell colliding kinds apart
213
- // (CNPG vs CAPI Cluster), so it establishes nothing.
214
- const relevance: InvestigationEvidenceRelevance = resources.some(
215
- (owned) =>
216
- owned.apiVersion !== undefined &&
217
- resourceMatchesTarget(builder.target, {
218
- kind: owned.kind,
219
- group: apiVersionToGroup(owned.apiVersion),
220
- namespace: owned.namespace || undefined,
221
- name: owned.name,
222
- }),
223
- )
224
- ? "producer-related"
225
- : "broader";
260
+ const relevance = releaseRelevance(builder, resources);
226
261
  const status = release.status.toLowerCase();
227
262
  const operationFailed =
228
263
  lastOperation?.status === "failed" ||
@@ -1,10 +1,12 @@
1
1
  import { type Issue, type IssueRecentChange } from "@skyhook-io/k8s-ui";
2
+ import { type UncheckedSource } from "../../../../api/client";
2
3
  import { type DiagnosisDNSContext } from "../../diagnoseEvidenceTypes";
3
4
  import {
4
5
  ProjectionBuilder,
5
6
  addChanges,
6
7
  addIssueObservation,
7
8
  addNarrowHint,
9
+ addUncheckedIssueLimitations,
8
10
  evidenceTierForRelevance,
9
11
  invalidPayload,
10
12
  scopeFromArgs,
@@ -43,6 +45,13 @@ export function adaptIssues(
43
45
  return;
44
46
  }
45
47
  addNarrowHint(builder, source, value);
48
+ if (Array.isArray(value.unchecked_sources)) {
49
+ addUncheckedIssueLimitations(
50
+ builder,
51
+ source,
52
+ value.unchecked_sources as UncheckedSource[],
53
+ );
54
+ }
46
55
  if (
47
56
  value.total_matched > issues.length &&
48
57
  !nonEmptyString(value.narrowHint)
@@ -1,24 +1,51 @@
1
1
  import { adaptListResources } from "./resource";
2
2
  import { nonEmptyString, parseJSON, record, stringArray } from "../parse";
3
3
  import { invalidPayload, type ProjectionBuilder } from "../observations";
4
- import type { InvestigationEvidenceSource } from "../types";
4
+ import type {
5
+ InvestigationEvidenceRelevance,
6
+ InvestigationEvidenceSource,
7
+ } from "../types";
5
8
 
6
9
  // Helm releases, installed packages and search hits are inventories: rows
7
10
  // with a kind, a name and a namespace, one line of status, and for a hit
8
11
  // the text that matched. They render on the inventory card so a citation
9
12
  // can name a row the way it names a resource in a listing.
10
13
 
14
+ // A caller who can't read all of Helm's storage gets an object, whose observed
15
+ // rows have no status of their own; the card must not read as though they did.
16
+ function helmReleaseRows(payload: unknown): unknown[] | undefined {
17
+ if (Array.isArray(payload)) return payload;
18
+ const value = record(payload);
19
+ if (!value || !Array.isArray(value.releases) || !Array.isArray(value.observed)) {
20
+ return undefined;
21
+ }
22
+ return [
23
+ ...value.releases,
24
+ ...value.observed.map((entry) => {
25
+ const item = record(entry);
26
+ return item ? { ...item, status: "status unknown" } : entry;
27
+ }),
28
+ ];
29
+ }
30
+
11
31
  export function adaptListHelmReleases(
12
32
  builder: ProjectionBuilder,
13
33
  source: InvestigationEvidenceSource,
14
34
  payload: unknown,
35
+ relevance?: InvestigationEvidenceRelevance,
15
36
  ): void {
16
37
  // Retained runs may contain the Helm producer's nil-slice encoding.
17
38
  if (payload === null) payload = [];
18
- if (!Array.isArray(payload)) {
39
+ const rows = helmReleaseRows(payload);
40
+ if (!rows) {
19
41
  invalidPayload(builder, source);
20
42
  return;
21
43
  }
44
+ // A partial read can miss releases, which its rows can't show.
45
+ const partial = record(payload)?.summary;
46
+ if (nonEmptyString(partial)) {
47
+ builder.limit(source, "Helm releases", partial, "unknown");
48
+ }
22
49
  const args = record(parseJSON(source.args ?? ""));
23
50
  const namespace = nonEmptyString(args?.namespace)
24
51
  ? args.namespace
@@ -26,7 +53,7 @@ export function adaptListHelmReleases(
26
53
  adaptListResources(
27
54
  builder,
28
55
  source,
29
- payload.map((entry) => {
56
+ rows.map((entry) => {
30
57
  const item = record(entry);
31
58
  if (!item) return entry;
32
59
  const chart = [item.chart, item.chartVersion]
@@ -44,7 +71,10 @@ export function adaptListHelmReleases(
44
71
  : {}),
45
72
  };
46
73
  }),
47
- { title: namespace ? `Helm releases in ${namespace}` : "Helm releases" },
74
+ {
75
+ title: namespace ? `Helm releases in ${namespace}` : "Helm releases",
76
+ relevance,
77
+ },
48
78
  );
49
79
  }
50
80
 
@@ -28,6 +28,7 @@ import {
28
28
  } from "../parse";
29
29
  import {
30
30
  type InvestigationEventEvidence,
31
+ type InvestigationEvidenceRelevance,
31
32
  type InvestigationEvidenceSource,
32
33
  type InvestigationResourceSummary,
33
34
  } from "../types";
@@ -299,7 +300,7 @@ export function adaptListResources(
299
300
  builder: ProjectionBuilder,
300
301
  source: InvestigationEvidenceSource,
301
302
  payload: unknown,
302
- options: { title?: string } = {},
303
+ options: { title?: string; relevance?: InvestigationEvidenceRelevance } = {},
303
304
  ): void {
304
305
  const listed = listedRows(payload);
305
306
  if (!listed) {
@@ -363,7 +364,7 @@ export function adaptListResources(
363
364
  source,
364
365
  {
365
366
  tier: "context",
366
- relevance: "broader",
367
+ relevance: options.relevance ?? "broader",
367
368
  tone: hasAdverseResource ? "warning" : "neutral",
368
369
  title,
369
370
  summary: [
@@ -1,3 +1,4 @@
1
+ import { resourceKey } from "@skyhook-io/k8s-ui";
1
2
  import {
2
3
  apiVersionToGroup,
3
4
  knownKindForPluralWithGroup,
@@ -307,12 +308,32 @@ export function projectInvestigationEvidence(
307
308
  source: InvestigationEvidenceSource,
308
309
  podContainer: string,
309
310
  ) => `previous-log:${source.tool}:${scopeFromArgs(source)}:${podContainer}`;
311
+ const connectorCoverageKey = (ref: {
312
+ group?: string;
313
+ kind: string;
314
+ namespace?: string;
315
+ name: string;
316
+ }) =>
317
+ `connector:${resourceKey(ref.group ?? "", ref.kind, ref.namespace ?? "", ref.name)}`;
310
318
  const retirementKey = (
311
319
  group: InvestigationEvidenceGroup,
312
320
  observation: InvestigationEvidenceObservation,
313
321
  ): string | undefined => {
314
322
  switch (group.kind) {
315
323
  case "issue":
324
+ if (
325
+ observation.data.type === "issue" &&
326
+ observation.data.issue.group === "kafka.strimzi.io" &&
327
+ observation.data.issue.kind === "KafkaConnector"
328
+ )
329
+ return connectorCoverageKey(observation.data.issue);
330
+ // A clean parent diagnosis cannot prove an associated resource recovered.
331
+ if (
332
+ observation.data.type === "issue" &&
333
+ observation.data.associatedVia
334
+ )
335
+ return undefined;
336
+ return semanticCoverageKey(group.kind);
316
337
  case "startup":
317
338
  case "crash":
318
339
  case "dns":
@@ -344,6 +365,15 @@ export function projectInvestigationEvidence(
344
365
  turns.forEach((turn, turnIndex) => {
345
366
  if (!turn.verify || turn.status !== "done") return;
346
367
  const keys = new Set<string>();
368
+ for (const source of builder.sources) {
369
+ const recovered = builder.connectorRecoveryBySource.get(source.id);
370
+ if (
371
+ source.turnIndex === turnIndex &&
372
+ source.confirmedSuccess &&
373
+ recovered
374
+ )
375
+ keys.add(connectorCoverageKey(recovered));
376
+ }
347
377
  for (const group of builder.groups) {
348
378
  for (const observation of group.observations) {
349
379
  if (
@@ -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 { nonEmptyString, parseJSON, record, stringArray } from "./parse";
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) => (getCrossplaneConditionTone(resource, condition) ?? defaultConditionTone(condition)) === "fail",
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
+ }