@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.
- package/README.md +1 -1
- package/package.json +11 -11
- package/src/App.tsx +138 -116
- package/src/api/actions.errorCode.test.ts +40 -0
- package/src/api/actions.test.ts +48 -0
- package/src/api/actions.ts +79 -0
- package/src/api/apiResources.navigation.test.tsx +232 -0
- package/src/api/apiResources.ts +46 -3
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.helmSource.test.ts +39 -0
- package/src/api/client.namespaceSwitch.hook.test.tsx +54 -0
- package/src/api/client.namespaceSwitch.test.ts +107 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +580 -103
- package/src/api/client.workloadRuns.test.ts +53 -0
- package/src/api/cnpg-ha.live.test.ts +140 -0
- package/src/api/cnpg-ha.test.ts +78 -0
- package/src/api/cnpg-ha.ts +19 -0
- package/src/api/cnpg-history.ts +123 -0
- package/src/api/cnpg-inspect.ts +102 -0
- package/src/api/cnpg-protection.ts +112 -0
- package/src/api/cnpg-recovery.test.tsx +60 -0
- package/src/api/cnpg-recovery.ts +262 -0
- package/src/api/cnpg-sessions.ts +175 -0
- package/src/api/cnpg-storage.ts +138 -0
- package/src/api/cnpg.legacy-reads.test.ts +43 -0
- package/src/api/cnpg.pooler-runtime.test.ts +15 -0
- package/src/api/cnpg.ts +428 -10
- package/src/api/config.test.ts +23 -1
- package/src/api/config.ts +7 -3
- package/src/api/diagnose.ts +4 -1
- package/src/api/drain-plan.test.ts +70 -40
- package/src/api/policy.ts +5 -5
- package/src/api/radarFeatures.render.test.tsx +47 -3
- package/src/api/radarFeatures.ts +5 -1
- package/src/api/reviewedActionMutation.test.tsx +164 -0
- package/src/api/reviewedActionMutation.ts +66 -0
- package/src/api/timelineSource.test.ts +9 -0
- package/src/api/timelineSource.ts +8 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/audit/AuditView.tsx +9 -0
- package/src/components/capacity/CapacityActivity.tsx +3 -31
- package/src/components/capacity/CapacityDemand.tsx +4 -36
- package/src/components/capacity/CapacityOverview.tsx +217 -56
- package/src/components/capacity/CapacityPoolDetail.tsx +6 -55
- package/src/components/capacity/CapacityView.test.tsx +323 -0
- package/src/components/capacity/ClusterSchedulingCard.tsx +2 -10
- package/src/components/capacity/certaintyGlyph.test.tsx +2 -9
- package/src/components/capacity/routes.ts +42 -0
- package/src/components/capacity/shared.tsx +11 -129
- package/src/components/capacity/workspaceRoute.ts +18 -0
- package/src/components/cnpg/CNPGActionHost.compatibility.test.tsx +30 -0
- package/src/components/cnpg/CNPGArchivingRepair.tsx +191 -0
- package/src/components/cnpg/CNPGBlockingSessions.test.tsx +50 -0
- package/src/components/cnpg/CNPGBlockingSessions.tsx +333 -0
- package/src/components/cnpg/CNPGClusterActivity.test.tsx +11 -0
- package/src/components/cnpg/CNPGClusterActivity.tsx +18 -9
- package/src/components/cnpg/CNPGClusterLogs.compatibility.test.tsx +130 -0
- package/src/components/cnpg/CNPGClusterLogs.empty.test.tsx +29 -0
- package/src/components/cnpg/CNPGClusterLogs.test.ts +9 -0
- package/src/components/cnpg/CNPGClusterLogs.tsx +81 -24
- package/src/components/cnpg/CNPGClusterTabs.test.tsx +152 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +187 -0
- package/src/components/cnpg/CNPGClustersKindView.tsx +46 -0
- package/src/components/cnpg/CNPGConfiguration.test.tsx +223 -0
- package/src/components/cnpg/CNPGConfiguration.tsx +190 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.test.tsx +113 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.tsx +74 -0
- package/src/components/cnpg/CNPGDeclarations.test.ts +107 -0
- package/src/components/cnpg/CNPGDeclarations.tsx +236 -78
- package/src/components/cnpg/CNPGDetailPage.test.tsx +62 -0
- package/src/components/cnpg/CNPGDetailPage.tsx +159 -98
- package/src/components/cnpg/CNPGDrawerTrail.tsx +2 -2
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +30 -0
- package/src/components/cnpg/CNPGOperator.test.tsx +34 -0
- package/src/components/cnpg/CNPGOperator.tsx +78 -30
- package/src/components/cnpg/CNPGOperatorBanner.tsx +39 -0
- package/src/components/cnpg/CNPGOperatorConditions.test.tsx +45 -0
- package/src/components/cnpg/CNPGOperatorConditions.tsx +16 -0
- package/src/components/cnpg/CNPGOperatorConfig.test.tsx +27 -0
- package/src/components/cnpg/CNPGOperatorDiagnosis.tsx +247 -0
- package/src/components/cnpg/CNPGOverview.test.tsx +171 -0
- package/src/components/cnpg/CNPGOverview.tsx +238 -63
- package/src/components/cnpg/CNPGParametersInEffect.test.tsx +51 -0
- package/src/components/cnpg/CNPGParametersInEffect.tsx +120 -0
- package/src/components/cnpg/CNPGPerformance.prerequisite.test.tsx +48 -0
- package/src/components/cnpg/CNPGPerformance.test.tsx +73 -0
- package/src/components/cnpg/CNPGPerformance.tsx +477 -0
- package/src/components/cnpg/CNPGPooling.test.tsx +89 -0
- package/src/components/cnpg/CNPGPooling.tsx +97 -40
- package/src/components/cnpg/CNPGProtection.test.tsx +145 -0
- package/src/components/cnpg/CNPGProtection.tsx +228 -122
- package/src/components/cnpg/CNPGReplicationTab.test.tsx +87 -0
- package/src/components/cnpg/CNPGReplicationTab.tsx +212 -0
- package/src/components/cnpg/CNPGReplicationView.tsx +264 -0
- package/src/components/cnpg/CNPGStorage.test.tsx +140 -0
- package/src/components/cnpg/CNPGStorage.tsx +619 -0
- package/src/components/cnpg/CNPGSummaryHost.overview.test.tsx +44 -0
- package/src/components/cnpg/CNPGSummaryHost.test.tsx +23 -0
- package/src/components/cnpg/CNPGSummaryHost.tsx +230 -55
- package/src/components/cnpg/CNPGTrends.denied.test.tsx +33 -0
- package/src/components/cnpg/CNPGTrends.missing.test.tsx +69 -0
- package/src/components/cnpg/CNPGTrends.test.ts +38 -0
- package/src/components/cnpg/CNPGTrends.tsx +702 -0
- package/src/components/cnpg/CNPGView.tsx +34 -21
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +90 -0
- package/src/components/cnpg/actions/CNPGClusterActions.dialog.test.tsx +79 -0
- package/src/components/cnpg/actions/CNPGClusterActions.test.tsx +142 -0
- package/src/components/cnpg/actions/CNPGClusterActions.tsx +853 -0
- package/src/components/cnpg/actions/CNPGConnectButton.read.test.tsx +40 -0
- package/src/components/cnpg/actions/CNPGConnectButton.test.ts +25 -0
- package/src/components/cnpg/actions/CNPGConnectButton.tsx +131 -0
- package/src/components/cnpg/actions/CNPGDestroyInstanceDialog.tsx +185 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.test.tsx +38 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.tsx +74 -0
- package/src/components/cnpg/actions/CNPGMaintenanceBanner.tsx +53 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.test.tsx +35 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.tsx +79 -0
- package/src/components/cnpg/actions/CNPGReportDialog.test.tsx +12 -0
- package/src/components/cnpg/actions/CNPGReportDialog.tsx +91 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.run.test.tsx +58 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.test.tsx +54 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.tsx +208 -0
- package/src/components/cnpg/actions/actionModel.test.ts +111 -0
- package/src/components/cnpg/actions/actionModel.ts +127 -0
- package/src/components/cnpg/actions/renderCNPGHeaderActions.tsx +60 -0
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +58 -0
- package/src/components/cnpg/actions/useOpenCNPGPsql.ts +22 -0
- package/src/components/cnpg/archivingRepair.test.ts +104 -0
- package/src/components/cnpg/archivingRepair.ts +145 -0
- package/src/components/cnpg/baseBackup.test.ts +36 -0
- package/src/components/cnpg/baseBackup.ts +36 -0
- package/src/components/cnpg/blocking.test.ts +59 -0
- package/src/components/cnpg/blocking.ts +131 -0
- package/src/components/cnpg/coverageText.test.ts +27 -0
- package/src/components/cnpg/creation/CNPGTargetFields.tsx +110 -0
- package/src/components/cnpg/creation/targetModel.test.ts +137 -0
- package/src/components/cnpg/creation/targetModel.ts +149 -0
- package/src/components/cnpg/fleetStatus.test.ts +46 -0
- package/src/components/cnpg/fleetStatus.ts +43 -0
- package/src/components/cnpg/formFields.ts +2 -0
- package/src/components/cnpg/grantText.test.tsx +11 -0
- package/src/components/cnpg/host.test.tsx +24 -0
- package/src/components/cnpg/host.tsx +101 -0
- package/src/components/cnpg/inspectModel.test.ts +120 -0
- package/src/components/cnpg/inspectModel.ts +140 -0
- package/src/components/cnpg/logicalSlots.test.ts +30 -0
- package/src/components/cnpg/logicalSlots.ts +29 -0
- package/src/components/cnpg/lsn.test.ts +40 -0
- package/src/components/cnpg/lsn.ts +43 -0
- package/src/components/cnpg/operations/CNPGFleetOperation.tsx +30 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.test.tsx +247 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.tsx +255 -0
- package/src/components/cnpg/operations/model.test.ts +510 -0
- package/src/components/cnpg/operations/model.ts +499 -0
- package/src/components/cnpg/operations/presentation.test.ts +80 -0
- package/src/components/cnpg/operations/presentation.ts +84 -0
- package/src/components/cnpg/operations/store.ts +98 -0
- package/src/components/cnpg/operatorStatus.test.ts +134 -0
- package/src/components/cnpg/operatorStatus.ts +194 -0
- package/src/components/cnpg/paths.test.ts +54 -0
- package/src/components/cnpg/paths.ts +47 -4
- package/src/components/cnpg/protection/CNPGAttachArchiveDialog.tsx +185 -0
- package/src/components/cnpg/protection/CNPGCreateScheduleDialog.tsx +196 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.test.tsx +121 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.tsx +452 -0
- package/src/components/cnpg/protection/CNPGScheduleInput.tsx +115 -0
- package/src/components/cnpg/protection/CNPGScheduleRepairButton.tsx +120 -0
- package/src/components/cnpg/protection/scheduleModel.test.ts +19 -0
- package/src/components/cnpg/protection/scheduleModel.ts +16 -0
- package/src/components/cnpg/recovery/CNPGRecoveryPoint.tsx +220 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.test.tsx +29 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.tsx +26 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.test.tsx +23 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.tsx +153 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.back.test.tsx +149 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.test.tsx +46 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.tsx +333 -0
- package/src/components/cnpg/recovery/CNPGRestoreProgress.tsx +182 -0
- package/src/components/cnpg/recovery/CNPGRestoreValidation.tsx +216 -0
- package/src/components/cnpg/recovery/restoreModel.test.ts +709 -0
- package/src/components/cnpg/recovery/restoreModel.ts +685 -0
- package/src/components/cnpg/recovery/restoreOperation.ts +56 -0
- package/src/components/cnpg/refresh.test.ts +38 -0
- package/src/components/cnpg/refresh.ts +17 -0
- package/src/components/cnpg/refreshNotice.test.tsx +29 -0
- package/src/components/cnpg/routes.test.ts +34 -3
- package/src/components/cnpg/routes.ts +60 -48
- package/src/components/cnpg/runtimeAssessment.ts +198 -0
- package/src/components/cnpg/runtimeModel.test.ts +175 -0
- package/src/components/cnpg/runtimeModel.ts +196 -0
- package/src/components/cnpg/runtimeParts.test.tsx +17 -0
- package/src/components/cnpg/runtimeParts.tsx +79 -0
- package/src/components/cnpg/shared.test.tsx +59 -0
- package/src/components/cnpg/shared.tsx +100 -182
- package/src/components/cnpg/storageModel.test.ts +107 -0
- package/src/components/cnpg/storageModel.ts +101 -0
- package/src/components/cnpg/trendSamples.test.ts +148 -0
- package/src/components/cnpg/trendSamples.ts +222 -0
- package/src/components/cnpg/useCNPGClusterAssessment.ts +30 -0
- package/src/components/cnpg/useCNPGKubectlContext.test.tsx +45 -0
- package/src/components/cnpg/useCNPGKubectlContext.ts +13 -0
- package/src/components/cnpg/useCNPGNavigate.test.tsx +58 -0
- package/src/components/cnpg/useCNPGNavigate.ts +21 -0
- package/src/components/cnpg/useCNPGPoolerLive.ts +46 -0
- package/src/components/cnpg/useCNPGScreenParams.ts +24 -0
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +66 -16
- package/src/components/cnpg/workspaceRoute.ts +23 -0
- package/src/components/cost/ApplicationCostTab.test.ts +7 -0
- package/src/components/cost/ApplicationCostTab.tsx +7 -7
- package/src/components/cost/CostView.test.ts +2 -1
- package/src/components/cost/CostView.tsx +0 -2
- package/src/components/cost/WorkloadCostTab.tsx +2 -4
- package/src/components/cost/errors.ts +3 -1
- package/src/components/cost/source.test.ts +10 -0
- package/src/components/cost/source.ts +5 -1
- package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
- package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
- package/src/components/diagnose/InvestigationView.tsx +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -43
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
- package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
- package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
- package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
- package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
- package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/types.ts +11 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
- package/src/components/diagnose/investigationState.test.ts +36 -1
- package/src/components/diagnose/investigationState.ts +8 -0
- package/src/components/diagnose/launch.ts +2 -2
- package/src/components/dock/BottomDock.tsx +8 -3
- package/src/components/dock/TerminalTab.test.tsx +17 -0
- package/src/components/dock/TerminalTab.tsx +7 -3
- package/src/components/dock/WorkloadLogsTab.tsx +3 -0
- package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
- package/src/components/execution/BatchExecutionView.tsx +23 -8
- package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
- package/src/components/gitops/ArgoResourceDiffLoader.tsx +4 -2
- package/src/components/gitops/GitOpsView.tsx +23 -23
- package/src/components/helm/HelmCompareRoute.test.tsx +59 -0
- package/src/components/helm/HelmCompareRoute.tsx +57 -26
- package/src/components/helm/HelmReleaseDrawer.test.ts +55 -3
- package/src/components/helm/HelmReleaseDrawer.tsx +186 -64
- package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
- package/src/components/helm/HelmReleaseNotes.tsx +26 -0
- package/src/components/helm/OwnedResources.tsx +2 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +192 -0
- package/src/components/helm/TrackChartSourceDialog.test.ts +51 -0
- package/src/components/helm/TrackChartSourceDialog.tsx +179 -176
- package/src/components/helm/ValuesDiffPreview.tsx +4 -1
- package/src/components/helm/ValuesViewer.test.tsx +301 -0
- package/src/components/helm/ValuesViewer.tsx +169 -78
- package/src/components/home/ActivitySummary.tsx +2 -1
- package/src/components/home/ClusterHealthCard.tsx +4 -4
- package/src/components/home/CostCard.test.tsx +100 -0
- package/src/components/home/CostCard.tsx +2 -2
- package/src/components/home/HelmSummary.tsx +2 -2
- package/src/components/home/HomeView.tsx +32 -12
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +82 -0
- package/src/components/home/TopologyPreview.tsx +2 -2
- package/src/components/home/mcpToolCatalog.ts +18 -2
- package/src/components/issues/IssuesPane.render.test.tsx +143 -0
- package/src/components/issues/IssuesPane.test.ts +65 -1
- package/src/components/issues/IssuesPane.tsx +213 -26
- package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
- package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
- package/src/components/issues/uncheckedSources.test.ts +43 -0
- package/src/components/issues/uncheckedSources.ts +74 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- package/src/components/resource/PVCUsageBar.render.test.tsx +32 -0
- package/src/components/resource/PVCUsageBar.test.tsx +24 -0
- package/src/components/resource/PVCUsageBar.tsx +15 -6
- package/src/components/resource/WorkloadMetricsHelpDialog.test.tsx +3 -1
- package/src/components/resource/WorkloadMetricsHelpDialog.tsx +1 -1
- package/src/components/resources/CompositeRenderer.tsx +4 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
- package/src/components/resources/ImageFilesystemModal.tsx +11 -4
- package/src/components/resources/PodFilesystemModal.tsx +2 -2
- package/src/components/resources/ResourceDetailDrawer.tsx +2 -2
- package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +44 -15
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
- package/src/components/settings/LocalIntegrationStatus.test.tsx +52 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -4
- package/src/components/settings/SettingsDialog.tsx +49 -30
- package/src/components/timeline/TimelineList.tsx +22 -24
- package/src/components/timeline/TimelineLoadError.test.tsx +62 -0
- package/src/components/timeline/TimelineLoadError.tsx +96 -0
- package/src/components/timeline/TimelineView.tsx +18 -45
- package/src/components/timeline/ViewModeToggle.tsx +20 -0
- package/src/components/timeline/useStickyError.test.tsx +47 -0
- package/src/components/timeline/useStickyError.ts +15 -0
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
- package/src/components/traffic/TrafficView.tsx +12 -12
- package/src/components/traffic/trafficFilters.test.ts +20 -1
- package/src/components/traffic/trafficFilters.ts +13 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +34 -2
- package/src/components/ui/Markdown.test.tsx +65 -0
- package/src/components/ui/Markdown.tsx +144 -127
- package/src/components/ui/Omnibar.tsx +13 -2
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/omnibar-match.test.ts +30 -0
- package/src/components/ui/omnibar-match.ts +18 -0
- package/src/components/whats-new/releaseNotes.ts +63 -1
- package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
- package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
- package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
- package/src/components/workload/NodeDrainStatus.tsx +55 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +63 -243
- package/src/components/workspace/layout.test.tsx +29 -0
- package/src/components/workspace/layout.tsx +259 -0
- package/src/components/workspace/table.ts +7 -0
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/contexts/CapabilitiesContext.tsx +1 -1
- package/src/integrations/resourceHost.test.tsx +55 -0
- package/src/integrations/resourceHost.ts +99 -0
- package/src/integrations/resourceHosts.test.tsx +142 -0
- package/src/integrations/resourceHosts.tsx +121 -0
- package/src/integrations/workspaceRoute.ts +20 -0
- package/src/integrations/workspaceRoutes.test.ts +40 -0
- package/src/integrations/workspaceRoutes.ts +22 -0
- package/src/integrations/workspaceScreens.tsx +14 -0
- package/src/utils/drawer-trail.ts +35 -0
- package/src/utils/kindFilterStore.test.ts +147 -0
- package/src/utils/kindFilterStore.ts +91 -0
- package/src/utils/navigation.test.ts +13 -1
- package/src/utils/navigation.ts +53 -2
- package/src/utils/page-links.ts +21 -0
- package/src/utils/tabStorage.ts +40 -0
- package/src/utils/viewMemory.test.ts +78 -0
- package/src/utils/viewMemory.ts +54 -0
- package/src/utils/wails-clipboard.ts +4 -2
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import {
|
|
5
|
+
DiffViewer,
|
|
6
|
+
ResourceLink,
|
|
7
|
+
formatRelativeAgeTime,
|
|
8
|
+
type IssueRecentChange,
|
|
9
|
+
} from "@skyhook-io/k8s-ui";
|
|
10
|
+
import { ChangesBody } from "./investigationEvidence/bodies/streams";
|
|
11
|
+
import { EvidenceNavigationContext } from "./investigationEvidence/navigation";
|
|
12
|
+
import { recentChange } from "./investigationEvidence/parse";
|
|
13
|
+
import { projectInvestigationEvidence } from "./investigationEvidence";
|
|
14
|
+
|
|
15
|
+
vi.mock("@skyhook-io/k8s-ui", async (importOriginal) => {
|
|
16
|
+
const actual = await importOriginal<typeof import("@skyhook-io/k8s-ui")>();
|
|
17
|
+
return {
|
|
18
|
+
...actual,
|
|
19
|
+
ResourceLink: vi.fn(actual.ResourceLink),
|
|
20
|
+
DiffViewer: vi.fn((props: ComponentProps<typeof actual.DiffViewer>) => (
|
|
21
|
+
<actual.DiffViewer {...props} />
|
|
22
|
+
)),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const annotation = {
|
|
27
|
+
workloads: ["Deployment/env-reader", "Deployment/envfrom-reader"],
|
|
28
|
+
pods: 2,
|
|
29
|
+
keys: ["password"],
|
|
30
|
+
note: "These Pods started before Radar observed this write and read the changed keys as env vars. Env values are set when a container starts, so they likely still hold the earlier value until they restart.",
|
|
31
|
+
};
|
|
32
|
+
const secretChange: IssueRecentChange = {
|
|
33
|
+
kind: "Secret",
|
|
34
|
+
apiVersion: "v1",
|
|
35
|
+
namespace: "secret-feed-proof",
|
|
36
|
+
name: "db-conn",
|
|
37
|
+
changeType: "update",
|
|
38
|
+
summary: "data modified keys: [password]",
|
|
39
|
+
timestamp: "2026-10-19T17:52:12+03:00",
|
|
40
|
+
change_category: "spec_config",
|
|
41
|
+
rank_reason:
|
|
42
|
+
"Secret data changed; 2 Pods likely still hold the earlier value",
|
|
43
|
+
application_configuration_change: true,
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
path: "data (modified keys)",
|
|
47
|
+
oldValue: ["password"],
|
|
48
|
+
newValue: ["password"],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
consumed_by: [
|
|
52
|
+
"Deployment/env-reader",
|
|
53
|
+
"Deployment/envfrom-reader",
|
|
54
|
+
"Deployment/mount-reader",
|
|
55
|
+
],
|
|
56
|
+
running_previous_value: annotation,
|
|
57
|
+
};
|
|
58
|
+
const onOpenResource = vi.fn();
|
|
59
|
+
|
|
60
|
+
function render(change: unknown = secretChange): string {
|
|
61
|
+
const projection = projectInvestigationEvidence(
|
|
62
|
+
[
|
|
63
|
+
{
|
|
64
|
+
timeline: [
|
|
65
|
+
{
|
|
66
|
+
kind: "tool",
|
|
67
|
+
id: "changes",
|
|
68
|
+
tool: "get_changes",
|
|
69
|
+
status: "done",
|
|
70
|
+
summary: JSON.stringify({ namespace: "secret-feed-proof" }),
|
|
71
|
+
result: JSON.stringify({ changes: [change] }),
|
|
72
|
+
isError: false,
|
|
73
|
+
radarEvidence: true,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
{
|
|
79
|
+
kind: "Secret",
|
|
80
|
+
group: "",
|
|
81
|
+
namespace: "secret-feed-proof",
|
|
82
|
+
name: "db-conn",
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
const data = projection.groups.find((group) => group.kind === "changes")
|
|
86
|
+
?.latest.data;
|
|
87
|
+
expect(data?.type).toBe("changes");
|
|
88
|
+
if (data?.type !== "changes") throw new Error("Expected a changes card");
|
|
89
|
+
return renderToStaticMarkup(
|
|
90
|
+
<EvidenceNavigationContext.Provider value={{ onOpenResource }}>
|
|
91
|
+
<ChangesBody data={data} />
|
|
92
|
+
</EvidenceNavigationContext.Provider>,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
beforeEach(() => vi.clearAllMocks());
|
|
97
|
+
|
|
98
|
+
describe("Secret and ConfigMap change evidence", () => {
|
|
99
|
+
it.each([1, 2])("renders the stale-reader fact for %i Pods", (pods) => {
|
|
100
|
+
const html = render({
|
|
101
|
+
...secretChange,
|
|
102
|
+
running_previous_value: {
|
|
103
|
+
...annotation,
|
|
104
|
+
pods,
|
|
105
|
+
keys: ["password", "username"],
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
expect(html).toContain(
|
|
109
|
+
pods === 1
|
|
110
|
+
? "1 Pod likely still holds the earlier value"
|
|
111
|
+
: "2 Pods likely still hold the earlier value",
|
|
112
|
+
);
|
|
113
|
+
expect(html).toMatch(
|
|
114
|
+
/Changed keys read as env: <span[^>]*font-mono[^>]*>password<\/span>, <span[^>]*>username<\/span><\/p>/,
|
|
115
|
+
);
|
|
116
|
+
expect(html).toContain(annotation.note);
|
|
117
|
+
expect(html).toMatch(/<button[^>]*>Deployment\/env-reader<\/button>/);
|
|
118
|
+
expect(html).toMatch(/<button[^>]*>Deployment\/envfrom-reader<\/button>/);
|
|
119
|
+
expect(html.indexOf(secretChange.summary!)).toBeLessThan(
|
|
120
|
+
html.indexOf("likely still"),
|
|
121
|
+
);
|
|
122
|
+
expect(html.indexOf(annotation.note)).toBeLessThan(
|
|
123
|
+
html.indexOf("1 changed field"),
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it.each([{ workloads: [] }, { workloads: null }])(
|
|
128
|
+
"keeps the Pod count when workload names are hidden (%j)",
|
|
129
|
+
({ workloads }) => {
|
|
130
|
+
const html = render({
|
|
131
|
+
...secretChange,
|
|
132
|
+
consumed_by: [],
|
|
133
|
+
running_previous_value: { ...annotation, workloads },
|
|
134
|
+
});
|
|
135
|
+
expect(html).toContain("2 Pods likely still hold the earlier value");
|
|
136
|
+
expect(html).toContain("workload names hidden by your permissions");
|
|
137
|
+
expect(html).not.toContain("Deployment/env-reader");
|
|
138
|
+
expect(
|
|
139
|
+
recentChange({
|
|
140
|
+
...secretChange,
|
|
141
|
+
running_previous_value: { ...annotation, workloads },
|
|
142
|
+
})?.running_previous_value?.workloads,
|
|
143
|
+
).toEqual([]);
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
it("marks a full list of five references and stale workloads as capped", () => {
|
|
148
|
+
const five = ["a", "b", "c", "d", "e"].map((name) => `Deployment/${name}`);
|
|
149
|
+
const html = render({
|
|
150
|
+
...secretChange,
|
|
151
|
+
consumed_by: five,
|
|
152
|
+
running_previous_value: { ...annotation, pods: 7, workloads: five },
|
|
153
|
+
});
|
|
154
|
+
expect(html.match(/\(first 5\)/g)).toHaveLength(2);
|
|
155
|
+
expect(html).toContain("In workloads you can view:");
|
|
156
|
+
expect(render(secretChange)).not.toContain("(first 5)");
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("renders references as text when the row has no namespace", () => {
|
|
160
|
+
render({ ...secretChange, namespace: undefined });
|
|
161
|
+
expect(
|
|
162
|
+
vi
|
|
163
|
+
.mocked(ResourceLink)
|
|
164
|
+
.mock.calls.filter(([props]) =>
|
|
165
|
+
String(props.label).startsWith("Deployment/"),
|
|
166
|
+
),
|
|
167
|
+
).toHaveLength(0);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("counts names the caller can't view instead of hiding them silently", () => {
|
|
171
|
+
const withheld = { count: 2, reason: "user_forbidden" };
|
|
172
|
+
const some = render({
|
|
173
|
+
...secretChange,
|
|
174
|
+
consumed_by: ["Deployment/env-reader"],
|
|
175
|
+
consumed_by_withheld: withheld,
|
|
176
|
+
running_previous_value: {
|
|
177
|
+
...annotation,
|
|
178
|
+
workloads: ["Deployment/env-reader"],
|
|
179
|
+
withheld,
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
expect(some.match(/\+2 more you can('|')t view/g)).toHaveLength(2);
|
|
183
|
+
const none = render({
|
|
184
|
+
...secretChange,
|
|
185
|
+
consumed_by: undefined,
|
|
186
|
+
consumed_by_withheld: withheld,
|
|
187
|
+
running_previous_value: { ...annotation, workloads: [], withheld },
|
|
188
|
+
});
|
|
189
|
+
expect(none).toContain("Referenced by");
|
|
190
|
+
expect(none).toContain("2 workloads you can't view");
|
|
191
|
+
expect(none).toContain("In 2 workloads you can't view");
|
|
192
|
+
expect(none).not.toContain("hidden by your permissions");
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it.each([{ count: 0, reason: "user_forbidden" }, { count: 1 }, "two", null])(
|
|
196
|
+
"drops a malformed withheld marker (%j) and keeps the row",
|
|
197
|
+
(marker) => {
|
|
198
|
+
const row = recentChange({
|
|
199
|
+
...secretChange,
|
|
200
|
+
consumed_by_withheld: marker,
|
|
201
|
+
running_previous_value: { ...annotation, withheld: marker },
|
|
202
|
+
});
|
|
203
|
+
expect(row).not.toHaveProperty("consumed_by_withheld");
|
|
204
|
+
expect(row?.running_previous_value).not.toHaveProperty("withheld");
|
|
205
|
+
expect(row?.summary).toBe(secretChange.summary);
|
|
206
|
+
},
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
it("renders a reference of a kind with no known group as text, not a link", () => {
|
|
210
|
+
const html = render({
|
|
211
|
+
...secretChange,
|
|
212
|
+
consumed_by: ["Cluster/database"],
|
|
213
|
+
running_previous_value: { ...annotation, workloads: ["Cluster/database"] },
|
|
214
|
+
});
|
|
215
|
+
expect(html).toContain("Cluster/database");
|
|
216
|
+
expect(
|
|
217
|
+
vi
|
|
218
|
+
.mocked(ResourceLink)
|
|
219
|
+
.mock.calls.filter(([props]) => props.label === "Cluster/database"),
|
|
220
|
+
).toHaveLength(0);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it.each([
|
|
224
|
+
["Deployment", "apps"],
|
|
225
|
+
["StatefulSet", "apps"],
|
|
226
|
+
["DaemonSet", "apps"],
|
|
227
|
+
["ReplicaSet", "apps"],
|
|
228
|
+
["Job", "batch"],
|
|
229
|
+
["CronJob", "batch"],
|
|
230
|
+
["Rollout", "argoproj.io"],
|
|
231
|
+
["Pod", ""],
|
|
232
|
+
])("links %s references to the correct API group", (kind, group) => {
|
|
233
|
+
render({
|
|
234
|
+
...secretChange,
|
|
235
|
+
consumed_by: [`${kind}/reader`],
|
|
236
|
+
running_previous_value: { ...annotation, workloads: [`${kind}/reader`] },
|
|
237
|
+
});
|
|
238
|
+
const links = vi
|
|
239
|
+
.mocked(ResourceLink)
|
|
240
|
+
.mock.calls.map(([props]) => props)
|
|
241
|
+
.filter((props) => props.label === `${kind}/reader`);
|
|
242
|
+
expect(links).toHaveLength(2);
|
|
243
|
+
for (const props of links) {
|
|
244
|
+
expect(props).toMatchObject({
|
|
245
|
+
kind,
|
|
246
|
+
name: "reader",
|
|
247
|
+
namespace: "secret-feed-proof",
|
|
248
|
+
group,
|
|
249
|
+
onNavigate: onOpenResource,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it("renders Referenced by for a ConfigMap", () => {
|
|
255
|
+
const html = render({
|
|
256
|
+
...secretChange,
|
|
257
|
+
kind: "ConfigMap",
|
|
258
|
+
running_previous_value: undefined,
|
|
259
|
+
});
|
|
260
|
+
expect(html).toContain("Referenced by");
|
|
261
|
+
expect(html).toMatch(/<button[^>]*>Deployment\/mount-reader<\/button>/);
|
|
262
|
+
expect(html).not.toContain("likely still");
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it("shows collapsed updates and the first update's age beside the timestamp", () => {
|
|
266
|
+
const first = "2026-10-19T17:50:00+03:00";
|
|
267
|
+
const html = render({
|
|
268
|
+
...secretChange,
|
|
269
|
+
updates_in_window: 4,
|
|
270
|
+
first_update_at: first,
|
|
271
|
+
});
|
|
272
|
+
const label = `4 updates, first ${formatRelativeAgeTime(first)}`;
|
|
273
|
+
expect(html).toContain(label);
|
|
274
|
+
expect(html.indexOf(label)).toBeLessThan(html.indexOf("<time"));
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it.each([undefined, 1])(
|
|
278
|
+
"omits the collapsed-update label for %s",
|
|
279
|
+
(updates_in_window) => {
|
|
280
|
+
expect(render({ ...secretChange, updates_in_window })).not.toContain(
|
|
281
|
+
" updates",
|
|
282
|
+
);
|
|
283
|
+
},
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
it.each(
|
|
287
|
+
[
|
|
288
|
+
null,
|
|
289
|
+
[],
|
|
290
|
+
"malformed",
|
|
291
|
+
{ ...annotation, workloads: "Deployment/env-reader" },
|
|
292
|
+
{ ...annotation, workloads: [1] },
|
|
293
|
+
{ ...annotation, pods: "2" },
|
|
294
|
+
{ ...annotation, pods: -1 },
|
|
295
|
+
{ ...annotation, pods: 1.5 },
|
|
296
|
+
{ ...annotation, keys: null },
|
|
297
|
+
{ ...annotation, keys: [1] },
|
|
298
|
+
{ ...annotation, note: false },
|
|
299
|
+
{ pods: 2, keys: ["password"], note: annotation.note },
|
|
300
|
+
].map((running_previous_value) => ({ running_previous_value })),
|
|
301
|
+
)(
|
|
302
|
+
"drops only a malformed stale-reader annotation (%j)",
|
|
303
|
+
({ running_previous_value }) => {
|
|
304
|
+
const row = { ...secretChange, running_previous_value };
|
|
305
|
+
expect(recentChange(row)).not.toHaveProperty("running_previous_value");
|
|
306
|
+
const html = render(row);
|
|
307
|
+
expect(html).toContain(secretChange.summary);
|
|
308
|
+
expect(html).toContain("Referenced by");
|
|
309
|
+
expect(html).not.toContain("likely still");
|
|
310
|
+
},
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
it.each([0, -1, 1.5, "4", null, Infinity, NaN])(
|
|
314
|
+
"drops an invalid update count (%j) without losing the row",
|
|
315
|
+
(updates_in_window) => {
|
|
316
|
+
const row = { ...secretChange, updates_in_window };
|
|
317
|
+
expect(recentChange(row)).not.toHaveProperty("updates_in_window");
|
|
318
|
+
const html = render(row);
|
|
319
|
+
expect(html).toContain(secretChange.summary);
|
|
320
|
+
expect(html).toContain(annotation.note);
|
|
321
|
+
expect(html).not.toMatch(/\d updates/);
|
|
322
|
+
},
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
it.each([null, 3, {}, [], "not a time"].map((first_update_at) => ({ first_update_at })))(
|
|
326
|
+
"drops a non-string first update time (%j)",
|
|
327
|
+
({ first_update_at }) => {
|
|
328
|
+
const row = { ...secretChange, updates_in_window: 3, first_update_at };
|
|
329
|
+
expect(recentChange(row)).not.toHaveProperty("first_update_at");
|
|
330
|
+
expect(render(row)).toMatch(/>3 updates</);
|
|
331
|
+
},
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
it("renders only key-name lists in the example Secret diff", () => {
|
|
335
|
+
const html = render();
|
|
336
|
+
expect(secretChange.fields).toEqual([
|
|
337
|
+
{
|
|
338
|
+
path: "data (modified keys)",
|
|
339
|
+
oldValue: ["password"],
|
|
340
|
+
newValue: ["password"],
|
|
341
|
+
},
|
|
342
|
+
]);
|
|
343
|
+
expect(vi.mocked(DiffViewer).mock.calls[0][0].diff.fields).toEqual(
|
|
344
|
+
secretChange.fields,
|
|
345
|
+
);
|
|
346
|
+
// The key list reads as a key change, not a struck-through old→new pair.
|
|
347
|
+
expect(html).not.toContain("["password"]");
|
|
348
|
+
expect(html).toContain("keys changed: ");
|
|
349
|
+
expect(html).toContain(">password</span>");
|
|
350
|
+
expect(html).not.toMatch(/oldValue|newValue|stringData/);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
@@ -2922,6 +2922,107 @@ describe("InvestigationEvidencePane metrics cards", () => {
|
|
|
2922
2922
|
};
|
|
2923
2923
|
}
|
|
2924
2924
|
|
|
2925
|
+
it.each([true, false, "true"])(
|
|
2926
|
+
"validates partial=%s while keeping valid charts",
|
|
2927
|
+
(partial) => {
|
|
2928
|
+
const projection = project(
|
|
2929
|
+
tool("prom", "query_prometheus", {
|
|
2930
|
+
...rangeResult(targetSelectors),
|
|
2931
|
+
partial,
|
|
2932
|
+
}),
|
|
2933
|
+
);
|
|
2934
|
+
if (typeof partial !== "boolean") {
|
|
2935
|
+
expect(projection.groups).toHaveLength(0);
|
|
2936
|
+
expect(projection.limitations).toHaveLength(1);
|
|
2937
|
+
return;
|
|
2938
|
+
}
|
|
2939
|
+
expect(render(projection)).toContain("Memory working set");
|
|
2940
|
+
expect(projection.limitations).toHaveLength(partial ? 1 : 0);
|
|
2941
|
+
if (partial) {
|
|
2942
|
+
expect(projection.limitations[0]).toMatchObject({
|
|
2943
|
+
kind: "unknown",
|
|
2944
|
+
message:
|
|
2945
|
+
"The metrics backend returned a partial result, so some series may be missing.",
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
},
|
|
2949
|
+
);
|
|
2950
|
+
|
|
2951
|
+
it.each([
|
|
2952
|
+
[
|
|
2953
|
+
{ infos: ["PromQL info: metric might not be a counter"] },
|
|
2954
|
+
[
|
|
2955
|
+
"Prometheus noted about this query: PromQL info: metric might not be a counter",
|
|
2956
|
+
],
|
|
2957
|
+
],
|
|
2958
|
+
[
|
|
2959
|
+
{ warnings: ["a", "b"], annotationsOmitted: 2 },
|
|
2960
|
+
[
|
|
2961
|
+
"The metrics backend returned 2 warnings with this result: a; b",
|
|
2962
|
+
"2 more backend messages were left out to keep the result small.",
|
|
2963
|
+
],
|
|
2964
|
+
],
|
|
2965
|
+
[
|
|
2966
|
+
{ warnings: ["store down"], infos: ["note"] },
|
|
2967
|
+
[
|
|
2968
|
+
"The metrics backend returned a warning with this result: store down",
|
|
2969
|
+
"Prometheus noted about this query: note",
|
|
2970
|
+
],
|
|
2971
|
+
],
|
|
2972
|
+
[
|
|
2973
|
+
{ annotationsOmitted: 1 },
|
|
2974
|
+
["1 more backend message was left out to keep the result small."],
|
|
2975
|
+
],
|
|
2976
|
+
])(
|
|
2977
|
+
"keeps the chart and surfaces backend annotations %j",
|
|
2978
|
+
(extra, messages) => {
|
|
2979
|
+
const projection = project(
|
|
2980
|
+
tool("prom", "query_prometheus", {
|
|
2981
|
+
...rangeResult(targetSelectors),
|
|
2982
|
+
...extra,
|
|
2983
|
+
}),
|
|
2984
|
+
);
|
|
2985
|
+
const html = render(projection);
|
|
2986
|
+
expect(html).toContain("Memory working set");
|
|
2987
|
+
const annotated = extra as { warnings?: string[]; infos?: string[] };
|
|
2988
|
+
for (const text of [
|
|
2989
|
+
...(annotated.warnings ?? []),
|
|
2990
|
+
...(annotated.infos ?? []),
|
|
2991
|
+
]) {
|
|
2992
|
+
expect(html).toContain(text);
|
|
2993
|
+
}
|
|
2994
|
+
if (annotated.warnings?.length) expect(html).toContain("Backend warning");
|
|
2995
|
+
if (annotated.infos?.length) expect(html).toContain("Prometheus noted:");
|
|
2996
|
+
const omitted = (extra as { annotationsOmitted?: number })
|
|
2997
|
+
.annotationsOmitted;
|
|
2998
|
+
if (omitted)
|
|
2999
|
+
expect(html).toContain(
|
|
3000
|
+
`${omitted} more backend ${omitted === 1 ? "message" : "messages"} left out.`,
|
|
3001
|
+
);
|
|
3002
|
+
expect(projection.limitations.map((item) => item.message)).toEqual(
|
|
3003
|
+
messages,
|
|
3004
|
+
);
|
|
3005
|
+
for (const item of projection.limitations)
|
|
3006
|
+
expect(item.kind).toBe("unknown");
|
|
3007
|
+
},
|
|
3008
|
+
);
|
|
3009
|
+
|
|
3010
|
+
it.each([
|
|
3011
|
+
{ warnings: "x" },
|
|
3012
|
+
{ warnings: [1] },
|
|
3013
|
+
{ infos: [true] },
|
|
3014
|
+
{ annotationsOmitted: "1" },
|
|
3015
|
+
])("rejects a malformed annotation field %j", (extra) => {
|
|
3016
|
+
const projection = project(
|
|
3017
|
+
tool("prom", "query_prometheus", {
|
|
3018
|
+
...rangeResult(targetSelectors),
|
|
3019
|
+
...extra,
|
|
3020
|
+
}),
|
|
3021
|
+
);
|
|
3022
|
+
expect(projection.groups).toHaveLength(0);
|
|
3023
|
+
expect(projection.limitations).toHaveLength(1);
|
|
3024
|
+
});
|
|
3025
|
+
|
|
2925
3026
|
it("keeps an uncited target-scoped chart in the workload collection", () => {
|
|
2926
3027
|
const projection = project(
|
|
2927
3028
|
tool("prom", "query_prometheus", rangeResult(targetSelectors)),
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
investigationPaneCenteredScrollTop,
|
|
42
42
|
canStopInvestigation,
|
|
43
43
|
canContinueInvestigation,
|
|
44
|
+
readOnlyNotice,
|
|
44
45
|
canInvestigateFurther,
|
|
45
46
|
} from "./investigationState";
|
|
46
47
|
import type { AssessmentExplanation } from "./parts";
|
|
@@ -1761,7 +1762,7 @@ export function InvestigationView({
|
|
|
1761
1762
|
)}
|
|
1762
1763
|
</>
|
|
1763
1764
|
) : (
|
|
1764
|
-
|
|
1765
|
+
readOnlyNotice(run)
|
|
1765
1766
|
)}
|
|
1766
1767
|
</div>
|
|
1767
1768
|
) : (
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { groupsOf, project, tool } from "../evidenceFixtures";
|
|
3
|
+
import fixture from "./testdata/get-changes-created.json";
|
|
4
|
+
import { createdChanges } from "./changes";
|
|
5
|
+
|
|
6
|
+
// The fixture is written by the Go test TestCompactCreatesSharedFixture from
|
|
7
|
+
// the producer's own CompactCreates, so this checks both ends of the contract.
|
|
8
|
+
function cardChanges(result: unknown) {
|
|
9
|
+
const projection = project([tool("changes", "get_changes", result)]);
|
|
10
|
+
const group = groupsOf(projection.groups, "changes")[0];
|
|
11
|
+
const data = group?.latest.data;
|
|
12
|
+
return { projection, changes: data?.type === "changes" ? data.changes : [] };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe("get_changes created runs", () => {
|
|
16
|
+
it("expand into the exact rows and order the producer replaced", () => {
|
|
17
|
+
const original = cardChanges(fixture.original);
|
|
18
|
+
const compacted = cardChanges(fixture.compacted);
|
|
19
|
+
expect(compacted.changes).toEqual(original.changes);
|
|
20
|
+
expect(compacted.changes).toHaveLength(fixture.original.changes.length);
|
|
21
|
+
expect(compacted.projection.limitations).toEqual(
|
|
22
|
+
original.projection.limitations,
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("rebuilds each timestamp in the zone of first", () => {
|
|
27
|
+
const rows = createdChanges([
|
|
28
|
+
{
|
|
29
|
+
namespace: "shop",
|
|
30
|
+
first: "2026-10-16T23:59:30+03:00",
|
|
31
|
+
count: 1,
|
|
32
|
+
objects: ["+41s Service/cart"],
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
expect(rows).toEqual([
|
|
36
|
+
{
|
|
37
|
+
changeType: "add",
|
|
38
|
+
summary: "add",
|
|
39
|
+
change_category: "lifecycle",
|
|
40
|
+
rank_reason: "resource create/delete for config or desired state",
|
|
41
|
+
kind: "Service",
|
|
42
|
+
namespace: "shop",
|
|
43
|
+
name: "cart",
|
|
44
|
+
timestamp: "2026-10-17T00:00:11+03:00",
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("expands an absent created field to no rows", () => {
|
|
50
|
+
expect(createdChanges(undefined)).toEqual([]);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("rejects a malformed run instead of dropping its objects", () => {
|
|
54
|
+
for (const created of [
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
namespace: "shop",
|
|
58
|
+
first: "2026-10-16T04:43:24+03:00",
|
|
59
|
+
count: 1,
|
|
60
|
+
objects: ["Service/cart"],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
{
|
|
65
|
+
namespace: "shop",
|
|
66
|
+
first: "not a time",
|
|
67
|
+
count: 1,
|
|
68
|
+
objects: ["+0s Service/cart"],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
{
|
|
73
|
+
first: "2026-10-16T04:43:24+03:00",
|
|
74
|
+
count: 1,
|
|
75
|
+
objects: ["+0s Service/cart"],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
namespace: "shop",
|
|
81
|
+
first: "2026-10-16T04:43:24+03:00",
|
|
82
|
+
count: 1,
|
|
83
|
+
objects: ["+0s Service/cart"],
|
|
84
|
+
apiVersions: { Service: "" },
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
{
|
|
89
|
+
namespace: "shop",
|
|
90
|
+
first: "2026-10-16T04:43:24+03:00",
|
|
91
|
+
count: 5,
|
|
92
|
+
objects: ["+0s Service/cart"],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
{
|
|
97
|
+
namespace: "shop",
|
|
98
|
+
first: "2026-02-30T04:43:24+03:00",
|
|
99
|
+
count: 1,
|
|
100
|
+
objects: ["+0s Service/cart"],
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
{
|
|
105
|
+
namespace: "shop",
|
|
106
|
+
first: "2026-10-16T04:43:24+03:00",
|
|
107
|
+
count: 1,
|
|
108
|
+
objects: ["+99999999999999999999s Service/cart"],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
{ namespace: "shop" },
|
|
112
|
+
]) {
|
|
113
|
+
expect(createdChanges(created)).toBeUndefined();
|
|
114
|
+
const { projection } = cardChanges({ changes: [], created });
|
|
115
|
+
expect(groupsOf(projection.groups, "changes")).toHaveLength(0);
|
|
116
|
+
expect(projection.limitations).toEqual(
|
|
117
|
+
expect.arrayContaining([
|
|
118
|
+
expect.objectContaining({ source: "Recent changes" }),
|
|
119
|
+
]),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|