Skip to content

Commit a8b2e58

Browse files
committed
test(onboard): strengthen recreation drift coverage
1 parent 1711241 commit a8b2e58

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/lib/onboard/machine/handlers/sandbox-checkpoint-crash-recovery.test.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ vi.mock("../../messaging-channel-setup", () => ({
2525

2626
vi.mocked(detectMessagingChannelsFromEnv).mockReturnValue([]);
2727

28-
function defaultCreateFingerprint(sandboxName = "my-assistant"): string {
28+
function defaultCreateFingerprint(
29+
builtFingerprint = "my-assistant",
30+
policyFingerprint = "default",
31+
): string {
2932
return [
30-
sandboxName,
31-
"default",
33+
builtFingerprint,
34+
policyFingerprint,
3235
"provider",
3336
"model",
3437
"openai-completions",
@@ -924,11 +927,14 @@ describe("sandbox crash-recovery replay (#5961, #6228)", () => {
924927
expect(calls.error.mock.calls.flat().join("\n")).toContain("--recreate-sandbox");
925928
});
926929

927-
it("recreates after build or policy drift when explicitly requested (#9297)", async () => {
930+
it.each([
931+
["build", defaultCreateFingerprint("v0.0.108")],
932+
["policy", defaultCreateFingerprint("my-assistant", "previous-policy")],
933+
] as const)("recreates after %s drift when explicitly requested (#9297)", async (_drift, fingerprint) => {
928934
const session = sessionWithCheckpoint(
929935
crashedCheckpoint({
930936
effectGroups: {
931-
sandbox_create: { completedAt: "2026-01-01T00:00:00.000Z", fingerprint: "stale-build" },
937+
sandbox_create: { completedAt: "2026-01-01T00:00:00.000Z", fingerprint },
932938
},
933939
}),
934940
);
@@ -943,6 +949,9 @@ describe("sandbox crash-recovery replay (#5961, #6228)", () => {
943949
});
944950

945951
expect(calls.createSandbox).toHaveBeenCalledOnce();
952+
expect(calls.createSandbox.mock.calls[0]?.at(-1)).toEqual(
953+
expect.objectContaining({ recreate: true }),
954+
);
946955
expect(calls.error).not.toHaveBeenCalled();
947956
});
948957

0 commit comments

Comments
 (0)