@skyhook-io/radar-app 1.17.0 → 1.18.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.
Files changed (347) hide show
  1. package/README.md +1 -1
  2. package/package.json +11 -11
  3. package/src/App.tsx +138 -116
  4. package/src/api/actions.errorCode.test.ts +40 -0
  5. package/src/api/actions.test.ts +48 -0
  6. package/src/api/actions.ts +79 -0
  7. package/src/api/apiResources.navigation.test.tsx +232 -0
  8. package/src/api/apiResources.ts +46 -3
  9. package/src/api/client.gitopsPoll.test.ts +99 -0
  10. package/src/api/client.helmPreview.test.tsx +48 -0
  11. package/src/api/client.helmSource.test.ts +39 -0
  12. package/src/api/client.namespaceSwitch.hook.test.tsx +54 -0
  13. package/src/api/client.namespaceSwitch.test.ts +107 -0
  14. package/src/api/client.resourceAvailability.test.ts +24 -0
  15. package/src/api/client.ts +580 -103
  16. package/src/api/client.workloadRuns.test.ts +53 -0
  17. package/src/api/cnpg-ha.live.test.ts +140 -0
  18. package/src/api/cnpg-ha.test.ts +78 -0
  19. package/src/api/cnpg-ha.ts +19 -0
  20. package/src/api/cnpg-history.ts +123 -0
  21. package/src/api/cnpg-inspect.ts +102 -0
  22. package/src/api/cnpg-protection.ts +112 -0
  23. package/src/api/cnpg-recovery.test.tsx +60 -0
  24. package/src/api/cnpg-recovery.ts +262 -0
  25. package/src/api/cnpg-sessions.ts +175 -0
  26. package/src/api/cnpg-storage.ts +138 -0
  27. package/src/api/cnpg.legacy-reads.test.ts +43 -0
  28. package/src/api/cnpg.pooler-runtime.test.ts +15 -0
  29. package/src/api/cnpg.ts +428 -10
  30. package/src/api/config.test.ts +23 -1
  31. package/src/api/config.ts +7 -3
  32. package/src/api/diagnose.ts +4 -1
  33. package/src/api/drain-plan.test.ts +70 -40
  34. package/src/api/policy.ts +5 -5
  35. package/src/api/radarFeatures.render.test.tsx +47 -3
  36. package/src/api/radarFeatures.ts +5 -1
  37. package/src/api/reviewedActionMutation.test.tsx +164 -0
  38. package/src/api/reviewedActionMutation.ts +66 -0
  39. package/src/api/timelineSource.test.ts +9 -0
  40. package/src/api/timelineSource.ts +8 -0
  41. package/src/api/traffic.scope.render.test.tsx +60 -0
  42. package/src/api/traffic.ts +3 -1
  43. package/src/components/audit/AuditView.tsx +9 -0
  44. package/src/components/capacity/CapacityActivity.tsx +3 -31
  45. package/src/components/capacity/CapacityDemand.tsx +4 -36
  46. package/src/components/capacity/CapacityOverview.tsx +217 -56
  47. package/src/components/capacity/CapacityPoolDetail.tsx +6 -55
  48. package/src/components/capacity/CapacityView.test.tsx +323 -0
  49. package/src/components/capacity/ClusterSchedulingCard.tsx +2 -10
  50. package/src/components/capacity/certaintyGlyph.test.tsx +2 -9
  51. package/src/components/capacity/routes.ts +42 -0
  52. package/src/components/capacity/shared.tsx +11 -129
  53. package/src/components/capacity/workspaceRoute.ts +18 -0
  54. package/src/components/cnpg/CNPGActionHost.compatibility.test.tsx +30 -0
  55. package/src/components/cnpg/CNPGArchivingRepair.tsx +191 -0
  56. package/src/components/cnpg/CNPGBlockingSessions.test.tsx +50 -0
  57. package/src/components/cnpg/CNPGBlockingSessions.tsx +333 -0
  58. package/src/components/cnpg/CNPGClusterActivity.test.tsx +11 -0
  59. package/src/components/cnpg/CNPGClusterActivity.tsx +18 -9
  60. package/src/components/cnpg/CNPGClusterLogs.compatibility.test.tsx +130 -0
  61. package/src/components/cnpg/CNPGClusterLogs.empty.test.tsx +29 -0
  62. package/src/components/cnpg/CNPGClusterLogs.test.ts +9 -0
  63. package/src/components/cnpg/CNPGClusterLogs.tsx +81 -24
  64. package/src/components/cnpg/CNPGClusterTabs.test.tsx +152 -0
  65. package/src/components/cnpg/CNPGClusterTabs.tsx +187 -0
  66. package/src/components/cnpg/CNPGClustersKindView.tsx +46 -0
  67. package/src/components/cnpg/CNPGConfiguration.test.tsx +223 -0
  68. package/src/components/cnpg/CNPGConfiguration.tsx +190 -0
  69. package/src/components/cnpg/CNPGCreateClusterDialog.test.tsx +113 -0
  70. package/src/components/cnpg/CNPGCreateClusterDialog.tsx +74 -0
  71. package/src/components/cnpg/CNPGDeclarations.test.ts +107 -0
  72. package/src/components/cnpg/CNPGDeclarations.tsx +236 -78
  73. package/src/components/cnpg/CNPGDetailPage.test.tsx +62 -0
  74. package/src/components/cnpg/CNPGDetailPage.tsx +159 -98
  75. package/src/components/cnpg/CNPGDrawerTrail.tsx +2 -2
  76. package/src/components/cnpg/CNPGInvestigationAction.test.tsx +30 -0
  77. package/src/components/cnpg/CNPGOperator.test.tsx +34 -0
  78. package/src/components/cnpg/CNPGOperator.tsx +78 -30
  79. package/src/components/cnpg/CNPGOperatorBanner.tsx +39 -0
  80. package/src/components/cnpg/CNPGOperatorConditions.test.tsx +45 -0
  81. package/src/components/cnpg/CNPGOperatorConditions.tsx +16 -0
  82. package/src/components/cnpg/CNPGOperatorConfig.test.tsx +27 -0
  83. package/src/components/cnpg/CNPGOperatorDiagnosis.tsx +247 -0
  84. package/src/components/cnpg/CNPGOverview.test.tsx +171 -0
  85. package/src/components/cnpg/CNPGOverview.tsx +238 -63
  86. package/src/components/cnpg/CNPGParametersInEffect.test.tsx +51 -0
  87. package/src/components/cnpg/CNPGParametersInEffect.tsx +120 -0
  88. package/src/components/cnpg/CNPGPerformance.prerequisite.test.tsx +48 -0
  89. package/src/components/cnpg/CNPGPerformance.test.tsx +73 -0
  90. package/src/components/cnpg/CNPGPerformance.tsx +477 -0
  91. package/src/components/cnpg/CNPGPooling.test.tsx +89 -0
  92. package/src/components/cnpg/CNPGPooling.tsx +97 -40
  93. package/src/components/cnpg/CNPGProtection.test.tsx +145 -0
  94. package/src/components/cnpg/CNPGProtection.tsx +228 -122
  95. package/src/components/cnpg/CNPGReplicationTab.test.tsx +87 -0
  96. package/src/components/cnpg/CNPGReplicationTab.tsx +212 -0
  97. package/src/components/cnpg/CNPGReplicationView.tsx +264 -0
  98. package/src/components/cnpg/CNPGStorage.test.tsx +140 -0
  99. package/src/components/cnpg/CNPGStorage.tsx +619 -0
  100. package/src/components/cnpg/CNPGSummaryHost.overview.test.tsx +44 -0
  101. package/src/components/cnpg/CNPGSummaryHost.test.tsx +23 -0
  102. package/src/components/cnpg/CNPGSummaryHost.tsx +230 -55
  103. package/src/components/cnpg/CNPGTrends.denied.test.tsx +33 -0
  104. package/src/components/cnpg/CNPGTrends.missing.test.tsx +69 -0
  105. package/src/components/cnpg/CNPGTrends.test.ts +38 -0
  106. package/src/components/cnpg/CNPGTrends.tsx +702 -0
  107. package/src/components/cnpg/CNPGView.tsx +34 -21
  108. package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +90 -0
  109. package/src/components/cnpg/actions/CNPGClusterActions.dialog.test.tsx +79 -0
  110. package/src/components/cnpg/actions/CNPGClusterActions.test.tsx +142 -0
  111. package/src/components/cnpg/actions/CNPGClusterActions.tsx +853 -0
  112. package/src/components/cnpg/actions/CNPGConnectButton.read.test.tsx +40 -0
  113. package/src/components/cnpg/actions/CNPGConnectButton.test.ts +25 -0
  114. package/src/components/cnpg/actions/CNPGConnectButton.tsx +131 -0
  115. package/src/components/cnpg/actions/CNPGDestroyInstanceDialog.tsx +185 -0
  116. package/src/components/cnpg/actions/CNPGInstanceActions.test.tsx +38 -0
  117. package/src/components/cnpg/actions/CNPGInstanceActions.tsx +74 -0
  118. package/src/components/cnpg/actions/CNPGMaintenanceBanner.tsx +53 -0
  119. package/src/components/cnpg/actions/CNPGPoolerActions.test.tsx +35 -0
  120. package/src/components/cnpg/actions/CNPGPoolerActions.tsx +79 -0
  121. package/src/components/cnpg/actions/CNPGReportDialog.test.tsx +12 -0
  122. package/src/components/cnpg/actions/CNPGReportDialog.tsx +91 -0
  123. package/src/components/cnpg/actions/CNPGScheduleActions.run.test.tsx +58 -0
  124. package/src/components/cnpg/actions/CNPGScheduleActions.test.tsx +54 -0
  125. package/src/components/cnpg/actions/CNPGScheduleActions.tsx +208 -0
  126. package/src/components/cnpg/actions/actionModel.test.ts +111 -0
  127. package/src/components/cnpg/actions/actionModel.ts +127 -0
  128. package/src/components/cnpg/actions/renderCNPGHeaderActions.tsx +60 -0
  129. package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +58 -0
  130. package/src/components/cnpg/actions/useOpenCNPGPsql.ts +22 -0
  131. package/src/components/cnpg/archivingRepair.test.ts +104 -0
  132. package/src/components/cnpg/archivingRepair.ts +145 -0
  133. package/src/components/cnpg/baseBackup.test.ts +36 -0
  134. package/src/components/cnpg/baseBackup.ts +36 -0
  135. package/src/components/cnpg/blocking.test.ts +59 -0
  136. package/src/components/cnpg/blocking.ts +131 -0
  137. package/src/components/cnpg/coverageText.test.ts +27 -0
  138. package/src/components/cnpg/creation/CNPGTargetFields.tsx +110 -0
  139. package/src/components/cnpg/creation/targetModel.test.ts +137 -0
  140. package/src/components/cnpg/creation/targetModel.ts +149 -0
  141. package/src/components/cnpg/fleetStatus.test.ts +46 -0
  142. package/src/components/cnpg/fleetStatus.ts +43 -0
  143. package/src/components/cnpg/formFields.ts +2 -0
  144. package/src/components/cnpg/grantText.test.tsx +11 -0
  145. package/src/components/cnpg/host.test.tsx +24 -0
  146. package/src/components/cnpg/host.tsx +101 -0
  147. package/src/components/cnpg/inspectModel.test.ts +120 -0
  148. package/src/components/cnpg/inspectModel.ts +140 -0
  149. package/src/components/cnpg/logicalSlots.test.ts +30 -0
  150. package/src/components/cnpg/logicalSlots.ts +29 -0
  151. package/src/components/cnpg/lsn.test.ts +40 -0
  152. package/src/components/cnpg/lsn.ts +43 -0
  153. package/src/components/cnpg/operations/CNPGFleetOperation.tsx +30 -0
  154. package/src/components/cnpg/operations/CNPGOperationTracker.test.tsx +247 -0
  155. package/src/components/cnpg/operations/CNPGOperationTracker.tsx +255 -0
  156. package/src/components/cnpg/operations/model.test.ts +510 -0
  157. package/src/components/cnpg/operations/model.ts +499 -0
  158. package/src/components/cnpg/operations/presentation.test.ts +80 -0
  159. package/src/components/cnpg/operations/presentation.ts +84 -0
  160. package/src/components/cnpg/operations/store.ts +98 -0
  161. package/src/components/cnpg/operatorStatus.test.ts +134 -0
  162. package/src/components/cnpg/operatorStatus.ts +194 -0
  163. package/src/components/cnpg/paths.test.ts +54 -0
  164. package/src/components/cnpg/paths.ts +47 -4
  165. package/src/components/cnpg/protection/CNPGAttachArchiveDialog.tsx +185 -0
  166. package/src/components/cnpg/protection/CNPGCreateScheduleDialog.tsx +196 -0
  167. package/src/components/cnpg/protection/CNPGProtectionSetup.test.tsx +121 -0
  168. package/src/components/cnpg/protection/CNPGProtectionSetup.tsx +452 -0
  169. package/src/components/cnpg/protection/CNPGScheduleInput.tsx +115 -0
  170. package/src/components/cnpg/protection/CNPGScheduleRepairButton.tsx +120 -0
  171. package/src/components/cnpg/protection/scheduleModel.test.ts +19 -0
  172. package/src/components/cnpg/protection/scheduleModel.ts +16 -0
  173. package/src/components/cnpg/recovery/CNPGRecoveryPoint.tsx +220 -0
  174. package/src/components/cnpg/recovery/CNPGRestoreButton.test.tsx +29 -0
  175. package/src/components/cnpg/recovery/CNPGRestoreButton.tsx +26 -0
  176. package/src/components/cnpg/recovery/CNPGRestoreChecks.test.tsx +23 -0
  177. package/src/components/cnpg/recovery/CNPGRestoreChecks.tsx +153 -0
  178. package/src/components/cnpg/recovery/CNPGRestoreDialog.back.test.tsx +149 -0
  179. package/src/components/cnpg/recovery/CNPGRestoreDialog.test.tsx +46 -0
  180. package/src/components/cnpg/recovery/CNPGRestoreDialog.tsx +333 -0
  181. package/src/components/cnpg/recovery/CNPGRestoreProgress.tsx +182 -0
  182. package/src/components/cnpg/recovery/CNPGRestoreValidation.tsx +216 -0
  183. package/src/components/cnpg/recovery/restoreModel.test.ts +709 -0
  184. package/src/components/cnpg/recovery/restoreModel.ts +685 -0
  185. package/src/components/cnpg/recovery/restoreOperation.ts +56 -0
  186. package/src/components/cnpg/refresh.test.ts +38 -0
  187. package/src/components/cnpg/refresh.ts +17 -0
  188. package/src/components/cnpg/refreshNotice.test.tsx +29 -0
  189. package/src/components/cnpg/routes.test.ts +34 -3
  190. package/src/components/cnpg/routes.ts +60 -48
  191. package/src/components/cnpg/runtimeAssessment.ts +198 -0
  192. package/src/components/cnpg/runtimeModel.test.ts +175 -0
  193. package/src/components/cnpg/runtimeModel.ts +196 -0
  194. package/src/components/cnpg/runtimeParts.test.tsx +17 -0
  195. package/src/components/cnpg/runtimeParts.tsx +79 -0
  196. package/src/components/cnpg/shared.test.tsx +59 -0
  197. package/src/components/cnpg/shared.tsx +100 -182
  198. package/src/components/cnpg/storageModel.test.ts +107 -0
  199. package/src/components/cnpg/storageModel.ts +101 -0
  200. package/src/components/cnpg/trendSamples.test.ts +148 -0
  201. package/src/components/cnpg/trendSamples.ts +222 -0
  202. package/src/components/cnpg/useCNPGClusterAssessment.ts +30 -0
  203. package/src/components/cnpg/useCNPGKubectlContext.test.tsx +45 -0
  204. package/src/components/cnpg/useCNPGKubectlContext.ts +13 -0
  205. package/src/components/cnpg/useCNPGNavigate.test.tsx +58 -0
  206. package/src/components/cnpg/useCNPGNavigate.ts +21 -0
  207. package/src/components/cnpg/useCNPGPoolerLive.ts +46 -0
  208. package/src/components/cnpg/useCNPGScreenParams.ts +24 -0
  209. package/src/components/cnpg/useCNPGSidebarWorkspace.ts +66 -16
  210. package/src/components/cnpg/workspaceRoute.ts +23 -0
  211. package/src/components/cost/ApplicationCostTab.test.ts +7 -0
  212. package/src/components/cost/ApplicationCostTab.tsx +7 -7
  213. package/src/components/cost/CostView.test.ts +2 -1
  214. package/src/components/cost/CostView.tsx +0 -2
  215. package/src/components/cost/WorkloadCostTab.tsx +2 -4
  216. package/src/components/cost/errors.ts +3 -1
  217. package/src/components/cost/source.test.ts +10 -0
  218. package/src/components/cost/source.ts +5 -1
  219. package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
  220. package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
  221. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
  222. package/src/components/diagnose/InvestigationView.tsx +2 -1
  223. package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
  224. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
  225. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -43
  226. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
  227. package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
  228. package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
  229. package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
  230. package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
  231. package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
  232. package/src/components/diagnose/investigationEvidence/projection.test.ts +123 -0
  233. package/src/components/diagnose/investigationEvidence/types.ts +11 -0
  234. package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
  235. package/src/components/diagnose/investigationState.test.ts +36 -1
  236. package/src/components/diagnose/investigationState.ts +8 -0
  237. package/src/components/diagnose/launch.ts +2 -2
  238. package/src/components/dock/BottomDock.tsx +8 -3
  239. package/src/components/dock/TerminalTab.test.tsx +17 -0
  240. package/src/components/dock/TerminalTab.tsx +7 -3
  241. package/src/components/dock/WorkloadLogsTab.tsx +3 -0
  242. package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
  243. package/src/components/execution/BatchExecutionView.tsx +23 -8
  244. package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
  245. package/src/components/gitops/ArgoResourceDiffLoader.tsx +4 -2
  246. package/src/components/gitops/GitOpsView.tsx +23 -23
  247. package/src/components/helm/HelmCompareRoute.test.tsx +59 -0
  248. package/src/components/helm/HelmCompareRoute.tsx +57 -26
  249. package/src/components/helm/HelmReleaseDrawer.test.ts +55 -3
  250. package/src/components/helm/HelmReleaseDrawer.tsx +186 -64
  251. package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
  252. package/src/components/helm/HelmReleaseNotes.tsx +26 -0
  253. package/src/components/helm/OwnedResources.tsx +2 -2
  254. package/src/components/helm/TrackChartSourceDialog.render.test.tsx +192 -0
  255. package/src/components/helm/TrackChartSourceDialog.test.ts +51 -0
  256. package/src/components/helm/TrackChartSourceDialog.tsx +179 -176
  257. package/src/components/helm/ValuesDiffPreview.tsx +4 -1
  258. package/src/components/helm/ValuesViewer.test.tsx +301 -0
  259. package/src/components/helm/ValuesViewer.tsx +169 -78
  260. package/src/components/home/ActivitySummary.tsx +2 -1
  261. package/src/components/home/ClusterHealthCard.tsx +4 -4
  262. package/src/components/home/CostCard.test.tsx +100 -0
  263. package/src/components/home/CostCard.tsx +2 -2
  264. package/src/components/home/HelmSummary.tsx +2 -2
  265. package/src/components/home/HomeView.tsx +32 -12
  266. package/src/components/home/MCPSetupDialog.test.tsx +30 -0
  267. package/src/components/home/MCPSetupDialog.tsx +13 -6
  268. package/src/components/home/ProblemsPanel.test.tsx +82 -0
  269. package/src/components/home/TopologyPreview.tsx +2 -2
  270. package/src/components/home/mcpToolCatalog.ts +18 -2
  271. package/src/components/issues/IssuesPane.render.test.tsx +143 -0
  272. package/src/components/issues/IssuesPane.test.ts +65 -1
  273. package/src/components/issues/IssuesPane.tsx +213 -26
  274. package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
  275. package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
  276. package/src/components/issues/uncheckedSources.test.ts +43 -0
  277. package/src/components/issues/uncheckedSources.ts +74 -0
  278. package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
  279. package/src/components/resource/PVCUsageBar.render.test.tsx +32 -0
  280. package/src/components/resource/PVCUsageBar.test.tsx +24 -0
  281. package/src/components/resource/PVCUsageBar.tsx +15 -6
  282. package/src/components/resource/WorkloadMetricsHelpDialog.test.tsx +3 -1
  283. package/src/components/resource/WorkloadMetricsHelpDialog.tsx +1 -1
  284. package/src/components/resources/CompositeRenderer.tsx +4 -4
  285. package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
  286. package/src/components/resources/ImageFilesystemModal.tsx +11 -4
  287. package/src/components/resources/PodFilesystemModal.tsx +2 -2
  288. package/src/components/resources/ResourceDetailDrawer.tsx +2 -2
  289. package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
  290. package/src/components/resources/ResourcesView.tsx +44 -15
  291. package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
  292. package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
  293. package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
  294. package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
  295. package/src/components/settings/LocalIntegrationStatus.test.tsx +52 -0
  296. package/src/components/settings/LocalIntegrationStatus.tsx +3 -4
  297. package/src/components/settings/SettingsDialog.tsx +49 -30
  298. package/src/components/timeline/TimelineList.tsx +22 -24
  299. package/src/components/timeline/TimelineLoadError.test.tsx +62 -0
  300. package/src/components/timeline/TimelineLoadError.tsx +96 -0
  301. package/src/components/timeline/TimelineView.tsx +18 -45
  302. package/src/components/timeline/ViewModeToggle.tsx +20 -0
  303. package/src/components/timeline/useStickyError.test.tsx +47 -0
  304. package/src/components/timeline/useStickyError.ts +15 -0
  305. package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
  306. package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
  307. package/src/components/traffic/TrafficView.tsx +12 -12
  308. package/src/components/traffic/trafficFilters.test.ts +20 -1
  309. package/src/components/traffic/trafficFilters.ts +13 -0
  310. package/src/components/ui/DiagnosticsOverlay.tsx +34 -2
  311. package/src/components/ui/Markdown.test.tsx +65 -0
  312. package/src/components/ui/Markdown.tsx +144 -127
  313. package/src/components/ui/Omnibar.tsx +13 -2
  314. package/src/components/ui/Toast.tsx +1 -1
  315. package/src/components/ui/omnibar-match.test.ts +30 -0
  316. package/src/components/ui/omnibar-match.ts +18 -0
  317. package/src/components/whats-new/releaseNotes.ts +63 -1
  318. package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
  319. package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
  320. package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
  321. package/src/components/workload/NodeDrainStatus.tsx +55 -0
  322. package/src/components/workload/WorkloadView.test.ts +10 -1
  323. package/src/components/workload/WorkloadView.tsx +63 -243
  324. package/src/components/workspace/layout.test.tsx +29 -0
  325. package/src/components/workspace/layout.tsx +259 -0
  326. package/src/components/workspace/table.ts +7 -0
  327. package/src/context/ConnectionContext.test.ts +27 -1
  328. package/src/context/ConnectionContext.tsx +17 -7
  329. package/src/contexts/CapabilitiesContext.tsx +1 -1
  330. package/src/integrations/resourceHost.test.tsx +55 -0
  331. package/src/integrations/resourceHost.ts +99 -0
  332. package/src/integrations/resourceHosts.test.tsx +142 -0
  333. package/src/integrations/resourceHosts.tsx +121 -0
  334. package/src/integrations/workspaceRoute.ts +20 -0
  335. package/src/integrations/workspaceRoutes.test.ts +40 -0
  336. package/src/integrations/workspaceRoutes.ts +22 -0
  337. package/src/integrations/workspaceScreens.tsx +14 -0
  338. package/src/utils/drawer-trail.ts +35 -0
  339. package/src/utils/kindFilterStore.test.ts +147 -0
  340. package/src/utils/kindFilterStore.ts +91 -0
  341. package/src/utils/navigation.test.ts +13 -1
  342. package/src/utils/navigation.ts +53 -2
  343. package/src/utils/page-links.ts +21 -0
  344. package/src/utils/tabStorage.ts +40 -0
  345. package/src/utils/viewMemory.test.ts +78 -0
  346. package/src/utils/viewMemory.ts +54 -0
  347. package/src/utils/wails-clipboard.ts +4 -2
