mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 22:41:38 +00:00
* chore(types): add declaration files for scripts/lib and scripts/e2e modules
* chore(types): add declaration files for top-level script modules (a-m)
* chore(types): add declaration files for top-level script modules (n-z)
* test: use a non-secret-shaped gateway token fixture
* test: type ci workflow guard helpers for the root test lane
* chore(tooling): typecheck root test/** with a dedicated tsgo lane
- test/tsconfig/tsconfig.test.root.json: root-test program (strict unused checks,
fixtures excluded; two Docker E2E clients that import built dist/** stay out,
same rationale as the scripts/e2e exclusion in tsconfig.scripts.json)
- tsgo:test:root wired into tsgo:test, check:test-types, scripts/check.mjs, and
the ci.yml test-types shard, mirroring the tsgo:scripts lane (#104348)
- changed-lane routing: test/**/*.ts (excluding fixtures) and the lane tsconfig
now trigger 'typecheck test root' in check:changed; previously test/ paths ran
lint only, so harness type errors surfaced first in CI (#104287 envDir case)
- burn down all 1071 latent type errors in the program: precise param/local
types across test/scripts, test/vitest, test/e2e, and transitive scripts/e2e
program members; 205 sibling .d.mts declaration files for imported .mjs
modules (committed separately); zero any, zero ts-expect-error
- resolve the pre-existing testing star-export ambiguity in
scripts/e2e/parallels/common.ts with an explicit re-export
Closes #104388
* chore(types): correct declaration fidelity per structured review
- re-derive 51 .d.mts files from implementation data flow instead of
initializers: fix a wrong never return (runTestProjectsDelegation returns
the child), add encoding-sensitive exec/spawn overloads (plain-gh), restore
the full release profile union, make parsed paths string | null, add missing
parseArgs fields via help/non-help unions, add a missing sibling declaration
(budget-number-args), drop 15 unused lint directives
- precise install-record/tuple typing removes the type-aware oxlint
regressions the first declarations caused in scripts/e2e implementations
- route .mts declaration edits under test/ to the testRoot lane and reference
the test-root project from tsconfig.projects.json so tsgo:all covers it
(closes both review findings against the lane wiring)
* chore(scripts): keep telegram runner dist typing structural for the boundary guard
* chore(types): declare runtime pack and gateway readiness exports added on main
* test: pin the importTargetPlan form of the plugin-contract plan import
The guard expectation still referenced the raw await import( form that
7ae5996bb3 (#103975) replaced with the importTargetPlan fallback helper;
the assertion fails on current main.
335 lines
11 KiB
TypeScript
335 lines
11 KiB
TypeScript
// Release Workflow Matrix Plan tests cover release workflow matrix plan script behavior.
|
|
import { readFileSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
import { parse } from "yaml";
|
|
import { createReleaseWorkflowMatrixPlan } from "../../scripts/plan-release-workflow-matrix.mjs";
|
|
|
|
function workflow(): WorkflowDocument {
|
|
return parse(
|
|
readFileSync(".github/workflows/openclaw-live-and-e2e-checks-reusable.yml", "utf8"),
|
|
) as WorkflowDocument;
|
|
}
|
|
|
|
const PROFILE_GATED_STATIC_MATRIX_ALLOWLIST = [
|
|
"validate_live_provider_suites",
|
|
"validate_live_docker_provider_suites",
|
|
"validate_live_media_provider_suites",
|
|
];
|
|
|
|
type WorkflowStep = {
|
|
env?: Record<string, string>;
|
|
if?: string;
|
|
name?: string;
|
|
run?: string;
|
|
};
|
|
|
|
type MatrixEntry = {
|
|
advisory?: boolean;
|
|
chunk_id?: string;
|
|
id?: string;
|
|
profiles?: string;
|
|
providers?: string;
|
|
suite_group?: string;
|
|
suite_id?: string;
|
|
};
|
|
|
|
type WorkflowJob = {
|
|
env: Record<string, string>;
|
|
needs: string[];
|
|
outputs: Record<string, string>;
|
|
steps: WorkflowStep[];
|
|
strategy: { matrix: { include: MatrixEntry[] } };
|
|
};
|
|
|
|
type WorkflowDocument = {
|
|
env: Record<string, string>;
|
|
jobs: Record<string, WorkflowJob>;
|
|
on: {
|
|
workflow_call: { inputs: Record<string, unknown> };
|
|
workflow_dispatch: { inputs: Record<string, unknown> };
|
|
};
|
|
};
|
|
|
|
// Direct dispatches build from the selected ref. Only trusted workflow callers
|
|
// may provide the complete immutable package artifact tuple.
|
|
const WORKFLOW_CALL_ONLY_INPUTS = new Set([
|
|
"package_artifact_name",
|
|
"package_artifact_id",
|
|
"package_artifact_digest",
|
|
"package_artifact_run_id",
|
|
"package_artifact_run_attempt",
|
|
"package_file_name",
|
|
"package_source_sha",
|
|
"package_sha256",
|
|
"package_version",
|
|
]);
|
|
|
|
const PROFILE_EXPECTATIONS = [
|
|
{
|
|
profile: "minimum",
|
|
dockerE2eChunks: ["package-update-openai", "package-update-anthropic", "package-update-core"],
|
|
liveModelProviders: ["openai"],
|
|
},
|
|
{
|
|
profile: "beta",
|
|
dockerE2eChunks: ["package-update-openai", "package-update-anthropic", "package-update-core"],
|
|
liveModelProviders: ["openai"],
|
|
},
|
|
{
|
|
profile: "stable",
|
|
dockerE2eChunks: [
|
|
"core",
|
|
"package-update-openai",
|
|
"package-update-anthropic",
|
|
"package-update-core",
|
|
"plugins-runtime-plugins",
|
|
"plugins-runtime-services",
|
|
"plugins-runtime-install-a",
|
|
"plugins-runtime-install-b",
|
|
"plugins-runtime-install-c",
|
|
"plugins-runtime-install-d",
|
|
"plugins-runtime-install-e",
|
|
"plugins-runtime-install-f",
|
|
"plugins-runtime-install-g",
|
|
"plugins-runtime-install-h",
|
|
],
|
|
liveModelProviders: ["anthropic", "google", "minimax", "openai"],
|
|
},
|
|
{
|
|
profile: "full",
|
|
dockerE2eChunks: [
|
|
"core",
|
|
"package-update-openai",
|
|
"package-update-anthropic",
|
|
"package-update-core",
|
|
"plugins-runtime-plugins",
|
|
"plugins-runtime-services",
|
|
"plugins-runtime-install-a",
|
|
"plugins-runtime-install-b",
|
|
"plugins-runtime-install-c",
|
|
"plugins-runtime-install-d",
|
|
"plugins-runtime-install-e",
|
|
"plugins-runtime-install-f",
|
|
"plugins-runtime-install-g",
|
|
"plugins-runtime-install-h",
|
|
],
|
|
liveModelProviders: [
|
|
"anthropic",
|
|
"google",
|
|
"minimax",
|
|
"moonshot",
|
|
"openai",
|
|
"opencode-go",
|
|
"openrouter",
|
|
"xai",
|
|
"zai",
|
|
"fireworks",
|
|
],
|
|
},
|
|
];
|
|
|
|
function staticProfileMatrixJobs() {
|
|
return Object.entries(workflow().jobs)
|
|
.filter(([, job]) => {
|
|
const entries = job.strategy?.matrix?.include;
|
|
return Array.isArray(entries) && entries.some((entry: MatrixEntry) => "profiles" in entry);
|
|
})
|
|
.map(([jobName]) => jobName)
|
|
.toSorted((left, right) => left.localeCompare(right));
|
|
}
|
|
|
|
describe("scripts/plan-release-workflow-matrix.mjs", () => {
|
|
it("declares every job input for both workflow entry points", () => {
|
|
const definition = workflow();
|
|
const referencedInputs = new Set<string>();
|
|
for (const match of JSON.stringify(definition.jobs).matchAll(/\binputs\.([a-zA-Z0-9_]+)/gu)) {
|
|
if (match[1]) {
|
|
referencedInputs.add(match[1]);
|
|
}
|
|
}
|
|
|
|
expect(Object.keys(definition.on.workflow_call.inputs)).toEqual(
|
|
expect.arrayContaining([...referencedInputs]),
|
|
);
|
|
expect(Object.keys(definition.on.workflow_dispatch.inputs)).toEqual(
|
|
expect.arrayContaining(
|
|
[...referencedInputs].filter((input) => !WORKFLOW_CALL_ONLY_INPUTS.has(input)),
|
|
),
|
|
);
|
|
for (const input of WORKFLOW_CALL_ONLY_INPUTS) {
|
|
expect(definition.on.workflow_call.inputs).toHaveProperty(input);
|
|
expect(definition.on.workflow_dispatch.inputs).not.toHaveProperty(input);
|
|
}
|
|
expect(definition.on.workflow_dispatch.inputs.live_advisory).toEqual(
|
|
definition.on.workflow_call.inputs.live_advisory,
|
|
);
|
|
expect(definition.on.workflow_dispatch.inputs.live_advisory).toMatchObject({
|
|
default: false,
|
|
required: false,
|
|
type: "boolean",
|
|
});
|
|
expect(definition.on.workflow_dispatch.inputs.allow_unreleased_changelog).toEqual(
|
|
definition.on.workflow_call.inputs.allow_unreleased_changelog,
|
|
);
|
|
expect(definition.on.workflow_call.inputs.allow_unreleased_changelog).toMatchObject({
|
|
default: false,
|
|
required: false,
|
|
type: "boolean",
|
|
});
|
|
expect(definition.env.OPENCLAW_DOCKER_E2E_ALLOW_UNRELEASED_CHANGELOG).toBe(
|
|
"${{ inputs.allow_unreleased_changelog }}",
|
|
);
|
|
const packageStep = definition.jobs.prepare_docker_e2e_image.steps.find(
|
|
(step: WorkflowStep) => step.name === "Pack OpenClaw package for Docker E2E",
|
|
);
|
|
expect(packageStep!.env!.ALLOW_UNRELEASED_CHANGELOG).toBe(
|
|
"${{ inputs.allow_unreleased_changelog }}",
|
|
);
|
|
expect(packageStep!.run).toContain("package_args+=(--allow-unreleased-changelog)");
|
|
});
|
|
|
|
it.each(PROFILE_EXPECTATIONS)(
|
|
"keeps $profile release jobs to profile-enabled Docker E2E chunks and live model providers",
|
|
({ profile, dockerE2eChunks, liveModelProviders }) => {
|
|
const plan = createReleaseWorkflowMatrixPlan({
|
|
includeLiveSuites: true,
|
|
includeReleasePathSuites: true,
|
|
releaseProfile: profile,
|
|
});
|
|
|
|
expect(plan.dockerE2e.matrix.include.map((entry: MatrixEntry) => entry.chunk_id)).toEqual(
|
|
dockerE2eChunks,
|
|
);
|
|
expect(plan.liveModels.matrix.include.map((entry: MatrixEntry) => entry.providers)).toEqual(
|
|
liveModelProviders,
|
|
);
|
|
},
|
|
);
|
|
|
|
it("reports omitted lanes for release jobs excluded by the selected profile", () => {
|
|
const plan = createReleaseWorkflowMatrixPlan({
|
|
includeLiveSuites: true,
|
|
includeReleasePathSuites: true,
|
|
releaseProfile: "beta",
|
|
});
|
|
|
|
expect(plan.dockerE2e.omitted.map((entry: MatrixEntry) => entry.id)).toContain("core");
|
|
expect(plan.liveModels.omitted.map((entry: MatrixEntry) => entry.id)).toContain("anthropic");
|
|
});
|
|
|
|
it("keeps stable release jobs broad enough for stable-required lanes", () => {
|
|
const plan = createReleaseWorkflowMatrixPlan({
|
|
includeLiveSuites: true,
|
|
includeReleasePathSuites: true,
|
|
releaseProfile: "stable",
|
|
});
|
|
|
|
expect(plan.dockerE2e.count).toBe(14);
|
|
expect(plan.liveModels.matrix.include.map((entry: MatrixEntry) => entry.providers)).toEqual([
|
|
"anthropic",
|
|
"google",
|
|
"minimax",
|
|
"openai",
|
|
]);
|
|
expect(plan.liveModels.omitted.map((entry: MatrixEntry) => entry.id)).toEqual([
|
|
"moonshot",
|
|
"opencode-go",
|
|
"openrouter",
|
|
"xai",
|
|
"zai",
|
|
"fireworks",
|
|
]);
|
|
});
|
|
|
|
it("limits MiniMax Docker live-model coverage to the stable M2.7 pair", () => {
|
|
const plan = createReleaseWorkflowMatrixPlan({
|
|
includeLiveSuites: true,
|
|
includeReleasePathSuites: true,
|
|
releaseProfile: "stable",
|
|
});
|
|
|
|
expect(plan.liveModels.matrix.include).toContainEqual({
|
|
provider_label: "MiniMax",
|
|
providers: "minimax",
|
|
models: "minimax/MiniMax-M2.7,minimax-portal/MiniMax-M2.7",
|
|
max_models: "2",
|
|
profiles: "stable full",
|
|
});
|
|
});
|
|
|
|
it("keeps stable Anthropic Docker proof blocking and full proof advisory", () => {
|
|
const jobs = workflow().jobs;
|
|
const dockerLiveJob = jobs.validate_live_docker_provider_suites;
|
|
const anthropicEntries = dockerLiveJob.strategy.matrix.include
|
|
.filter((entry: MatrixEntry) => entry.suite_group === "live-gateway-anthropic-docker")
|
|
.map((entry: MatrixEntry) => ({
|
|
advisory: entry.advisory,
|
|
profiles: entry.profiles,
|
|
suiteId: entry.suite_id,
|
|
}));
|
|
|
|
expect(anthropicEntries).toEqual([
|
|
{
|
|
advisory: undefined,
|
|
profiles: "stable",
|
|
suiteId: "live-gateway-anthropic-docker",
|
|
},
|
|
{
|
|
advisory: true,
|
|
profiles: "full",
|
|
suiteId: "live-gateway-anthropic-docker-full",
|
|
},
|
|
]);
|
|
expect(dockerLiveJob.strategy.matrix.include).toContainEqual(
|
|
expect.objectContaining({ suite_id: "live-gateway-anthropic-docker-full" }),
|
|
);
|
|
|
|
const conditionalSteps = dockerLiveJob.steps.filter((step: WorkflowStep) => step.if);
|
|
expect(conditionalSteps.length).toBeGreaterThan(0);
|
|
for (const step of conditionalSteps) {
|
|
expect(step.if).toContain("inputs.live_suite_filter == matrix.suite_group");
|
|
}
|
|
});
|
|
|
|
it("disables live model planning when focused recovery targets another live suite", () => {
|
|
const plan = createReleaseWorkflowMatrixPlan({
|
|
includeLiveSuites: true,
|
|
includeReleasePathSuites: true,
|
|
liveSuiteFilter: "live-cache",
|
|
releaseProfile: "full",
|
|
});
|
|
|
|
expect(plan.liveModels.count).toBe(0);
|
|
expect(plan.liveModels.omitted).toHaveLength(10);
|
|
expect(plan.liveModels.omitted[0]?.reason).toBe(
|
|
"Docker live model matrix disabled by input selection",
|
|
);
|
|
});
|
|
|
|
it("wires filtered matrices into the reusable live and E2E workflow", () => {
|
|
const jobs = workflow().jobs;
|
|
const planner = jobs.plan_release_workflow_matrices;
|
|
|
|
expect(planner.outputs.docker_e2e_matrix).toBe("${{ steps.plan.outputs.docker_e2e_matrix }}");
|
|
expect(planner.outputs.live_models_matrix).toBe("${{ steps.plan.outputs.live_models_matrix }}");
|
|
expect(jobs.validate_docker_e2e.needs).toContain("plan_release_workflow_matrices");
|
|
expect(jobs.validate_live_models_docker.needs).toContain("plan_release_workflow_matrices");
|
|
expect(jobs.validate_docker_e2e.strategy.matrix).toBe(
|
|
"${{ fromJson(needs.plan_release_workflow_matrices.outputs.docker_e2e_matrix) }}",
|
|
);
|
|
expect(jobs.validate_live_models_docker.strategy.matrix).toBe(
|
|
"${{ fromJson(needs.plan_release_workflow_matrices.outputs.live_models_matrix) }}",
|
|
);
|
|
expect(jobs.validate_live_models_docker.env.OPENCLAW_LIVE_MODELS).toBe(
|
|
"${{ matrix.models || 'modern' }}",
|
|
);
|
|
expect(jobs.validate_live_models_docker.env.OPENCLAW_LIVE_MAX_MODELS).toBe(
|
|
"${{ matrix.max_models || '6' }}",
|
|
);
|
|
});
|
|
|
|
it("requires new release-profile matrices to use a planner or an explicit allowlist", () => {
|
|
expect(staticProfileMatrixJobs()).toEqual(PROFILE_GATED_STATIC_MATRIX_ALLOWLIST.toSorted());
|
|
});
|
|
});
|