fix(workbench): stabilize investigation presentation rendering

Keep investigation graphs stable during updates, defer expensive chart rendering, and prevent stale results when switching tasks. Adopt reference annotations and consolidate frontend documentation.
This commit is contained in:
2026-11-11 19:10:41 +08:00
parent 0ae0a41e61
commit a617aa95e9
35 changed files with 1268 additions and 715 deletions
@@ -59,14 +59,24 @@ describe("investigation report read contract", () => {
expect(value.diagram?.node_refs[0]?.action_refs).toEqual([]);
expect(value.data_gaps?.[0]?.node_id).toBeNull();
});
it("distinguishes waiting for dependencies from human feedback without inventing missing states", () => {
it("reads legacy waits as saved input conditions without inferring live waiting", () => {
const value = investigationReportSchema.parse({ ...base, diagram: {
title: "等待结果", mermaid: "flowchart LR\nA[外部回执] --> B[人工复核] --> C[下一步]",
node_refs: [{ node_id: "A", label: "外部回执", status: "waiting" },
{ node_id: "B", label: "人工复核", status: "waiting_human" },
{ node_id: "C", label: "下一步" }]
} });
expect(value.diagram?.node_refs.map((node) => node.status)).toEqual(["waiting", "waiting_human", undefined]);
expect(value.diagram?.node_refs.map((node) => node.status)).toEqual(["needs_input", "needs_input", undefined]);
});
it("reads host-generated cumulative graphs with failed attempts and failure reasons", () => {
const value = investigationReportSchema.parse({ ...base, diagram: {
title: "累计调查脉络", mermaid: 'flowchart TD\nold["首次读取(失败)"] --> retry["重新读取"]',
node_refs: [{ node_id: "old", label: "首次读取", status: "failed", detail: "接口超时" },
{ node_id: "retry", label: "重新读取", status: "completed" }],
edges: [{ source: "old", target: "retry", label: "重试" }]
} });
expect(value.diagram?.node_refs[0]).toMatchObject({ status: "failed", detail: "接口超时" });
expect(value.diagram?.edges).toEqual([{ source: "old", target: "retry", label: "重试" }]);
});
it.each([
{ outcome: "other" },