mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 14:13:40 +00:00
Summary: - Add a shared live provider catalog runtime for SDK-backed providers. - Route OpenAI, xAI, OpenCode Go, Chutes, DeepInfra, Venice, NVIDIA, and Vercel AI Gateway live model discovery through the shared helper. - Remove duplicated provider-local live catalog caching and harden auth marker stripping, empty live-result retries, and OpenAI custom-base-url handling. Verification: - node scripts/run-vitest.mjs extensions/openai/openai-provider.test.ts src/plugin-sdk/provider-catalog-live-runtime.test.ts src/commands/models/list.source-plan.test.ts extensions/opencode-go/index.test.ts extensions/nvidia/provider-catalog.test.ts - pnpm plugin-sdk:api:check - pnpm lint --threads=8 - pnpm run lint:extensions:bundled - pnpm run test:extensions:package-boundary:compile - pnpm check:import-cycles - pnpm exec oxfmt --check extensions/openai/openai-provider.ts extensions/openai/openai-provider.test.ts - git diff --check origin/main...HEAD - autoreview clean: no accepted/actionable findings reported - AWS Crabbox focused remote proof: run_364680d1bff8 / cbx_2456fffafe01 - Earlier same-PR AWS Crabbox live proof: run_1f05ccab368e / cbx_7375c79fcf9b Known proof gap: - Final current-code true live-provider smoke was blocked by Crabbox secret hydration, documented in the PR proof comment.
141 lines
4.1 KiB
TypeScript
141 lines
4.1 KiB
TypeScript
/**
|
|
* Integration tests for QA runner runtime public surface loading.
|
|
*/
|
|
import fs from "node:fs";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
import { setTestEnvValue } from "../test-utils/env.js";
|
|
import * as activationCheckRuntime from "./facade-activation-check.runtime.js";
|
|
import {
|
|
testing as facadeRuntimeTesting,
|
|
resetFacadeRuntimeStateForTest,
|
|
} from "./facade-runtime.js";
|
|
import { listQaRunnerCliContributions } from "./qa-runner-runtime.js";
|
|
|
|
const ORIGINAL_ENV = {
|
|
OPENCLAW_DISABLE_BUNDLED_PLUGINS: process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS,
|
|
OPENCLAW_CONFIG_PATH: process.env.OPENCLAW_CONFIG_PATH,
|
|
OPENCLAW_STATE_DIR: process.env.OPENCLAW_STATE_DIR,
|
|
OPENCLAW_TEST_FAST: process.env.OPENCLAW_TEST_FAST,
|
|
} as const;
|
|
|
|
const tempDirs: string[] = [];
|
|
|
|
function makeTempDir(prefix: string): string {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
tempDirs.push(dir);
|
|
return dir;
|
|
}
|
|
|
|
function resetQaRunnerRuntimeState() {
|
|
resetFacadeRuntimeStateForTest();
|
|
facadeRuntimeTesting.setFacadeActivationCheckRuntimeForTest(activationCheckRuntime);
|
|
}
|
|
|
|
describe("plugin-sdk qa-runner-runtime linked plugin smoke", () => {
|
|
beforeEach(() => {
|
|
resetQaRunnerRuntimeState();
|
|
process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS = "1";
|
|
process.env.OPENCLAW_TEST_FAST = "1";
|
|
});
|
|
|
|
afterEach(() => {
|
|
resetQaRunnerRuntimeState();
|
|
for (const dir of tempDirs.splice(0)) {
|
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
}
|
|
for (const [key, value] of Object.entries(ORIGINAL_ENV)) {
|
|
if (value === undefined) {
|
|
delete process.env[key];
|
|
} else {
|
|
setTestEnvValue(key, value);
|
|
}
|
|
}
|
|
});
|
|
|
|
it("loads an activated qa runner from a linked plugin path without a bundled install fallback", async () => {
|
|
const stateDir = makeTempDir("openclaw-qa-runner-state-");
|
|
const pluginDir = path.join(stateDir, "extensions", "qa-linked");
|
|
const configPath = path.join(stateDir, "openclaw.json");
|
|
|
|
fs.writeFileSync(
|
|
configPath,
|
|
JSON.stringify({
|
|
plugins: {},
|
|
}),
|
|
"utf8",
|
|
);
|
|
process.env.OPENCLAW_CONFIG_PATH = configPath;
|
|
process.env.OPENCLAW_STATE_DIR = stateDir;
|
|
|
|
fs.mkdirSync(pluginDir, { recursive: true });
|
|
fs.writeFileSync(
|
|
path.join(pluginDir, "openclaw.plugin.json"),
|
|
JSON.stringify({
|
|
id: "qa-linked",
|
|
qaRunners: [
|
|
{
|
|
commandName: "linked",
|
|
description: "Run the linked QA lane",
|
|
},
|
|
],
|
|
configSchema: {
|
|
type: "object",
|
|
additionalProperties: false,
|
|
properties: {},
|
|
},
|
|
}),
|
|
"utf8",
|
|
);
|
|
fs.writeFileSync(
|
|
path.join(pluginDir, "package.json"),
|
|
JSON.stringify({
|
|
name: "@openclaw/qa-linked",
|
|
type: "module",
|
|
openclaw: {
|
|
extensions: ["./index.js"],
|
|
install: {
|
|
npmSpec: "@openclaw/qa-linked",
|
|
},
|
|
},
|
|
}),
|
|
"utf8",
|
|
);
|
|
fs.writeFileSync(path.join(pluginDir, "index.js"), "export default {};\n", "utf8");
|
|
fs.writeFileSync(
|
|
path.join(pluginDir, "runtime-api.js"),
|
|
[
|
|
"export const qaRunnerCliRegistrations = [",
|
|
" {",
|
|
' commandName: "linked",',
|
|
" register() {}",
|
|
" }",
|
|
"];",
|
|
].join("\n"),
|
|
"utf8",
|
|
);
|
|
|
|
const contributions = listQaRunnerCliContributions();
|
|
const contribution = contributions[0];
|
|
expect(contribution?.status).toBe("available");
|
|
if (!contribution || contribution.status !== "available") {
|
|
throw new Error("Expected linked QA runner contribution to be available");
|
|
}
|
|
const register = contribution.registration["register"];
|
|
expect(typeof register).toBe("function");
|
|
expect(contributions).toEqual([
|
|
{
|
|
pluginId: "qa-linked",
|
|
commandName: "linked",
|
|
description: "Run the linked QA lane",
|
|
status: "available",
|
|
registration: {
|
|
commandName: "linked",
|
|
register,
|
|
},
|
|
},
|
|
]);
|
|
});
|
|
});
|