@skyhook-io/radar-app 1.19.0 → 1.20.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 +5 -5
- package/src/App.tsx +31 -5
- package/src/api/application-evidence.ts +63 -0
- package/src/api/argoSync.test.ts +22 -0
- package/src/api/client.audit-gating.test.tsx +48 -0
- package/src/api/client.kueuePosition.test.ts +32 -0
- package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
- package/src/api/client.resource-identity.test.ts +3 -0
- package/src/api/client.resourceIssues.test.tsx +239 -0
- package/src/api/client.resourcePath.test.ts +3 -0
- package/src/api/client.ts +285 -55
- package/src/api/config.ts +21 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/radarFeatures.render.test.tsx +33 -1
- package/src/api/radarFeatures.test.ts +47 -0
- package/src/api/radarFeatures.ts +40 -1
- package/src/api/rbac.settled.test.tsx +42 -0
- package/src/api/rbac.test.ts +18 -0
- package/src/api/rbac.ts +37 -7
- package/src/api/traffic.ts +9 -4
- package/src/api/usage-data.fixtures.ts +3 -1
- package/src/api/usage-data.test.tsx +134 -0
- package/src/api/usage-data.ts +35 -7
- package/src/api/workloadPodsPolling.test.ts +26 -0
- package/src/components/CloudConnectFlow.test.tsx +86 -0
- package/src/components/CloudConnectFlow.tsx +65 -27
- package/src/components/CloudFunnelButton.test.tsx +140 -5
- package/src/components/CloudFunnelButton.tsx +50 -9
- package/src/components/ConnectionErrorView.test.tsx +34 -0
- package/src/components/ConnectionErrorView.tsx +35 -11
- package/src/components/ContextSwitcher.tsx +5 -2
- package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
- package/src/components/SwitchAwareConnectionError.tsx +85 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
- package/src/components/capacity/CapacityDemand.tsx +3 -2
- package/src/components/capacity/demandSummary.test.ts +38 -0
- package/src/components/capacity/shared.tsx +12 -1
- package/src/components/cost/ApplicationCostTab.tsx +4 -0
- package/src/components/cost/CostTrendChart.tsx +2 -0
- package/src/components/cost/WorkloadCostTab.tsx +4 -0
- package/src/components/cost/source.test.ts +5 -0
- package/src/components/cost/source.ts +11 -0
- package/src/components/diagnose/AIMarkdown.tsx +3 -0
- package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
- package/src/components/diagnose/AgentSetupNotice.tsx +21 -3
- package/src/components/diagnose/ContinueInAgentButton.mounted.test.tsx +182 -0
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
- package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +1 -1
- package/src/components/diagnose/DiagnoseContext.tsx +68 -2
- package/src/components/diagnose/DiagnoseSurface.tsx +58 -113
- package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
- package/src/components/diagnose/Home.test.tsx +26 -0
- package/src/components/diagnose/Home.tsx +20 -1
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +45 -22
- package/src/components/diagnose/InvestigationView.tsx +94 -26
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
- package/src/components/diagnose/LocalDiagnoseAction.tsx +354 -35
- package/src/components/diagnose/NextStepJump.test.tsx +92 -0
- package/src/components/diagnose/NextStepJump.tsx +75 -0
- package/src/components/diagnose/QuestionComposer.tsx +8 -0
- package/src/components/diagnose/exampleInvestigation.events.json +191 -0
- package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
- package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
- package/src/components/diagnose/exampleInvestigation.ts +121 -0
- package/src/components/diagnose/investigationCase.test.tsx +9 -1
- package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +50 -2
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -0
- package/src/components/diagnose/investigationEvidence/builder.ts +30 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +121 -2
- package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/diagnose/investigationState.ts +28 -0
- package/src/components/diagnose/lastInvestigation.test.ts +95 -0
- package/src/components/diagnose/lastInvestigation.ts +58 -0
- package/src/components/diagnose/launch.test.ts +125 -1
- package/src/components/diagnose/launch.ts +57 -10
- package/src/components/diagnose/toolCallLabel.test.ts +10 -4
- package/src/components/execution/BatchExecutionView.tsx +24 -11
- package/src/components/execution/JobSetAdmission.test.tsx +42 -0
- package/src/components/execution/JobSetAdmission.tsx +18 -3
- package/src/components/execution/JobSetMemberComparison.tsx +2 -1
- package/src/components/execution/runState.test.ts +14 -0
- package/src/components/execution/runState.ts +8 -0
- package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
- package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
- package/src/components/gitops/GitOpsView.tsx +86 -17
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
- package/src/components/gitops/destination-toast.test.ts +1 -1
- package/src/components/gitops/destination-toast.ts +2 -2
- package/src/components/home/ClusterHealthCard.tsx +1 -1
- package/src/components/home/HomeAgentBlock.test.tsx +31 -3
- package/src/components/home/HomeAgentBlock.tsx +13 -4
- package/src/components/home/HomeDiagramCard.tsx +47 -0
- package/src/components/home/HomeView.tsx +81 -41
- package/src/components/home/MCPSetupDialog.test.tsx +95 -5
- package/src/components/home/MCPSetupDialog.tsx +30 -5
- package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
- package/src/components/home/ProblemsPanel.test.tsx +3 -1
- package/src/components/home/TopologyPreview.test.tsx +73 -0
- package/src/components/home/TopologyPreview.tsx +120 -233
- package/src/components/home/TrafficSummary.test.tsx +63 -0
- package/src/components/home/TrafficSummary.tsx +135 -138
- package/src/components/home/mcpToolCatalog.ts +23 -10
- package/src/components/issues/IssuesPane.test.ts +11 -0
- package/src/components/issues/IssuesPane.tsx +15 -5
- package/src/components/issues/uncheckedSources.test.ts +20 -1
- package/src/components/issues/uncheckedSources.ts +18 -0
- package/src/components/kueue/KueuePendingPosition.tsx +35 -0
- package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
- package/src/components/kueue/useRelatedReads.test.ts +56 -0
- package/src/components/kueue/useRelatedReads.ts +205 -0
- package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
- package/src/components/logs/MultiPodLogsTab.tsx +120 -0
- package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
- package/src/components/logs/PodLogsUnavailable.tsx +21 -0
- package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
- package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
- package/src/components/logs/RayClusterLogsTab.tsx +109 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
- package/src/components/logs/rayClusterPods.ts +32 -0
- package/src/components/outageSince.test.ts +21 -0
- package/src/components/outageSince.ts +10 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
- package/src/components/resource/PrometheusCharts.tsx +3 -40
- package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
- package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
- package/src/components/resources/crd/host.tsx +14 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
- package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
- package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
- package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
- package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
- package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
- package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
- package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
- package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
- package/src/components/traffic/TrafficView.tsx +3 -3
- package/src/components/ui/command-items-crd.test.tsx +23 -0
- package/src/components/ui/command-items.ts +2 -1
- package/src/components/useContextSwitchFlow.test.tsx +61 -0
- package/src/components/useContextSwitchFlow.tsx +21 -4
- package/src/components/whats-new/WhatsNew.test.ts +10 -3
- package/src/components/whats-new/WhatsNew.tsx +5 -1
- package/src/components/whats-new/WhatsNewDialog.test.tsx +17 -3
- package/src/components/whats-new/releaseNotes.ts +77 -4
- package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
- package/src/components/workload/RelatedFindingsSection.tsx +80 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +85 -98
- package/src/components/workload/issueResourceOpener.test.ts +20 -0
- package/src/components/workload/issueResourceOpener.ts +17 -0
- package/src/context/ConnectionContext.tsx +133 -60
- package/src/context/ConnectionProvider.retry.test.tsx +176 -0
- package/src/context/ContextSwitchContext.tsx +14 -1
- package/src/context/DiagnoseCustomization.tsx +3 -0
- package/src/context/clusterConnected.ts +10 -0
- package/src/contexts/CapabilitiesContext.tsx +6 -4
- package/src/hooks/useElementSize.ts +30 -0
- package/src/integrations/resourceHost.test.tsx +1 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +21 -4
- package/src/integrations/resourceHosts.tsx +12 -0
- package/src/main.tsx +5 -0
- package/src/utils/related-findings.ts +46 -0
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
investigationEvidenceSubjectRef,
|
|
4
|
+
projectInvestigationEvidence,
|
|
5
|
+
} from "../index";
|
|
6
|
+
import {
|
|
7
|
+
criticalIssue,
|
|
8
|
+
deployment,
|
|
9
|
+
evidenceRef,
|
|
10
|
+
groupsOf,
|
|
11
|
+
project,
|
|
12
|
+
target,
|
|
13
|
+
tool,
|
|
14
|
+
} from "../evidenceFixtures";
|
|
15
|
+
|
|
16
|
+
const connector = {
|
|
17
|
+
...criticalIssue,
|
|
18
|
+
id: "kafka.strimzi.io:KafkaConnector:shop:sink:StrimziConnectorTasksFailed",
|
|
19
|
+
severity: "warning",
|
|
20
|
+
group: "kafka.strimzi.io",
|
|
21
|
+
kind: "KafkaConnector",
|
|
22
|
+
name: "sink",
|
|
23
|
+
reason: "StrimziConnectorTasksFailed",
|
|
24
|
+
message: "Strimzi reports one or more connector tasks as FAILED",
|
|
25
|
+
};
|
|
26
|
+
const source = {
|
|
27
|
+
group: "kafka.strimzi.io",
|
|
28
|
+
kind: "KafkaConnect",
|
|
29
|
+
namespace: "shop",
|
|
30
|
+
name: "connect",
|
|
31
|
+
};
|
|
32
|
+
const context = {
|
|
33
|
+
tier: "basic",
|
|
34
|
+
workloadSummary: { replicas: { desired: 1, ready: 1, available: 1 } },
|
|
35
|
+
relatedFindings: [
|
|
36
|
+
{
|
|
37
|
+
kinds: {
|
|
38
|
+
count: 1,
|
|
39
|
+
names: [{ kind: "KafkaConnector", group: "kafka.strimzi.io" }],
|
|
40
|
+
},
|
|
41
|
+
associatedVia: source,
|
|
42
|
+
gaps: [],
|
|
43
|
+
checked: 1,
|
|
44
|
+
unknown: 0,
|
|
45
|
+
findings: [connector],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
describe("cached application findings", () => {
|
|
51
|
+
it("accepts an empty group list and does not invent a limitation", () => {
|
|
52
|
+
const result = project([
|
|
53
|
+
tool("read", "diagnose", {
|
|
54
|
+
resource: deployment,
|
|
55
|
+
relatedIssues: [],
|
|
56
|
+
resourceContext: { ...context, relatedFindings: [] },
|
|
57
|
+
}),
|
|
58
|
+
]);
|
|
59
|
+
expect(groupsOf(result.groups, "issue")).toHaveLength(0);
|
|
60
|
+
expect(result.limitations).toHaveLength(0);
|
|
61
|
+
expect(
|
|
62
|
+
groupsOf(result.groups, "receipt").some(
|
|
63
|
+
(group) =>
|
|
64
|
+
group.latest.data.type === "receipt" &&
|
|
65
|
+
group.latest.data.checked === "issues",
|
|
66
|
+
),
|
|
67
|
+
).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("retains good groups around a malformed group and preserves both anchors for one issue", () => {
|
|
71
|
+
const first = context.relatedFindings[0];
|
|
72
|
+
const second = {
|
|
73
|
+
...first,
|
|
74
|
+
associatedVia: {
|
|
75
|
+
group: "argoproj.io",
|
|
76
|
+
kind: "Application",
|
|
77
|
+
namespace: "ops",
|
|
78
|
+
name: "store",
|
|
79
|
+
},
|
|
80
|
+
unknown: 1,
|
|
81
|
+
};
|
|
82
|
+
const result = project([
|
|
83
|
+
tool("read", "get_resource", {
|
|
84
|
+
resource: deployment,
|
|
85
|
+
resourceContext: {
|
|
86
|
+
...context,
|
|
87
|
+
relatedFindings: [
|
|
88
|
+
first,
|
|
89
|
+
{ ...first, kinds: { count: 2, names: [] } },
|
|
90
|
+
second,
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
]);
|
|
95
|
+
const groups = groupsOf(result.groups, "issue");
|
|
96
|
+
expect(groups).toHaveLength(1);
|
|
97
|
+
expect(groups[0].observations).toHaveLength(2);
|
|
98
|
+
expect(
|
|
99
|
+
groups[0].observations.map(
|
|
100
|
+
(item) => item.data.type === "issue" && item.data.associatedVia,
|
|
101
|
+
),
|
|
102
|
+
).toEqual([source, second.associatedVia]);
|
|
103
|
+
expect(
|
|
104
|
+
result.limitations.some(
|
|
105
|
+
(item) => item.source === "Related findings group",
|
|
106
|
+
),
|
|
107
|
+
).toBe(true);
|
|
108
|
+
expect(
|
|
109
|
+
result.limitations.some(
|
|
110
|
+
(item) =>
|
|
111
|
+
item.source.includes("Application ops/store") &&
|
|
112
|
+
item.kind === "unknown",
|
|
113
|
+
),
|
|
114
|
+
).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("retains distinct issue IDs on one subject across repeated anchors", () => {
|
|
118
|
+
const first = context.relatedFindings[0];
|
|
119
|
+
const other = {
|
|
120
|
+
...connector,
|
|
121
|
+
id: `${connector.id}:other`,
|
|
122
|
+
reason: "OtherFailure",
|
|
123
|
+
};
|
|
124
|
+
const result = project([
|
|
125
|
+
tool("read", "get_resource", {
|
|
126
|
+
resource: deployment,
|
|
127
|
+
resourceContext: {
|
|
128
|
+
...context,
|
|
129
|
+
relatedFindings: [
|
|
130
|
+
{ ...first, findings: [connector, other] },
|
|
131
|
+
{
|
|
132
|
+
...first,
|
|
133
|
+
associatedVia: { ...source, name: "second" },
|
|
134
|
+
findings: [connector, other],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
139
|
+
]);
|
|
140
|
+
const groups = groupsOf(result.groups, "issue");
|
|
141
|
+
expect(groups).toHaveLength(2);
|
|
142
|
+
expect(groups.map((group) => group.observations.length)).toEqual([2, 2]);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it.each([
|
|
146
|
+
{ checked: -1 },
|
|
147
|
+
{ unknown: 2 },
|
|
148
|
+
{ kinds: { count: 0 } },
|
|
149
|
+
{ kinds: { count: 1, names: [{ kind: "" }] } },
|
|
150
|
+
{ gaps: [{ code: "" }] },
|
|
151
|
+
])("withholds invalid group fields without an all-clear: %j", (invalid) => {
|
|
152
|
+
const result = project([
|
|
153
|
+
tool("read", "diagnose", {
|
|
154
|
+
resource: deployment,
|
|
155
|
+
relatedIssues: [],
|
|
156
|
+
resourceContext: {
|
|
157
|
+
...context,
|
|
158
|
+
relatedFindings: [{ ...context.relatedFindings[0], ...invalid }],
|
|
159
|
+
},
|
|
160
|
+
}),
|
|
161
|
+
]);
|
|
162
|
+
expect(groupsOf(result.groups, "issue")).toHaveLength(0);
|
|
163
|
+
expect(
|
|
164
|
+
result.limitations.some(
|
|
165
|
+
(item) => item.source === "Related findings group",
|
|
166
|
+
),
|
|
167
|
+
).toBe(true);
|
|
168
|
+
expect(
|
|
169
|
+
groupsOf(result.groups, "receipt").filter(
|
|
170
|
+
(group) =>
|
|
171
|
+
group.latest.data.type === "receipt" &&
|
|
172
|
+
group.latest.data.checked === "issues",
|
|
173
|
+
),
|
|
174
|
+
).toHaveLength(0);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it("distinguishes output truncation without requiring explanatory prose", () => {
|
|
178
|
+
const result = project([
|
|
179
|
+
tool("read", "get_resource", {
|
|
180
|
+
resource: deployment,
|
|
181
|
+
resourceContext: {
|
|
182
|
+
...context,
|
|
183
|
+
relatedFindings: [{ ...context.relatedFindings[0], truncated: true }],
|
|
184
|
+
},
|
|
185
|
+
}),
|
|
186
|
+
]);
|
|
187
|
+
expect(groupsOf(result.groups, "issue")).toHaveLength(1);
|
|
188
|
+
expect(result.limitations).toEqual(
|
|
189
|
+
expect.arrayContaining([
|
|
190
|
+
expect.objectContaining({
|
|
191
|
+
kind: "truncated",
|
|
192
|
+
message: "Additional related findings were omitted.",
|
|
193
|
+
}),
|
|
194
|
+
]),
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const relatedCases = [
|
|
199
|
+
{
|
|
200
|
+
label: "cert-manager issuance",
|
|
201
|
+
anchor: {
|
|
202
|
+
group: "cert-manager.io",
|
|
203
|
+
kind: "Certificate",
|
|
204
|
+
namespace: "shop",
|
|
205
|
+
name: "tls",
|
|
206
|
+
},
|
|
207
|
+
subject: {
|
|
208
|
+
group: "acme.cert-manager.io",
|
|
209
|
+
kind: "Challenge",
|
|
210
|
+
namespace: "shop",
|
|
211
|
+
name: "http-01",
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
label: "External Secrets cluster store",
|
|
216
|
+
anchor: {
|
|
217
|
+
group: "external-secrets.io",
|
|
218
|
+
kind: "ExternalSecret",
|
|
219
|
+
namespace: "shop",
|
|
220
|
+
name: "credentials",
|
|
221
|
+
},
|
|
222
|
+
subject: {
|
|
223
|
+
group: "external-secrets.io",
|
|
224
|
+
kind: "ClusterSecretStore",
|
|
225
|
+
namespace: "",
|
|
226
|
+
name: "shared",
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
label: "Crossplane composition",
|
|
231
|
+
anchor: {
|
|
232
|
+
group: "platform.example.org",
|
|
233
|
+
kind: "Database",
|
|
234
|
+
namespace: "",
|
|
235
|
+
name: "orders",
|
|
236
|
+
},
|
|
237
|
+
subject: {
|
|
238
|
+
group: "aws.example.org",
|
|
239
|
+
kind: "Bucket",
|
|
240
|
+
namespace: "shop",
|
|
241
|
+
name: "storage",
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
label: "CloudNativePG backup",
|
|
246
|
+
anchor: {
|
|
247
|
+
group: "postgresql.cnpg.io",
|
|
248
|
+
kind: "Cluster",
|
|
249
|
+
namespace: "shop",
|
|
250
|
+
name: "orders",
|
|
251
|
+
},
|
|
252
|
+
subject: {
|
|
253
|
+
group: "postgresql.cnpg.io",
|
|
254
|
+
kind: "Backup",
|
|
255
|
+
namespace: "shop",
|
|
256
|
+
name: "nightly",
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
label: "Flux dependency",
|
|
261
|
+
anchor: {
|
|
262
|
+
group: "kustomize.toolkit.fluxcd.io",
|
|
263
|
+
kind: "Kustomization",
|
|
264
|
+
namespace: "shop",
|
|
265
|
+
name: "frontend",
|
|
266
|
+
},
|
|
267
|
+
subject: {
|
|
268
|
+
group: "kustomize.toolkit.fluxcd.io",
|
|
269
|
+
kind: "Kustomization",
|
|
270
|
+
namespace: "infra",
|
|
271
|
+
name: "database",
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
label: "Argo local managed resource",
|
|
276
|
+
anchor: {
|
|
277
|
+
group: "argoproj.io",
|
|
278
|
+
kind: "Application",
|
|
279
|
+
namespace: "argocd",
|
|
280
|
+
name: "store",
|
|
281
|
+
},
|
|
282
|
+
subject: {
|
|
283
|
+
group: "apps",
|
|
284
|
+
kind: "Deployment",
|
|
285
|
+
namespace: "shop",
|
|
286
|
+
name: "worker",
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
];
|
|
290
|
+
|
|
291
|
+
it.each(relatedCases)(
|
|
292
|
+
"preserves subject identity and partial coverage for $label",
|
|
293
|
+
({ anchor, subject }) => {
|
|
294
|
+
const findings = ["NotReady", "SyncFailed"].map((reason) => ({
|
|
295
|
+
...criticalIssue,
|
|
296
|
+
...subject,
|
|
297
|
+
id: `${subject.group}:${subject.kind}:${subject.namespace}:${subject.name}:${reason}`,
|
|
298
|
+
reason,
|
|
299
|
+
}));
|
|
300
|
+
const result = project([
|
|
301
|
+
tool("read", "get_resource", {
|
|
302
|
+
resource: deployment,
|
|
303
|
+
resourceContext: {
|
|
304
|
+
...context,
|
|
305
|
+
relatedFindings: [
|
|
306
|
+
{
|
|
307
|
+
kinds: {
|
|
308
|
+
count: 1,
|
|
309
|
+
names: [{ kind: subject.kind, group: subject.group }],
|
|
310
|
+
},
|
|
311
|
+
associatedVia: anchor,
|
|
312
|
+
checked: 1,
|
|
313
|
+
unknown: 0,
|
|
314
|
+
findings,
|
|
315
|
+
gaps: [{ code: "user_forbidden", action: "request_access" }],
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
},
|
|
319
|
+
}),
|
|
320
|
+
]);
|
|
321
|
+
const issues = groupsOf(result.groups, "issue");
|
|
322
|
+
expect(issues).toHaveLength(2);
|
|
323
|
+
for (const group of issues) {
|
|
324
|
+
const { namespace, ...identity } = subject;
|
|
325
|
+
const ref = investigationEvidenceSubjectRef(group.latest.data);
|
|
326
|
+
expect(ref).toMatchObject(identity);
|
|
327
|
+
expect(ref?.namespace).toBe(namespace || undefined);
|
|
328
|
+
expect(group.latest.data).toMatchObject({ associatedVia: anchor });
|
|
329
|
+
}
|
|
330
|
+
expect(groupsOf(result.groups, "resource")[0].latest).toMatchObject({
|
|
331
|
+
tier: "context",
|
|
332
|
+
tone: "neutral",
|
|
333
|
+
summary: "1/1 replicas ready",
|
|
334
|
+
});
|
|
335
|
+
expect(result.limitations.some((item) => item.kind === "unknown")).toBe(
|
|
336
|
+
true,
|
|
337
|
+
);
|
|
338
|
+
},
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
it.each(relatedCases)(
|
|
342
|
+
"does not retire $label findings from an empty parent verification",
|
|
343
|
+
({ anchor, subject }) => {
|
|
344
|
+
const finding = {
|
|
345
|
+
...criticalIssue,
|
|
346
|
+
...subject,
|
|
347
|
+
id: `${subject.group}:${subject.kind}:${subject.namespace}:${subject.name}:NotReady`,
|
|
348
|
+
reason: "NotReady",
|
|
349
|
+
};
|
|
350
|
+
const relatedFindings = {
|
|
351
|
+
kinds: {
|
|
352
|
+
count: 1,
|
|
353
|
+
names: [{ kind: subject.kind, group: subject.group }],
|
|
354
|
+
},
|
|
355
|
+
associatedVia: anchor,
|
|
356
|
+
checked: 1,
|
|
357
|
+
unknown: 0,
|
|
358
|
+
findings: [finding],
|
|
359
|
+
gaps: [],
|
|
360
|
+
};
|
|
361
|
+
const result = projectInvestigationEvidence(
|
|
362
|
+
[
|
|
363
|
+
{
|
|
364
|
+
timeline: [
|
|
365
|
+
tool("read", "diagnose", {
|
|
366
|
+
resource: deployment,
|
|
367
|
+
resourceContext: {
|
|
368
|
+
...context,
|
|
369
|
+
relatedFindings: [relatedFindings],
|
|
370
|
+
},
|
|
371
|
+
}),
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
verify: true,
|
|
376
|
+
status: "done",
|
|
377
|
+
timeline: [
|
|
378
|
+
tool("verify", "diagnose", {
|
|
379
|
+
resource: deployment,
|
|
380
|
+
relatedIssues: [],
|
|
381
|
+
resourceContext: {
|
|
382
|
+
...context,
|
|
383
|
+
relatedFindings: [
|
|
384
|
+
{
|
|
385
|
+
...relatedFindings,
|
|
386
|
+
findings: [],
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
},
|
|
390
|
+
}),
|
|
391
|
+
],
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
target,
|
|
395
|
+
);
|
|
396
|
+
expect(
|
|
397
|
+
groupsOf(result.groups, "issue").find(
|
|
398
|
+
(group) => group.identity === `issue:${finding.id}`,
|
|
399
|
+
)?.historical,
|
|
400
|
+
).toBe(false);
|
|
401
|
+
},
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
it.each(["diagnose", "get_resource"])(
|
|
405
|
+
"keeps connector identity and citation separate from healthy parent in %s",
|
|
406
|
+
(name) => {
|
|
407
|
+
const ref = evidenceRef("a", "b");
|
|
408
|
+
const result = project([
|
|
409
|
+
tool(
|
|
410
|
+
"read",
|
|
411
|
+
name,
|
|
412
|
+
{ resource: deployment, resourceContext: context },
|
|
413
|
+
{ evidenceRef: ref },
|
|
414
|
+
),
|
|
415
|
+
]);
|
|
416
|
+
const finding = groupsOf(result.groups, "issue")[0];
|
|
417
|
+
expect(finding.latest).toMatchObject({
|
|
418
|
+
tier: "supporting",
|
|
419
|
+
relevance: "producer-related",
|
|
420
|
+
source: { evidenceRef: ref },
|
|
421
|
+
data: { issue: connector, associatedVia: source },
|
|
422
|
+
});
|
|
423
|
+
expect(
|
|
424
|
+
investigationEvidenceSubjectRef(finding.latest.data),
|
|
425
|
+
).toMatchObject({
|
|
426
|
+
group: "kafka.strimzi.io",
|
|
427
|
+
kind: "KafkaConnector",
|
|
428
|
+
namespace: "shop",
|
|
429
|
+
name: "sink",
|
|
430
|
+
});
|
|
431
|
+
expect(groupsOf(result.groups, "resource")[0].latest).toMatchObject({
|
|
432
|
+
tier: "context",
|
|
433
|
+
tone: "neutral",
|
|
434
|
+
summary: "1/1 replicas ready",
|
|
435
|
+
});
|
|
436
|
+
expect(result.limitations).toHaveLength(0);
|
|
437
|
+
expect(
|
|
438
|
+
groupsOf(result.groups, "receipt").filter(
|
|
439
|
+
(group) =>
|
|
440
|
+
group.latest.data.type === "receipt" &&
|
|
441
|
+
group.latest.data.checked === "issues",
|
|
442
|
+
),
|
|
443
|
+
).toHaveLength(0);
|
|
444
|
+
},
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
it("does not clear captured connector proof when a later parent diagnosis lacks it", () => {
|
|
448
|
+
const result = projectInvestigationEvidence(
|
|
449
|
+
[
|
|
450
|
+
{
|
|
451
|
+
timeline: [
|
|
452
|
+
tool("read", "diagnose", {
|
|
453
|
+
resource: deployment,
|
|
454
|
+
resourceContext: context,
|
|
455
|
+
}),
|
|
456
|
+
],
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
verify: true,
|
|
460
|
+
status: "done",
|
|
461
|
+
timeline: [
|
|
462
|
+
tool("verify", "diagnose", {
|
|
463
|
+
resource: deployment,
|
|
464
|
+
relatedIssues: [],
|
|
465
|
+
}),
|
|
466
|
+
],
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
target,
|
|
470
|
+
);
|
|
471
|
+
expect(groupsOf(result.groups, "issue")[0].historical).toBe(false);
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
it("shows incomplete inspection without emitting a healthy receipt", () => {
|
|
475
|
+
const result = project([
|
|
476
|
+
tool("read", "diagnose", {
|
|
477
|
+
resource: deployment,
|
|
478
|
+
resourceContext: {
|
|
479
|
+
tier: "basic",
|
|
480
|
+
relatedFindings: [
|
|
481
|
+
{
|
|
482
|
+
kinds: {
|
|
483
|
+
count: 1,
|
|
484
|
+
names: [{ kind: "KafkaConnector", group: "kafka.strimzi.io" }],
|
|
485
|
+
},
|
|
486
|
+
associatedVia: source,
|
|
487
|
+
gaps: [{ code: "list_too_large", action: "change_request" }],
|
|
488
|
+
checked: 0,
|
|
489
|
+
unknown: 0,
|
|
490
|
+
},
|
|
491
|
+
],
|
|
492
|
+
},
|
|
493
|
+
}),
|
|
494
|
+
]);
|
|
495
|
+
expect(groupsOf(result.groups, "issue")).toHaveLength(0);
|
|
496
|
+
expect(
|
|
497
|
+
groupsOf(result.groups, "receipt").filter(
|
|
498
|
+
(group) =>
|
|
499
|
+
group.latest.data.type === "receipt" &&
|
|
500
|
+
group.latest.data.checked === "issues",
|
|
501
|
+
),
|
|
502
|
+
).toHaveLength(0);
|
|
503
|
+
expect(result.limitations).toEqual(
|
|
504
|
+
expect.arrayContaining([expect.objectContaining({ kind: "unknown" })]),
|
|
505
|
+
);
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it.each(["KafkaConnector", "KafkaConnect"])(
|
|
509
|
+
"does not invent event or change reads for cached %s diagnosis",
|
|
510
|
+
(kind) => {
|
|
511
|
+
const result = project([
|
|
512
|
+
tool("read", "diagnose", {
|
|
513
|
+
resource: {
|
|
514
|
+
apiVersion: "kafka.strimzi.io/v1",
|
|
515
|
+
kind,
|
|
516
|
+
metadata: { namespace: "shop", name: "connect" },
|
|
517
|
+
},
|
|
518
|
+
resourceContext: { tier: "basic" },
|
|
519
|
+
coverage:
|
|
520
|
+
"Cached operator evidence only; Pods, logs and live application endpoints were not collected.",
|
|
521
|
+
}),
|
|
522
|
+
]);
|
|
523
|
+
expect(groupsOf(result.groups, "receipt")).toHaveLength(0);
|
|
524
|
+
},
|
|
525
|
+
);
|
|
526
|
+
|
|
527
|
+
it("still retires the parent's own repaired issue while retaining connector proof", () => {
|
|
528
|
+
const result = projectInvestigationEvidence(
|
|
529
|
+
[
|
|
530
|
+
{
|
|
531
|
+
timeline: [
|
|
532
|
+
tool("read", "diagnose", {
|
|
533
|
+
resource: deployment,
|
|
534
|
+
relatedIssues: [criticalIssue],
|
|
535
|
+
resourceContext: context,
|
|
536
|
+
}),
|
|
537
|
+
],
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
verify: true,
|
|
541
|
+
status: "done",
|
|
542
|
+
timeline: [
|
|
543
|
+
tool("verify", "diagnose", {
|
|
544
|
+
resource: deployment,
|
|
545
|
+
relatedIssues: [],
|
|
546
|
+
resourceContext: {
|
|
547
|
+
...context,
|
|
548
|
+
relatedFindings: [
|
|
549
|
+
{
|
|
550
|
+
...context.relatedFindings[0],
|
|
551
|
+
findings: [],
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
},
|
|
555
|
+
}),
|
|
556
|
+
],
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
target,
|
|
560
|
+
);
|
|
561
|
+
expect(
|
|
562
|
+
groupsOf(result.groups, "issue").find(
|
|
563
|
+
(group) => group.identity === `issue:${criticalIssue.id}`,
|
|
564
|
+
)?.historical,
|
|
565
|
+
).toBe(true);
|
|
566
|
+
expect(
|
|
567
|
+
groupsOf(result.groups, "issue").find(
|
|
568
|
+
(group) => group.identity === `issue:${connector.id}`,
|
|
569
|
+
)?.historical,
|
|
570
|
+
).toBe(false);
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
it.each([true, false])(
|
|
574
|
+
"retires a connector target only with explicit observed recovery (%s)",
|
|
575
|
+
(recovered) => {
|
|
576
|
+
const resource = {
|
|
577
|
+
apiVersion: "kafka.strimzi.io/v1",
|
|
578
|
+
kind: "KafkaConnector",
|
|
579
|
+
metadata: { namespace: "shop", name: "sink" },
|
|
580
|
+
};
|
|
581
|
+
const result = projectInvestigationEvidence(
|
|
582
|
+
[
|
|
583
|
+
{
|
|
584
|
+
timeline: [
|
|
585
|
+
tool("read", "get_resource", {
|
|
586
|
+
resource: deployment,
|
|
587
|
+
resourceContext: context,
|
|
588
|
+
}),
|
|
589
|
+
],
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
verify: true,
|
|
593
|
+
status: "done",
|
|
594
|
+
timeline: [
|
|
595
|
+
tool("verify", "diagnose", {
|
|
596
|
+
resource,
|
|
597
|
+
resourceContext: { tier: "basic" },
|
|
598
|
+
operatorSnapshot: {
|
|
599
|
+
state: recovered ? "recovered" : "unknown",
|
|
600
|
+
generationCurrent: recovered,
|
|
601
|
+
readiness: recovered ? "ready" : "unknown",
|
|
602
|
+
reason: recovered ? undefined : "stale",
|
|
603
|
+
},
|
|
604
|
+
}),
|
|
605
|
+
],
|
|
606
|
+
},
|
|
607
|
+
],
|
|
608
|
+
{
|
|
609
|
+
group: "kafka.strimzi.io",
|
|
610
|
+
kind: "KafkaConnector",
|
|
611
|
+
namespace: "shop",
|
|
612
|
+
name: "sink",
|
|
613
|
+
},
|
|
614
|
+
);
|
|
615
|
+
expect(groupsOf(result.groups, "issue")[0].historical).toBe(recovered);
|
|
616
|
+
},
|
|
617
|
+
);
|
|
618
|
+
|
|
619
|
+
it.each(["shop", "other"])(
|
|
620
|
+
"uses connector-scoped recovery in a parent investigation (%s)",
|
|
621
|
+
(namespace) => {
|
|
622
|
+
const resource = {
|
|
623
|
+
apiVersion: "kafka.strimzi.io/v1",
|
|
624
|
+
kind: "KafkaConnector",
|
|
625
|
+
metadata: { namespace, name: "sink" },
|
|
626
|
+
};
|
|
627
|
+
const result = projectInvestigationEvidence(
|
|
628
|
+
[
|
|
629
|
+
{
|
|
630
|
+
timeline: [
|
|
631
|
+
tool("read", "diagnose", {
|
|
632
|
+
resource: deployment,
|
|
633
|
+
resourceContext: context,
|
|
634
|
+
}),
|
|
635
|
+
],
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
verify: true,
|
|
639
|
+
status: "done",
|
|
640
|
+
timeline: [
|
|
641
|
+
tool("verify", "diagnose", {
|
|
642
|
+
resource,
|
|
643
|
+
operatorSnapshot: {
|
|
644
|
+
state: "recovered",
|
|
645
|
+
generationCurrent: true,
|
|
646
|
+
readiness: "ready",
|
|
647
|
+
},
|
|
648
|
+
resourceContext: { tier: "basic" },
|
|
649
|
+
}),
|
|
650
|
+
],
|
|
651
|
+
},
|
|
652
|
+
],
|
|
653
|
+
target,
|
|
654
|
+
);
|
|
655
|
+
expect(groupsOf(result.groups, "issue")[0].historical).toBe(
|
|
656
|
+
namespace === "shop",
|
|
657
|
+
);
|
|
658
|
+
},
|
|
659
|
+
);
|
|
660
|
+
|
|
661
|
+
it("shows unverifiable operator status as a limitation", () => {
|
|
662
|
+
const result = project([
|
|
663
|
+
tool("read", "diagnose", {
|
|
664
|
+
resource: {
|
|
665
|
+
apiVersion: "kafka.strimzi.io/v1",
|
|
666
|
+
kind: "KafkaConnector",
|
|
667
|
+
metadata: { namespace: "shop", name: "sink" },
|
|
668
|
+
},
|
|
669
|
+
resourceContext: { tier: "basic" },
|
|
670
|
+
operatorSnapshot: {
|
|
671
|
+
state: "unknown",
|
|
672
|
+
generationCurrent: false,
|
|
673
|
+
readiness: "unknown",
|
|
674
|
+
reason: "stale",
|
|
675
|
+
},
|
|
676
|
+
}),
|
|
677
|
+
]);
|
|
678
|
+
expect(result.limitations).toEqual(
|
|
679
|
+
expect.arrayContaining([
|
|
680
|
+
expect.objectContaining({
|
|
681
|
+
source: "Operator snapshot",
|
|
682
|
+
message: expect.stringContaining("stale"),
|
|
683
|
+
}),
|
|
684
|
+
]),
|
|
685
|
+
);
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
it("shows KafkaConnect's own NotReady condition separately from connector findings", () => {
|
|
689
|
+
const result = project([
|
|
690
|
+
tool("read", "diagnose", {
|
|
691
|
+
resource: {
|
|
692
|
+
apiVersion: "kafka.strimzi.io/v1",
|
|
693
|
+
kind: "KafkaConnect",
|
|
694
|
+
metadata: { namespace: "shop", name: "connect" },
|
|
695
|
+
},
|
|
696
|
+
resourceContext: {
|
|
697
|
+
tier: "basic",
|
|
698
|
+
statusSummary: {
|
|
699
|
+
phase: "NotReady",
|
|
700
|
+
conditions: [{ type: "Ready", status: "False" }],
|
|
701
|
+
},
|
|
702
|
+
},
|
|
703
|
+
operatorSnapshot: {
|
|
704
|
+
state: "observed",
|
|
705
|
+
generationCurrent: true,
|
|
706
|
+
readiness: "not_ready",
|
|
707
|
+
},
|
|
708
|
+
}),
|
|
709
|
+
]);
|
|
710
|
+
expect(groupsOf(result.groups, "resource")[0].latest).toMatchObject({
|
|
711
|
+
tone: "warning",
|
|
712
|
+
summary: "NotReady",
|
|
713
|
+
});
|
|
714
|
+
expect(groupsOf(result.groups, "issue")).toHaveLength(0);
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
it("rejects malformed findings without projecting partial proof", () => {
|
|
718
|
+
const result = project([
|
|
719
|
+
tool("read", "get_resource", {
|
|
720
|
+
resource: deployment,
|
|
721
|
+
resourceContext: {
|
|
722
|
+
...context,
|
|
723
|
+
relatedFindings: [
|
|
724
|
+
{
|
|
725
|
+
...context.relatedFindings[0],
|
|
726
|
+
findings: [connector, { id: "bad" }],
|
|
727
|
+
},
|
|
728
|
+
],
|
|
729
|
+
},
|
|
730
|
+
}),
|
|
731
|
+
]);
|
|
732
|
+
expect(groupsOf(result.groups, "issue")).toHaveLength(0);
|
|
733
|
+
expect(
|
|
734
|
+
result.limitations.some(
|
|
735
|
+
(item) => item.source === "Related findings group",
|
|
736
|
+
),
|
|
737
|
+
).toBe(true);
|
|
738
|
+
});
|
|
739
|
+
});
|