@skyhook-io/radar-app 1.22.2 → 1.23.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 (228) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +49 -13
  3. package/src/RadarApp.basename.test.tsx +177 -0
  4. package/src/RadarApp.settings.test.tsx +33 -0
  5. package/src/api/agentSandbox.ts +259 -0
  6. package/src/api/client.autoPromConnect.test.tsx +43 -0
  7. package/src/api/client.metricsRelayCheck.test.tsx +134 -0
  8. package/src/api/client.ts +151 -27
  9. package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
  10. package/src/api/cloudInstallDiscover.test.tsx +76 -0
  11. package/src/api/diagnose.ts +4 -0
  12. package/src/api/kagent.test.ts +82 -0
  13. package/src/api/kagent.ts +230 -0
  14. package/src/api/poll.ts +78 -0
  15. package/src/api/prometheusCharts.ts +5 -0
  16. package/src/api/radarFeatures.test.ts +9 -0
  17. package/src/api/radarFeatures.ts +16 -0
  18. package/src/api/substrateWorkspace.test.ts +72 -0
  19. package/src/api/substrateWorkspace.ts +1394 -0
  20. package/src/api/vulnerabilities.ts +207 -9
  21. package/src/api/workloadSource.test.tsx +315 -0
  22. package/src/api/workloadSource.ts +128 -12
  23. package/src/components/CloudConnectFlow.tsx +46 -7
  24. package/src/components/CloudFunnelButton.test.tsx +193 -7
  25. package/src/components/CloudFunnelButton.tsx +128 -32
  26. package/src/components/SelfManagedStart.tsx +12 -2
  27. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  28. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  29. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  30. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  31. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  32. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  33. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  34. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  35. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  36. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  37. package/src/components/agentsandbox/data.ts +135 -0
  38. package/src/components/agentsandbox/host.test.ts +27 -0
  39. package/src/components/agentsandbox/host.tsx +85 -0
  40. package/src/components/agentsandbox/labels.test.ts +42 -0
  41. package/src/components/agentsandbox/labels.ts +146 -0
  42. package/src/components/agentsandbox/listFilters.ts +85 -0
  43. package/src/components/agentsandbox/lists.ts +52 -0
  44. package/src/components/agentsandbox/routes.ts +23 -0
  45. package/src/components/agentsandbox/shared.tsx +321 -0
  46. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  47. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  48. package/src/components/agentsandbox/workspace.tsx +258 -0
  49. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  50. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  51. package/src/components/applications/ApplicationsView.tsx +156 -3
  52. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  53. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  54. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  55. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  56. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  57. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  58. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  59. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  60. package/src/components/cloudHints/cloudHints.ts +131 -0
  61. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  62. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  63. package/src/components/cloudHints/cloudLinks.ts +31 -0
  64. package/src/components/cloudHints/hintStorage.ts +28 -0
  65. package/src/components/cnpg/CNPGView.tsx +4 -7
  66. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  67. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  68. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  69. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  70. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  71. package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
  72. package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
  73. package/src/components/helm/HelmView.tsx +4 -3
  74. package/src/components/helm/ObservedHelmNotice.tsx +39 -17
  75. package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
  76. package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
  77. package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
  78. package/src/components/home/HomeAgentBlock.tsx +2 -0
  79. package/src/components/home/HomeView.tsx +3 -3
  80. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  81. package/src/components/home/MCPSetupDialog.tsx +6 -2
  82. package/src/components/home/McpCloudLine.test.tsx +162 -0
  83. package/src/components/home/McpCloudLine.tsx +95 -0
  84. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  85. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  86. package/src/components/home/mcpToolCatalog.ts +4 -4
  87. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  88. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  89. package/src/components/issues/IssuesPane.tsx +181 -23
  90. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  91. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  92. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  93. package/src/components/issues/sinceLastVisit.ts +439 -0
  94. package/src/components/issues/uncheckedSources.test.ts +8 -0
  95. package/src/components/issues/uncheckedSources.ts +3 -0
  96. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  97. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  98. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  99. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  100. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  101. package/src/components/kagent/KagentLists.tsx +412 -0
  102. package/src/components/kagent/KagentOverview.tsx +234 -0
  103. package/src/components/kagent/KagentPages.tsx +690 -0
  104. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  105. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  106. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  107. package/src/components/kagent/KagentView.tsx +109 -0
  108. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  109. package/src/components/kagent/host.tsx +144 -0
  110. package/src/components/kagent/routes.ts +31 -0
  111. package/src/components/kagent/shared.tsx +336 -0
  112. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  113. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  114. package/src/components/kagent/workspace.fixtures.ts +108 -0
  115. package/src/components/kagent/workspaceRoute.ts +18 -0
  116. package/src/components/nudges/activeNudges.test.ts +39 -0
  117. package/src/components/nudges/activeNudges.ts +76 -0
  118. package/src/components/poll/OssPoll.tsx +871 -0
  119. package/src/components/poll/mount.test.ts +12 -0
  120. package/src/components/poll/pollCloud.test.ts +23 -0
  121. package/src/components/poll/pollCloud.ts +6 -0
  122. package/src/components/poll/pollDefinition.ts +93 -0
  123. package/src/components/poll/pollFlow.test.ts +140 -0
  124. package/src/components/poll/pollFlow.ts +137 -0
  125. package/src/components/poll/pollSender.test.ts +137 -0
  126. package/src/components/poll/pollSender.ts +76 -0
  127. package/src/components/poll/pollStorage.test.ts +53 -0
  128. package/src/components/poll/pollStorage.ts +77 -0
  129. package/src/components/poll/round.json +350 -0
  130. package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
  131. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  132. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  133. package/src/components/resource/PrometheusCharts.tsx +10 -1
  134. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  135. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  136. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  137. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  138. package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
  139. package/src/components/resources/ImageFilesystemModal.tsx +42 -3
  140. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  141. package/src/components/resources/ResourcesView.tsx +24 -11
  142. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  143. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  144. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  145. package/src/components/settings/SettingsDialog.tsx +84 -16
  146. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  147. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  148. package/src/components/settings/SubstrateSettings.tsx +544 -0
  149. package/src/components/settings/settings-state.test.ts +21 -3
  150. package/src/components/settings/settings-state.ts +13 -3
  151. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  152. package/src/components/share/ShareLinkButton.tsx +391 -0
  153. package/src/components/share/openShareInCloud.test.ts +29 -0
  154. package/src/components/share/openShareInCloud.ts +10 -0
  155. package/src/components/share/shareLink.test.ts +129 -0
  156. package/src/components/share/shareLink.ts +175 -0
  157. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  158. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  159. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  160. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  161. package/src/components/substrate/SubstrateActors.tsx +612 -0
  162. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  163. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  164. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  165. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  166. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  167. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  168. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  169. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  170. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  171. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  172. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  173. package/src/components/substrate/SubstrateView.tsx +173 -0
  174. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  175. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  176. package/src/components/substrate/attention.ts +81 -0
  177. package/src/components/substrate/contextPin.tsx +69 -0
  178. package/src/components/substrate/host.tsx +83 -0
  179. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  180. package/src/components/substrate/readings.test.ts +484 -0
  181. package/src/components/substrate/readings.ts +997 -0
  182. package/src/components/substrate/routes.ts +103 -0
  183. package/src/components/substrate/shared.tsx +426 -0
  184. package/src/components/substrate/substrate.fixtures.ts +325 -0
  185. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  186. package/src/components/substrate/workspaceRoute.ts +23 -0
  187. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  188. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  189. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  190. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  191. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  192. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  193. package/src/components/traffic/TrafficGraph.tsx +17 -14
  194. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  195. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  196. package/src/components/traffic/TrafficView.tsx +26 -56
  197. package/src/components/traffic/trafficFilters.test.ts +61 -1
  198. package/src/components/traffic/trafficFilters.ts +68 -8
  199. package/src/components/ui/UpdateNotification.tsx +2 -0
  200. package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
  201. package/src/components/velero/VeleroOverview.tsx +2 -2
  202. package/src/components/velero/VeleroView.tsx +3 -6
  203. package/src/components/vulnerabilities/columns.tsx +132 -0
  204. package/src/components/vulnerabilities/filters.tsx +317 -0
  205. package/src/components/vulnerabilities/owner.test.ts +54 -0
  206. package/src/components/vulnerabilities/owner.tsx +163 -0
  207. package/src/components/vulnerabilities/parts.test.ts +126 -12
  208. package/src/components/vulnerabilities/parts.tsx +612 -52
  209. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  210. package/src/components/vulnerabilities/traffic.tsx +40 -0
  211. package/src/components/whats-new/WhatsNew.tsx +2 -0
  212. package/src/components/whats-new/releaseNotes.ts +75 -1
  213. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  214. package/src/components/workload/WorkloadView.tsx +52 -13
  215. package/src/components/workspace/layout.tsx +13 -7
  216. package/src/components/workspace/sidebar.test.ts +48 -0
  217. package/src/components/workspace/sidebar.ts +73 -3
  218. package/src/components/workspace/table.ts +2 -1
  219. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  220. package/src/contexts/RegistryAccessMode.tsx +25 -0
  221. package/src/integrations/resourceHost.ts +12 -6
  222. package/src/integrations/resourceHosts.test.tsx +27 -1
  223. package/src/integrations/resourceHosts.tsx +15 -7
  224. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  225. package/src/integrations/sidebarWorkspaces.ts +41 -0
  226. package/src/integrations/workspaceRoute.ts +1 -1
  227. package/src/integrations/workspaceRoutes.ts +7 -1
  228. package/src/integrations/workspaceScreens.tsx +6 -0
