fix(update): break the update admission import cycle through the type leaf

check:madge-import-cycles failed on main with update-command-artifact -> update-command-candidate-admission -> update-command-initialization. The only back edge was a type-only import of inspectStagedUpdateCandidateAdmission for its return shape. Name that shape once as StagedUpdateCandidateAdmission in update-command-initialization-types.ts and use it on both sides. Type-only: emitted JavaScript and update behavior are unchanged.
This commit is contained in:
Peter Steinberger 2026-09-29 17:33:07 -07:00
parent ca8f24d05f
commit 2a0a65c4ae
3 changed files with 13 additions and 4 deletions

View file

@ -25,6 +25,7 @@ import { withPrivateStagedPackageInstall } from "./update-command-artifact.js";
import { readUpdateChannelConfig } from "./update-command-config.js";
import { inspectUpdateManagedServices } from "./update-command-database-context.js";
import { handoffUpdateFromGateway } from "./update-command-handoff.js";
import type { StagedUpdateCandidateAdmission } from "./update-command-initialization-types.js";
import type { StagedPackageInstallUpdate } from "./update-command-package.js";
import type { prepareUpdateCommand } from "./update-command-run.js";
import { withOwnedManagedUpdateEnv } from "./update-command-service-env.js";
@ -76,7 +77,7 @@ export async function inspectStagedUpdateCandidateAdmission(
env?: NodeJS.ProcessEnv;
assertCurrent?: () => void;
},
): Promise<{ result: UpdateCandidateAdmissionResult; configSnapshot: ConfigFileSnapshot }> {
): Promise<StagedUpdateCandidateAdmission> {
return await withOwnedManagedUpdateEnv(params.env, async () => {
const { target, opts, prepared } = params;
const installTarget = target.packageInstallTarget;

View file

@ -1,5 +1,6 @@
import type { LegacyConfigUpdatePlan } from "../../commands/doctor/legacy-config-repair.js";
import type { ConfigFileSnapshot } from "../../config/types.openclaw.js";
import type { UpdateCandidateAdmissionResult } from "../../infra/update-candidate-admission.js";
import type { UpdateRecoveryBaselineRef } from "../../infra/update-recovery-baseline-capture.js";
export type UpdateInitializationAdmission = {
@ -15,3 +16,8 @@ export type UpdateInitializationAdmission = {
updateInstallKind?: "git" | "package" | "unknown";
};
};
export type StagedUpdateCandidateAdmission = {
result: UpdateCandidateAdmissionResult;
configSnapshot: ConfigFileSnapshot;
};

View file

@ -15,9 +15,11 @@ import {
UpdatePreMutationError,
type UpdateCommandOptions,
} from "./shared.js";
import type { inspectStagedUpdateCandidateAdmission } from "./update-command-candidate-admission.js";
import type { UpdateCommandExecutor } from "./update-command-executor.js";
import type { UpdateInitializationAdmission } from "./update-command-initialization-types.js";
import type {
StagedUpdateCandidateAdmission,
UpdateInitializationAdmission,
} from "./update-command-initialization-types.js";
import type { StagedPackageInstallUpdate } from "./update-command-package.js";
import { runPackageUpdateDoctor } from "./update-command-package.js";
import { UnreportedUpdateAdmissionOutcome } from "./update-command-result.js";
@ -35,7 +37,7 @@ export type InitializedUpdate = UpdateInitializationAdmission &
executor: UpdateCommandExecutor;
registerRun: (run: NonNullable<UpdateCommandOptions["run"]>) => Promise<void>;
stagedPackage?: StagedPackageInstallUpdate;
candidateAdmission?: Awaited<ReturnType<typeof inspectStagedUpdateCandidateAdmission>>;
candidateAdmission?: StagedUpdateCandidateAdmission;
downgradeConfirmed?: boolean;
callerLegacyConfigPlan?: LegacyConfigUpdatePlan;
};