@@ -2165,6 +2165,43 @@ describe("update-cli", () => {
|
2165 | 2165 | expect(logs.join("\n")).not.toContain("already-current"); |
2166 | 2166 | }); |
2167 | 2167 | |
| 2168 | +it("runs the package update when latest target lookup is unresolved", async () => { |
| 2169 | +const tempDir = createCaseDir("openclaw-update"); |
| 2170 | +setTty(false); |
| 2171 | +mockPackageInstallStatus(tempDir); |
| 2172 | +readPackageVersion.mockResolvedValue("2026.4.22"); |
| 2173 | +vi.mocked(resolveNpmChannelTag).mockResolvedValue({ |
| 2174 | +tag: "latest", |
| 2175 | +version: null, |
| 2176 | +}); |
| 2177 | + |
| 2178 | +await updateCommand({}); |
| 2179 | + |
| 2180 | +const errors = vi.mocked(defaultRuntime.error).mock.calls.map((call) => String(call[0])); |
| 2181 | +expect(errors.join("\n")).not.toContain("Downgrade confirmation required."); |
| 2182 | +expect(defaultRuntime.exit).not.toHaveBeenCalled(); |
| 2183 | +expectPackageInstallSpec("openclaw@latest"); |
| 2184 | +}); |
| 2185 | + |
| 2186 | +it("blocks the package update when a non-latest dist-tag lookup is unresolved", async () => { |
| 2187 | +const tempDir = createCaseDir("openclaw-update"); |
| 2188 | +setTty(false); |
| 2189 | +mockPackageInstallStatus(tempDir); |
| 2190 | +readPackageVersion.mockResolvedValue("2026.4.22"); |
| 2191 | +vi.mocked(fetchNpmTagVersion).mockResolvedValue({ |
| 2192 | +tag: "next", |
| 2193 | +version: null, |
| 2194 | +error: "HTTP 404", |
| 2195 | +}); |
| 2196 | + |
| 2197 | +await updateCommand({ tag: "next" }); |
| 2198 | + |
| 2199 | +const errors = vi.mocked(defaultRuntime.error).mock.calls.map((call) => String(call[0])); |
| 2200 | +expect(errors.join("\n")).toContain("Downgrade confirmation required."); |
| 2201 | +expect(defaultRuntime.exit).toHaveBeenCalledWith(1); |
| 2202 | +expect(packageInstallCommandCall()).toBeUndefined(); |
| 2203 | +}); |
| 2204 | + |
2168 | 2205 | it("warns but still runs package updates when disk space looks low", async () => { |
2169 | 2206 | const tempDir = createCaseDir("openclaw-update"); |
2170 | 2207 | mockPackageInstallStatus(tempDir); |
|