Files
rea/tests/boundary/mcp/mcpStartupPolicy.test.ts
T
morlutoandGitHub 4fbc501121 feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)
* fix(hopper): normalize string-backed addresses and update verification

* feat(native): add inspection primitives, dispatch traces and approved UI observation

* test: prioritize real artifact E2E and captured golden regressions

* fix(process): queue observed output before reactive rendering actions

* test: prune redundant cases and strengthen boundary assertions

* fix(cli): route native value tracing through shared workflows

* test: replace synthetic success with real workflows and captured data

* fix(catalog): separate portable metadata from native host availability
2026-10-04 16:02:36 +08:00

49 lines
1.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { MCP_STARTUP_POLICY } from "../../../src/mcpStartupPolicy.js";
import {
createEsmModuleProfileCollector,
parseLinuxVmRssBytes,
} from "../../../scripts/lib/mcp-startup-probe.mjs";
describe("MCP startup policy", () => {
it("preserves headroom beneath the configured Codex timeout", () => {
const codexTimeoutMs =
MCP_STARTUP_POLICY.codexStartupTimeoutSeconds * 1_000;
expect(MCP_STARTUP_POLICY.initializeBudgetMs).toBeLessThan(codexTimeoutMs);
expect(MCP_STARTUP_POLICY.firstCatalogBudgetMs).toBeLessThan(
codexTimeoutMs,
);
expect(MCP_STARTUP_POLICY.doctorDeadlineMs).toBeGreaterThanOrEqual(
codexTimeoutMs,
);
});
it("parses Linux resident memory without accepting other fields", () => {
expect(
parseLinuxVmRssBytes("Name:\tnode\nVmRSS:\t 12345 kB\nThreads:\t7\n"),
).toBe(12_641_280);
expect(parseLinuxVmRssBytes("VmSize:\t12345 kB\n")).toBeNull();
});
it("profiles unique file-backed ESM modules without retaining paths", () => {
const collector = createEsmModuleProfileCollector();
collector.append(
"ESM 1: Storing file:///opt/rea/dist/main.js\n" +
"ESM 1: Translating StandardModule file:///opt/rea/dist/main.js\n" +
"ESM 1: Storing file:///opt/rea/node_modules/zod/index.js",
);
expect(collector.result()).toEqual({
supported: true,
method: "node-debug-esm",
unique_file_modules: 2,
unique_package_modules: 0,
unique_dependency_modules: 1,
debug_lines: 3,
truncated: false,
});
});
});