fix: harden update channel switching

This commit is contained in:
Peter Steinberger
2026-03-22 15:01:12 -07:00
parent 601f560682
commit e06b8d3e62
8 changed files with 305 additions and 13 deletions

View File

@@ -7,6 +7,7 @@ import { setProgramContext } from "./program-context.js";
export function buildProgram() {
const program = new Command();
program.enablePositionalOptions();
const ctx = createProgramContext();
const argv = process.argv;

View File

@@ -104,6 +104,11 @@ describe("ensureConfigReady", () => {
commandPath: ["status"],
expectedDoctorCalls: 0,
},
{
name: "skips doctor flow for update status",
commandPath: ["update", "status"],
expectedDoctorCalls: 0,
},
{
name: "runs doctor flow for commands that may mutate state",
commandPath: ["message"],
@@ -145,7 +150,6 @@ describe("ensureConfigReady", () => {
await ensureConfigReady({ runtime: runtimeA as never, commandPath: ["message"] });
await ensureConfigReady({ runtime: runtimeB as never, commandPath: ["message"] });
expect(loadAndMaybeMigrateDoctorConfigMock).toHaveBeenCalledTimes(1);
});