@skyhook-io/radar-app 1.22.1 → 1.23.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/package.json +8 -8
- package/src/App.tsx +131 -38
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -0
- package/src/RadarApp.tsx +5 -0
- package/src/api/agentSandbox.ts +259 -0
- package/src/api/client.autoPromConnect.test.tsx +43 -0
- package/src/api/client.metricsRelayCheck.test.tsx +134 -0
- package/src/api/client.ts +128 -25
- package/src/api/cloudInstallDiscover.test.tsx +76 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/kagent.test.ts +82 -0
- package/src/api/kagent.ts +230 -0
- package/src/api/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +13 -0
- package/src/api/substrateWorkspace.test.ts +72 -0
- package/src/api/substrateWorkspace.ts +1394 -0
- package/src/api/vulnerabilities.ts +207 -9
- package/src/api/workloadSource.test.tsx +1172 -0
- package/src/api/workloadSource.ts +408 -0
- package/src/components/APIUnreachableBanner.test.tsx +19 -0
- package/src/components/APIUnreachableBanner.tsx +20 -0
- package/src/components/CloudConnectFlow.tsx +46 -7
- package/src/components/CloudFunnelButton.test.tsx +193 -7
- package/src/components/CloudFunnelButton.tsx +127 -32
- package/src/components/ConnectionErrorView.test.tsx +63 -2
- package/src/components/ConnectionErrorView.tsx +88 -68
- package/src/components/SelfManagedStart.tsx +12 -2
- package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
- package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
- package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
- package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
- package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
- package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
- package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
- package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
- package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
- package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
- package/src/components/agentsandbox/data.ts +135 -0
- package/src/components/agentsandbox/host.test.ts +27 -0
- package/src/components/agentsandbox/host.tsx +85 -0
- package/src/components/agentsandbox/labels.test.ts +42 -0
- package/src/components/agentsandbox/labels.ts +146 -0
- package/src/components/agentsandbox/listFilters.ts +85 -0
- package/src/components/agentsandbox/lists.ts +52 -0
- package/src/components/agentsandbox/routes.ts +23 -0
- package/src/components/agentsandbox/shared.tsx +321 -0
- package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
- package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
- package/src/components/agentsandbox/workspace.tsx +258 -0
- package/src/components/agentsandbox/workspaceRoute.ts +18 -0
- package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
- package/src/components/applications/ApplicationsView.tsx +156 -3
- package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
- package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
- package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
- package/src/components/audit/VulnerabilitiesView.tsx +639 -199
- package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
- package/src/components/cloudHints/CloudHintLink.tsx +29 -0
- package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
- package/src/components/cloudHints/cloudHints.test.ts +126 -0
- package/src/components/cloudHints/cloudHints.ts +131 -0
- package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
- package/src/components/cloudHints/cloudLinks.test.ts +52 -0
- package/src/components/cloudHints/cloudLinks.ts +31 -0
- package/src/components/cloudHints/hintStorage.ts +28 -0
- package/src/components/cnpg/CNPGView.tsx +4 -7
- package/src/components/diagnose/ActivityTurn.tsx +6 -4
- package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
- package/src/components/diagnose/AssessmentCard.tsx +1 -2
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +7 -0
- package/src/components/diagnose/DiagnoseContext.tsx +7 -0
- package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
- package/src/components/diagnose/Home.test.tsx +6 -0
- package/src/components/diagnose/Home.tsx +10 -3
- package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +1 -1
- package/src/components/diagnose/InvestigationEvidencePane.tsx +19 -2
- package/src/components/diagnose/InvestigationFindingsFooter.test.tsx +413 -0
- package/src/components/diagnose/InvestigationView.tsx +120 -23
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +1 -1
- package/src/components/diagnose/investigationState.ts +9 -0
- package/src/components/diagnose/parts.test.tsx +11 -3
- package/src/components/diagnose/toolCallLabel.ts +3 -0
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/home/ActivitySummary.tsx +3 -8
- package/src/components/home/ClusterHealthCard.tsx +91 -17
- package/src/components/home/ClusterHealthCard.utilization.test.tsx +187 -0
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +9 -29
- package/src/components/home/MCPSetupDialog.test.tsx +9 -0
- package/src/components/home/MCPSetupDialog.tsx +6 -2
- package/src/components/home/McpCloudLine.test.tsx +162 -0
- package/src/components/home/McpCloudLine.tsx +95 -0
- package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
- package/src/components/home/TopologyPreview.test.tsx +31 -30
- package/src/components/home/TopologyPreview.tsx +19 -28
- package/src/components/home/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +7 -7
- package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
- package/src/components/issues/IssuesPane.render.test.tsx +36 -1
- package/src/components/issues/IssuesPane.tsx +181 -23
- package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
- package/src/components/issues/SinceLastVisitRow.tsx +71 -0
- package/src/components/issues/sinceLastVisit.test.ts +266 -0
- package/src/components/issues/sinceLastVisit.ts +439 -0
- package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
- package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
- package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
- package/src/components/kagent/KagentAgentSessions.tsx +124 -0
- package/src/components/kagent/KagentDetailPage.tsx +106 -0
- package/src/components/kagent/KagentLists.tsx +412 -0
- package/src/components/kagent/KagentOverview.tsx +234 -0
- package/src/components/kagent/KagentPages.tsx +690 -0
- package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
- package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
- package/src/components/kagent/KagentSidebar.test.tsx +112 -0
- package/src/components/kagent/KagentView.tsx +109 -0
- package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
- package/src/components/kagent/host.tsx +144 -0
- package/src/components/kagent/routes.ts +31 -0
- package/src/components/kagent/shared.tsx +336 -0
- package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
- package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
- package/src/components/kagent/workspace.fixtures.ts +108 -0
- package/src/components/kagent/workspaceRoute.ts +18 -0
- package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
- package/src/components/resource/MetricsNotConnected.tsx +10 -7
- package/src/components/resource/PrometheusCharts.tsx +10 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
- package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
- package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
- package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
- package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +2 -6
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +5 -4
- package/src/components/resources/renderers/PodRenderer.tsx +8 -2
- package/src/components/resources/renderers/RolloutRenderer.tsx +4 -1
- package/src/components/resources/renderers/WorkloadRenderer.tsx +4 -1
- package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
- package/src/components/settings/SettingsDialog.tsx +84 -16
- package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
- package/src/components/settings/SubstrateSettings.test.tsx +131 -0
- package/src/components/settings/SubstrateSettings.tsx +544 -0
- package/src/components/settings/settings-state.test.ts +21 -3
- package/src/components/settings/settings-state.ts +13 -3
- package/src/components/share/ShareLinkButton.test.tsx +360 -0
- package/src/components/share/ShareLinkButton.tsx +391 -0
- package/src/components/share/openShareInCloud.test.ts +29 -0
- package/src/components/share/openShareInCloud.ts +10 -0
- package/src/components/share/shareLink.test.ts +129 -0
- package/src/components/share/shareLink.ts +175 -0
- package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
- package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
- package/src/components/substrate/SubstrateActorPage.tsx +384 -0
- package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
- package/src/components/substrate/SubstrateActors.tsx +612 -0
- package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
- package/src/components/substrate/SubstrateConnect.tsx +88 -0
- package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
- package/src/components/substrate/SubstrateOverview.tsx +575 -0
- package/src/components/substrate/SubstratePages.test.tsx +478 -0
- package/src/components/substrate/SubstratePool.test.tsx +462 -0
- package/src/components/substrate/SubstratePoolPage.tsx +95 -0
- package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
- package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
- package/src/components/substrate/SubstrateStateBar.tsx +63 -0
- package/src/components/substrate/SubstrateTemplates.tsx +376 -0
- package/src/components/substrate/SubstrateView.tsx +173 -0
- package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
- package/src/components/substrate/SubstrateWorkers.tsx +389 -0
- package/src/components/substrate/attention.ts +81 -0
- package/src/components/substrate/contextPin.tsx +69 -0
- package/src/components/substrate/host.tsx +83 -0
- package/src/components/substrate/kubectlTarget.test.tsx +77 -0
- package/src/components/substrate/readings.test.ts +484 -0
- package/src/components/substrate/readings.ts +997 -0
- package/src/components/substrate/routes.ts +103 -0
- package/src/components/substrate/shared.tsx +426 -0
- package/src/components/substrate/substrate.fixtures.ts +325 -0
- package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
- package/src/components/substrate/workspaceRoute.ts +23 -0
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
- package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
- package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -5
- package/src/components/traffic/TrafficGraph.test.tsx +26 -0
- package/src/components/traffic/TrafficGraph.tsx +17 -14
- package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
- package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
- package/src/components/traffic/TrafficView.tsx +26 -56
- package/src/components/traffic/trafficFilters.test.ts +61 -1
- package/src/components/traffic/trafficFilters.ts +68 -8
- package/src/components/velero/VeleroOverview.tsx +2 -2
- package/src/components/velero/VeleroView.tsx +3 -6
- package/src/components/vulnerabilities/columns.tsx +132 -0
- package/src/components/vulnerabilities/filters.tsx +317 -0
- package/src/components/vulnerabilities/owner.test.ts +54 -0
- package/src/components/vulnerabilities/owner.tsx +163 -0
- package/src/components/vulnerabilities/parts.test.ts +126 -12
- package/src/components/vulnerabilities/parts.tsx +612 -52
- package/src/components/vulnerabilities/traffic.test.tsx +65 -0
- package/src/components/vulnerabilities/traffic.tsx +40 -0
- package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
- package/src/components/workload/WorkloadView.tsx +119 -14
- package/src/components/workload/WorkloadView.workloadSource.test.tsx +121 -0
- package/src/components/workspace/layout.tsx +13 -7
- package/src/components/workspace/sidebar.test.ts +48 -0
- package/src/components/workspace/sidebar.ts +73 -3
- package/src/components/workspace/table.ts +2 -1
- package/src/context/ConnectionContext.tsx +24 -5
- package/src/context/ConnectionProvider.connectionId.test.tsx +14 -0
- package/src/context/ConnectionProvider.handover.test.tsx +94 -0
- package/src/context/DiagnoseCustomization.tsx +20 -2
- package/src/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -0
- package/src/hooks/useEventSource.test.tsx +275 -4
- package/src/hooks/useEventSource.ts +278 -51
- package/src/index.ts +1 -0
- package/src/integrations/resourceHost.ts +12 -6
- package/src/integrations/resourceHosts.test.tsx +27 -1
- package/src/integrations/resourceHosts.tsx +15 -7
- package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
- package/src/integrations/sidebarWorkspaces.ts +41 -0
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.ts +7 -1
- package/src/integrations/workspaceScreens.tsx +6 -0
- package/src/utils/navigation.test.ts +1 -6
- package/src/utils/navigation.ts +9 -44
- package/src/utils/network-policy-navigation.test.ts +21 -36
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, type ReactNode } from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import { MemoryRouter } from "react-router-dom";
|
|
5
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
6
|
+
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
|
7
|
+
import {
|
|
8
|
+
subscribeRun,
|
|
9
|
+
type DiagnoseStreamEvent,
|
|
10
|
+
type RunSummary,
|
|
11
|
+
type SubscribeHandlers,
|
|
12
|
+
} from "../../api/diagnose";
|
|
13
|
+
import {
|
|
14
|
+
DiagnoseCustomizationProvider,
|
|
15
|
+
type RenderInvestigationFindingsFooter,
|
|
16
|
+
} from "../../context/DiagnoseCustomization";
|
|
17
|
+
import { EXAMPLE_INVESTIGATION_RUN } from "./exampleInvestigation";
|
|
18
|
+
import transcript from "./exampleInvestigation.events.json";
|
|
19
|
+
import { InvestigationView } from "./InvestigationView";
|
|
20
|
+
|
|
21
|
+
vi.mock("../../api/diagnose", async (original) => ({
|
|
22
|
+
...(await original<typeof import("../../api/diagnose")>()),
|
|
23
|
+
subscribeRun: vi.fn(),
|
|
24
|
+
}));
|
|
25
|
+
vi.mock("./DiagnoseContext", () => ({
|
|
26
|
+
useDiagnose: () => ({
|
|
27
|
+
refreshRuns: vi.fn(),
|
|
28
|
+
agents: [{ name: "claude", hosted: true, assessmentExplanations: true }],
|
|
29
|
+
}),
|
|
30
|
+
}));
|
|
31
|
+
vi.mock("../../context/ThemeContext", () => ({
|
|
32
|
+
useTheme: () => ({ theme: "light" }),
|
|
33
|
+
}));
|
|
34
|
+
vi.mock("../ui/Tooltip", () => ({
|
|
35
|
+
Tooltip: ({ children }: { children: ReactNode }) => children,
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
const events = transcript as unknown as DiagnoseStreamEvent[];
|
|
39
|
+
const evidenceRef = events.find((e) => e.step?.evidenceRef)?.step?.evidenceRef;
|
|
40
|
+
if (!evidenceRef) throw new Error("The example transcript needs a cited read");
|
|
41
|
+
const run = {
|
|
42
|
+
...EXAMPLE_INVESTIGATION_RUN,
|
|
43
|
+
id: "hosted-run",
|
|
44
|
+
ownedByMe: false,
|
|
45
|
+
visibility: "organization" as const,
|
|
46
|
+
canContinue: true,
|
|
47
|
+
};
|
|
48
|
+
let container: HTMLDivElement;
|
|
49
|
+
let root: ReturnType<typeof createRoot>;
|
|
50
|
+
let stream: SubscribeHandlers;
|
|
51
|
+
let footer: Parameters<RenderInvestigationFindingsFooter>[0];
|
|
52
|
+
const scrollTo = vi.fn();
|
|
53
|
+
const renderFooter: RenderInvestigationFindingsFooter = (props) => {
|
|
54
|
+
footer = props;
|
|
55
|
+
return (
|
|
56
|
+
<article aria-label="Proposed change" tabIndex={-1}>
|
|
57
|
+
Review change
|
|
58
|
+
</article>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
|
63
|
+
vi.stubGlobal(
|
|
64
|
+
"ResizeObserver",
|
|
65
|
+
class {
|
|
66
|
+
observe() {}
|
|
67
|
+
disconnect() {}
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
vi.stubGlobal("matchMedia", () => ({
|
|
71
|
+
matches: true,
|
|
72
|
+
addEventListener() {},
|
|
73
|
+
removeEventListener() {},
|
|
74
|
+
}));
|
|
75
|
+
vi.mocked(subscribeRun).mockImplementation((_id, handlers) => {
|
|
76
|
+
stream = handlers;
|
|
77
|
+
return () => {};
|
|
78
|
+
});
|
|
79
|
+
container = document.createElement("div");
|
|
80
|
+
document.body.appendChild(container);
|
|
81
|
+
root = createRoot(container);
|
|
82
|
+
});
|
|
83
|
+
afterEach(() => {
|
|
84
|
+
act(() => root.unmount());
|
|
85
|
+
container.remove();
|
|
86
|
+
vi.unstubAllGlobals();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
function render(canContinue = true, summary: Partial<RunSummary> = {}) {
|
|
90
|
+
act(() =>
|
|
91
|
+
root.render(
|
|
92
|
+
<QueryClientProvider client={new QueryClient()}>
|
|
93
|
+
<MemoryRouter>
|
|
94
|
+
<DiagnoseCustomizationProvider
|
|
95
|
+
value={undefined}
|
|
96
|
+
renderFindingsFooter={renderFooter}
|
|
97
|
+
>
|
|
98
|
+
<InvestigationView
|
|
99
|
+
run={{ ...run, canContinue, ...summary }}
|
|
100
|
+
agentLabel="Hosted"
|
|
101
|
+
maximized={false}
|
|
102
|
+
/>
|
|
103
|
+
</DiagnoseCustomizationProvider>
|
|
104
|
+
</MemoryRouter>
|
|
105
|
+
</QueryClientProvider>,
|
|
106
|
+
),
|
|
107
|
+
);
|
|
108
|
+
const findings = container.querySelector<HTMLElement>(
|
|
109
|
+
"[data-investigation-findings-scroll]",
|
|
110
|
+
)!;
|
|
111
|
+
scrollTo.mockClear();
|
|
112
|
+
findings.scrollTo = scrollTo;
|
|
113
|
+
return findings;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function replay(saved: DiagnoseStreamEvent[] = events) {
|
|
117
|
+
act(() => {
|
|
118
|
+
for (const [i, event] of saved.entries()) stream.onEvent(event, i + 1);
|
|
119
|
+
stream.onEvent({ type: "replay_complete" });
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
it("waits for the replay boundary before exposing a landing target", () => {
|
|
124
|
+
const findings = render();
|
|
125
|
+
for (const [i, event] of events.entries()) {
|
|
126
|
+
act(() => stream.onEvent(event, i + 1));
|
|
127
|
+
expect(findings.querySelector("[aria-label='Proposed change']")).toBeNull();
|
|
128
|
+
}
|
|
129
|
+
act(() => stream.onEvent({ type: "replay_complete" }));
|
|
130
|
+
expect(findings.querySelector("[aria-label='Proposed change']")).toBeTruthy();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("lands on the resolved card in Findings and returns to the actual assessment and composer", () => {
|
|
134
|
+
const findings = render();
|
|
135
|
+
expect(
|
|
136
|
+
findings.querySelector("article[aria-label='Proposed change']"),
|
|
137
|
+
).toBeNull();
|
|
138
|
+
replay();
|
|
139
|
+
const card = findings.querySelector<HTMLElement>(
|
|
140
|
+
"[aria-label='Proposed change']",
|
|
141
|
+
)!;
|
|
142
|
+
const assessment = findings.querySelector<HTMLElement>(
|
|
143
|
+
".investigation-assessment",
|
|
144
|
+
)!;
|
|
145
|
+
expect(
|
|
146
|
+
assessment.compareDocumentPosition(card) & Node.DOCUMENT_POSITION_FOLLOWING,
|
|
147
|
+
).toBeTruthy();
|
|
148
|
+
expect(scrollTo).not.toHaveBeenCalled();
|
|
149
|
+
act(() => footer.askQuestion!());
|
|
150
|
+
expect(document.activeElement?.tagName).toBe("TEXTAREA");
|
|
151
|
+
act(() => footer.revealInFindings(card));
|
|
152
|
+
expect(document.activeElement).toBe(card);
|
|
153
|
+
expect(findings.parentElement?.classList.contains("hidden")).toBe(false);
|
|
154
|
+
expect(scrollTo).toHaveBeenCalledTimes(1);
|
|
155
|
+
act(() => footer.viewAssessment!());
|
|
156
|
+
expect(document.activeElement).toBe(assessment);
|
|
157
|
+
expect(footer.evidenceLink(evidenceRef)).toEqual(expect.any(Function));
|
|
158
|
+
expect(footer.evidenceLink("unrelated")).toBeUndefined();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("opens the precise raw tool result when Findings has no card for its read", async () => {
|
|
162
|
+
render();
|
|
163
|
+
const original = events.find(
|
|
164
|
+
(event) => event.step?.evidenceRef === evidenceRef,
|
|
165
|
+
)!;
|
|
166
|
+
const step = {
|
|
167
|
+
...original.step!,
|
|
168
|
+
tool: "read_cluster_provider",
|
|
169
|
+
id: "raw-receipt",
|
|
170
|
+
};
|
|
171
|
+
replay([{ type: "turn" }, { type: "step", step }, { type: "done" }]);
|
|
172
|
+
const activity = container.querySelector<HTMLElement>(
|
|
173
|
+
"[data-investigation-activity-scroll]",
|
|
174
|
+
)!;
|
|
175
|
+
activity.scrollTo = vi.fn();
|
|
176
|
+
const open = footer.evidenceLink(evidenceRef);
|
|
177
|
+
expect(open).toEqual(expect.any(Function));
|
|
178
|
+
act(() => open!());
|
|
179
|
+
await vi.waitFor(() => {
|
|
180
|
+
expect(document.activeElement?.id).toBe(
|
|
181
|
+
"investigation-activity-turn-0-step-raw-receipt",
|
|
182
|
+
);
|
|
183
|
+
});
|
|
184
|
+
expect(activity.contains(document.activeElement)).toBe(true);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("keeps a proposal bound to its earlier read and withholds ambiguous references", () => {
|
|
188
|
+
render();
|
|
189
|
+
const original = events.find(
|
|
190
|
+
(event) => event.step?.evidenceRef === evidenceRef,
|
|
191
|
+
)!;
|
|
192
|
+
const followUp: DiagnoseStreamEvent = {
|
|
193
|
+
type: "turn",
|
|
194
|
+
question: "Check another resource",
|
|
195
|
+
};
|
|
196
|
+
replay([...events, followUp]);
|
|
197
|
+
expect(footer.evidenceLink(evidenceRef)).toEqual(expect.any(Function));
|
|
198
|
+
act(() =>
|
|
199
|
+
stream.onEvent({
|
|
200
|
+
...original,
|
|
201
|
+
step: { ...original.step!, id: "duplicate" },
|
|
202
|
+
}),
|
|
203
|
+
);
|
|
204
|
+
expect(footer.evidenceLink(evidenceRef)).toBeUndefined();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("opens the original Kubernetes read after a second read updates its Findings card", async () => {
|
|
208
|
+
const findings = render();
|
|
209
|
+
const activity = container.querySelector<HTMLElement>(
|
|
210
|
+
"[data-investigation-activity-scroll]",
|
|
211
|
+
)!;
|
|
212
|
+
activity.scrollTo = vi.fn();
|
|
213
|
+
const newerRef = "ev_sampleinvestigationaaaaaaa_seconddeploymentreadbaaaaa";
|
|
214
|
+
function read(id: string, ref: string, version: string): DiagnoseStreamEvent {
|
|
215
|
+
return {
|
|
216
|
+
type: "step",
|
|
217
|
+
step: {
|
|
218
|
+
id,
|
|
219
|
+
tool: "get_resource",
|
|
220
|
+
status: "done",
|
|
221
|
+
isError: false,
|
|
222
|
+
radarEvidence: true,
|
|
223
|
+
evidenceRef: ref,
|
|
224
|
+
result: JSON.stringify({
|
|
225
|
+
apiVersion: "apps/v1",
|
|
226
|
+
kind: "Deployment",
|
|
227
|
+
metadata: {
|
|
228
|
+
name: run.name,
|
|
229
|
+
namespace: run.namespace,
|
|
230
|
+
resourceVersion: version,
|
|
231
|
+
},
|
|
232
|
+
status: { readyReplicas: 2, replicas: 3 },
|
|
233
|
+
}),
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
replay([
|
|
238
|
+
{ type: "turn" },
|
|
239
|
+
read("initial-read", evidenceRef, "before-change"),
|
|
240
|
+
{ type: "done" },
|
|
241
|
+
{ type: "turn", question: "Check the current workload", verify: true },
|
|
242
|
+
read("verified-read", newerRef, "after-change"),
|
|
243
|
+
{ type: "done" },
|
|
244
|
+
]);
|
|
245
|
+
act(() => footer.evidenceLink(evidenceRef)!());
|
|
246
|
+
await vi.waitFor(() => {
|
|
247
|
+
expect(document.activeElement?.id).toBe(
|
|
248
|
+
"investigation-activity-turn-0-step-initial-read",
|
|
249
|
+
);
|
|
250
|
+
expect(document.activeElement?.textContent).toContain("before-change");
|
|
251
|
+
expect(document.activeElement?.textContent).not.toContain("after-change");
|
|
252
|
+
});
|
|
253
|
+
act(() => footer.evidenceLink(newerRef)!());
|
|
254
|
+
await vi.waitFor(() => {
|
|
255
|
+
expect(findings.contains(document.activeElement)).toBe(true);
|
|
256
|
+
expect(document.activeElement?.hasAttribute("data-evidence-card")).toBe(
|
|
257
|
+
true,
|
|
258
|
+
);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it("keeps read-only proposals in Findings without exposing a follow-up action", () => {
|
|
263
|
+
const findings = render(false);
|
|
264
|
+
replay();
|
|
265
|
+
expect(findings.textContent).toContain("Review change");
|
|
266
|
+
expect(footer.askQuestion).toBeUndefined();
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it("lets an assigned reader see the private proposal and its evidence through a running turn and replay", () => {
|
|
270
|
+
const explanation = "Only the investigator can ask follow-up questions.";
|
|
271
|
+
const findings = render(false, {
|
|
272
|
+
visibility: "private",
|
|
273
|
+
status: "running",
|
|
274
|
+
ownedByMe: false,
|
|
275
|
+
continueBlockedReason: explanation,
|
|
276
|
+
});
|
|
277
|
+
replay([{ type: "turn" }]);
|
|
278
|
+
expect(container.textContent).not.toContain("Stop agent");
|
|
279
|
+
expect(footer.askQuestion).toBeUndefined();
|
|
280
|
+
// The server's run summary still says running after the terminal event.
|
|
281
|
+
act(() => {
|
|
282
|
+
for (const [i, event] of events.slice(1).entries())
|
|
283
|
+
stream.onEvent(event, i + 2);
|
|
284
|
+
});
|
|
285
|
+
expect(findings.querySelector("[aria-label='Proposed change']")).toBeTruthy();
|
|
286
|
+
expect(footer.evidenceLink(evidenceRef)).toEqual(expect.any(Function));
|
|
287
|
+
expect(container.textContent).toContain(explanation);
|
|
288
|
+
expect(container.querySelector("textarea")).toBeNull();
|
|
289
|
+
expect(findings.textContent).not.toContain("Explain simply");
|
|
290
|
+
expect(footer.askQuestion).toBeUndefined();
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it("can land on a proposal even when saved evidence is permanently unavailable", () => {
|
|
294
|
+
const findings = render();
|
|
295
|
+
act(() =>
|
|
296
|
+
stream.onEvent({
|
|
297
|
+
type: "history_unavailable",
|
|
298
|
+
error: "Could not restore history",
|
|
299
|
+
retryable: false,
|
|
300
|
+
}),
|
|
301
|
+
);
|
|
302
|
+
expect(findings.textContent).toContain("Saved evidence unavailable");
|
|
303
|
+
const card = findings.querySelector<HTMLElement>(
|
|
304
|
+
"[aria-label='Proposed change']",
|
|
305
|
+
)!;
|
|
306
|
+
act(() => footer.revealInFindings(card));
|
|
307
|
+
expect(document.activeElement).toBe(card);
|
|
308
|
+
expect(footer.viewAssessment).toBeUndefined();
|
|
309
|
+
expect(footer.evidenceLink(evidenceRef)).toBeUndefined();
|
|
310
|
+
expect(footer.askQuestion).toBeUndefined();
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it("expands Captured results and focuses an unplaced main read in a story-shaped investigation", async () => {
|
|
314
|
+
const findings = render();
|
|
315
|
+
const proposalRef = "ev_sampleinvestigationaaaaaaa_proposalgetresourcereadaaa";
|
|
316
|
+
const proposalRead: DiagnoseStreamEvent = {
|
|
317
|
+
type: "step",
|
|
318
|
+
step: {
|
|
319
|
+
id: "proposal-read",
|
|
320
|
+
tool: "get_resource",
|
|
321
|
+
status: "done",
|
|
322
|
+
isError: false,
|
|
323
|
+
radarEvidence: true,
|
|
324
|
+
evidenceRef: proposalRef,
|
|
325
|
+
result: JSON.stringify({
|
|
326
|
+
apiVersion: "apps/v1",
|
|
327
|
+
kind: "Deployment",
|
|
328
|
+
metadata: {
|
|
329
|
+
name: run.name,
|
|
330
|
+
namespace: run.namespace,
|
|
331
|
+
resourceVersion: "42",
|
|
332
|
+
},
|
|
333
|
+
status: { readyReplicas: 1, replicas: 2 },
|
|
334
|
+
}),
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
replay([...events.slice(0, -1), proposalRead, events[events.length - 1]]);
|
|
338
|
+
|
|
339
|
+
const resultsToggle = findings.querySelector<HTMLButtonElement>(
|
|
340
|
+
'button[aria-controls="investigation-captured-results"]',
|
|
341
|
+
)!;
|
|
342
|
+
const resultsPanel = findings.querySelector<HTMLElement>(
|
|
343
|
+
"#investigation-captured-results",
|
|
344
|
+
)!;
|
|
345
|
+
const targetCard = resultsPanel.querySelector<HTMLElement>(
|
|
346
|
+
'[data-evidence-source="turn-0-step-proposal-read"]',
|
|
347
|
+
)!;
|
|
348
|
+
expect(resultsToggle.getAttribute("aria-expanded")).toBe("false");
|
|
349
|
+
expect(targetCard).toBeTruthy();
|
|
350
|
+
expect(targetCard.closest("[inert]")).not.toBeNull();
|
|
351
|
+
|
|
352
|
+
const open = footer.evidenceLink(proposalRef);
|
|
353
|
+
expect(open).toEqual(expect.any(Function));
|
|
354
|
+
act(() => open!());
|
|
355
|
+
|
|
356
|
+
await vi.waitFor(() => {
|
|
357
|
+
expect(resultsToggle.getAttribute("aria-expanded")).toBe("true");
|
|
358
|
+
expect(targetCard.closest("[inert]")).toBeNull();
|
|
359
|
+
expect(document.activeElement).toBe(targetCard);
|
|
360
|
+
expect(document.activeElement?.hasAttribute("data-evidence-card")).toBe(
|
|
361
|
+
true,
|
|
362
|
+
);
|
|
363
|
+
});
|
|
364
|
+
expect(resultsPanel.contains(document.activeElement)).toBe(true);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
it("preserves visible story cards and focuses the non-inert Captured results card when a story duplicate is inert", async () => {
|
|
368
|
+
const findings = render();
|
|
369
|
+
replay();
|
|
370
|
+
const placedRef = "ev_sampleinvestigationaaaaaaa_applicationdiagnosebundlea";
|
|
371
|
+
const resultsToggle = findings.querySelector<HTMLButtonElement>(
|
|
372
|
+
'button[aria-controls="investigation-captured-results"]',
|
|
373
|
+
)!;
|
|
374
|
+
const resultsPanel = findings.querySelector<HTMLElement>(
|
|
375
|
+
"#investigation-captured-results",
|
|
376
|
+
)!;
|
|
377
|
+
const story = findings.querySelector<HTMLElement>("[data-story]")!;
|
|
378
|
+
const storyToggle = findings.querySelector<HTMLButtonElement>(
|
|
379
|
+
"[data-story] > button[aria-expanded]",
|
|
380
|
+
)!;
|
|
381
|
+
|
|
382
|
+
act(() => storyToggle.click());
|
|
383
|
+
expect(story.getAttribute("data-story-open")).toBe("true");
|
|
384
|
+
expect(resultsToggle.getAttribute("aria-expanded")).toBe("false");
|
|
385
|
+
|
|
386
|
+
const open = footer.evidenceLink(placedRef);
|
|
387
|
+
expect(open).toEqual(expect.any(Function));
|
|
388
|
+
act(() => open!());
|
|
389
|
+
|
|
390
|
+
await vi.waitFor(() => {
|
|
391
|
+
expect(story.contains(document.activeElement)).toBe(true);
|
|
392
|
+
expect(document.activeElement?.id.startsWith("story-")).toBe(true);
|
|
393
|
+
expect(document.activeElement?.closest("[inert]")).toBeNull();
|
|
394
|
+
});
|
|
395
|
+
const storyCard = document.activeElement as HTMLElement;
|
|
396
|
+
expect(resultsToggle.getAttribute("aria-expanded")).toBe("false");
|
|
397
|
+
|
|
398
|
+
act(() => storyToggle.click());
|
|
399
|
+
expect(story.getAttribute("data-story-open")).toBe("false");
|
|
400
|
+
expect(story.contains(storyCard)).toBe(true);
|
|
401
|
+
expect(storyCard.closest("[inert]")).not.toBeNull();
|
|
402
|
+
|
|
403
|
+
act(() => footer.evidenceLink(placedRef)!());
|
|
404
|
+
await vi.waitFor(() => {
|
|
405
|
+
expect(resultsToggle.getAttribute("aria-expanded")).toBe("true");
|
|
406
|
+
expect(resultsPanel.contains(document.activeElement)).toBe(true);
|
|
407
|
+
expect(document.activeElement).not.toBe(storyCard);
|
|
408
|
+
expect(document.activeElement?.hasAttribute("data-evidence-card")).toBe(
|
|
409
|
+
true,
|
|
410
|
+
);
|
|
411
|
+
expect(document.activeElement?.closest("[inert]")).toBeNull();
|
|
412
|
+
});
|
|
413
|
+
});
|
|
@@ -88,6 +88,7 @@ import {
|
|
|
88
88
|
type RunSummary,
|
|
89
89
|
} from "../../api/diagnose";
|
|
90
90
|
import { useDiagnose } from "./DiagnoseContext";
|
|
91
|
+
import { useDiagnoseCustomization } from "../../context/DiagnoseCustomization";
|
|
91
92
|
import {
|
|
92
93
|
ExampleInvestigationProvider,
|
|
93
94
|
replayExampleInvestigation,
|
|
@@ -267,6 +268,22 @@ export function InvestigationStatusCheckNotice({
|
|
|
267
268
|
);
|
|
268
269
|
}
|
|
269
270
|
|
|
271
|
+
function focusFindingsSection(
|
|
272
|
+
scroller: HTMLElement,
|
|
273
|
+
section: HTMLElement,
|
|
274
|
+
behavior: ScrollBehavior,
|
|
275
|
+
) {
|
|
276
|
+
section.focus({ preventScroll: true });
|
|
277
|
+
scroller.scrollTo({
|
|
278
|
+
top:
|
|
279
|
+
scroller.scrollTop +
|
|
280
|
+
section.getBoundingClientRect().top -
|
|
281
|
+
scroller.getBoundingClientRect().top -
|
|
282
|
+
12,
|
|
283
|
+
behavior,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
|
|
270
287
|
function captureEvidenceCardLayout(container: HTMLElement) {
|
|
271
288
|
const containerTop = container.getBoundingClientRect().top;
|
|
272
289
|
return new Map(
|
|
@@ -357,6 +374,7 @@ export function InvestigationView({
|
|
|
357
374
|
onHandoffAllowedChange?: (allowed: boolean) => void;
|
|
358
375
|
}) {
|
|
359
376
|
const { kind, namespace, name } = run;
|
|
377
|
+
const { renderFindingsFooter } = useDiagnoseCustomization();
|
|
360
378
|
const {
|
|
361
379
|
refreshRuns,
|
|
362
380
|
openInvestigation,
|
|
@@ -454,6 +472,9 @@ export function InvestigationView({
|
|
|
454
472
|
const evidenceScrollTopRef = useRef(0);
|
|
455
473
|
const evidenceContentRef = useRef<HTMLDivElement>(null);
|
|
456
474
|
const nextStepsRef = useRef<HTMLElement>(null);
|
|
475
|
+
const assessmentRef = useRef<HTMLElement>(null);
|
|
476
|
+
const composerRef = useRef<HTMLTextAreaElement>(null);
|
|
477
|
+
const [focusTarget, setFocusTarget] = useState<HTMLElement | null>(null);
|
|
457
478
|
const evidenceCardLayoutRef = useRef(
|
|
458
479
|
new Map<string, { top: number; height: number }>(),
|
|
459
480
|
);
|
|
@@ -925,6 +946,10 @@ export function InvestigationView({
|
|
|
925
946
|
const readOnly = unavailable || !canContinue;
|
|
926
947
|
const endedEarly = investigationEndedBeforeConclusion(run.status, lastTurn);
|
|
927
948
|
const rebuildingReplay = !streamReady && turns.length === 0;
|
|
949
|
+
// Mount a host footer after replay so inserting the restored Findings above
|
|
950
|
+
// it cannot move a deep-link landing. A permanent history error is settled.
|
|
951
|
+
const findingsSettled =
|
|
952
|
+
!rebuildingReplay || (historyUnavailable && !historyUnavailable.retryable);
|
|
928
953
|
const historyUnavailablePresentation = historyUnavailable
|
|
929
954
|
? investigationHistoryUnavailablePresentation(historyUnavailable)
|
|
930
955
|
: null;
|
|
@@ -936,6 +961,8 @@ export function InvestigationView({
|
|
|
936
961
|
verificationPending,
|
|
937
962
|
});
|
|
938
963
|
|
|
964
|
+
const canAskQuestion = !example && !canStop && !interactionsBlocked;
|
|
965
|
+
|
|
939
966
|
const submitFollowup = () => {
|
|
940
967
|
const q = input.trim();
|
|
941
968
|
if (!q || interactionsBlocked) return;
|
|
@@ -1488,15 +1515,22 @@ export function InvestigationView({
|
|
|
1488
1515
|
(domId: string, evidence: boolean) => {
|
|
1489
1516
|
requestAnimationFrame(() => {
|
|
1490
1517
|
requestAnimationFrame(() => {
|
|
1491
|
-
const
|
|
1518
|
+
const container = evidence
|
|
1519
|
+
? evidenceScrollRef.current
|
|
1520
|
+
: scrollRef.current;
|
|
1521
|
+
const marker =
|
|
1522
|
+
(evidence && container
|
|
1523
|
+
? Array.from(
|
|
1524
|
+
container.querySelectorAll<HTMLElement>(
|
|
1525
|
+
`[id="${domId.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"]`,
|
|
1526
|
+
),
|
|
1527
|
+
).find((candidate) => !candidate.closest("[inert]"))
|
|
1528
|
+
: undefined) ?? document.getElementById(domId);
|
|
1492
1529
|
const target = evidence
|
|
1493
1530
|
? ((marker?.closest(
|
|
1494
1531
|
"[data-evidence-card], [data-evidence-source-container]",
|
|
1495
1532
|
) as HTMLElement | null) ?? marker)
|
|
1496
1533
|
: marker;
|
|
1497
|
-
const container = evidence
|
|
1498
|
-
? evidenceScrollRef.current
|
|
1499
|
-
: scrollRef.current;
|
|
1500
1534
|
if (target && container) {
|
|
1501
1535
|
const containerRect = container.getBoundingClientRect();
|
|
1502
1536
|
const targetRect = target.getBoundingClientRect();
|
|
@@ -1559,6 +1593,38 @@ export function InvestigationView({
|
|
|
1559
1593
|
[focusAfterPaneSwitch],
|
|
1560
1594
|
);
|
|
1561
1595
|
|
|
1596
|
+
const evidenceLink = useCallback(
|
|
1597
|
+
(ref: string) => {
|
|
1598
|
+
// A proposed change can cite an earlier turn. Resolve exactly one
|
|
1599
|
+
// complete read across this run, even after a newer assessment arrives.
|
|
1600
|
+
const [link] = resolveInvestigationRootCauseEvidence(
|
|
1601
|
+
projection,
|
|
1602
|
+
{ status: "linked", refs: [ref] },
|
|
1603
|
+
turns.length - 1,
|
|
1604
|
+
).links;
|
|
1605
|
+
if (!link) return undefined;
|
|
1606
|
+
const source = link.source;
|
|
1607
|
+
// A grouped Findings card opens its latest read. Older citations should
|
|
1608
|
+
// open their own saved payload, including when both reads look alike.
|
|
1609
|
+
const currentCard = projection.groups.some(
|
|
1610
|
+
(group) =>
|
|
1611
|
+
group.id === link.originalGroupId &&
|
|
1612
|
+
visibleEvidenceGroupIds.has(group.id) &&
|
|
1613
|
+
group.latest.source.id === source.id,
|
|
1614
|
+
);
|
|
1615
|
+
return currentCard
|
|
1616
|
+
? () => viewEvidenceSource(source.id)
|
|
1617
|
+
: () => viewActivitySource(source.id);
|
|
1618
|
+
},
|
|
1619
|
+
[
|
|
1620
|
+
projection,
|
|
1621
|
+
turns.length,
|
|
1622
|
+
visibleEvidenceGroupIds,
|
|
1623
|
+
viewEvidenceSource,
|
|
1624
|
+
viewActivitySource,
|
|
1625
|
+
],
|
|
1626
|
+
);
|
|
1627
|
+
|
|
1562
1628
|
const verificationRunning = turns.some(
|
|
1563
1629
|
(turn) => turn.verify && turn.status === "running",
|
|
1564
1630
|
);
|
|
@@ -1806,6 +1872,33 @@ export function InvestigationView({
|
|
|
1806
1872
|
setUnreadEvidence(false);
|
|
1807
1873
|
}
|
|
1808
1874
|
};
|
|
1875
|
+
// An external link can resolve its card while Findings is hidden. Select
|
|
1876
|
+
// the pane first, then position and focus in its post-commit layout.
|
|
1877
|
+
const revealInFindings = useCallback((element: HTMLElement) => {
|
|
1878
|
+
paneSelectionTouchedRef.current = true;
|
|
1879
|
+
setNarrowPane("evidence");
|
|
1880
|
+
setUnreadEvidence(false);
|
|
1881
|
+
setFocusTarget(element);
|
|
1882
|
+
}, []);
|
|
1883
|
+
const viewAssessment = useCallback(() => {
|
|
1884
|
+
if (assessmentRef.current) revealInFindings(assessmentRef.current);
|
|
1885
|
+
}, [revealInFindings]);
|
|
1886
|
+
const askQuestion = useCallback(() => {
|
|
1887
|
+
if (!composerRef.current || composerRef.current.disabled) return;
|
|
1888
|
+
paneSelectionTouchedRef.current = true;
|
|
1889
|
+
setNarrowPane("activity");
|
|
1890
|
+
setFocusTarget(composerRef.current);
|
|
1891
|
+
}, []);
|
|
1892
|
+
useLayoutEffect(() => {
|
|
1893
|
+
if (!focusTarget) return;
|
|
1894
|
+
const scroller = evidenceScrollRef.current;
|
|
1895
|
+
if (scroller?.contains(focusTarget)) {
|
|
1896
|
+
focusFindingsSection(scroller, focusTarget, "instant");
|
|
1897
|
+
} else if (focusTarget === composerRef.current) {
|
|
1898
|
+
focusTarget.focus({ preventScroll: true });
|
|
1899
|
+
}
|
|
1900
|
+
setFocusTarget(null);
|
|
1901
|
+
}, [focusTarget]);
|
|
1809
1902
|
const viewActivity = () => {
|
|
1810
1903
|
paneSelectionTouchedRef.current = true;
|
|
1811
1904
|
setNarrowPane("activity");
|
|
@@ -1896,6 +1989,7 @@ export function InvestigationView({
|
|
|
1896
1989
|
) : (
|
|
1897
1990
|
<div className="flex items-end gap-2">
|
|
1898
1991
|
<textarea
|
|
1992
|
+
ref={composerRef}
|
|
1899
1993
|
value={input}
|
|
1900
1994
|
onChange={(event) => setInput(event.target.value)}
|
|
1901
1995
|
onKeyDown={(event) => {
|
|
@@ -1905,13 +1999,7 @@ export function InvestigationView({
|
|
|
1905
1999
|
}
|
|
1906
2000
|
}}
|
|
1907
2001
|
rows={1}
|
|
1908
|
-
disabled={
|
|
1909
|
-
!streamReady ||
|
|
1910
|
-
readOnly ||
|
|
1911
|
-
busy ||
|
|
1912
|
-
requestPending ||
|
|
1913
|
-
verificationPending
|
|
1914
|
-
}
|
|
2002
|
+
disabled={!canAskQuestion}
|
|
1915
2003
|
placeholder={
|
|
1916
2004
|
!streamReady
|
|
1917
2005
|
? historyUnavailablePresentation?.loading
|
|
@@ -2506,6 +2594,9 @@ export function InvestigationView({
|
|
|
2506
2594
|
<div
|
|
2507
2595
|
ref={evidenceScrollRef}
|
|
2508
2596
|
data-investigation-findings-scroll
|
|
2597
|
+
// A linked footer can reserve one visible pane of scroll room so a
|
|
2598
|
+
// short card's heading also lands at the top, above its controls.
|
|
2599
|
+
style={renderFindingsFooter ? { containerType: "size" } : undefined}
|
|
2509
2600
|
onScroll={(event) => {
|
|
2510
2601
|
if (event.currentTarget.offsetParent === null) return;
|
|
2511
2602
|
evidenceScrollTopRef.current = event.currentTarget.scrollTop;
|
|
@@ -2547,8 +2638,10 @@ export function InvestigationView({
|
|
|
2547
2638
|
not a fifth, and it fills the pane it is given. */}
|
|
2548
2639
|
<div className="space-y-3">
|
|
2549
2640
|
<section
|
|
2641
|
+
ref={assessmentRef}
|
|
2642
|
+
tabIndex={-1}
|
|
2550
2643
|
aria-labelledby={`${viewId}-assessment-heading`}
|
|
2551
|
-
className="investigation-assessment rounded-xl border p-3"
|
|
2644
|
+
className="investigation-assessment rounded-xl border p-3 outline-none focus-visible:ring-2 focus-visible:ring-accent/50"
|
|
2552
2645
|
>
|
|
2553
2646
|
<div className="flex flex-wrap items-center gap-1.5">
|
|
2554
2647
|
{/* A label for the block, not its headline: the
|
|
@@ -2633,17 +2726,11 @@ export function InvestigationView({
|
|
|
2633
2726
|
const section = nextStepsRef.current;
|
|
2634
2727
|
const scroller = evidenceScrollRef.current;
|
|
2635
2728
|
if (!section || !scroller) return;
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
scroller.getBoundingClientRect().top -
|
|
2642
|
-
12,
|
|
2643
|
-
behavior: prefersReducedMotion()
|
|
2644
|
-
? "auto"
|
|
2645
|
-
: "smooth",
|
|
2646
|
-
});
|
|
2729
|
+
focusFindingsSection(
|
|
2730
|
+
scroller,
|
|
2731
|
+
section,
|
|
2732
|
+
prefersReducedMotion() ? "auto" : "smooth",
|
|
2733
|
+
);
|
|
2647
2734
|
}}
|
|
2648
2735
|
/>
|
|
2649
2736
|
) : null
|
|
@@ -2805,6 +2892,16 @@ export function InvestigationView({
|
|
|
2805
2892
|
/>
|
|
2806
2893
|
</div>
|
|
2807
2894
|
)}
|
|
2895
|
+
{!example && !gone && findingsSettled &&
|
|
2896
|
+
renderFindingsFooter?.({
|
|
2897
|
+
run,
|
|
2898
|
+
revealInFindings,
|
|
2899
|
+
evidenceLink,
|
|
2900
|
+
viewAssessment: currentAssessment?.diagnosis
|
|
2901
|
+
? viewAssessment
|
|
2902
|
+
: undefined,
|
|
2903
|
+
askQuestion: canAskQuestion ? askQuestion : undefined,
|
|
2904
|
+
})}
|
|
2808
2905
|
</div>
|
|
2809
2906
|
</div>
|
|
2810
2907
|
</section>
|
|
@@ -446,7 +446,7 @@ describe("root-cause evidence resolution", () => {
|
|
|
446
446
|
it("keeps an unadapted successful Radar check linkable to Activity", () => {
|
|
447
447
|
const ref = evidenceRef("a", "b");
|
|
448
448
|
const projection = project([
|
|
449
|
-
tool("metrics-1", "
|
|
449
|
+
tool("metrics-1", "get_cluster_overview", { result: [1] }, { evidenceRef: ref }),
|
|
450
450
|
]);
|
|
451
451
|
|
|
452
452
|
expect(projection.groups).toHaveLength(0);
|
|
@@ -1831,7 +1831,7 @@ describe("strict evidence adapters", () => {
|
|
|
1831
1831
|
|
|
1832
1832
|
it("keeps unknown tools in Activity and limits invalid known contracts", () => {
|
|
1833
1833
|
const result = project([
|
|
1834
|
-
tool("other", "
|
|
1834
|
+
tool("other", "get_cluster_overview", { data: "ignored" }),
|
|
1835
1835
|
tool("bad-events", "get_events", { events: [{ nope: true }] }),
|
|
1836
1836
|
]);
|
|
1837
1837
|
expect(result.sources.map((source) => source.stepId)).toEqual([
|