fix(plugins): make Matrix recovery paths tolerate stale plugin config (#52899)

This commit is contained in:
Catalin Lupuleti
2026-03-23 23:17:21 +02:00
committed by Peter Steinberger
parent 5c9e4cd30a
commit 3ae100a8d7
8 changed files with 149 additions and 24 deletions

View File

@@ -144,6 +144,12 @@ describe("ensureConfigReady", () => {
expect(gatewayRuntime.exit).not.toHaveBeenCalled();
});
it("does not exit for invalid config on plugins install", async () => {
setInvalidSnapshot();
const runtime = await runEnsureConfigReady(["plugins", "install"]);
expect(runtime.exit).not.toHaveBeenCalled();
});
it("runs doctor migration flow only once per module instance", async () => {
const runtimeA = makeRuntime();
const runtimeB = makeRuntime();

View File

@@ -15,6 +15,7 @@ const ALLOWED_INVALID_GATEWAY_SUBCOMMANDS = new Set([
"stop",
"restart",
]);
const ALLOWED_INVALID_PLUGINS_SUBCOMMANDS = new Set(["install"]);
let didRunDoctorConfigFlow = false;
let configSnapshotPromise: Promise<Awaited<ReturnType<typeof readConfigFileSnapshot>>> | null =
null;
@@ -76,7 +77,10 @@ export async function ensureConfigReady(params: {
? ALLOWED_INVALID_COMMANDS.has(commandName) ||
(commandName === "gateway" &&
subcommandName &&
ALLOWED_INVALID_GATEWAY_SUBCOMMANDS.has(subcommandName))
ALLOWED_INVALID_GATEWAY_SUBCOMMANDS.has(subcommandName)) ||
(commandName === "plugins" &&
subcommandName &&
ALLOWED_INVALID_PLUGINS_SUBCOMMANDS.has(subcommandName))
: false;
const { formatConfigIssueLines } = await import("../../config/issue-format.js");
const issues =