Files
rea/scripts/lib/test-projects.mjs
T
01788bac86 fix(android): name the JADX deadline and recover apktool decode (#6024)
* fix(android): name the JADX deadline and recover apktool decode

JADX operation timeouts now name REA_JADX_OPERATION_TIMEOUT_MS, the
effective milliseconds, the 1..2147483647 range, and that a change applies
on the next process start. Apktool decode accepts decode_timeout_ms,
omitted means 600000, and a timeout names that key. ADB deadlines and
apktool and Java version probes stay fixed and say there is no runtime
override.

Refs #5910

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(android): derive capture recovery from the fixed allowance

Main now stores a fixed allowance instead of a prebuilt remediation
string. Apktool and adb capture refusals keep the no-runtime-override
sentence in that allowance name, including that decode_timeout_ms does
not raise the apktool output cap.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* test(apktool): observe a real decode deadline and process cleanup

A hanging interpreter launcher and its pipe-holding child stay alive
until decode_timeout_ms elapses. The provider then reports
provider_timeout with completed cleanup, and both processes are gone.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
2026-10-22 00:31:43 +08:00

108 lines
2.9 KiB
JavaScript

import { matchesGlob } from "node:path";
/** Canonical file ownership shared by Vitest and development-test planning. */
export const SOURCE_TEST_PROJECTS = [
{
name: "domain",
group: "source",
include: ["src/{contracts,domain}/**/*.test.ts"],
},
{
name: "services",
group: "source",
include: ["src/application/**/*.test.ts"],
},
{
name: "adapters",
group: "source",
include: [
"src/*.test.ts",
"src/{android,apktool,jeb,adb,artifacts,browser,dotnet,electron,evm,firmware,flutter,pcap,ghidra,go,gpu,hopper,ida,inspector,javascript,native,process,reference,rust,server,sqlite,wasm,windows}/**/*.test.ts",
],
},
{
name: "composition",
group: "source",
include: ["tests/composition/**/*.test.ts"],
},
{
name: "conformance",
group: "source",
include: ["tests/conformance/**/*.test.ts"],
exclude: ["tests/conformance/providers/hopper/realHopperSearch.test.ts"],
},
{
name: "evaluation",
group: "source",
include: ["tests/evaluation/**/*.test.ts"],
},
];
export const BUILT_TEST_PROJECTS = [
{
name: "boundary",
group: "built",
include: [
"tests/boundary/**/*.test.ts",
"tests/conformance/providers/hopper/realHopperSearch.test.ts",
],
exclude: [
"tests/boundary/cli/**/*.test.ts",
"tests/boundary/mcp/**/*.test.ts",
"tests/boundary/process/**/*.test.ts",
],
},
{
name: "cli-boundary",
group: "built",
include: ["tests/boundary/cli/**/*.test.ts"],
},
{
name: "process-boundary",
group: "built",
include: ["tests/boundary/process/**/*.test.ts"],
},
{
name: "mcp-boundary",
group: "built",
include: ["tests/boundary/mcp/**/*.test.ts"],
},
{
name: "acceptance",
group: "built",
include: ["tests/acceptance/**/*.test.ts"],
},
{
name: "process-global",
group: "built",
include: ["tests/process-global/**/*.test.ts"],
},
];
const ALL_TEST_PROJECTS = [...SOURCE_TEST_PROJECTS, ...BUILT_TEST_PROJECTS];
/** Return the unique Vitest owner for an exact repository-relative test path. */
export const projectForTest = (testPath) => {
if (
typeof testPath !== "string" ||
testPath.startsWith("/") ||
testPath.includes("\\") ||
testPath.split("/").some((part) => part === ".." || part === ".") ||
!testPath.endsWith(".test.ts")
)
throw new Error(`Expected a normalized repository test path: ${testPath}`);
const owners = ALL_TEST_PROJECTS.filter(
({ include, exclude = [] }) =>
include.some((pattern) => matchesGlob(testPath, pattern)) &&
!exclude.some((pattern) => matchesGlob(testPath, pattern)),
);
if (owners.length !== 1)
throw new Error(
owners.length === 0
? `No test project owns ${testPath}`
: `Multiple test projects own ${testPath}: ${owners.map(({ name }) => name).join(", ")}`,
);
return owners[0];
};