fix(ci): restore capture and maintenance regression checks

This commit is contained in:
N0zoM1z0
2026-10-10 16:34:17 +00:00
parent 6d8f95e38d
commit 69485e27f7
13 changed files with 127 additions and 51 deletions
+1 -1
View File
@@ -157,7 +157,7 @@ const runApktool = async (
timeoutMs: limits.timeoutMs,
diagnosticBytes: limits.maxOutputBytes,
},
(signal === undefined ? {} : { signal }),
signal === undefined ? {} : { signal },
);
return ok({ stdout: output.stdout.text, stderr: output.stderr.text });
} catch (cause) {
+3 -1
View File
@@ -130,7 +130,9 @@ export const planIntegrationMaintenance = async (
};
if (plan.data.plannedActions.length === 0)
return { status: "current", plannedActions: [] };
const allowedIds = new Set(scope.clients.map((client) => `configure_client:${client}`));
const allowedIds = new Set(
scope.clients.map((client) => `configure_client:${client}`),
);
const skillTargets = new Set(skillDestinations.map(({ path }) => path));
if (
plan.data.plannedActions.some((action) =>
@@ -2,6 +2,7 @@ import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { expect, it } from "vitest";
import { z } from "zod";
import { createTestTempDirectory } from "../../../tests/fixtures/temporaryDirectory.js";
import { javascriptApplicationAnalysisResultSchema } from "../../domain/javascript/javascriptApplicationAnalysis.js";
@@ -31,7 +32,15 @@ const graphIdentities = async (source: string) => {
...(identity.strategy === "artifact-local-key"
? {
namespace: identity.namespace,
key: identity.key.replace(/^[0-9a-f]{64}:/u, ""),
key:
identity.namespace === "module-export"
? JSON.stringify(
z
.array(z.string())
.parse(JSON.parse(identity.key))
.slice(1),
)
: identity.key.replace(/^[0-9a-f]{64}:/u, ""),
}
: {}),
}))
+11 -11
View File
@@ -68,18 +68,18 @@ export const closeCdpTargetSession = async (
// Best-effort domain cleanup; transport close is the definitive boundary.
}
}
if (!cleanup.signal.aborted && sessionId !== undefined)
try {
await connection.send(
"Target.detachFromTarget",
{ sessionId },
undefined,
cleanup.signal,
);
} catch {
// Best-effort detach; transport close is the definitive boundary.
}
}
if (!cleanup.signal.aborted && sessionId !== undefined)
try {
await connection.send(
"Target.detachFromTarget",
{ sessionId },
undefined,
cleanup.signal,
);
} catch {
// Best-effort detach; transport close is the definitive boundary.
}
} finally {
clearTimeout(timeout);
cleanup.abort();
@@ -553,7 +553,7 @@ it("shares concurrent close and retries browser cleanup after failure", async ()
expect(cleanupSettlements).toEqual([false, true]);
});
it("keeps failed event finalization failed across cleanup retries", async () => {
it("reports event finalization failure before allowing settled cleanup retries", async () => {
const finishEvents = vi
.fn<() => Promise<void>>()
.mockRejectedValue(new Error("event finalization failed"));
@@ -567,10 +567,9 @@ it("keeps failed event finalization failed across cleanup retries", async () =>
await expect(cleanup.close(finishEvents)).rejects.toMatchObject({
reason: "cleanup_failed",
cleanup: { reason: "event finalization failed" },
});
await expect(cleanup.close(finishEvents)).rejects.toMatchObject({
reason: "cleanup_failed",
});
await expect(cleanup.close(finishEvents)).resolves.toBeUndefined();
expect(finishEvents).toHaveBeenCalledTimes(1);
expect(closeBrowser).toHaveBeenCalledTimes(1);
});
@@ -22,8 +22,9 @@ it("preserves a 12,000-member native import through both analyzers", () => {
const staticAnalysis = analyzeParsedJavaScriptStaticSource("", parsed);
const ir = analyzeParsedJavaScriptSemantics(parsed);
expect(staticAnalysis.parse_status).toBe("complete");
// The addon exports `next`; `last` belongs to an object reached from it.
expect(staticAnalysis.electron.native_addon_bindings).toEqual([
expect.objectContaining({ specifier: "./addon.node", members: ["last"] }),
expect.objectContaining({ specifier: "./addon.node", members: ["next"] }),
]);
expect(ir.coverage).toEqual({ status: "complete", omittedCount: 0 });
const path = origin(onlyBinding(ir, "value"));
+16 -10
View File
@@ -17,27 +17,33 @@ it.each(["after", "before"] as const)(
"keeps absence unknown when the %s snapshot omits an existing file",
async (partialSide) => {
const root = await createTestTempDirectory("rea-fs-partial-absence-");
await writeFile(join(root, "z.txt"), "unchanged");
const names = ["a.txt", "z.txt"];
for (const name of names) await writeFile(join(root, name), "unchanged");
const scenario = parseProcessScenario({
executable: process.execPath,
working_directory: root,
filesystem_observation_paths: [root],
limits: { files: 2 },
});
if (partialSide === "before") await writeFile(join(root, "a.txt"), "other");
const before = await snapshotRoots(scenario);
if (partialSide === "after") await writeFile(join(root, "a.txt"), "other");
else await rm(join(root, "a.txt"));
const after = await snapshotRoots(scenario);
expect(await readFile(join(root, "z.txt"), "utf8")).toBe("unchanged");
const partial = await snapshotRoots(scenario);
const omitted = names.find(
(name) => !partial.files.some(({ path }) => path === `root_0:${name}`),
);
if (omitted === undefined)
throw new Error("Expected an omitted fixture file");
for (const name of names) if (name !== omitted) await rm(join(root, name));
const complete = await snapshotRoots(scenario);
const before = partialSide === "before" ? partial : complete;
const after = partialSide === "after" ? partial : complete;
expect(await readFile(join(root, omitted), "utf8")).toBe("unchanged");
const effect = classifyFilesystemEffects(before, after).find(
({ path }) => path === "root_0:z.txt",
({ path }) => path === `root_0:${omitted}`,
);
expect(effect?.status).toBe("unknown");
expect(effect).toMatchObject(
partialSide === "after"
? { before: { path: "root_0:z.txt" }, after: null }
: { before: null, after: { path: "root_0:z.txt" } },
? { before: { path: `root_0:${omitted}` }, after: null }
: { before: null, after: { path: `root_0:${omitted}` } },
);
},
);
+6 -3
View File
@@ -291,7 +291,7 @@ it("keeps empty cleanup exception messages actionable in the report", async () =
});
it.each(["termination", "verification"] as const)(
"retains observations and releases the temporary root when process %s throws",
"retains observations and the temporary root when process %s throws",
async (stage) => {
const cleanupFailure = new Error(`${stage} inspection failed`);
const removeTemporaryRoot = vi.fn(async () => undefined);
@@ -319,8 +319,11 @@ it.each(["termination", "verification"] as const)(
host,
});
expect(removeTemporaryRoot).toHaveBeenCalledWith("/fixture/root");
expect(cleanup.temporary_root).toEqual({ state: "cleaned", reason: null });
expect(removeTemporaryRoot).not.toHaveBeenCalled();
expect(cleanup.temporary_root).toEqual({
state: "unverified",
reason: `temporary root retained because owned process cleanup is failed: ${cleanupFailure.message}`,
});
expect(cleanup.owned_process_group).toMatchObject({
state: "failed",
reason: cleanupFailure.message,