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
@@ -51,13 +51,19 @@ it("keeps independent server budgets for successful results and oversized errors
};
vi.stubEnv("REA_MCP_MAX_RESPONSE_BYTES", String(largeBudget));
const small = createServer(analysis, undefined, {
environment: smallEnvironment,
});
const small = createServer(
{ kind: "fixed", analysis },
{
environment: smallEnvironment,
},
);
vi.stubEnv("REA_MCP_MAX_RESPONSE_BYTES", String(smallBudget));
const large = createServer(analysis, undefined, {
environment: largeEnvironment,
});
const large = createServer(
{ kind: "fixed", analysis },
{
environment: largeEnvironment,
},
);
smallEnvironment.REA_MCP_MAX_RESPONSE_BYTES = "invalid-after-selection";
largeEnvironment.REA_MCP_MAX_RESPONSE_BYTES = String(smallBudget);
vi.stubEnv("REA_MCP_MAX_RESPONSE_BYTES", "invalid-ambient-after-selection");
@@ -161,12 +167,12 @@ it("snapshots the runtime-selected environment before optional loading and reuse
selected.REA_BROWSER_EXECUTABLE = "/mutated/browser";
return {};
},
createServer: (analysis, session, options) => {
createServer: (source, options) => {
expect(options?.environment?.REA_BROWSER_EXECUTABLE).toBe(
"/selected/browser",
);
expect(Object.isFrozen(options?.environment)).toBe(true);
const server = createServer(analysis, session, options);
const server = createServer(source, options);
observed.push(server);
return server;
},