mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-20 21:23:23 +00:00
test: add raw plugin-schema defaults regression coverage (#61856)
This commit is contained in:
@@ -12,6 +12,7 @@ Docs: https://docs.openclaw.ai
|
||||
- Agents/history: suppress commentary-only visible-text leaks in streaming and chat history views, and keep sanitized SSE history sequence numbers monotonic after transcript-only refreshes. (#61829) Thanks @100yenadmin.
|
||||
- Plugins/Windows: load plugin entrypoints through `file://` import specifiers on Windows without breaking plugin SDK alias resolution, fixing `ERR_UNSUPPORTED_ESM_URL_SCHEME` for absolute plugin paths. (#61832) Thanks @Zeesejo.
|
||||
- Discord/forwarding: recover forwarded referenced message text and attachments when Discord omits snapshot payloads, so forwarded-message relays keep the original content. (#61670) Thanks @artwalker.
|
||||
- Plugins/install: preserve plugin-schema defaults during fresh-install raw config validation so bundled plugin installs stop failing when required fields rely on schema defaults. (#61856) Thanks @SuperMarioYL.
|
||||
- Docs/i18n: remove the zh-CN homepage redirect override so Mintlify can resolve the localized Chinese homepage without self-redirecting `/zh-CN/index`.
|
||||
- Agents/heartbeat: stop truncating live session transcripts after no-op heartbeat acks, move heartbeat cleanup to prompt assembly and compaction, and keep post-filter context-engine ingestion aligned with the real session baseline. (#60998) Thanks @nxmxbbd.
|
||||
- macOS/gateway version: strip trailing commit metadata from CLI version output before semver parsing so the Mac app recognizes installed gateway versions like `OpenClaw 2026.4.2 (d74a122)` again. (#61111) Thanks @oliviareid-svg.
|
||||
@@ -22,6 +23,7 @@ Docs: https://docs.openclaw.ai
|
||||
- TUI/status: route `/status` through the shared session-status command and move the old gateway-wide diagnostic summary to `/gateway-status` (`/gwstatus`). Thanks @vincentkoc.
|
||||
|
||||
## 2026.4.5
|
||||
|
||||
### Breaking
|
||||
|
||||
- Config: remove legacy public config aliases such as `talk.voiceId` / `talk.apiKey`, `agents.*.sandbox.perSession`, `browser.ssrfPolicy.allowPrivateNetwork`, `hooks.internal.handlers`, and channel/group/room `allow` toggles in favor of the canonical public paths and `enabled`, while keeping load-time compatibility and `openclaw doctor --fix` migration support for existing configs. (#60726) Thanks @vincentkoc.
|
||||
|
||||
@@ -9,6 +9,15 @@ vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: (...args: unknown[]) => mockLoadPluginManifestRegistry(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/doctor-contract-registry.js", () => ({
|
||||
listPluginDoctorLegacyConfigRules: () => [],
|
||||
}));
|
||||
|
||||
mockLoadPluginManifestRegistry.mockReturnValue({
|
||||
diagnostics: [],
|
||||
plugins: [],
|
||||
});
|
||||
|
||||
beforeAll(async () => {
|
||||
({ validateConfigObjectWithPlugins, validateConfigObjectRawWithPlugins } =
|
||||
await import("./validation.js"));
|
||||
@@ -52,6 +61,32 @@ function setupTelegramSchemaWithDefault() {
|
||||
});
|
||||
}
|
||||
|
||||
function setupPluginSchemaWithRequiredDefault() {
|
||||
mockLoadPluginManifestRegistry.mockReturnValue({
|
||||
diagnostics: [],
|
||||
plugins: [
|
||||
{
|
||||
id: "opik",
|
||||
origin: "bundled",
|
||||
channels: [],
|
||||
providers: [],
|
||||
kind: ["tool"],
|
||||
configSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
workspace: {
|
||||
type: "string",
|
||||
default: "default-workspace",
|
||||
},
|
||||
},
|
||||
required: ["workspace"],
|
||||
additionalProperties: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
describe("validateConfigObjectWithPlugins channel metadata (applyDefaults: true)", () => {
|
||||
it("applies bundled channel defaults from plugin-owned schema metadata", async () => {
|
||||
setupTelegramSchemaWithDefault();
|
||||
@@ -98,3 +133,26 @@ describe("validateConfigObjectRawWithPlugins channel metadata", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("validateConfigObjectRawWithPlugins plugin config defaults", () => {
|
||||
it("still injects plugin AJV defaults in raw mode for required defaulted fields", async () => {
|
||||
setupPluginSchemaWithRequiredDefault();
|
||||
|
||||
const result = validateConfigObjectRawWithPlugins({
|
||||
plugins: {
|
||||
entries: {
|
||||
opik: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok) {
|
||||
expect(result.config.plugins?.entries?.opik?.config).toEqual(
|
||||
expect.objectContaining({ workspace: "default-workspace" }),
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user