mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-03 09:37:19 +01:00
fix: retain expired backup cleanup after listing failures
This commit is contained in:
1 parent
7e33906d14
commit
4c4e4a469c
4 files changed
+47
-7
No files matched your search
@@ -352,7 +352,7 @@ export function nativeHarnessBackupExpirationService(
|
||||
|
||||
async function settleLeftovers(backupRoot: string) {
|
||||
const current = path.join(backupRoot, "current");
|
||||
for (const name of await fs.readdir(backupRoot).catch(() => [] as string[])) {
|
||||
for (const name of (await fs.readdir(backupRoot).catch(missingPath)) ?? []) {
|
||||
const target = path.join(backupRoot, name);
|
||||
if (name.startsWith(RETIRING_PREFIX) && UUID_PATTERN.test(name.slice(RETIRING_PREFIX.length))) {
|
||||
if (!(await isRealDirectory(current))) await fs.rename(target, current);
|
||||
|
||||
@@ -5103,7 +5103,10 @@ describe("retained native cleanup activation", () => {
|
||||
}
|
||||
const outcome = await pendingOutcome;
|
||||
if (mode === "legacy_busy_copy") {
|
||||
expect(maintenanceReleased).toHaveBeenCalledExactlyOnceWith({ companyId: run.companyId, runId: run.id });
|
||||
expect(maintenanceReleased).toHaveBeenCalledExactlyOnceWith(
|
||||
{ companyId: run.companyId, runId: run.id },
|
||||
{ companyId: run.companyId, runId: run.id },
|
||||
);
|
||||
unsubscribeMaintenance?.();
|
||||
}
|
||||
if (canonicalSource) {
|
||||
@@ -6425,7 +6428,10 @@ describe("native startup cancellation fence", () => {
|
||||
})).rejects.toThrow("native_cancellation_pending_recovery");
|
||||
expect(cancel).toHaveBeenCalledOnce();
|
||||
expect(submit).not.toHaveBeenCalled();
|
||||
expect(released).toHaveBeenCalledWith({ companyId: execution.binding.companyId, agentId: execution.binding.agentId });
|
||||
expect(released).toHaveBeenCalledWith(
|
||||
{ companyId: execution.binding.companyId, agentId: execution.binding.agentId },
|
||||
{ companyId: execution.binding.companyId, runId: execution.binding.runId, issueId: execution.binding.issueId },
|
||||
);
|
||||
} finally { unsubscribe(); }
|
||||
});
|
||||
});
|
||||
@@ -9872,9 +9878,10 @@ describe("native warm session supervision", () => {
|
||||
);
|
||||
expect(released).not.toHaveBeenCalled();
|
||||
releaseClose();
|
||||
await vi.waitFor(() => expect(released).toHaveBeenCalledExactlyOnceWith({
|
||||
companyId: base.binding.companyId, agentId: base.binding.agentId,
|
||||
}));
|
||||
await vi.waitFor(() => expect(released).toHaveBeenCalledExactlyOnceWith(
|
||||
{ companyId: base.binding.companyId, agentId: base.binding.agentId },
|
||||
{ companyId: base.binding.companyId, runId: base.binding.runId, issueId: base.binding.issueId },
|
||||
));
|
||||
} finally { releaseClose(); unsubscribe(); }
|
||||
});
|
||||
|
||||
@@ -12453,7 +12460,10 @@ describe("runnerd provider runtime wiring", () => {
|
||||
releaseEnvironment();
|
||||
releaseAssigned();
|
||||
const result = await preparation;
|
||||
expect(released).toHaveBeenCalledExactlyOnceWith({ companyId: execution.binding.companyId, agentId: execution.binding.agentId });
|
||||
expect(released).toHaveBeenCalledExactlyOnceWith(
|
||||
{ companyId: execution.binding.companyId, agentId: execution.binding.agentId },
|
||||
{ companyId: execution.binding.companyId, runId: execution.binding.runId, issueId: execution.binding.issueId },
|
||||
);
|
||||
if (failure !== "success") {
|
||||
expect(result).toMatchObject({ error: { message: failure === "assigned" ? "assigned failed" : "environment failed" } });
|
||||
expect(state.createBackend).not.toHaveBeenCalled();
|
||||
|
||||
Reference in new issue
Block a user