mirror of
https://github.com/morluto/rea.git
synced 2026-10-29 02:45:58 +00:00
* feat(javascript): recover readable modules with Wakaru Integrate pinned upstream source behind a typed optional recovery port, preserve source identity and producer provenance, and publish verified artifacts for existing JavaScript analysis through CLI and MCP. Add focused real-tool CI with genuine bundler fixtures and bounded resource, cancellation, cleanup, schema and packaged-artifact checks. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * fix(javascript): align recovery catalog and browser verification Share canonical Wakaru provider identity, describe CLI mode options, and format the new workflow test. Disconnect the real page transport after its observation readiness progress instead of a fixed delay. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * refactor(javascript): consume the investigation evidence writer Verify that the SDK recovery handler records complete Evidence through the newly shared investigation owner. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) * chore(test): account for isolated recovery fixture compilers * fix(javascript): validate recovery paths before acquiring the engine Return field-specific invalid_format diagnostics for relative paths and verify compiled CLI/MCP parity even when the optional engine is unavailable. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
173 lines
4.7 KiB
TypeScript
173 lines
4.7 KiB
TypeScript
import { realpathSync } from "node:fs";
|
|
import { availableParallelism, tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
const CANONICAL_TEMPORARY_DIRECTORY = realpathSync(tmpdir());
|
|
const COVERAGE_ENABLED = process.argv.some((argument) =>
|
|
argument.startsWith("--coverage"),
|
|
);
|
|
const COVERAGE_SHARD = process.argv.some((argument) =>
|
|
argument.startsWith("--shard="),
|
|
);
|
|
// Keep local and CI concurrency bounded by the runner rather than command locks.
|
|
const MAX_TEST_WORKERS = Math.min(2, availableParallelism());
|
|
|
|
const TEST_PROJECTS = [
|
|
{
|
|
name: "domain",
|
|
include: ["src/{contracts,domain}/**/*.test.ts"],
|
|
pool: "threads" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
// Domain and contract modules are pure and own no process-global state, so
|
|
// per-file module isolation adds startup cost without protecting a seam.
|
|
isolate: false,
|
|
},
|
|
{
|
|
name: "services",
|
|
include: ["src/application/**/*.test.ts"],
|
|
pool: "threads" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
// Service tests use recording ports and own no process-global state. Share
|
|
// their module graph so file startup does not dominate the lane.
|
|
isolate: false,
|
|
},
|
|
{
|
|
name: "adapters",
|
|
include: [
|
|
"src/*.test.ts",
|
|
"src/{artifacts,browser,dotnet,firmware,ghidra,hopper,ida,javascript,native,process,reference,server,windows}/**/*.test.ts",
|
|
],
|
|
pool: "forks" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
},
|
|
{
|
|
name: "composition",
|
|
include: ["tests/composition/**/*.test.ts"],
|
|
pool: "threads" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
},
|
|
{
|
|
name: "boundary",
|
|
include: ["tests/boundary/**/*.test.ts"],
|
|
exclude: [
|
|
"tests/boundary/mcp/**/*.test.ts",
|
|
"tests/boundary/process/**/*.test.ts",
|
|
],
|
|
pool: "forks" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
},
|
|
{
|
|
// Process-tree observations share host sampling resources; keep this small
|
|
// lane serial while the independent projects run together.
|
|
name: "process-boundary",
|
|
include: ["tests/boundary/process/**/*.test.ts"],
|
|
pool: "forks" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
fileParallelism: false,
|
|
sequence: { groupOrder: 1 },
|
|
},
|
|
{
|
|
name: "mcp-boundary",
|
|
include: ["tests/boundary/mcp/**/*.test.ts"],
|
|
pool: "threads" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
// Each file creates and closes an explicit in-memory MCP session. Reuse the
|
|
// immutable server graph so module startup does not outweigh transport work.
|
|
isolate: false,
|
|
},
|
|
{
|
|
name: "acceptance",
|
|
include: ["tests/acceptance/**/*.test.ts"],
|
|
pool: "forks" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
},
|
|
{
|
|
name: "process-global",
|
|
include: ["tests/process-global/**/*.test.ts"],
|
|
pool: "forks" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
},
|
|
{
|
|
name: "conformance",
|
|
include: ["tests/conformance/**/*.test.ts"],
|
|
pool: "threads" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
},
|
|
{
|
|
name: "evaluation",
|
|
include: ["tests/evaluation/**/*.test.ts"],
|
|
pool: "threads" as const,
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
},
|
|
];
|
|
|
|
const ZERO_COVERAGE_THRESHOLDS = {
|
|
statements: 0,
|
|
branches: 0,
|
|
functions: 0,
|
|
lines: 0,
|
|
"src/domain/**": {
|
|
statements: 0,
|
|
branches: 0,
|
|
functions: 0,
|
|
lines: 0,
|
|
},
|
|
"src/contracts/**": {
|
|
statements: 0,
|
|
branches: 0,
|
|
functions: 0,
|
|
lines: 0,
|
|
},
|
|
};
|
|
|
|
const projects = TEST_PROJECTS.map((project) => ({
|
|
extends: true as const,
|
|
test: project,
|
|
}));
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
env: { TMPDIR: CANONICAL_TEMPORARY_DIRECTORY },
|
|
maxWorkers: MAX_TEST_WORKERS,
|
|
projects,
|
|
retry: 0,
|
|
reporters: ["default"],
|
|
// Boundary projects may compete with TypeScript, docs, and package checks
|
|
// under Turbo. Keep the deadline bounded while avoiding false failures from
|
|
// host-level CPU and filesystem contention.
|
|
testTimeout: COVERAGE_ENABLED ? 60_000 : 30_000,
|
|
coverage: {
|
|
enabled: false,
|
|
provider: "v8",
|
|
reportsDirectory: join(
|
|
tmpdir(),
|
|
`rea-vitest-coverage-${String(process.pid)}`,
|
|
),
|
|
include: ["src/**"],
|
|
thresholds: COVERAGE_SHARD
|
|
? ZERO_COVERAGE_THRESHOLDS
|
|
: {
|
|
statements: 65,
|
|
branches: 60,
|
|
functions: 60,
|
|
lines: 68,
|
|
"src/domain/**": {
|
|
statements: 80,
|
|
branches: 75,
|
|
functions: 75,
|
|
lines: 80,
|
|
},
|
|
"src/contracts/**": {
|
|
statements: 85,
|
|
branches: 80,
|
|
functions: 80,
|
|
lines: 85,
|
|
},
|
|
},
|
|
reporter: ["text", "text-summary"],
|
|
},
|
|
},
|
|
});
|