@@ -3,13 +3,20 @@ import { act, useEffect } from 'react'
3
3
  import { createRoot } from 'react-dom/client'
4
4
  import { MemoryRouter, useLocation, useNavigationType } from 'react-router-dom'
5
5
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
6
- import { afterEach, beforeEach, expect, it, vi } from 'vitest'
7
- import { ToastProvider, workloadKey, type AppHistory, type AppRow, type AppWorkload, type SelectedResource } from '@skyhook-io/k8s-ui'
6
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
7
+ import { ToastProvider, workloadKey, type AppHistory, type AppRow, type AppWorkload, type FeatureCapabilities, type SelectedResource } from '@skyhook-io/k8s-ui'
8
+ import { radarFeatureSupport, type RadarFeature } from '../../api/radarFeatures'
8
9
  import { ApplicationsView } from './ApplicationsView'
9
10
 
10
11
  let apps: AppRow[] = []
11
12
  const idle = { data: undefined, isLoading: false, isFetching: false, isPending: false, isSuccess: false, isError: false, error: null }
12
13
  let history: Omit<typeof idle, 'data'> & { data?: AppHistory }
14
+ let timelineMode: 'local' | 'retained' = 'local'
15
+ let capabilities: { features?: FeatureCapabilities } | undefined = { features: { workloadSource: true, runningCodeHistory: true } }
16
+ const historyReads: Array<{ kind: string; name: string }> = []
17
+ let workloadHistory: unknown = undefined
18
+ let timelineEvents: unknown[] = []
19
+ let workloadSourceHandler: ((targets: Array<{ kind: string; group?: string; namespace: string; name: string }>) => Map<string, unknown> | null) | null = null
13
20
 
