fix(cli): avoid guessed restart versions

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-07-22 19:38:47 +00:00
1 parent 7484df71f4
commit 4eaa0c510a
2 files changed
+5 -6

No files matched your search

@@ -6,7 +6,6 @@ import { serviceHealthChecks } from "../checks/service-health-check.js";
import { resolveRestartExpectedVersion } from "../commands/service.js";
import type { PaperclipConfig } from "../config/schema.js";
import { buildLocalHealthUrl } from "../utils/health-url.js";
import { packageVersion } from "../version.js";
const config = {
server: { host: "127.0.0.1", port: 3100 },
@@ -41,8 +40,9 @@ function managerFixture(active = true) {
}
describe("service health doctor checks", () => {
it("uses the current CLI version unless an expected restart version is explicit", () => {
expect(resolveRestartExpectedVersion(null)).toBe(packageVersion);
it("skips exact version matching unless a restart version is explicit", () => {
expect(resolveRestartExpectedVersion(null)).toBeNull();
expect(resolveRestartExpectedVersion(undefined)).toBeNull();
expect(resolveRestartExpectedVersion("1.2.3")).toBe("1.2.3");
});
+2 -3
View File
@@ -2,7 +2,6 @@ import fs from "node:fs/promises";
import path from "node:path";
import * as p from "@clack/prompts";
import type { Command } from "commander";
import { packageVersion } from "../version.js";
import { readConfig, resolveConfigPath } from "../config/store.js";
import { resolvePaperclipHomeDir, resolvePaperclipInstanceId } from "../config/home.js";
import { detectServiceManager, type ServiceManager, type ServiceStatus } from "../services/service-manager.js";
@@ -51,8 +50,8 @@ async function waitForHealth(instanceId: string, expectedVersion: string | null,
throw new Error(`Paperclip service did not become healthy${expectedVersion ? ` at version ${expectedVersion}` : ""}: ${last.error ?? `reported ${last.serverVersion ?? "no version"}`}`);
}
export function resolveRestartExpectedVersion(expectedVersion: string | null | undefined): string {
return expectedVersion ?? packageVersion;
export function resolveRestartExpectedVersion(expectedVersion: string | null | undefined): string | null {
return expectedVersion ?? null;
}
async function writeHotRestartIntent(status: ServiceStatus, instanceId: string, drainRequired: boolean): Promise<{ requestedAt: string }> {