feat: expand intelligent investigation workspace
Generic Container CI/CD / test-build-publish (push) Successful in 1m52s
Frontend CI/CD / build-test-publish-and-deploy (push) Successful in 1m52s

This commit is contained in:
2026-10-30 17:30:19 +08:00
parent ddd03dbff6
commit c0e4231b83
223 changed files with 13155 additions and 5304 deletions
@@ -158,3 +158,44 @@ describe("live investigation presentation following", () => {
} finally { oldDisplay.resolve(); test.follower.stop(); }
});
});
it("buffers live events while saved history is loading and drains only after that boundary", async () => {
const ready = deferred<void>();
const loadHistory = vi.fn(async () => ready.promise);
const test = setup({ loadHistory });
test.follower.start(); test.channel.publish({ type: "open" });
try {
await vi.waitFor(() => expect(loadHistory).toHaveBeenCalledTimes(1));
test.channel.publish({ type: "events", events: [event(11, openChart)] });
expect(test.execute).not.toHaveBeenCalled();
ready.resolve();
await vi.waitFor(() => expect(test.execute).toHaveBeenCalledTimes(1));
} finally { test.follower.stop(); }
});
it("loads saved history without live following and aborts an unfinished history load on stop", async () => {
const ready = deferred<void>();
const loadHistory = vi.fn(async (_cursor: InvestigationPresentationCursor, _signal: AbortSignal) => ready.promise);
const subscribe = vi.fn();
const test = setup({ follow: false, loadHistory, subscribe });
test.follower.start();
await vi.waitFor(() => expect(loadHistory).toHaveBeenCalledTimes(1));
expect(subscribe).not.toHaveBeenCalled();
test.follower.stop();
expect(loadHistory.mock.calls[0][1].aborted).toBe(true);
ready.resolve();
expect(test.execute).not.toHaveBeenCalled();
});
it("reads saved history even before the live event stream opens", async () => {
const loadHistory = vi.fn(async () => undefined);
const test = setup({ loadHistory });
test.follower.start();
try {
await vi.waitFor(() => expect(loadHistory).toHaveBeenCalledTimes(1));
await vi.waitFor(() => expect(test.onStatus).toHaveBeenCalledWith("history"));
expect(test.execute).not.toHaveBeenCalled();
} finally { test.follower.stop(); }
});