fix(tests): bound oxlint test threads, throttle export spin loop, align process-boundary workers, and use level-1 zlib in large synthetic fixtures (#13471)

* fix(tests): bound oxlint test threads, throttle export spin loop, align process-boundary workers, and use level-1 zlib in large synthetic fixtures (#13357)

* test(mcp): gate Evidence export cancellation before publication

* test(ghidra): verify Java timeout after doctor settles
This commit is contained in:
morluto authored and GitHub committed 2026-11-22 13:27:03 -05:00
1 parent fe1c0d6b94
commit 9e9cfba67d
8 files changed
+35 -32

No files matched your search

+3 -1
View File
@@ -286,7 +286,9 @@ it("names the padded-storage basis when a padded section overflows inflate alloc
it("names the fixed cap when it bounds a large padded section's inflate allocation", () => {
// Storage above 128 KiB derives more than the fixed 8 MiB cap, so the cap,
// not the padded storage size, is the enforced bound.
const compressed = deflateSync(Buffer.alloc(9 * 1024 * 1024, 0x20));
const compressed = deflateSync(Buffer.alloc(9 * 1024 * 1024, 0x20), {
level: 1,
});
const fileAlignment = 512;
const stored = Buffer.alloc(132 * 1024);
compressed.copy(stored);
@@ -61,7 +61,11 @@ const lintDiagnostics = async (root: string) =>
it("covers the lint inventory and root tool configs in resolved cache inputs", () => {
const scan = spawnSync(
process.execPath,
[join(repository, "node_modules/oxlint/bin/oxlint"), "--debug=files"],
[
join(repository, "node_modules/oxlint/bin/oxlint"),
"--threads=1",
"--debug=files",
],
{ cwd: repository, encoding: "utf8", timeout: 15_000 },
);
expect(scan.error).toBeUndefined();
+1 -1
View File
@@ -395,7 +395,7 @@ it("refuses a gzip file that expands past what REA checks for known secrets", as
Buffer.from(`token=${token}\n`),
Buffer.alloc(65 * 1024 * 1024),
]);
await writeFile(join(seed, "large.txt.gz"), gzipSync(inside));
await writeFile(join(seed, "large.txt.gz"), gzipSync(inside, { level: 1 }));
const directory = join(await createTestTempDirectory("build-out-"), "notes");
const refused = await client.callTool({
name: "export_build_environment",
@@ -2,14 +2,15 @@ import { unknownTarget } from "../../../src/domain/targetIdentity.js";
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
import { readdir, readFile, stat, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { setImmediate } from "node:timers/promises";
import { expect, it, onTestFinished } from "vitest";
import { expect, it, onTestFinished, vi } from "vitest";
import { readEvidenceBundle } from "../../../src/application/EvidenceBundleFiles.js";
import { createEvidence } from "../../../src/domain/evidence.js";
import { OwnedStagedOutput } from "../../../src/filesystem/OwnedStagedOutput.js";
import { createServer } from "../../../src/server/createServer.js";
import { createTestBinarySession } from "../../fixtures/binarySession.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { createMcpSchemaValidation } from "../../fixtures/mcpSchemaValidation.js";
import { phaseGate } from "../../support/lifecycleHarness.js";
it.each([false, true])(
"stops an SDK export cancellation before publication and keeps the same session usable (overwrite: %s)",
@@ -24,9 +25,9 @@ it.each([false, true])(
unknownTarget("not-observed"),
{ id: "fixture", name: "Fixture", version: "1" },
{
operation: "large_observation",
operation: "fixture_observation",
parameters: {},
result: { observed: "雪😀".repeat(1024 * 1024) },
result: { observed: "雪😀" },
},
);
expect(session.recordEvidence(evidence).ok).toBe(true);
@@ -39,8 +40,10 @@ it.each([false, true])(
{ jsonSchemaValidator: createMcpSchemaValidation() },
);
const controller = new AbortController();
const stagedWrite = phaseGate<string>();
onTestFinished(async () => {
controller.abort();
stagedWrite.release();
await client.close();
await server.close();
await session.close();
@@ -49,6 +52,14 @@ it.each([false, true])(
InMemoryTransport.createLinkedPair();
await server.connect(serverTransport);
await client.connect(clientTransport);
const closeFile = OwnedStagedOutput.prototype.closeFile;
const stagedClose = vi
.spyOn(OwnedStagedOutput.prototype, "closeFile")
.mockImplementationOnce(async function (this: OwnedStagedOutput) {
await closeFile.call(this);
await stagedWrite.hold(this.directory);
});
onTestFinished(() => stagedClose.mockRestore());
const cancellation = client
.callTool(
{ name: "export_evidence_bundle", arguments: { path, overwrite } },
@@ -58,34 +69,17 @@ it.each([false, true])(
() => "completed",
(error: unknown) => error,
);
// Observe actual staged bytes, rather than only a locally rejected promise.
const deadline = performance.now() + 5000;
let stagedBytes = 0;
while (stagedBytes === 0 && performance.now() < deadline) {
const staging = (await readdir(root)).find((name) =>
name.startsWith(".rea-write-"),
);
if (staging !== undefined) {
const staged = await stat(join(root, staging, "content")).catch(
(cause: unknown) => {
if (
cause instanceof Error &&
"code" in cause &&
cause.code === "ENOENT"
)
return undefined;
throw cause;
},
);
stagedBytes = staged?.size ?? 0;
}
await setImmediate();
}
expect(stagedBytes).toBeGreaterThan(0);
const directory = await stagedWrite.reached(
cancellation,
"staged file close",
);
expect((await stat(join(directory, "content"))).size).toBeGreaterThan(0);
controller.abort(new Error("SDK export cancellation verification"));
expect(await cancellation).toMatchObject({
message: expect.stringContaining("SDK export cancellation verification"),
});
await client.ping();
stagedWrite.release();
await expect
.poll(() => readdir(root))
.toEqual(overwrite ? ["bundle.json"] : []);
@@ -61,6 +61,7 @@ it("limits the shared Babel child expansion exception to its owner", async () =>
process.execPath,
[
resolve("node_modules/oxlint/bin/oxlint"),
"--threads=1",
"-c",
config,
"--format",
@@ -42,6 +42,7 @@ it("applies the ordering rule to domain production files and excludes tests", as
process.execPath,
[
resolve("node_modules/oxlint/bin/oxlint"),
"--threads=1",
"-c",
config,
"--format",
@@ -61,6 +61,7 @@ it("allows raw Playwright CDP sessions only in their owner and tests, including
process.execPath,
[
resolve("node_modules/oxlint/bin/oxlint"),
"--threads=1",
"-c",
config,
"--format",
+1 -1
View File
@@ -108,7 +108,7 @@ const PROJECT_POLICIES = {
},
"process-boundary": {
pool: "forks" as const,
maxWorkers: MAX_TEST_WORKERS,
maxWorkers: 1,
// Process-tree observations share host sampling resources; keep this small
// lane serial while the independent projects run together.
fileParallelism: false,