fix: preserve investigation execution history by round

This commit is contained in:
2026-10-30 17:07:53 +08:00
parent 1ee21d1c7f
commit 185bf31446
16 changed files with 830 additions and 32 deletions
@@ -149,6 +149,56 @@ it("references the selected report round instead of the latest task round, inclu
});
});
it("opens the investigation execution record separately from Agent collaboration", async () => {
const onViewExecutionHistory = vi.fn(async () => undefined);
taskPanel(taskBase, { onViewExecutionHistory });
const executionHistory = screen.getByRole("button", { name: "执行记录" });
expect(executionHistory).toHaveAttribute("title", "在左侧 Agent 中打开所选轮次自动同步的调查执行记录,并可创建调试会话。");
fireEvent.click(executionHistory);
await waitFor(() => expect(onViewExecutionHistory).toHaveBeenCalledWith({
executionGeneration: 1,
sessionId: "execution-session"
}));
});
it("opens the execution record bound to the selected report round", async () => {
const currentReport = {
...taskBase.latest_report!,
revision: 2,
execution_generation: 2,
source_session_id: "execution-session-2"
};
const previousReport = {
...taskBase.latest_report!,
revision: 1,
execution_generation: 1,
source_session_id: "execution-session-1"
};
const onViewExecutionHistory = vi.fn(async () => undefined);
taskPanel({
...taskBase,
execution_generation: 2,
current_report_revision: 2,
latest_report: currentReport
}, {
onViewExecutionHistory,
onLoadReports: vi.fn(async () => ({ items: [currentReport, previousReport], next_offset: null }))
});
fireEvent.click(screen.getByRole("button", { name: "展开报告版本" }));
fireEvent.click(await screen.findByRole("button", { name: /第 1 轮 · 报告第 1 版/ }));
expect(screen.getByText("调查任务 · 第 1 轮", { exact: true })).toBeVisible();
expect(screen.queryByText("调查任务 · 第 2 轮", { exact: true })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "执行记录", hidden: true }));
await waitFor(() => expect(onViewExecutionHistory).toHaveBeenCalledWith({
executionGeneration: 1,
sessionId: "execution-session-1"
}));
});
describe("operational task approval and evidence", () => {
it("shows the selected v2 route first and keeps unchosen work available", () => {
const node = (id: string, title: string, status: "completed" | "waiting" | "skipped") => ({