Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership. Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers. BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { describe, expect, it, onTestFinished } from "vitest";
|
|
import { HopperClient } from "../../../../src/hopper/HopperClient.js";
|
|
|
|
import {
|
|
HopperFixtureLauncher as FixtureLauncher,
|
|
startHopperFixtureClient as startClient,
|
|
} from "./hopperClient.fixture.js";
|
|
|
|
describe("HopperClient restart", () => {
|
|
it("does not finish startup after an immediate close", async () => {
|
|
const client = new HopperClient({
|
|
launcher: new FixtureLauncher(),
|
|
startupTimeoutMs: 1_000,
|
|
});
|
|
onTestFinished(async () => {
|
|
await client.close();
|
|
});
|
|
|
|
const starting = client.start();
|
|
await client.close();
|
|
|
|
const result = await starting;
|
|
expect(result.ok).toBe(false);
|
|
if (!result.ok) expect(result.error._tag).toBe("HopperCancelledError");
|
|
});
|
|
|
|
it("starts a fresh session after close completes", async () => {
|
|
const client = await startClient();
|
|
await client.close();
|
|
|
|
await expect(client.start()).resolves.toEqual({
|
|
ok: true,
|
|
value: { name: "REA Hopper bridge", version: "1.0.0" },
|
|
});
|
|
});
|
|
|
|
it("serializes a restart requested while close is in progress", async () => {
|
|
const client = await startClient();
|
|
const closing = client.close();
|
|
const restarting = client.start();
|
|
|
|
await closing;
|
|
await expect(restarting).resolves.toEqual({
|
|
ok: true,
|
|
value: { name: "REA Hopper bridge", version: "1.0.0" },
|
|
});
|
|
await expect(client.callTool("echo", { value: "fresh" })).resolves.toEqual({
|
|
ok: true,
|
|
value: { value: "fresh" },
|
|
});
|
|
});
|
|
});
|