fix(qa): use exported runner sdk seam
Docker Release / validate_manual_backfill (push) Has been cancelled
Docker Release / approve_manual_backfill (push) Has been cancelled
Docker Release / build-amd64 (push) Has been cancelled
Docker Release / build-arm64 (push) Has been cancelled
Docker Release / create-manifest (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Failing after 33s
Plugin NPM Release / preview_plugin_pack (push) Has been skipped
Plugin NPM Release / publish_plugins_npm (push) Has been skipped
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
Install Smoke / preflight (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / checks-node-extensions (push) Has been cancelled
CI / checks-node-core (push) Has been cancelled
CI / extension-fast (push) Has been cancelled
CI / check (push) Has been cancelled
CI / check-additional (push) Has been cancelled
CI / build-smoke (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
Install Smoke / install-smoke (push) Has been cancelled
Docker Release / validate_manual_backfill (push) Has been cancelled
Docker Release / approve_manual_backfill (push) Has been cancelled
Docker Release / build-amd64 (push) Has been cancelled
Docker Release / build-arm64 (push) Has been cancelled
Docker Release / create-manifest (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Failing after 33s
Plugin NPM Release / preview_plugin_pack (push) Has been skipped
Plugin NPM Release / publish_plugins_npm (push) Has been skipped
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
Install Smoke / preflight (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / checks-node-extensions (push) Has been cancelled
CI / checks-node-core (push) Has been cancelled
CI / extension-fast (push) Has been cancelled
CI / check (push) Has been cancelled
CI / check-additional (push) Has been cancelled
CI / build-smoke (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
Install Smoke / install-smoke (push) Has been cancelled
This commit is contained in:
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
const loadQaRuntimeModule = vi.hoisted(() => vi.fn());
|
||||
const defaultQaRuntimeModelForMode = vi.hoisted(() => vi.fn());
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/qa-runtime", () => ({
|
||||
vi.mock("openclaw/plugin-sdk/qa-runner-runtime", () => ({
|
||||
loadQaRuntimeModule,
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { loadQaRuntimeModule } from "openclaw/plugin-sdk/qa-runtime";
|
||||
import { loadQaRuntimeModule } from "openclaw/plugin-sdk/qa-runner-runtime";
|
||||
import { normalizeQaProviderMode, type QaProviderModeInput } from "../../run-config.js";
|
||||
|
||||
export type ResolvedMatrixQaModels = {
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from "node:path";
|
||||
import { setTimeout as sleep } from "node:timers/promises";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
||||
import { loadQaRuntimeModule } from "openclaw/plugin-sdk/qa-runtime";
|
||||
import { loadQaRuntimeModule } from "openclaw/plugin-sdk/qa-runner-runtime";
|
||||
import type { QaReportCheck } from "../../report.js";
|
||||
import { renderQaMarkdownReport } from "../../report.js";
|
||||
import { type QaProviderModeInput } from "../../run-config.js";
|
||||
|
||||
@@ -32,6 +32,32 @@ describe("plugin-sdk qa-runner-runtime", () => {
|
||||
expect(tryLoadActivatedBundledPluginPublicSurfaceModuleSync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("loads the qa-lab runtime public surface through the public runner seam", async () => {
|
||||
const runtimeSurface = {
|
||||
defaultQaRuntimeModelForMode: vi.fn(),
|
||||
startQaLiveLaneGateway: vi.fn(),
|
||||
};
|
||||
loadBundledPluginPublicSurfaceModuleSync.mockReturnValue(runtimeSurface);
|
||||
|
||||
const module = await import("./qa-runner-runtime.js");
|
||||
|
||||
expect(module.loadQaRuntimeModule()).toBe(runtimeSurface);
|
||||
expect(loadBundledPluginPublicSurfaceModuleSync).toHaveBeenCalledWith({
|
||||
dirName: "qa-lab",
|
||||
artifactBasename: "runtime-api.js",
|
||||
});
|
||||
});
|
||||
|
||||
it("reports the qa runtime as unavailable when the qa-lab surface is missing", async () => {
|
||||
loadBundledPluginPublicSurfaceModuleSync.mockImplementation(() => {
|
||||
throw new Error("Unable to resolve bundled plugin public surface qa-lab/runtime-api.js");
|
||||
});
|
||||
|
||||
const module = await import("./qa-runner-runtime.js");
|
||||
|
||||
expect(module.isQaRuntimeAvailable()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns activated runner registrations declared in plugin manifests", async () => {
|
||||
const register = vi.fn((qa: Command) => qa);
|
||||
loadPluginManifestRegistry.mockReturnValue({
|
||||
|
||||
@@ -15,6 +15,17 @@ type QaRunnerRuntimeSurface = {
|
||||
qaRunnerCliRegistrations?: readonly QaRunnerCliRegistration[];
|
||||
};
|
||||
|
||||
type QaRuntimeSurface = {
|
||||
defaultQaRuntimeModelForMode: (
|
||||
mode: string,
|
||||
options?: {
|
||||
alternate?: boolean;
|
||||
preferredLiveModel?: string;
|
||||
},
|
||||
) => string;
|
||||
startQaLiveLaneGateway: (...args: unknown[]) => Promise<unknown>;
|
||||
};
|
||||
|
||||
export type QaRunnerCliContribution =
|
||||
| {
|
||||
pluginId: string;
|
||||
@@ -30,6 +41,36 @@ export type QaRunnerCliContribution =
|
||||
status: "blocked";
|
||||
};
|
||||
|
||||
function isMissingQaRuntimeError(error: unknown) {
|
||||
if (!(error instanceof Error)) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
error.message.includes("qa-lab") &&
|
||||
(error.message.includes("runtime-api.js") ||
|
||||
error.message.startsWith("Unable to open bundled plugin public surface "))
|
||||
);
|
||||
}
|
||||
|
||||
export function loadQaRuntimeModule(): QaRuntimeSurface {
|
||||
return loadBundledPluginPublicSurfaceModuleSync<QaRuntimeSurface>({
|
||||
dirName: ["qa", "lab"].join("-"),
|
||||
artifactBasename: ["runtime-api", "js"].join("."),
|
||||
});
|
||||
}
|
||||
|
||||
export function isQaRuntimeAvailable(): boolean {
|
||||
try {
|
||||
loadQaRuntimeModule();
|
||||
return true;
|
||||
} catch (error) {
|
||||
if (isMissingQaRuntimeError(error)) {
|
||||
return false;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function listDeclaredQaRunnerPlugins(): Array<
|
||||
PluginManifestRecord & {
|
||||
qaRunners: NonNullable<PluginManifestRecord["qaRunners"]>;
|
||||
|
||||
Reference in New Issue
Block a user