Skip to content

Commit 8bf55bf

Browse files
authored
fix(update): remove false dependency staleness (#124627)
1 parent a3099a5 commit 8bf55bf

3 files changed

Lines changed: 5 additions & 47 deletions

File tree

‎src/commands/status.update.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ export function formatUpdateOneLiner(update: UpdateCheckResult): string {
191191
if (update.deps.status === "missing") {
192192
parts.push("deps missing");
193193
}
194-
if (update.deps.status === "stale") {
195-
parts.push("deps stale");
196-
}
197194
}
198195
return `Update: ${parts.join(" · ")}`;
199196
}

‎src/infra/update-check.test.ts‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ describe("checkUpdateStatus", () => {
10011001
},
10021002
);
10031003

1004-
it("reports missing and stale dependency markers for package installs", async () => {
1004+
it("reports a missing dependency marker and accepts an older valid marker", async () => {
10051005
await withTestDir({ prefix: "openclaw-update-check-deps-" }, async (root) => {
10061006
await fs.writeFile(
10071007
path.join(root, "package.json"),
@@ -1031,27 +1031,16 @@ describe("checkUpdateStatus", () => {
10311031
await fs.utimes(markerPath, staleDate, staleDate);
10321032
await fs.utimes(lockfilePath, freshDate, freshDate);
10331033

1034-
const stale = await checkUpdateStatus({
1034+
const installed = await checkUpdateStatus({
10351035
root,
10361036
includeRegistry: false,
10371037
fetchGit: false,
10381038
timeoutMs: 1000,
10391039
});
1040-
expect(stale.deps).toMatchObject({
1040+
expect(installed.deps).toMatchObject({
10411041
manager: "pnpm",
1042-
status: "stale",
1043-
reason: "lockfile newer than install marker",
1042+
status: "ok",
10441043
});
1045-
1046-
const newerMarker = new Date(Date.now() + 2_000);
1047-
await fs.utimes(markerPath, newerMarker, newerMarker);
1048-
const ok = await checkUpdateStatus({
1049-
root,
1050-
includeRegistry: false,
1051-
fetchGit: false,
1052-
timeoutMs: 1000,
1053-
});
1054-
expect(ok.deps?.status).toBe("ok");
10551044
});
10561045
});
10571046

‎src/infra/update-check.ts‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type GitUpdateStatus = {
3636

3737
type DepsStatus = {
3838
manager: PackageManager;
39-
status: "ok" | "missing" | "stale" | "unknown";
39+
status: "ok" | "missing" | "unknown";
4040
lockfilePath: string | null;
4141
markerPath: string | null;
4242
reason?: string;
@@ -370,15 +370,6 @@ async function checkGitUpdateStatus(params: {
370370
};
371371
}
372372

373-
async function statMtimeMs(p: string): Promise<number | null> {
374-
try {
375-
const st = await fs.stat(p);
376-
return st.mtimeMs;
377-
} catch {
378-
return null;
379-
}
380-
}
381-
382373
async function resolveDepsMarker(params: { root: string; manager: PackageManager }): Promise<{
383374
lockfilePath: string | null;
384375
markerPath: string | null;
@@ -449,25 +440,6 @@ async function checkDepsStatus(params: {
449440
};
450441
}
451442

452-
const lockMtime = await statMtimeMs(lockfilePath);
453-
const markerMtime = await statMtimeMs(markerPath);
454-
if (!lockMtime || !markerMtime) {
455-
return {
456-
manager: params.manager,
457-
status: "unknown",
458-
lockfilePath,
459-
markerPath,
460-
};
461-
}
462-
if (lockMtime > markerMtime + 1000) {
463-
return {
464-
manager: params.manager,
465-
status: "stale",
466-
lockfilePath,
467-
markerPath,
468-
reason: "lockfile newer than install marker",
469-
};
470-
}
471443
return {
472444
manager: params.manager,
473445
status: "ok",

0 commit comments

Comments
 (0)