mirror of
https://github.com/morluto/rea.git
synced 2026-10-31 11:56:12 +00:00
* test(ci): require provider coverage and reuse test sessions * fix(ci): prepare the runtime before Python producer tests The fast Python job ran the suite on a fresh checkout, so analysis-efficiency checks failed without compiled process modules. Install locked dependencies and prepare the runtime before the suite. * fix(ci): keep provider test reports inside the checkout The provider-report reader accepted an arbitrary path from argv. Resolve the path and reject anything outside the checkout before reading it. The packet and signal workflows write those reports under .cache. * fix(ci): require a test module in each named Python bridge family Discovery still runs every bridge test. The mitmproxy, native, and pwndbg families must each keep a test module, so deleting one cannot pass through the others. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
68 lines
2.4 KiB
JavaScript
68 lines
2.4 KiB
JavaScript
import { readFile } from "node:fs/promises";
|
|
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
|
|
const resources = [
|
|
"enforces both address-space limits before any producer allocation",
|
|
"preserves lower inherited file/CPU limits in the real launch",
|
|
];
|
|
const descriptors = [
|
|
"capture",
|
|
"tool",
|
|
"limiter",
|
|
"kernel",
|
|
"field-tool",
|
|
"field-limiter",
|
|
"field-kernel",
|
|
].map(
|
|
(member) =>
|
|
`retains failed ${member} descriptors and retries them before further acquisition and shutdown`,
|
|
);
|
|
const requirements = {
|
|
packet: {
|
|
"tests/boundary/captures/resourceLimits.test.ts": [
|
|
...resources,
|
|
"reports a real kernel file-limit termination with its effective ceiling",
|
|
],
|
|
"tests/boundary/captures/captureDescriptorCleanup.test.ts": descriptors,
|
|
},
|
|
signal: {
|
|
"tests/boundary/signals/resourceLimits.test.ts": resources,
|
|
"tests/boundary/signals/recordingDescriptorCleanup.test.ts": descriptors,
|
|
},
|
|
};
|
|
|
|
const [lane, reportPath] = process.argv.slice(2);
|
|
if (!Object.hasOwn(requirements, lane ?? "") || !reportPath)
|
|
throw new Error(
|
|
"Expected provider test lane (packet or signal) and report path",
|
|
);
|
|
const root = resolve(process.cwd());
|
|
const rootPrefix = `${root}${sep}`;
|
|
const reportFile = resolve(root, reportPath);
|
|
if (!reportFile.startsWith(rootPrefix)) {
|
|
const failure = { code: "report_path_outside_checkout" };
|
|
throw Object.assign(new Error(JSON.stringify(failure)), failure);
|
|
}
|
|
const report = JSON.parse(await readFile(reportFile, "utf8"));
|
|
if (report?.success !== true || !Array.isArray(report.testResults))
|
|
throw new Error(
|
|
"Provider test report is missing a successful test inventory",
|
|
);
|
|
for (const [path, cases] of Object.entries(requirements[lane])) {
|
|
const matches = report.testResults.filter((file) => {
|
|
if (typeof file?.name !== "string") return false;
|
|
const filePath = relative(process.cwd(), resolve(file.name));
|
|
return !isAbsolute(filePath) && filePath.split(sep).join("/") === path;
|
|
});
|
|
if (matches.length !== 1 || !Array.isArray(matches[0].assertionResults))
|
|
throw new Error(`Expected exactly one provider test result for ${path}`);
|
|
for (const name of cases) {
|
|
const results = matches[0].assertionResults.filter(
|
|
(test) => test?.fullName === name,
|
|
);
|
|
if (results.length !== 1 || results[0].status !== "passed")
|
|
throw new Error(`Required provider test did not pass: ${path}: ${name}`);
|
|
}
|
|
}
|
|
console.log(`Required ${lane} resource and cleanup cases passed`);
|