fix(doctor): ignore empty managed install stores

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-07-27 15:32:13 +00:00
1 parent ade8761ae3
commit 7fd6e8d829
2 files changed
+21 -2

No files matched your search

@@ -72,4 +72,17 @@ describe("managed install doctor checks", () => {
expect.objectContaining({ name: "Managed install", status: "pass" }),
]);
});
it("ignores an empty installs directory left by a harmless lock lifecycle", () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "paperclip-install-doctor-"));
const paths = resolveInstallStorePaths({
paperclipHome: path.join(root, ".paperclip"),
homeDir: root,
});
fs.mkdirSync(paths.installsRoot, { recursive: true });
expect(managedInstallChecks(paths)).toEqual([
expect.objectContaining({ name: "Managed install", status: "pass" }),
]);
});
});
+8 -2
View File
@@ -17,13 +17,19 @@ function pathContains(directory: string): boolean {
}
function hasManagedArtifacts(paths: InstallStorePaths): boolean {
return [
paths.installsRoot,
const persistentArtifacts = [
paths.manifestPath,
paths.markerPath,
paths.currentPath,
paths.shimPath,
].some((entry) => fs.existsSync(entry));
if (persistentArtifacts) return true;
try {
return fs.readdirSync(paths.installsRoot).length > 0;
} catch (error) {
if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
return true;
}
}
export function nodeRuntimeCheck(): CheckResult {