mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-05 22:32:12 +00:00
refactor(matrix): move legacy migrations behind doctor
This commit is contained in:
@@ -11,8 +11,8 @@ import {
|
||||
runMatrixDoctorSequence,
|
||||
} from "./doctor.js";
|
||||
|
||||
vi.mock("./runtime-api.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./runtime-api.js")>();
|
||||
vi.mock("./matrix-migration.runtime.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./matrix-migration.runtime.js")>();
|
||||
return {
|
||||
...actual,
|
||||
hasActionableMatrixMigration: vi.fn(() => false),
|
||||
@@ -89,7 +89,7 @@ describe("matrix doctor", () => {
|
||||
});
|
||||
|
||||
it("surfaces matrix sequence warnings and repair changes", async () => {
|
||||
const runtimeApi = await import("./runtime-api.js");
|
||||
const runtimeApi = await import("./matrix-migration.runtime.js");
|
||||
vi.mocked(runtimeApi.hasActionableMatrixMigration).mockReturnValue(true);
|
||||
vi.mocked(runtimeApi.maybeCreateMatrixMigrationSnapshot).mockResolvedValue({
|
||||
archivePath: "/tmp/matrix-backup.tgz",
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
hasActionableMatrixMigration,
|
||||
hasPendingMatrixMigration,
|
||||
maybeCreateMatrixMigrationSnapshot,
|
||||
} from "./runtime-api.js";
|
||||
} from "./matrix-migration.runtime.js";
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
||||
|
||||
@@ -70,8 +70,6 @@ function countMatrixExecApprovalEligibleAccounts(params: {
|
||||
}) &&
|
||||
matchesApprovalRequestFilters({
|
||||
request: params.request.request,
|
||||
agentFilter: config?.agentFilter,
|
||||
sessionFilter: config?.sessionFilter,
|
||||
agentFilter: filters.agentFilter,
|
||||
sessionFilter: filters.sessionFilter,
|
||||
})
|
||||
|
||||
9
extensions/matrix/src/matrix-migration.runtime.ts
Normal file
9
extensions/matrix/src/matrix-migration.runtime.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export {
|
||||
autoMigrateLegacyMatrixState,
|
||||
autoPrepareLegacyMatrixCrypto,
|
||||
detectLegacyMatrixCrypto,
|
||||
detectLegacyMatrixState,
|
||||
hasActionableMatrixMigration,
|
||||
hasPendingMatrixMigration,
|
||||
maybeCreateMatrixMigrationSnapshot,
|
||||
} from "openclaw/plugin-sdk/matrix-runtime-heavy";
|
||||
@@ -1 +1 @@
|
||||
export { maybeCreateMatrixMigrationSnapshot } from "openclaw/plugin-sdk/matrix-runtime-heavy";
|
||||
export { maybeCreateMatrixMigrationSnapshot } from "../../matrix-migration.runtime.js";
|
||||
|
||||
@@ -27,15 +27,8 @@ export {
|
||||
type SsrFPolicy,
|
||||
} from "openclaw/plugin-sdk/ssrf-runtime";
|
||||
export {
|
||||
autoMigrateLegacyMatrixState,
|
||||
autoPrepareLegacyMatrixCrypto,
|
||||
detectLegacyMatrixCrypto,
|
||||
detectLegacyMatrixState,
|
||||
dispatchReplyFromConfigWithSettledDispatcher,
|
||||
ensureConfiguredAcpBindingReady,
|
||||
hasActionableMatrixMigration,
|
||||
hasPendingMatrixMigration,
|
||||
maybeCreateMatrixMigrationSnapshot,
|
||||
resolveConfiguredAcpBindingRecord,
|
||||
} from "openclaw/plugin-sdk/matrix-runtime-heavy";
|
||||
// resolveMatrixAccountStringValues already comes from plugin-sdk/matrix.
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
hasActionableMatrixMigration,
|
||||
hasPendingMatrixMigration,
|
||||
maybeCreateMatrixMigrationSnapshot,
|
||||
} from "openclaw/plugin-sdk/matrix-runtime-heavy";
|
||||
} from "./matrix-migration.runtime.js";
|
||||
|
||||
type MatrixStartupLogger = {
|
||||
info?: (message: string) => void;
|
||||
|
||||
Reference in New Issue
Block a user