Files
openclaw/scripts/ci-run-node-test-shard.d.mts
Peter Steinberger 2c7cf8d745 perf(ci): scale Vitest workers with runner class and share serial module cache (#108788)
* perf(ci): scale Vitest workers with runner class and share serial module cache

Compact node-test jobs pinned OPENCLAW_VITEST_MAX_WORKERS=2 regardless of
runner size, so import-bound suites (30-45s of module-graph import per
file) crawled: runner-cli spent 284s on 5s of tests, commands-1 296s on
10s. With serial plans the budget now scales with the class (6 on 8vcpu,
3 on 4vcpu); timing-sensitive groups (tooling, tui-pty, infra-process)
stay pinned to 2 via plan-level env. Serial bins share one Vitest
fs-module-cache path so later plans reuse the first plan's transforms.
The import-bound commands stripes and security suite move to the 8vcpu
class, and packing hints refresh from serial-run measurements (run
29481835688).

* perf(ci): stripe cli-runner suite and pin media-ui worker budget

The agents-core config runs files serially (fileParallelism false guards
shared module state), so raising the worker budget cannot help its
import-heavy cli-runner suite (~35s module import per file, 213s serial).
Stripe it three ways so bins parallelize the imports instead. media-ui
hosts browser locator tests that timed out at 6 workers on the first
validation run; pin it to the proven 2-worker budget. commands-1's hint
drops to its measured 6-worker runtime.
2026-07-16 03:36:37 -07:00

48 lines
1.1 KiB
TypeScript

export type ShardTargetPlan = {
kind: "target";
name: string;
target: string;
};
export type ShardGroupPlan = {
kind: "group";
name: string;
plan: {
configs: string[];
env?: Record<string, unknown> | null;
includePatterns?: string[] | null;
shard_name?: string;
};
};
export type ShardPlan = ShardTargetPlan | ShardGroupPlan;
export function resolveShardPlans(env?: Record<string, string | undefined>): ShardPlan[];
export function buildChildEnv(
entry: ShardPlan,
baseEnv: Record<string, string | undefined>,
scratchDir: string,
index: number,
options?: { serial?: boolean },
): Record<string, string | undefined>;
export function resolveShardChildCommand(
args: string[],
nodeExecPath?: string,
): { command: string; args: string[] };
export function runShardPlans(
plans: ShardPlan[],
options?: {
concurrency?: number;
env?: Record<string, string | undefined>;
runChild?: (
args: string[],
childEnv: Record<string, string | undefined>,
label: string,
) => Promise<number>;
scratchDir?: string;
},
): Promise<number>;