@@ -0,0 +1,323 @@
1
+ {
2
+ "compacted": {
3
+ "changes": [
4
+ {
5
+ "kind": "Deployment",
6
+ "apiVersion": "apps/v1",
7
+ "namespace": "shop",
8
+ "name": "checkout",
9
+ "changeType": "update",
10
+ "summary": "env(checkout/CART_ADDR) changed",
11
+ "timestamp": "2026-10-16T04:55:24+03:00",
12
+ "change_category": "spec_config",
13
+ "rank_reason": "application configuration field changed",
14
+ "application_configuration_change": true,
15
+ "fields": [
16
+ {
17
+ "path": "spec.template.spec.containers[checkout].env[CART_ADDR]",
18
+ "oldValue": "cart:7070",
19
+ "newValue": "localhost:7070"
20
+ }
21
+ ]
22
+ },
23
+ {
24
+ "kind": "Deployment",
25
+ "apiVersion": "apps/v1",
26
+ "namespace": "shop",
27
+ "name": "debug",
28
+ "changeType": "add",
29
+ "summary": "add",
30
+ "timestamp": "2026-10-16T04:53:24+03:00",
31
+ "change_category": "lifecycle",
32
+ "rank_reason": "resource create/delete for config or desired state"
33
+ },
34
+ {
35
+ "kind": "NetworkPolicy",
36
+ "apiVersion": "networking.k8s.io/v1",
37
+ "namespace": "shop",
38
+ "name": "deny-all",
39
+ "changeType": "add",
40
+ "summary": "add",
41
+ "timestamp": "2026-10-16T04:43:28+03:00",
42
+ "change_category": "lifecycle",
43
+ "rank_reason": "resource create/delete for config or desired state"
44
+ },
45
+ {
46
+ "kind": "Service",
47
+ "apiVersion": "v1",
48
+ "namespace": "shop",
49
+ "name": "legacy",
50
+ "changeType": "delete",
51
+ "summary": "delete",
52
+ "timestamp": "2026-10-16T04:43:26+03:00",
53
+ "change_category": "lifecycle",
54
+ "rank_reason": "resource create/delete for config or desired state"
55
+ },
56
+ {
57
+ "kind": "Deployment",
58
+ "apiVersion": "apps/v1",
59
+ "namespace": "shop",
60
+ "name": "cart",
61
+ "changeType": "update",
62
+ "summary": "ready: 0→1",
63
+ "timestamp": "2026-10-16T04:43:54+03:00",
64
+ "change_category": "runtime_status",
65
+ "rank_reason": "status field changed",
66
+ "fields": [
67
+ {
68
+ "path": "status.readyReplicas",
69
+ "oldValue": 0,
70
+ "newValue": 1
71
+ }
72
+ ]
73
+ }
74
+ ],
75
+ "created": [
76
+ {
77
+ "namespace": "shop",
78
+ "first": "2026-10-16T04:43:24+03:00",
79
+ "count": 13,
80
+ "apiVersions": {
81
+ "ConfigMap": "v1",
82
+ "Deployment": "apps/v1",
83
+ "Service": "v1"
84
+ },
85
+ "objects": [
86
+ "+0s Deployment/cart",
87
+ "+0s Service/cart",
88
+ "+1s Deployment/checkout",
89
+ "+1s Service/checkout",
90
+ "+2s Deployment/frontend",
91
+ "+2s Service/frontend",
92
+ "+3s ConfigMap/checkout-config (used by Deployment/checkout)",
93
+ "+3s Deployment/payment",
94
+ "+3s Service/payment",
95
+ "+4s Deployment/shipping",
96
+ "+4s Service/shipping",
97
+ "+5s Deployment/catalog",
98
+ "+5s Service/catalog"
99
+ ]
100
+ }
101
+ ]
102
+ },
103
+ "original": {
104
+ "changes": [
105
+ {
106
+ "kind": "Deployment",
107
+ "apiVersion": "apps/v1",
108
+ "namespace": "shop",
109
+ "name": "checkout",
110
+ "changeType": "update",
111
+ "summary": "env(checkout/CART_ADDR) changed",
112
+ "timestamp": "2026-10-16T04:55:24+03:00",
113
+ "change_category": "spec_config",
114
+ "rank_reason": "application configuration field changed",
115
+ "application_configuration_change": true,
116
+ "fields": [
117
+ {
118
+ "path": "spec.template.spec.containers[checkout].env[CART_ADDR]",
119
+ "oldValue": "cart:7070",
120
+ "newValue": "localhost:7070"
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "kind": "Deployment",
126
+ "apiVersion": "apps/v1",
127
+ "namespace": "shop",
128
+ "name": "debug",
129
+ "changeType": "add",
130
+ "summary": "add",
131
+ "timestamp": "2026-10-16T04:53:24+03:00",
132
+ "change_category": "lifecycle",
133
+ "rank_reason": "resource create/delete for config or desired state"
134
+ },
135
+ {
136
+ "kind": "Deployment",
137
+ "apiVersion": "apps/v1",
138
+ "namespace": "shop",
139
+ "name": "catalog",
140
+ "changeType": "add",
141
+ "summary": "add",
142
+ "timestamp": "2026-10-16T04:43:29+03:00",
143
+ "change_category": "lifecycle",
144
+ "rank_reason": "resource create/delete for config or desired state"
145
+ },
146
+ {
147
+ "kind": "Service",
148
+ "apiVersion": "v1",
149
+ "namespace": "shop",
150
+ "name": "catalog",
151
+ "changeType": "add",
152
+ "summary": "add",
153
+ "timestamp": "2026-10-16T04:43:29+03:00",
154
+ "change_category": "lifecycle",
155
+ "rank_reason": "resource create/delete for config or desired state"
156
+ },
157
+ {
158
+ "kind": "Deployment",
159
+ "apiVersion": "apps/v1",
160
+ "namespace": "shop",
161
+ "name": "shipping",
162
+ "changeType": "add",
163
+ "summary": "add",
164
+ "timestamp": "2026-10-16T04:43:28+03:00",
165
+ "change_category": "lifecycle",
166
+ "rank_reason": "resource create/delete for config or desired state"
167
+ },
168
+ {
169
+ "kind": "NetworkPolicy",
170
+ "apiVersion": "networking.k8s.io/v1",
171
+ "namespace": "shop",
172
+ "name": "deny-all",
173
+ "changeType": "add",
174
+ "summary": "add",
175
+ "timestamp": "2026-10-16T04:43:28+03:00",
176
+ "change_category": "lifecycle",
177
+ "rank_reason": "resource create/delete for config or desired state"
178
+ },
179
+ {
180
+ "kind": "Service",
181
+ "apiVersion": "v1",
182
+ "namespace": "shop",
183
+ "name": "shipping",
184
+ "changeType": "add",
185
+ "summary": "add",
186
+ "timestamp": "2026-10-16T04:43:28+03:00",
187
+ "change_category": "lifecycle",
188
+ "rank_reason": "resource create/delete for config or desired state"
189
+ },
190
+ {
191
+ "kind": "ConfigMap",
192
+ "apiVersion": "v1",
193
+ "namespace": "shop",
194
+ "name": "checkout-config",
195
+ "changeType": "add",
196
+ "summary": "add",
197
+ "timestamp": "2026-10-16T04:43:27+03:00",
198
+ "change_category": "lifecycle",
199
+ "rank_reason": "resource create/delete for config or desired state",
200
+ "consumed_by": [
201
+ "Deployment/checkout"
202
+ ]
203
+ },
204
+ {
205
+ "kind": "Deployment",
206
+ "apiVersion": "apps/v1",
207
+ "namespace": "shop",
208
+ "name": "payment",
209
+ "changeType": "add",
210
+ "summary": "add",
211
+ "timestamp": "2026-10-16T04:43:27+03:00",
212
+ "change_category": "lifecycle",
213
+ "rank_reason": "resource create/delete for config or desired state"
214
+ },
215
+ {
216
+ "kind": "Service",
217
+ "apiVersion": "v1",
218
+ "namespace": "shop",
219
+ "name": "payment",
220
+ "changeType": "add",
221
+ "summary": "add",
222
+ "timestamp": "2026-10-16T04:43:27+03:00",
223
+ "change_category": "lifecycle",
224
+ "rank_reason": "resource create/delete for config or desired state"
225
+ },
226
+ {
227
+ "kind": "Deployment",
228
+ "apiVersion": "apps/v1",
229
+ "namespace": "shop",
230
+ "name": "frontend",
231
+ "changeType": "add",
232
+ "summary": "add",
233
+ "timestamp": "2026-10-16T04:43:26+03:00",
234
+ "change_category": "lifecycle",
235
+ "rank_reason": "resource create/delete for config or desired state"
236
+ },
237
+ {
238
+ "kind": "Service",
239
+ "apiVersion": "v1",
240
+ "namespace": "shop",
241
+ "name": "frontend",
242
+ "changeType": "add",
243
+ "summary": "add",
244
+ "timestamp": "2026-10-16T04:43:26+03:00",
245
+ "change_category": "lifecycle",
246
+ "rank_reason": "resource create/delete for config or desired state"
247
+ },
248
+ {
249
+ "kind": "Service",
250
+ "apiVersion": "v1",
251
+ "namespace": "shop",
252
+ "name": "legacy",
253
+ "changeType": "delete",
254
+ "summary": "delete",
255
+ "timestamp": "2026-10-16T04:43:26+03:00",
256
+ "change_category": "lifecycle",
257
+ "rank_reason": "resource create/delete for config or desired state"
258
+ },
259
+ {
260
+ "kind": "Deployment",
261
+ "apiVersion": "apps/v1",
262
+ "namespace": "shop",
263
+ "name": "checkout",
264
+ "changeType": "add",
265
+ "summary": "add",
266
+ "timestamp": "2026-10-16T04:43:25+03:00",
267
+ "change_category": "lifecycle",
268
+ "rank_reason": "resource create/delete for config or desired state"
269
+ },
270
+ {
271
+ "kind": "Service",
272
+ "apiVersion": "v1",
273
+ "namespace": "shop",
274
+ "name": "checkout",
275
+ "changeType": "add",
276
+ "summary": "add",
277
+ "timestamp": "2026-10-16T04:43:25+03:00",
278
+ "change_category": "lifecycle",
279
+ "rank_reason": "resource create/delete for config or desired state"
280
+ },
281
+ {
282
+ "kind": "Deployment",
283
+ "apiVersion": "apps/v1",
284
+ "namespace": "shop",
285
+ "name": "cart",
286
+ "changeType": "add",
287
+ "summary": "add",
288
+ "timestamp": "2026-10-16T04:43:24+03:00",
289
+ "change_category": "lifecycle",
290
+ "rank_reason": "resource create/delete for config or desired state"
291
+ },
292
+ {
293
+ "kind": "Service",
294
+ "apiVersion": "v1",
295
+ "namespace": "shop",
296
+ "name": "cart",
297
+ "changeType": "add",
298
+ "summary": "add",
299
+ "timestamp": "2026-10-16T04:43:24+03:00",
300
+ "change_category": "lifecycle",
301
+ "rank_reason": "resource create/delete for config or desired state"
302
+ },
303
+ {
304
+ "kind": "Deployment",
305
+ "apiVersion": "apps/v1",
306
+ "namespace": "shop",
307
+ "name": "cart",
308
+ "changeType": "update",
309
+ "summary": "ready: 0→1",
310
+ "timestamp": "2026-10-16T04:43:54+03:00",
311
+ "change_category": "runtime_status",
312
+ "rank_reason": "status field changed",
313
+ "fields": [
314
+ {
315
+ "path": "status.readyReplicas",
316
+ "oldValue": 0,
317
+ "newValue": 1
318
+ }
319
+ ]
320
+ }
321
+ ]
322
+ }
323
+ }
@@ -1,13 +1,16 @@
1
1
  import { VISIBLE_LOG_EVIDENCE_LINES } from "../excerpt";
2
- import { useContext } from "react";
2
+ import { Fragment, useContext } from "react";
3
3
  import {
4
+ AlertBanner,
4
5
  Badge,
5
6
  DiffViewer,
6
7
  TerminalBlock,
7
8
  formatRelativeAgeTime,
9
+ pluralize,
8
10
  ResourceLink,
9
11
  stripAnsi,
10
12
  } from "@skyhook-io/k8s-ui";
13
+ import { builtinGroupForKind } from "@skyhook-io/k8s-ui/utils/api-resources";
11
14
  import { apiVersionToGroup } from "../../../../utils/navigation";
12
15
  import { Tooltip } from "../../../ui/Tooltip";
13
16
  import { EvidenceNavigationContext } from "../navigation";
@@ -133,6 +136,49 @@ export function EventsBody({ data }: { data: EvidenceDataOf<"events"> }) {
133
136
  );
134
137
  }
135
138
 
139
+ // The producer caps consumed_by and running_previous_value.workloads at five
140
+ // (maxConsumersPerEntry), so a full list may not be the whole set.
141
+ const REFERENCE_LIST_CAP = 5;
142
+
143
+ function ChangeReferences({
144
+ references,
145
+ namespace,
146
+ }: {
147
+ references: string[];
148
+ namespace?: string;
149
+ }) {
150
+ const { onOpenResource } = useContext(EvidenceNavigationContext);
151
+ return references.map((reference) => {
152
+ const slash = reference.indexOf("/");
153
+ const kind = reference.slice(0, slash);
154
+ const name = reference.slice(slash + 1);
155
+ // The producer names only Kind/name, so a link is safe only for kinds
156
+ // whose group is known and a row with a namespace; a CRD owner such as a
157
+ // CNPG Cluster stays text.
158
+ const group =
159
+ kind === "Rollout" ? "argoproj.io" : builtinGroupForKind(kind);
160
+ return (
161
+ <span
162
+ key={reference}
163
+ className="min-w-0 max-w-full font-mono [overflow-wrap:anywhere]"
164
+ >
165
+ {group === undefined || !namespace ? (
166
+ reference
167
+ ) : (
168
+ <ResourceLink
169
+ name={name}
170
+ kind={kind}
171
+ namespace={namespace}
172
+ group={group}
173
+ label={reference}
174
+ onNavigate={onOpenResource}
175
+ />
176
+ )}
177
+ </span>
178
+ );
179
+ });
180
+ }
181
+
136
182
  export function ChangesBody({ data }: { data: EvidenceDataOf<"changes"> }) {
137
183
  const { onOpenResource } = useContext(EvidenceNavigationContext);
138
184
  return (
@@ -145,13 +191,13 @@ export function ChangesBody({ data }: { data: EvidenceDataOf<"changes"> }) {
145
191
  {data.changes.map((change, index) => (
146
192
  <div
147
193
  key={`${change.kind}-${change.namespace ?? ""}-${change.name}-${change.timestamp}-${index}`}
148
- className="rounded-md border border-theme-border/70 bg-theme-base/30 p-2.5"
194
+ className="min-w-0 rounded-md border border-theme-border/70 bg-theme-base/30 p-2.5 [overflow-wrap:anywhere]"
149
195
  >
150
196
  <div className="flex flex-wrap items-center gap-1.5">
151
197
  <Badge tone="structural" size="sm">
152
198
  {change.kind}
153
199
  </Badge>
154
- <span className="font-mono text-xs">
200
+ <span className="min-w-0 max-w-full font-mono text-xs">
155
201
  <ResourceLink
156
202
  name={change.name}
157
203
  kind={change.kind}
@@ -172,25 +218,108 @@ export function ChangesBody({ data }: { data: EvidenceDataOf<"changes"> }) {
172
218
  <Badge tone="note" size="sm">
173
219
  {change.changeType.replaceAll("_", " ")}
174
220
  </Badge>
175
- <Tooltip
176
- content={new Date(change.timestamp).toLocaleString()}
177
- delay={150}
178
- position="left"
179
- wrapperClassName="ml-auto"
180
- >
181
- <time
182
- dateTime={change.timestamp}
183
- className="text-xs text-theme-text-tertiary"
221
+ <div className="ml-auto flex min-w-0 flex-wrap items-center gap-1.5">
222
+ {(change.updates_in_window ?? 0) > 1 ? (
223
+ <Badge
224
+ tone="structural"
225
+ size="sm"
226
+ className="max-w-full whitespace-normal"
227
+ >
228
+ {change.updates_in_window} updates
229
+ {change.first_update_at
230
+ ? `, first ${formatRelativeAgeTime(change.first_update_at)}`
231
+ : ""}
232
+ </Badge>
233
+ ) : null}
234
+ <Tooltip
235
+ content={new Date(change.timestamp).toLocaleString()}
236
+ delay={150}
237
+ position="left"
184
238
  >
185
- {formatRelativeAgeTime(change.timestamp)}
186
- </time>
187
- </Tooltip>
239
+ <time
240
+ dateTime={change.timestamp}
241
+ className="text-xs text-theme-text-tertiary"
242
+ >
243
+ {formatRelativeAgeTime(change.timestamp)}
244
+ </time>
245
+ </Tooltip>
246
+ </div>
188
247
  </div>
189
248
  {change.summary ? (
190
249
  <p className="mt-1.5 text-xs text-theme-text-secondary">
191
250
  {change.summary}
192
251
  </p>
193
252
  ) : null}
253
+ {change.running_previous_value ? (
254
+ <AlertBanner
255
+ variant="warning"
256
+ className="mt-2"
257
+ title={`${pluralize(change.running_previous_value.pods, "Pod")} likely still ${change.running_previous_value.pods === 1 ? "holds" : "hold"} the earlier value`}
258
+ >
259
+ <div className="mt-1 space-y-1.5 text-xs text-theme-text-secondary">
260
+ <p>
261
+ Changed keys read as env:{" "}
262
+ {change.running_previous_value.keys.map((key, keyIndex) => (
263
+ <Fragment key={key}>
264
+ {keyIndex > 0 ? ", " : null}
265
+ <Badge
266
+ tone="structural"
267
+ size="sm"
268
+ className="max-w-full whitespace-normal font-mono [overflow-wrap:anywhere]"
269
+ >
270
+ {key}
271
+ </Badge>
272
+ </Fragment>
273
+ ))}
274
+ </p>
275
+ {(change.running_previous_value.workloads ?? []).length > 0 ? (
276
+ <div className="flex min-w-0 flex-wrap gap-x-2 gap-y-1">
277
+ <span>In workloads you can view:</span>
278
+ <ChangeReferences
279
+ references={change.running_previous_value.workloads ?? []}
280
+ namespace={change.namespace}
281
+ />
282
+ {(change.running_previous_value.workloads ?? []).length >=
283
+ REFERENCE_LIST_CAP ? (
284
+ <span>(first {REFERENCE_LIST_CAP})</span>
285
+ ) : null}
286
+ {change.running_previous_value.withheld ? (
287
+ <span>
288
+ +{change.running_previous_value.withheld.count} more
289
+ you can&apos;t view
290
+ </span>
291
+ ) : null}
292
+ </div>
293
+ ) : (
294
+ <p>
295
+ {change.running_previous_value.withheld
296
+ ? `In ${pluralize(change.running_previous_value.withheld.count, "workload")} you can't view`
297
+ : "workload names hidden by your permissions"}
298
+ </p>
299
+ )}
300
+ <p>{change.running_previous_value.note}</p>
301
+ </div>
302
+ </AlertBanner>
303
+ ) : null}
304
+ {change.consumed_by?.length || change.consumed_by_withheld ? (
305
+ <div className="mt-1.5 flex min-w-0 flex-wrap gap-x-2 gap-y-1 text-xs text-theme-text-secondary">
306
+ <span>Referenced by</span>
307
+ <ChangeReferences
308
+ references={change.consumed_by ?? []}
309
+ namespace={change.namespace}
310
+ />
311
+ {(change.consumed_by?.length ?? 0) >= REFERENCE_LIST_CAP ? (
312
+ <span>(first {REFERENCE_LIST_CAP})</span>
313
+ ) : null}
314
+ {change.consumed_by_withheld ? (
315
+ <span>
316
+ {change.consumed_by?.length
317
+ ? `+${change.consumed_by_withheld.count} more you can't view`
318
+ : `${pluralize(change.consumed_by_withheld.count, "workload")} you can't view`}
319
+ </span>
320
+ ) : null}
321
+ </div>
322
+ ) : null}
194
323
  {change.fields?.length ? (
195
324
  <div className="mt-2">
196
325
  <DiffViewer
@@ -182,6 +182,7 @@ const INVESTIGATION_RESULT_LABELS: Readonly<Record<string, string>> = {
182
182
  get_neighborhood: "Relationships",
183
183
  get_topology: "Topology",
184
184
  get_workload_logs: "Workload logs",
185
+ wait_for: "Wait",
185
186
  get_prometheus_rules: "Alert rules",
186
187
  get_helm_release: "Helm release",
187
188
  get_subject_permissions: "Permissions",
@@ -700,6 +701,11 @@ export function addResourceObservation(
700
701
  : warnings.length > 0
701
702
  ? "warning"
702
703
  : "neutral";
704
+ // A Pod/template difference is listed with the warnings but does not set
705
+ // the tone: admission defaults (LimitRange, injected sidecars) produce it on
706
+ // healthy Pods.
707
+ const divergence = templateDivergenceWarning(context);
708
+ if (divergence) warnings = [...warnings, divergence];
703
709
  const namespace = resource.metadata.namespace;
704
710
  const identity = `${resource.apiVersion}:${resource.kind}:${namespace ?? ""}:${resource.metadata.name}`;
705
711
  builder.observe(identity, "resource", source, {
@@ -724,6 +730,20 @@ export function addResourceObservation(
724
730
  });
725
731
  addResourceContextLimitations(builder, source, context);
726
732
  }
733
+ // The live Pod spec differing from its template is context, not a fault, so
734
+ // it reads as a line on the resource card rather than a finding of its own.
735
+ function templateDivergenceWarning(
736
+ context: InvestigationResourceContext | undefined,
737
+ ): string | undefined {
738
+ const divergence = context?.templateDivergence;
739
+ const first = divergence?.differences?.[0];
740
+ if (!divergence || !nonEmptyString(first)) return undefined;
741
+ const scope = divergence.examplePod
742
+ ? `${divergence.podsDiffering} of ${divergence.podsCompared} compared Pods${divergence.podsCapped ? " (the most recent)" : ""} differ from their template${divergence.podsNotCompared ? `, ${divergence.podsNotCompared} more not compared` : ""}`
743
+ : "Live Pod spec differs from its template";
744
+ const more = divergence.differences.length > 1 ? " (and more)" : "";
745
+ return `${scope}: ${first}${more}`;
746
+ }
727
747
  export function addIssueObservation(
728
748
  builder: ProjectionBuilder,
729
749
  source: InvestigationEvidenceSource,
@@ -2,6 +2,7 @@ import {
2
2
  type Issue,
3
3
  type IssueRecentChange,
4
4
  stripAnsi,
5
+ type IssueWithheld,
5
6
  } from "@skyhook-io/k8s-ui";
6
7
  import { type TimeSeries } from "@skyhook-io/k8s-ui/components/charts";
7
8
  import {
@@ -186,7 +187,62 @@ export function recentChange(value: unknown): IssueRecentChange | undefined {
186
187
  ) {
187
188
  return undefined;
188
189
  }
189
- return candidate as unknown as IssueRecentChange;
190
+ const {
191
+ running_previous_value,
192
+ updates_in_window,
193
+ first_update_at,
194
+ consumed_by,
195
+ consumed_by_withheld,
196
+ ...change
197
+ } = candidate;
198
+ const running = record(running_previous_value);
199
+ const workloads =
200
+ running?.workloads === null ? [] : stringArray(running?.workloads);
201
+ const keys = stringArray(running?.keys);
202
+ const consumers = stringArray(consumed_by);
203
+ const runningWithheld = withheld(running?.withheld);
204
+ const consumersWithheld = withheld(consumed_by_withheld);
205
+ return {
206
+ ...change,
207
+ ...(running &&
208
+ workloads &&
209
+ keys &&
210
+ nonNegativeInteger(running.pods) &&
211
+ typeof running.note === "string"
212
+ ? {
213
+ running_previous_value: {
214
+ workloads,
215
+ ...(runningWithheld ? { withheld: runningWithheld } : {}),
216
+ pods: running.pods,
217
+ keys,
218
+ note: running.note,
219
+ },
220
+ }
221
+ : {}),
222
+ ...(nonNegativeInteger(updates_in_window) && updates_in_window > 0
223
+ ? { updates_in_window }
224
+ : {}),
225
+ ...(typeof first_update_at === "string" &&
226
+ Number.isFinite(Date.parse(first_update_at))
227
+ ? { first_update_at }
228
+ : {}),
229
+ ...(consumers ? { consumed_by: consumers } : {}),
230
+ ...(consumersWithheld ? { consumed_by_withheld: consumersWithheld } : {}),
231
+ } as unknown as IssueRecentChange;
232
+ }
233
+
234
+ // withheld keeps a well-formed {count, reason} marker; anything else drops it.
235
+ function withheld(value: unknown): IssueWithheld | undefined {
236
+ const candidate = record(value);
237
+ if (
238
+ !candidate ||
239
+ !nonNegativeInteger(candidate.count) ||
240
+ candidate.count === 0 ||
241
+ !nonEmptyString(candidate.reason)
242
+ ) {
243
+ return undefined;
244
+ }
245
+ return { count: candidate.count, reason: candidate.reason };
190
246
  }
191
247
  export function diagnosisChangeContext(
192
248
  value: unknown,