mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
* refactor(scripts): deslop scripts/lib Consolidate script lifecycle, scenario, planner, report, release and packaging helpers while retaining CLI and publication contracts. Keep config-boundary source caches within one scan so repeated in-process checks observe edits. Carry extracted helpers through selective fixtures and iOS scope routing. Leave PR tooling and its library import closure intact. * fix(scripts): retain sanitizer fast path after helper cleanup * fix(scripts): model watchdog shell consumer in dead-code checks
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
// Builds balanced Vitest shard plans for plugin contract tests.
|
|
import { listTrackedTestFiles } from "./list-test-files.mts";
|
|
import { assignWeightedTestFiles } from "./weighted-test-shards.mts";
|
|
|
|
const CONTRACT_FILE_WEIGHTS = new Map([
|
|
["plugin-sdk-subpaths.test.ts", 80],
|
|
["tts.contract.test.ts", 70],
|
|
["boundary-invariants.test.ts", 36],
|
|
["extension-package-project-boundaries.test.ts", 34],
|
|
["plugin-sdk-package-contract-guardrails.test.ts", 46],
|
|
["providers.contract.test.ts", 30],
|
|
["registry.contract.test.ts", 30],
|
|
["core-extension-facade-boundary.test.ts", 28],
|
|
["loader.contract.test.ts", 28],
|
|
["runtime-import-side-effects.contract.test.ts", 24],
|
|
["extension-runtime-dependencies.contract.test.ts", 22],
|
|
]);
|
|
|
|
function resolveContractFileWeight(file: string) {
|
|
const name = file.replaceAll("\\", "/").split("/").pop() ?? "";
|
|
if (name.startsWith("plugin-registration.")) {
|
|
return 14;
|
|
}
|
|
if (name.startsWith("wizard.")) {
|
|
return 12;
|
|
}
|
|
return CONTRACT_FILE_WEIGHTS.get(name) ?? 10;
|
|
}
|
|
|
|
/** Create balanced plugin contract test shards for CI check planning. */
|
|
export function createPluginContractTestShards() {
|
|
const suffixes = ["a", "b"];
|
|
const groups = suffixes.map((suffix) => ({
|
|
checkName: `checks-fast-contracts-plugins-${suffix}`,
|
|
includePatterns: new Array<string>(),
|
|
weight: 0,
|
|
}));
|
|
|
|
assignWeightedTestFiles(
|
|
groups,
|
|
listTrackedTestFiles("src/plugins/contracts"),
|
|
resolveContractFileWeight,
|
|
);
|
|
|
|
return groups
|
|
.map(({ checkName, includePatterns }) => ({
|
|
checkName,
|
|
includePatterns,
|
|
runtime: "node",
|
|
task: "contracts-plugins",
|
|
}))
|
|
.filter((shard) => shard.includePatterns.length > 0);
|
|
}
|