14
21
  vi.mock('../../api/client', () => ({
15
22
  useApplications: () => ({ ...idle, data: { applications: apps }, isSuccess: true, dataUpdatedAt: 0, refetch: () => {} }),
@@ -17,11 +24,24 @@ vi.mock('../../api/client', () => ({
17
24
  useGitOpsTree: () => idle,
18
25
  useHelmRelease: () => idle,
19
26
  useIssues: () => idle,
27
+ useRadarFeature: (feature: RadarFeature) => ({ support: radarFeatureSupport(feature, capabilities, undefined) }),
28
+ useWorkloadHistory: (kind: string, _ns: string, name: string, _group?: string, enabled?: boolean) => {
29
+ if (enabled) historyReads.push({ kind, name })
30
+ return { ...idle, data: enabled ? workloadHistory : undefined, isSuccess: Boolean(enabled && workloadHistory !== undefined) }
31
+ },
20
32
  useTopology: () => idle,
21
33
  }))
34
+ vi.mock('../../api/workloadSource', () => ({
35
+ supportsWorkloadSource: () => true,
36
+ useWorkloadSources: (targets: Array<{ kind: string; group?: string; namespace: string; name: string }>) =>
37
+ workloadSourceHandler ? workloadSourceHandler(targets) : null,
38
+ WORKLOAD_SOURCES_MAX: 24,
39
+ workloadSourceTargetKey: (t: { kind: string; group?: string; namespace: string; name: string }) =>
40
+ `${(t.group ?? '').toLowerCase()}/${t.kind.toLowerCase()}/${t.namespace}/${t.name}`,
41
+ }))
22
42
  vi.mock('../../context/ConnectionContext', () => ({ useConnection: () => ({ connection: { state: 'connected', context: 'test' } }) }))
23
43
  vi.mock('../../context/TimelineSource', () => ({
24
- useTimelineSource: () => ({ capabilities: { mode: 'local' }, useEvents: () => ({ data: [], isLoading: false, isError: false }) }),
44
+ useTimelineSource: () => ({ capabilities: { mode: timelineMode }, useEvents: () => ({ data: timelineEvents, isLoading: false, isError: false }) }),
25
45
  }))
26
46
  // The workload view's own content is out of scope here: the stub stands in for
27
47
  // any resource the user clicks inside it (a config chip or a topology node).
@@ -61,6 +81,12 @@ function LocationProbe() {
61
81
 
62
82
  beforeEach(() => {
63
83
  history = idle
84
+ timelineMode = 'local'
85
+ capabilities = { features: { workloadSource: true, runningCodeHistory: true } }
86
+ historyReads.length = 0
87
+ workloadHistory = undefined
88
+ timelineEvents = []
89
+ workloadSourceHandler = null
64
90
  vi.stubGlobal('matchMedia', () => ({ matches: false, addEventListener: () => {}, removeEventListener: () => {} }))
65
91
  container = document.createElement('div')
66
92
  document.body.appendChild(container)
@@ -242,3 +268,222 @@ it('keeps Deploys and explains a partial source lookup until a complete response
242
268
  expect(new URLSearchParams(location.split('?')[1]).has('view')).toBe(false)
243
269
  expect(container.querySelector('[role="tab"][aria-selected="true"]')?.textContent).toBe('Overview')
244
270
  })
271
+
272
+ it('keeps the Environments panel past the code read limit and says why code is not compared', async () => {
273
+ const names = Array.from({ length: 13 }, (_, i) => `svc-${i}`)
274
+ const env = (envName: string): AppRow => ({
275
+ ...app(`shop-${envName}/shop`, names),
276
+ name: `shop-${envName}`,
277
+ identity: { key: 'shop', env: envName, confidence: 'high', evidence: 'test' },
278
+ })
279
+ apps = [env('staging'), env('prod')]
280
+ await renderAt('/applications?app=shop-staging%2Fshop')
281
+ const text = container.textContent ?? ''
282
+ expect(text).toContain('13 workloads')
283
+ expect(text).toContain("Code isn't compared for apps with more than 24 workloads across environments.")
284
+ })
285
+
286
+ it('says nothing about the read limit while workload source support is not yet known', async () => {
287
+ capabilities = undefined
288
+ const names = Array.from({ length: 13 }, (_, i) => `svc-${i}`)
289
+ const env = (envName: string): AppRow => ({
290
+ ...app(`shop-${envName}/shop`, names),
291
+ name: `shop-${envName}`,
292
+ identity: { key: 'shop', env: envName, confidence: 'high', evidence: 'test' },
293
+ })
294
+ apps = [env('staging'), env('prod')]
295
+ await renderAt('/applications?app=shop-staging%2Fshop')
296
+ expect(container.textContent).not.toContain("Code isn't compared")
297
+ })
298
+
299
+ it('dates the Deploys history start from the oldest Deployment, StatefulSet or DaemonSet, and not on a retained store', async () => {
300
+ const job: AppWorkload = { kind: 'Job', group: 'batch', namespace: 'shop', name: 'migrate', health: 'healthy', ready: 1, desired: 1, restarts: 0 }
301
+ const newer = { ...deployment('worker'), creationTimestamp: '2026-11-23T12:00:00Z' }
302
+ const older = { ...deployment('web'), creationTimestamp: '2026-11-20T12:00:00Z' }
303
+ apps = [{ ...app('shop/app', []), workloads: [job, newer, older] }]
304
+ await renderAt('/applications?app=shop%2Fapp&view=deploys')
305
+ expect(historyReads.length).toBeGreaterThan(0)
306
+ expect(historyReads.every((r) => r.kind === 'deployments' && r.name === 'web')).toBe(true)
307
+
308
+ historyReads.length = 0
309
+ apps = [{ ...app('shop/jobs', []), workloads: [job] }]
310
+ await renderAt('/applications?app=shop%2Fjobs&view=deploys')
311
+ expect(historyReads).toHaveLength(0)
312
+
313
+ timelineMode = 'retained'
314
+ apps = [app('shop/app2', ['web'])]
315
+ await renderAt('/applications?app=shop%2Fapp2&view=deploys')
316
+ expect(historyReads).toHaveLength(0)
317
+ })
318
+
319
+ it('ignores an unparseable creationTimestamp when picking the oldest Deploys boundary workload', async () => {
320
+ const unparseable = { ...deployment('worker'), creationTimestamp: 'not-a-date' }
321
+ const valid = { ...deployment('web'), creationTimestamp: '2026-11-20T12:00:00Z' }
322
+ apps = [{ ...app('shop/app', []), workloads: [unparseable, valid] }]
323
+ await renderAt('/applications?app=shop%2Fapp&view=deploys')
324
+ expect(historyReads.length).toBeGreaterThan(0)
325
+ expect(historyReads.every((r) => r.kind === 'deployments' && r.name === 'web')).toBe(true)
326
+ })
327
+
328
+ it('says the Deploys divider\'s earlier changes come from ReplicaSet history only when rebuilt rows are listed', async () => {
329
+ const now = Date.now()
330
+ const since = new Date(now - 2 * 3600_000).toISOString()
331
+ workloadHistory = { historyCoverage: { incomplete: true, complete_since: since, reasons: ['observation_started_late'] } }
332
+ const code = (id: string, hoursAgo: number, reconstructed: boolean) => ({
333
+ id, timestamp: new Date(now - hoursAgo * 3600_000).toISOString(), source: 'informer', kind: 'Deployment', apiVersion: 'apps/v1',
334
+ namespace: 'shop', name: 'web', eventType: 'update', reason: 'RunningCodeChanged',
335
+ diff: { summary: '', fields: [{ path: 'running.app', oldValue: [{ digest: 'r@sha256:1', image: 'r/web:v1' }], newValue: { digest: 'r@sha256:2', image: 'r/web:v2', ...(reconstructed ? { reconstructed: true } : {}) } }] },
336
+ })
337
+ // Two workloads, so Deploys is the application's view rather than a workload tab.
338
+ const gitopsApp = (): AppRow => ({ ...app('shop/web', ['web', 'worker']), sourceRef: { type: 'gitops', tool: 'argocd', kind: 'Application', namespace: 'argocd', name: 'web' } })
339
+
340
+ apps = [gitopsApp()]
341
+ timelineEvents = [code('new', 1, false), code('old', 3, false)]
342
+ await renderAt('/applications?app=shop%2Fweb&view=deploys')
343
+ const divider = () => container.querySelector('[data-history-boundary]')?.textContent ?? ''
344
+ expect(divider()).toMatch(/^Radar started recording code changes at .+ · earlier code changes may be missing$/)
345
+
346
+ timelineEvents = [code('new', 1, false), code('rebuilt', 3, true)]
347
+ await renderAt('/applications?app=shop%2Fweb&view=deploys')
348
+ expect(divider()).toMatch(/· earlier ones come only from ReplicaSet history$/)
349
+ })
350
+
351
+ describe('Deploys recording boundary and code notes', () => {
352
+ const now = Date.now()
353
+ const hoursAgo = (h: number) => new Date(now - h * 3600_000).toISOString()
354
+ const dated = (h: number) => ({ historyCoverage: { incomplete: true, complete_since: hoursAgo(h), reasons: ['observation_started_late'] } })
355
+ const sync = (h: number, rev: string) => ({ type: 'gitops' as const, title: 'Argo CD sync', revision: rev.repeat(40), timestamp: hoursAgo(h), status: 'Succeeded', id: rev })
356
+ const gitopsApp = (workloads: AppWorkload[]): AppRow => ({
357
+ ...app('shop/web', []), workloads,
358
+ sourceRef: { type: 'gitops', tool: 'argocd', kind: 'Application', namespace: 'argocd', name: 'web' },
359
+ })
360
+ const notes = () => [...container.querySelectorAll('[data-code-note]')].map((n) => n.getAttribute('data-code-note'))
361
+ const withDeliveries = () => {
362
+ history = { ...idle, isSuccess: true, data: { appKey: 'shop/web', sourceRef: { type: 'gitops', tool: 'argocd', kind: 'Application', namespace: 'argocd', name: 'web' }, anchors: [sync(2, 'a'), sync(10, 'b')] } as AppHistory }
363
+ }
364
+
365
+ it('never claims running code unchanged, and drives divider and "code not recorded" from the same boundary', async () => {
366
+ withDeliveries()
367
+ workloadHistory = dated(5)
368
+ apps = [gitopsApp([deployment('web'), deployment('worker')])]
369
+ await renderAt('/applications?app=shop%2Fweb&view=deploys')
370
+ expect(notes()).toEqual(['not_recorded'])
371
+ expect(container.textContent).not.toContain('running code unchanged')
372
+ expect(container.querySelector('[data-history-boundary]')).not.toBeNull()
373
+ })
374
+
375
+ it('shows neither divider nor "code not recorded" when no dated boundary is known (including on a retained store)', async () => {
376
+ withDeliveries()
377
+ workloadHistory = {}
378
+ apps = [gitopsApp([deployment('web'), deployment('worker')])]
379
+ await renderAt('/applications?app=shop%2Fweb&view=deploys')
380
+ expect(notes()).toEqual([])
381
+ expect(container.querySelector('[data-history-boundary]')).toBeNull()
382
+
383
+ historyReads.length = 0
384
+ timelineMode = 'retained'
385
+ history = { ...history, data: { ...history.data!, anchors: [sync(2, 'a'), sync(24 * 8, 'b')] } }
386
+ await renderAt('/applications?app=shop%2Fweb&view=deploys')
387
+ expect(historyReads).toHaveLength(0)
388
+ expect(notes()).toEqual([])
389
+ expect(container.querySelector('[data-history-boundary]')).toBeNull()
390
+ })
391
+
392
+ it('suppresses the code-change divider and delivery code labels when runningCodeHistory is absent or false, while still rendering code rows', async () => {
393
+ const argoCode = {
394
+ id: 'code-1',
395
+ timestamp: new Date(now - 2 * 3600_000 + 30_000).toISOString(),
396
+ source: 'informer',
397
+ kind: 'Deployment',
398
+ apiVersion: 'apps/v1',
399
+ namespace: 'shop',
400
+ name: 'web',
401
+ eventType: 'update',
402
+ reason: 'RunningCodeChanged',
403
+ diff: {
404
+ summary: '',
405
+ fields: [{
406
+ path: 'running.app',
407
+ oldValue: [{ digest: 'r@sha256:1', image: 'r/web:v1' }],
408
+ newValue: { digest: 'r@sha256:2', image: 'r/web:v2', setBy: { manager: 'argocd-controller' } },
409
+ }],
410
+ },
411
+ }
412
+ withDeliveries()
413
+ workloadHistory = dated(5)
414
+ timelineEvents = [argoCode]
415
+ apps = [gitopsApp([deployment('web'), deployment('worker')])]
416
+
417
+ // Flag true: divider, "shipped code", and "code not recorded" all render.
418
+ capabilities = { features: { runningCodeHistory: true } }
419
+ await renderAt('/applications?app=shop%2Fweb&view=deploys')
420
+ expect(container.querySelector('[data-history-boundary]')).not.toBeNull()
421
+ expect(notes()).toEqual(['shipped', 'not_recorded'])
422
+ expect(container.querySelector('[data-code-change-badge]')).not.toBeNull()
423
+
424
+ // Flag absent, false, or capabilities still loading: no divider, no delivery
425
+ // code labels, no boundary-only workload history fetch, and any code rows still render.
426
+ for (const caps of [{ features: {} }, { features: { runningCodeHistory: false } }, undefined]) {
427
+ historyReads.length = 0
428
+ capabilities = caps
429
+ await renderAt('/applications?app=shop%2Fweb&view=deploys')
430
+ expect(container.querySelector('[data-history-boundary]')).toBeNull()
431
+ expect(notes()).toEqual([])
432
+ expect(container.textContent).not.toContain('code not recorded')
433
+ expect(container.textContent).not.toContain('shipped code')
434
+ expect(historyReads).toHaveLength(0)
435
+ expect(container.querySelector('[data-code-change-badge]')).not.toBeNull()
436
+ }
437
+ })
438
+ })
439
+
440
+ describe('over-24 targets across environments fallback', () => {
441
+ it('still reads the viewed environment when it has 24 or fewer workloads while keeping the cross-env note', async () => {
442
+ const sha = 'a'.repeat(40)
443
+ const makeEnvApp = (envName: string, count: number): AppRow => ({
444
+ key: `${envName}/shop`,
445
+ name: 'shop',
446
+ namespace: envName,
447
+ health: 'healthy',
448
+ identity: { key: 'shop', env: envName, confidence: 'high', evidence: 'namespace' },
449
+ workloads: Array.from({ length: count }, (_, i) => ({
450
+ kind: 'Deployment', group: 'apps', namespace: envName, name: `svc-${i}`, health: 'healthy', ready: 1, desired: 1, restarts: 0,
451
+ })),
452
+ })
453
+ let seenTargets: Array<{ namespace: string; name: string }> = []
454
+ workloadSourceHandler = (targets) => {
455
+ seenTargets = targets
456
+ if (targets.length === 0 || targets.length > 24) return null
457
+ const out = new Map<string, unknown>()
458
+ for (const t of targets) {
459
+ out.set(`apps/deployment/${t.namespace}/${t.name}`, {
460
+ status: 'ready',
461
+ source: {
462
+ workload: { group: 'apps', kind: 'Deployment', namespace: t.namespace, name: t.name },
463
+ observedAt: '2026-11-29T00:00:00Z',
464
+ images: [{
465
+ container: 'app', kind: 'container', image: 'ghcr.io/acme/shop:1', digest: `sha256:${sha}`, pods: 1, provenance: 'read',
466
+ source: { revision: { value: sha, from: 'oci-label' }, repository: { value: 'https://github.com/acme/shop', from: 'oci-label' } },
467
+ }],
468
+ },
469
+ })
470
+ }
471
+ return out
472
+ }
473
+ apps = [makeEnvApp('staging', 15), makeEnvApp('prod', 15)]
474
+ await renderAt('/applications?app=staging%2Fshop')
475
+ expect(seenTargets).toHaveLength(15)
476
+ expect(seenTargets.every((t) => t.namespace === 'staging')).toBe(true)
477
+ const text = container.textContent ?? ''
478
+ // Header Code fact works for the viewed environment.
479
+ expect(text).toContain('aaaaaaa')
480
+ // Cross-environment comparison note stays.
481
+ expect(text).toContain("Code isn't compared for apps with more than 24 workloads across environments")
482
+
483
+ // When the viewed environment itself exceeds 24 targets, no source targets are read.
484
+ seenTargets = [{ namespace: 'sentinel', name: 'sentinel' }]
485
+ apps = [makeEnvApp('staging', 25), makeEnvApp('prod', 5)]
486
+ await renderAt('/applications?app=staging%2Fshop')
487
+ expect(seenTargets).toHaveLength(0)
488
+ })
489
+ })
@@ -28,6 +28,11 @@ import {
28
28
  deploymentInventoryFromGitOps,
29
29
  deploymentInventoryFromHelm,
30
30
  buildAppMembershipIndex,
31
+ appCodeChangesFromEvents,
32
+ rolloutSummaryForApps,
33
+ servingReadiness,
34
+ summarizeEnv,
35
+ type AppCodeEnv,
31
36
  buildApplicationHistoryItems,
32
37
  eventsForApplication,
33
38
  memberRef,
@@ -53,12 +58,16 @@ import {
53
58
  useGitOpsTree,
54
59
  useHelmRelease,
55
60
  useIssues,
61
+ useRadarFeature,
56
62
  useTopology,
63
+ useWorkloadHistory,
57
64
  type IssuesResponse,
58
65
  } from "../../api/client";
66
+ import { formatBoundaryTime, workloadHistoryBoundary } from "@skyhook-io/k8s-ui/utils/workload-history-notes";
59
67
  import { useConnection } from "../../context/ConnectionContext";
60
68
  import { useTimelineSource } from "../../context/TimelineSource";
61
69
  import { apiVersionToGroup, kindToPluralWithGroup, relatedResourcePath, withCrossViewParams } from "../../utils/navigation";
70
+ import { supportsWorkloadSource, useWorkloadSources, WORKLOAD_SOURCES_MAX, workloadSourceTargetKey, type WorkloadSourcesRead } from "../../api/workloadSource";
62
71
  import { WorkloadView } from "../workload/WorkloadView";
63
72
  import { ApplicationCostTab } from "../cost/ApplicationCostTab";
64
73
  import { ArgoSyncDetails } from "./ArgoSyncDetails";
@@ -66,6 +75,8 @@ import { WorkloadRevisionsButton } from "../workload/WorkloadRevisionsButton";
66
75
  import { useTimelineRetentionNote } from "../../context/TimelineCustomization";
67
76
  import { isOpenCostWorkloadKind } from "../cost/kinds";
68
77
 
78
+ const CODE_HISTORY_KINDS = new Set(["Deployment", "StatefulSet", "DaemonSet"]);
79
+
69
80
  type ApplicationRouteView = ApplicationView | "cost";
70
81
 
71
82
  const APPLICATION_HISTORY_WINDOW: Record<
@@ -284,7 +295,7 @@ function AppDetailRoute({
284
295
  const [searchParams, setSearchParams] = useSearchParams();
285
296
  const viewParam = searchParams.get("view");
286
297
  const selectedWorkloadParam = searchParams.get("workload");
287
- const appWorkloads = app.workloads ?? [];
298
+ const appWorkloads = useMemo(() => app.workloads ?? [], [app.workloads]);
288
299
  const singleWorkloadKey =
289
300
  appWorkloads.length === 1 ? workloadKey(appWorkloads[0]) : null;
290
301
  const selectedWorkloadKey = singleWorkloadKey ?? selectedWorkloadParam;
@@ -335,8 +346,9 @@ function AppDetailRoute({
335
346
  )
336
347
  ? retainedHistoryRange
337
348
  : historyRangeOptions[0].value;
349
+ // Deploys reads the same events for the running-code changes it interleaves.
338
350
  const historyTimelineEnabled =
339
- !selectedWorkloadKey && selectedView === "history";
351
+ (!selectedWorkloadKey && selectedView === "history") || requestedDeploys;
340
352
  const retentionNote = useTimelineRetentionNote();
341
353
  const historyTimelineQuery = timelineSource.useEvents({
342
354
  namespaces: appHistoryNamespaces,
@@ -620,6 +632,87 @@ function AppDetailRoute({
620
632
  }));
621
633
  }, [apps, app]);
622
634
 
635
+ // Which code each environment runs: every workload of every environment
636
+ // instance (or of this app alone), read through the per-workload source route.
637
+ const codeApps = useMemo<AppRow[]>(() => {
638
+ if (!identityInstances) return [app];
639
+ return identityInstances
640
+ .filter((inst) => !inst.aggregate)
641
+ .map((inst) => apps.find((a) => a.key === inst.appKey))
642
+ .filter((a): a is AppRow => !!a);
643
+ }, [app, apps, identityInstances]);
644
+ const sourceWorkloads = useCallback(
645
+ (a: AppRow) => a.workloads.filter((w) => supportsWorkloadSource(kindToPluralWithGroup(w.kind, w.group ?? ""), w.group)),
646
+ [],
647
+ );
648
+ const allCodeTargets = useMemo(
649
+ () => codeApps.flatMap((a) => sourceWorkloads(a).map((w) => ({ kind: w.kind, group: w.group, namespace: w.namespace, name: w.name }))),
650
+ [codeApps, sourceWorkloads],
651
+ );
652
+ const viewedCodeTargets = useMemo(
653
+ () => sourceWorkloads(app).map((w) => ({ kind: w.kind, group: w.group, namespace: w.namespace, name: w.name })),
654
+ [app, sourceWorkloads],
655
+ );
656
+ const overCrossEnvLimit = allCodeTargets.length > WORKLOAD_SOURCES_MAX;
657
+ // Past the read limit across environments we skip cross-environment
658
+ // comparison, but still read the viewed environment's own targets when they
659
+ // fit so its header Code fact and Workloads Code column keep working.
660
+ const codeTargets = useMemo(
661
+ () => (overCrossEnvLimit ? (viewedCodeTargets.length <= WORKLOAD_SOURCES_MAX ? viewedCodeTargets : []) : allCodeTargets),
662
+ [overCrossEnvLimit, viewedCodeTargets, allCodeTargets],
663
+ );
664
+ const sourceReads = useWorkloadSources(codeTargets);
665
+ const { support: sourceSupport } = useRadarFeature("workloadSource");
666
+ const { support: runningCodeHistorySupport } = useRadarFeature("runningCodeHistory");
667
+ const recordsCodeHistory = runningCodeHistorySupport === "supported";
668
+ const tooManyForCode = sourceSupport === "supported" && overCrossEnvLimit;
669
+ const environmentCode = useMemo<AppCodeEnv[] | null>(() => {
670
+ const summarizeWithReads = (a: AppRow, reads: Map<string, WorkloadSourcesRead>) => {
671
+ const supported = sourceWorkloads(a);
672
+ const rollout = rolloutSummaryForApps([a]);
673
+ const { ready, desired } = servingReadiness(a.workloads);
674
+ return summarizeEnv({
675
+ appKey: a.key,
676
+ env: a.identity?.env ?? a.name,
677
+ health: a.health,
678
+ ready,
679
+ desired,
680
+ complete: supported.length === a.workloads.length,
681
+ rolloutNote: a.workloads.some((w) => w.rollout?.phase === "stalled") ? rollout?.label : undefined,
682
+ workloads: supported.map((w) => {
683
+ const workload = { kind: w.kind, group: w.group, namespace: w.namespace, name: w.name };
684
+ const read = reads.get(workloadSourceTargetKey(workload)) ?? { status: "loading" as const };
685
+ return { workload, ...read };
686
+ }),
687
+ stale: supported.some((w) => {
688
+ const read = reads.get(workloadSourceTargetKey(w));
689
+ return read?.status === "ready" && read.stale === true;
690
+ }),
691
+ workloadCount: a.workloads.length,
692
+ });
693
+ };
694
+ if (tooManyForCode) {
695
+ return codeApps.map((a) => {
696
+ if (a.key === app.key && sourceReads) {
697
+ return summarizeWithReads(a, sourceReads);
698
+ }
699
+ const { ready, desired } = servingReadiness(a.workloads);
700
+ return summarizeEnv({
701
+ appKey: a.key,
702
+ env: a.identity?.env ?? a.name,
703
+ health: a.health,
704
+ ready,
705
+ desired,
706
+ complete: false,
707
+ workloads: [],
708
+ workloadCount: a.workloads.length,
709
+ });
710
+ });
711
+ }
712
+ if (!sourceReads) return null;
713
+ return codeApps.map((a) => summarizeWithReads(a, sourceReads));
714
+ }, [app.key, codeApps, sourceReads, sourceWorkloads, tooManyForCode]);
715
+
623
716
  // Position-preserving env switch: carry the selected workload + tab into the
624
717
  // sibling when a matching workload exists there (exact kind+name, else the
625
718
  // env-affix-stripped stem); otherwise land on the instance overview and say
@@ -685,8 +778,66 @@ function AppDetailRoute({
685
778
  [apps],
686
779
  );
687
780
 
781
+ const codeChanges = useMemo(
782
+ () => appCodeChangesFromEvents(historyTimelineQuery.data ?? [], app.workloads ?? []),
783
+ [app.workloads, historyTimelineQuery.data],
784
+ );
785
+ // When recording started is process-wide, so one tracked workload's history
786
+ // coverage dates it for Deploys. Pick the oldest tracked workload: one
787
+ // created after Radar started omits historyCoverage because its own history
788
+ // is complete. A retained store keeps code rows across agent restarts, so
789
+ // the agent's start is no boundary there.
790
+ const boundaryWorkload = useMemo(() => {
791
+ if (!requestedDeploys || !recordsCodeHistory || timelineSource.capabilities.mode === "retained") return undefined;
792
+ const tracked = appWorkloads.filter((w) => CODE_HISTORY_KINDS.has(w.kind) && (w.group ?? "apps") === "apps");
793
+ if (tracked.length === 0) return undefined;
794
+ const parseTimestamp = (ts?: string) => {
795
+ if (!ts) return Number.POSITIVE_INFINITY;
796
+ const ms = Date.parse(ts);
797
+ return Number.isFinite(ms) ? ms : Number.POSITIVE_INFINITY;
798
+ };
799
+ let oldest = tracked[0];
800
+ let oldestMs = parseTimestamp(oldest.creationTimestamp);
801
+ for (let i = 1; i < tracked.length; i++) {
802
+ const ms = parseTimestamp(tracked[i].creationTimestamp);
803
+ if (ms < oldestMs) {
804
+ oldest = tracked[i];
805
+ oldestMs = ms;
806
+ }
807
+ }
808
+ return oldest;
809
+ }, [requestedDeploys, recordsCodeHistory, timelineSource.capabilities.mode, appWorkloads]);
810
+ const boundaryHistory = useWorkloadHistory(
811
+ boundaryWorkload ? kindToPluralWithGroup(boundaryWorkload.kind, boundaryWorkload.group ?? "") : "",
812
+ boundaryWorkload?.namespace ?? "",
813
+ boundaryWorkload?.name ?? "",
814
+ boundaryWorkload?.group,
815
+ Boolean(boundaryWorkload),
816
+ );
817
+ // Name the ReplicaSet rebuild only when rebuilt rows are actually listed.
818
+ const rebuiltListed = codeChanges.some((c) => c.reconstructed);
819
+ const deploysBoundary = useMemo(() => {
820
+ if (!recordsCodeHistory) return null;
821
+ const coverage = boundaryHistory.data?.historyCoverage;
822
+ const boundary = workloadHistoryBoundary(coverage);
823
+ if (!boundary || !coverage?.reasons.includes("observation_started_late")) return boundary;
824
+ const earlier = rebuiltListed ? "earlier ones come only from ReplicaSet history" : "earlier code changes may be missing";
825
+ return { ...boundary, label: `Radar started recording code changes at ${formatBoundaryTime(boundary.atMs)} · ${earlier}` };
826
+ }, [recordsCodeHistory, boundaryHistory.data?.historyCoverage, rebuiltListed]);
827
+ const codeChangesNote = !recordsCodeHistory
828
+ ? ""
829
+ : historyTimelineQuery.isError
830
+ ? "Recorded code changes could not be loaded."
831
+ : historyTimelineQuery.isLoading
832
+ ? ""
833
+ : [
834
+ historyTimelineQuery.truncated ? "Older events are not loaded, so earlier code changes may be missing." : null,
835
+ timelineSource.capabilities.mode === "retained" && (historyTimelineQuery.coverage?.length ?? 0) > 0
836
+ ? "Recording coverage is incomplete for part of this range."
837
+ : null,
838
+ ].filter(Boolean).join(" ");
688
839
  const renderDeploys = deliverySource && (deliveryRecords.length > 0 || requestedDeploys)
689
- ? () => <ApplicationDeploys source={deliverySource} records={deliveryRecords} loading={historyQuery.isLoading} unavailable={historyQuery.isError} partialSources={partialSources} onOpenSource={openSource} />
840
+ ? () => <ApplicationDeploys source={deliverySource} records={deliveryRecords} loading={historyQuery.isLoading} unavailable={historyQuery.isError} partialSources={partialSources} onOpenSource={openSource} codeChanges={codeChanges} multiWorkload={appWorkloads.length > 1} codeChangesNote={codeChangesNote} historyBoundary={deploysBoundary} codeHistoryRecorded={recordsCodeHistory} />
690
841
  : needsDeploySource && (historyQuery.isError || sourceUnavailable)
691
842
  ? () => <AlertBanner className="m-4" variant="warning" title={sourceUnavailable ? "Delivery records are unavailable" : "Delivery records could not be refreshed"} items={partialSources} />
692
843
  : undefined;
@@ -705,6 +856,8 @@ function AppDetailRoute({
705
856
  topologyLoading={topologyLoading}
706
857
  deploymentInventory={deploymentInventory}
707
858
  identityInstances={identityInstances}
859
+ environmentCode={environmentCode}
860
+ environmentCodeLimit={tooManyForCode ? WORKLOAD_SOURCES_MAX : undefined}
708
861
  onSwitchInstance={switchInstance}
709
862
  discoveredEnvs={discoveredEnvs}
710
863
  onNavigateToResource={onOpenResource}