mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 17:53:39 +00:00
* refactor(infra): deslop infra sixth pass Consolidate canonical owners and remove redundant forwarding, projections, type declarations, and unread state across infra. Preserve persistent stores, filesystem/security boundaries, SSRF policy, and update/install behavior. Keep Fleet hardlink archive coverage at the surviving owner. Retain the SQLite bootstrap's dependency-free guard after import-boundary validation rejected loading a package alias before Vitest configuration was ready. Independent review is clean through P2. Validation remains incomplete after Blacksmith source-sync failures and local artifact-preparation refusal; keep the PR draft until the remaining scoped gates pass. * refactor(infra): retain presence typing and shrink assertion allowances * test(cron): align heartbeat prompt fixtures * fix(infra): preserve astral comparisons and prepare Code Mode workers Use equivalent Unicode property alternatives so astral comparison operands survive plain-text sanitization on affected Node runtimes. Retain the tag grammar, HTML element checks, matching-closer checks, and numeric right operand. Prepare Code Mode's compiled worker generation through the existing runner owner before timed cases start. Add deterministic regressions at both CLI routes and retain the existing deadlines, import assertions, and cleanup checks. * test(infra): exercise browser registry precedence through its owner * refactor(infra): preserve explicit projections and cleanup ownership * fix(infra): preserve native script import boundaries Restore main's self-contained exact-duration formatter so native Node entrypoints do not resolve a runtime .js import to a TypeScript source. Include the existing npm JSON helper in the canonical PR wrapper inventory so extracted wrappers retain their runtime dependency closure. Keep test assertions and deadlines unchanged. The declaration file passes three times; wrapper closure and provisioning pass on Blacksmith. Changed checks and both cycle checks pass, with no cycles and clean P2 review.
73 lines
2.8 KiB
TypeScript
73 lines
2.8 KiB
TypeScript
import { agentVitestProjectOwners } from "../../test/vitest/vitest.agents-paths.mjs";
|
|
import { databaseWorkerCoreTestFiles } from "../../test/vitest/vitest.database-worker-core-paths.mjs";
|
|
import { matchesVitestCliSelection } from "../../test/vitest/vitest.pattern-file.ts";
|
|
import { fullSuiteVitestShards } from "../../test/vitest/vitest.test-shards.mjs";
|
|
import {
|
|
resolveVitestRuntimeConfigScopes,
|
|
type VitestRuntimeTestSelection,
|
|
} from "./vitest-build-prerequisites.mts";
|
|
import { collectVitestFileFilters } from "./vitest-cli-mode.mts";
|
|
|
|
/** Bind installed CLI matching without adding runtime dependencies to CI planning. */
|
|
export function resolveVitestRuntimeCliSelections(
|
|
config: string,
|
|
args: string[],
|
|
env: NodeJS.ProcessEnv,
|
|
): VitestRuntimeTestSelection[] {
|
|
return resolveVitestRuntimeConfigScopes(config).map(({ file: scopedFile, configs, dir }) => ({
|
|
configs,
|
|
matchesFile: (file, included, includePatterns) =>
|
|
file === scopedFile &&
|
|
matchesVitestCliSelection(file, included ? [file] : [], args, dir, env, includePatterns),
|
|
}));
|
|
}
|
|
|
|
/** Keep known worker compilation outside dynamically imported test cases. */
|
|
export function shouldPrepareVitestCoreWorkers(
|
|
config: string,
|
|
args: string[],
|
|
env: NodeJS.ProcessEnv,
|
|
includePatterns?: readonly string[] | null,
|
|
): boolean {
|
|
// The full channels lane imports native declarations during collection. Prepare
|
|
// them before the test watchdog starts, as for the known database-worker lane.
|
|
if (
|
|
config === "test/vitest/vitest.channels.config.ts" &&
|
|
collectVitestFileFilters(args).length === 0 &&
|
|
includePatterns == null &&
|
|
!env.OPENCLAW_VITEST_INCLUDE_FILE?.trim()
|
|
) {
|
|
return true;
|
|
}
|
|
const infra = "test/vitest/vitest.infra.config.ts";
|
|
const contracts = "test/vitest/vitest.contracts-plugin.config.ts";
|
|
const includesProject = (project: string) =>
|
|
config === project ||
|
|
config === "vitest.config.ts" ||
|
|
config === "test/vitest/vitest.config.ts" ||
|
|
fullSuiteVitestShards.some(
|
|
(shard) => shard.config === config && shard.projects.includes(project),
|
|
);
|
|
const workers = [
|
|
...(includesProject(infra) ? databaseWorkerCoreTestFiles : []),
|
|
...(includesProject(contracts)
|
|
? ["src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts"]
|
|
: []),
|
|
];
|
|
const codeModeWorker = "src/agents/code-mode.import-boundary.test.ts";
|
|
return (
|
|
workers.some((file) =>
|
|
matchesVitestCliSelection(file, [file], args, "", env, includePatterns),
|
|
) ||
|
|
((includesProject(agentVitestProjectOwners.core.config) ||
|
|
includesProject(agentVitestProjectOwners.all.config)) &&
|
|
matchesVitestCliSelection(
|
|
codeModeWorker,
|
|
[codeModeWorker],
|
|
args,
|
|
agentVitestProjectOwners.core.dir,
|
|
env,
|
|
includePatterns,
|
|
))
|
|
);
|
|
}
|