
























@@ -1,5 +1,8 @@
11import { describe, expect, it } from "vitest";
2-import { resolveDoctorHealthContributions } from "./doctor-health-contributions.js";
2+import {
3+resolveDoctorHealthContributions,
4+shouldSkipLegacyUpdateDoctorMetadataWrite,
5+} from "./doctor-health-contributions.js";
3647describe("doctor health contributions", () => {
58it("repairs bundled runtime deps before channel-owned doctor paths can import runtimes", () => {
@@ -20,11 +23,47 @@ describe("doctor health contributions", () => {
2023expect(ids.indexOf("doctor:plugin-registry")).toBeGreaterThan(-1);
2124expect(ids.indexOf("doctor:plugin-registry")).toBeLessThan(ids.indexOf("doctor:write-config"));
2225});
23-2426it("checks command owner configuration before final config writes", () => {
2527const ids = resolveDoctorHealthContributions().map((entry) => entry.id);
26282729expect(ids.indexOf("doctor:command-owner")).toBeGreaterThan(-1);
2830expect(ids.indexOf("doctor:command-owner")).toBeLessThan(ids.indexOf("doctor:write-config"));
2931});
32+33+it("skips metadata-only doctor writes under legacy update parents", () => {
34+expect(
35+shouldSkipLegacyUpdateDoctorMetadataWrite({
36+env: { OPENCLAW_UPDATE_IN_PROGRESS: "1" },
37+before: { gateway: { mode: "local" }, meta: { lastTouchedVersion: "2026.4.26" } },
38+after: {
39+gateway: { mode: "local" },
40+meta: { lastTouchedVersion: "2026.4.27" },
41+wizard: { lastRunCommand: "doctor" },
42+},
43+}),
44+).toBe(true);
45+});
46+47+it("keeps real doctor repairs writable during update", () => {
48+expect(
49+shouldSkipLegacyUpdateDoctorMetadataWrite({
50+env: { OPENCLAW_UPDATE_IN_PROGRESS: "1" },
51+before: { gateway: { mode: "local" } },
52+after: { gateway: { mode: "remote" } },
53+}),
54+).toBe(false);
55+});
56+57+it("keeps current update parents writable", () => {
58+expect(
59+shouldSkipLegacyUpdateDoctorMetadataWrite({
60+env: {
61+OPENCLAW_UPDATE_IN_PROGRESS: "1",
62+OPENCLAW_UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE: "1",
63+},
64+before: { meta: { lastTouchedVersion: "2026.4.26" } },
65+after: { meta: { lastTouchedVersion: "2026.4.27" } },
66+}),
67+).toBe(false);
68+});
3069});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。