Files
openclaw/src/plugin-sdk/runtime-doctor.test.ts
T
Peter Steinberger c83c3bc3a9 fix(plugin-sdk): keep published pre-split plugin imports loading after upgrade (#124086)
* fix(plugin-sdk): keep published pre-split plugin imports loading after upgrade

Same bug class as #124041: published plugin artifacts import SDK names at
module top level, so removing them from the barrel makes the installed
plugin fail to load (voice-call/matrix doctor contracts silently never run
their migrations; whatsapp and slack channels fail outright) after a core
upgrade. Verified against the actual npm tarballs (2026.7.2-beta.7):

- openclaw/plugin-sdk/runtime-doctor: voice-call + matrix doctor contracts
  import repair names (archiveLegacyStateSource, detect/repair state DB
  schema, plugin install-path repair, removePluginFromConfig,
  createPluginStateSyncKeyedStore) that moved to doctor-repair-runtime.
- openclaw/plugin-sdk/channel-feedback: whatsapp imports
  shouldAckReactionForWhatsApp (owner policy moved in-plugin by #121257).
- openclaw/plugin-sdk/channel-outbound: slack imports
  resolveChannelProgressDraftRender (render key retired by #122927).

Adds deprecated load-only bridges with named removal windows, bumps the
SDK surface budgets with comments, and locks behavior with unit tests
plus a loader fixture that fails without the bridges.

* test(plugin-sdk): cover the repair bridge in the runtime-doctor facade surface lock
2026-08-15 01:05:08 -07:00

34 lines
1.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { createPluginStateSyncKeyedStore } from "../plugin-state/plugin-state-store.js";
import * as doctorRepairRuntime from "./doctor-repair-runtime.js";
import * as runtimeDoctorMigrations from "./runtime-doctor-migrations.js";
import * as legacyRuntimeDoctor from "./runtime-doctor.js";
describe("legacy runtime-doctor package facade", () => {
it("is exactly the migration surface plus the published-artifact repair bridge", () => {
// Bridge names ship for published pre-split doctor artifacts (#124041
// class); delete them here alongside the runtime-doctor.ts bridge.
const expected = [
...new Set([
...Object.keys(runtimeDoctorMigrations),
...Object.keys(doctorRepairRuntime),
"createPluginStateSyncKeyedStore",
]),
].toSorted();
expect(Object.keys(legacyRuntimeDoctor).toSorted()).toEqual(expected);
for (const key of Object.keys(runtimeDoctorMigrations)) {
expect(legacyRuntimeDoctor[key as keyof typeof legacyRuntimeDoctor]).toBe(
runtimeDoctorMigrations[key as keyof typeof runtimeDoctorMigrations],
);
}
for (const key of Object.keys(doctorRepairRuntime)) {
expect(legacyRuntimeDoctor[key as keyof typeof legacyRuntimeDoctor]).toBe(
doctorRepairRuntime[key as keyof typeof doctorRepairRuntime],
);
}
expect(legacyRuntimeDoctor.createPluginStateSyncKeyedStore).toBe(
createPluginStateSyncKeyedStore,
);
});
});