mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 23:43:16 +01:00
test: await committed recovery and adapter admission outcomes
This commit is contained in:
1 parent
32044a63e1
commit
f201195a92
2 files changed
+17
-3
No files matched your search
@@ -16341,9 +16341,15 @@ describeEmbeddedPostgres("chat channel control-plane integration", () => {
|
||||
await tx.update(toolConnections).set({ credentialSecretRefs: connection.credentialSecretRefs.map(ref => ({ ...ref,
|
||||
versionSelector: ref.versionSelector === "1" ? "latest" : "1" })) }).where(eq(toolConnections.id, connection.id));
|
||||
});
|
||||
await expect.poll(async () => ((await f.checkpoint()).value as Record<string, unknown>).credentialFingerprint,
|
||||
{ timeout: 5000 }).not.toBe(oldWindow.credentialFingerprint);
|
||||
expect((await f.checkpoint()).value).toMatchObject({ generation: oldWindow.generation, outcome: "epoch_initialized" });
|
||||
// Credential synchronization and epoch initialization commit separately.
|
||||
// Require the final epoch receipt, not just the intermediate fingerprint.
|
||||
await expect.poll(async () => {
|
||||
const value = (await f.checkpoint()).value as Record<string, unknown>;
|
||||
return { ...value, fingerprintChanged: typeof value.credentialFingerprint === "string"
|
||||
&& value.credentialFingerprint !== oldWindow.credentialFingerprint };
|
||||
}, { timeout: 5000 }).toMatchObject({
|
||||
fingerprintChanged: true, generation: oldWindow.generation, outcome: "epoch_initialized",
|
||||
});
|
||||
expect(f.requests).toEqual([]);
|
||||
} finally { await coordinator.stop(); }
|
||||
});
|
||||
|
||||
@@ -262,6 +262,14 @@ describeEmbeddedPostgres("heartbeat stale queued-run invalidation", () => {
|
||||
await heartbeat.resumeQueuedRuns();
|
||||
const [delivered] = await db.select().from(agentWakeupRequests).where(eq(agentWakeupRequests.id, wake.id));
|
||||
expect(delivered.runId).toBeTruthy();
|
||||
// The receipt can commit before execution enters liveRunExecutions.
|
||||
// Observe actual adapter admission before awaiting its drain.
|
||||
await vi.waitFor(async () => {
|
||||
const current = await heartbeat.getRun(delivered.runId!);
|
||||
expect(countExecuteCallsForRun(delivered.runId!), JSON.stringify({
|
||||
status: current?.status, errorCode: current?.errorCode,
|
||||
})).toBe(1);
|
||||
}, { timeout: 5_000 });
|
||||
await heartbeat.waitForRunExecutionDrain(delivered.runId!);
|
||||
expect(countExecuteCallsForRun(delivered.runId!)).toBe(1);
|
||||
expect((await heartbeat.getRun(delivered.runId!))?.contextSnapshot).toMatchObject({ wakeCommentIds: [comment.id] });
|
||||
|
||||
Reference in new issue
Block a user