test(lifecycle): move local gate copies, tests/process-global and tests/boundary phase gates onto the shared harness (#11412)

* test(lifecycle): replace eight local gate helper copies with the shared harness

* test(lifecycle): count an arrival announced in the turn its operation settles

* test(lifecycle): move tests/process-global phase gates onto the shared harness (#11414)

* test(lifecycle): move tests/process-global phase gates onto the shared harness

* test(lifecycle): move tests/boundary filesystem and process phase gates onto the shared harness (#11418)

* test(lifecycle): move tests/boundary provider phase gates onto the shared harness

* test(lifecycle): move tests/boundary/mcp phase gates onto the shared harness (#11433)

* test(lifecycle): give each phaseGate hold its own promise so unhandled held rejections stay visible

* test(lifecycle): move tests/boundary browser, pcap and CLI worker phase gates onto the shared harness (#11437)

* test(lifecycle): move tests/boundary browser, pcap and CLI worker phase gates onto the shared harness

* test(lifecycle): move fixture-owned and arrival-only provider gates onto the shared harness (#11441)

* test(lifecycle): move src/server and provider phase gates onto the shared harness (#11447)

* test(lifecycle): move the remaining src server, Kuna copy, Frida and Ghidra phase gates onto the shared harness (#11471)
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 04:49:19 +08:00
1 parent f5aeb90ec5
commit b4a2a79c55
123 files changed
+1507 -2914

No files matched your search

@@ -5,7 +5,7 @@ import { join } from "node:path";
import { promisify } from "node:util";
import { expect, it } from "vitest";
import { withVerifierCleanup } from "../../../scripts/lib/verifier-cleanup.mjs";
import { awaitAcknowledgement } from "../../fixtures/lifecycleAcknowledgement.js";
import { phaseGate } from "../../support/lifecycleHarness.js";
import { JavaScriptAnalysisWorker } from "../../../src/javascript/analysis/JavaScriptAnalysisWorker.js";
import { createJavaScriptSourceAnalysis } from "../../../src/artifacts/javascript/JavaScriptSourceAnalysis.js";
import { ArtifactResourceScope } from "../../../src/resources/ArtifactResourceScope.js";
@@ -332,15 +332,8 @@ it("keeps a worker parked while a limit change closes the previous process", asy
const limits = { heapMb: 128, timeoutMs: 30_000 };
const file = source("parked.mjs", "export const observed = 1;");
const originalClose = JavaScriptAnalysisWorker.prototype.close;
let releaseClose = (): void => {};
const gate = new Promise<void>((resolve) => {
releaseClose = resolve;
});
let closeCalls = 0;
let markCloseStarted = (): void => {};
const closeStarted = new Promise<void>((resolve) => {
markCloseStarted = resolve;
});
const workerClose = phaseGate();
let replacement:
| ReturnType<typeof createJavaScriptSourceAnalysis>
| undefined;
@@ -361,8 +354,7 @@ it("keeps a worker parked while a limit change closes the previous process", asy
) {
closeCalls += 1;
if (closeCalls === 1) {
markCloseStarted();
await gate;
await workerClose.hold();
}
return originalClose.call(this);
};
@@ -371,7 +363,7 @@ it("keeps a worker parked while a limit change closes the previous process", asy
1,
{ scope, launcher },
);
await awaitAcknowledgement(closeStarted, replacement, "worker close");
await workerClose.reached(replacement, "worker close");
const concurrent = await createJavaScriptSourceAnalysis(limits, 1, {
scope,
@@ -387,7 +379,7 @@ it("keeps a worker parked while a limit change closes the previous process", asy
if (parkedPid === undefined)
throw new Error("Parked analyzer has no observed PID");
releaseClose();
workerClose.release();
const extra = await replacement;
const extraResult = await extra.analyze(file, {
nodes: 100,
@@ -408,7 +400,7 @@ it("keeps a worker parked while a limit change closes the previous process", asy
await exits.get(parkedPid);
expect(exited.has(parkedPid)).toBe(true);
}, [
releaseClose,
workerClose.release,
async () => {
const port = await replacement?.catch(() => undefined);
await port?.close();