fix(mcp): admit composed analysis through result bookkeeping

This commit is contained in:
morluto
2026-10-10 00:35:17 +08:00
parent e64678e8f9
commit e11f4d371a
80 changed files with 774 additions and 471 deletions
@@ -34,11 +34,11 @@ it("keeps a replacement server usable after the SDK discards its discovery probe
factories.push(factory);
return { close: async () => undefined };
},
createServer: (analysis, binary, options) => {
createServer: (source, options) => {
if (options?.androidAnalysis === undefined)
throw new Error("Expected owned Android provider");
providers.push(options.androidAnalysis);
return createServer(analysis, binary, options);
return createServer(source, options);
},
writeStderr: () => undefined,
setExitCode: () => undefined,
@@ -83,7 +83,10 @@ it("publishes and executes all APK contracts with inline Evidence and no active
const session = createTestBinarySession(() => {
throw new Error("APK analysis must not acquire a deep binary provider");
});
const server = createServer(session, session, { androidAnalysis: provider });
const server = createServer(
{ kind: "session", session },
{ androidAnalysis: provider },
);
const client = new Client({
name: "android-contract-regression",
version: "1",
@@ -150,7 +153,10 @@ it("cleans an active engine when the MCP client disconnects", async () => {
const session = createTestBinarySession(() => {
throw new Error("Unexpected native provider acquisition");
});
const server = createServer(session, session, { androidAnalysis: provider });
const server = createServer(
{ kind: "session", session },
{ androidAnalysis: provider },
);
const client = new Client({
name: "android-disconnect-regression",
version: "1",
@@ -161,7 +161,7 @@ itWithCaptureCapability(
},
},
);
const server = createServer(session, session, { logger });
const server = createServer({ kind: "session", session }, { logger });
const client = new Client({
name: "process-settlement-cancellation",
version: "1",
@@ -21,7 +21,7 @@ const captureViaMcp = async (scenario: Record<string, unknown>) => {
const session = createTestBinarySession(() => {
throw new Error("Process capture must not launch a binary provider");
});
const server = createServer(session, session);
const server = createServer({ kind: "session", session });
const client = new Client({ name: "filesystem-coverage", version: "1" });
onTestFinished(async () => {
await client.close();
@@ -27,9 +27,12 @@ itWithCaptureCapability(
"records process residuals linked to capture Evidence",
async () => {
const session = createTestBinarySession(createCacheProvider([]));
const server = createServer(session, session, {
logger: silentLogger,
});
const server = createServer(
{ kind: "session", session },
{
logger: silentLogger,
},
);
const mcp = new Client({ name: "process-unknown", version: "1.0.0" });
const [clientTransport, serverTransport] =
InMemoryTransport.createLinkedPair();
@@ -40,7 +40,7 @@ const capture = async (
const session = createTestBinarySession(() => {
throw new Error("Capture must not launch a binary provider");
});
const server = createServer(session, session);
const server = createServer({ kind: "session", session });
const client = new Client({ name: "truncation-coverage", version: "1" });
onTestFinished(async () => {
await client.close();