mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-26 10:26:26 +01:00
Fix sandbox command-session and lazy ACP model recovery
This commit is contained in:
1 parent
17ddb89618
commit
cb381c6a5f
8 files changed
+255
-19
No files matched your search
@@ -1,5 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isStagingOrigin, assertDeployedAdapterExclusions, deployedAgentEngine } from "./deployed-stack.js";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { isStagingOrigin, assertDeployedAdapterExclusions, deployedAgentEngine, findDeployedWorkFile } from "./deployed-stack.js";
|
||||
|
||||
describe("deployed work-file pagination", () => {
|
||||
it.each([false, true])("finds a later-page entry while preserving trash=%s", async (trash) => {
|
||||
const file = { path: "nested/empty.sh", byteSize: 0, executable: true };
|
||||
const json = vi.fn().mockResolvedValueOnce({ files: [{ path: "unrelated" }], nextCursor: "next-page" })
|
||||
.mockResolvedValueOnce({ files: [file], nextCursor: null });
|
||||
expect(await findDeployedWorkFile({ json }, "/api/folder", file.path, trash)).toEqual(file);
|
||||
expect(json.mock.calls.map(([url]) => url)).toEqual([
|
||||
`/api/folder?limit=200&trash=${trash}`,
|
||||
`/api/folder?limit=200&trash=${trash}&cursor=next-page`,
|
||||
]);
|
||||
});
|
||||
|
||||
it("returns missing only after the final page", async () => {
|
||||
const json = vi.fn().mockResolvedValueOnce({ files: [], nextCursor: "next-page" })
|
||||
.mockResolvedValueOnce({ files: [], nextCursor: null });
|
||||
expect(await findDeployedWorkFile({ json }, "/api/folder", "missing")).toBeUndefined();
|
||||
expect(json).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("rejects a repeated cursor instead of looping", async () => {
|
||||
const json = vi.fn().mockResolvedValue({ files: [], nextCursor: "same-page" });
|
||||
await expect(findDeployedWorkFile({ json }, "/api/folder", "missing")).rejects.toThrow("repeated its cursor");
|
||||
expect(json).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("deployed stack target", () => {
|
||||
it("requires an explicit HTTPS staging tenant and rejects credential-bearing URLs", () => {
|
||||
|
||||
Reference in new issue
Block a user