test: settle deferred GitHub replay and retain saved lease fixture

This commit is contained in:
Dotta committed 2026-10-05 18:23:43 -05:00
1 parent b012b3aebe
commit 5a23ef6595
3 files changed
+46 -2

No files matched your search

@@ -86,6 +86,28 @@ now parses the fenced JSON and independently checks all 33 bytes. Full build
and recursive typecheck pass at the prior source; new artifacts and all live
qualification remain required after this binding correction.
The source-bound `b012b3aeb` artifacts now pass normal public profile-15
admission on ARM Mac (8.618 seconds) and native Linux (8.498 seconds). The new
immutable image is
`ghcr.io/paperclipai/paperclip-daytona-runner@sha256:3279d92405a59b4654cb6af5de27bfacffee73a2c57311bf5f2d5ff9272b9b67`.
Anonymous pull, source identity, normal companion import, and Linux installed
server health/browser startup pass with zero provider calls. The temporary
image-admission sandbox is deleted. The Linux qualification controller remains
owned and bounded. Mac installed server startup fails before a model call;
its stderr-free database failure is still unexplained, and a fresh direct
initdb probe succeeds. Intel admission and fresh live qualification remain
outstanding.
Current-head CI exposes two fixture races. The lease test constructs a second
timestamped fixture instead of comparing with the saved lease; all 37 tests
pass after retaining that fixture. A GitHub callback fixture reproduces its
failure when the root finishes before callback replay. Waiting for durable
admission and draining the subsequently scheduled work makes both orderings
pass without changing production worker code, assertions, or timeouts. These
test-only changes do not relabel the frozen runtime artifacts. Their new head
requires fresh CI. The prior full local test command remains failed; complete
local tests and release review are still required.
## Frozen target
- Pi: `@earendil-works/pi-coding-agent@1.0.0`.
@@ -61865,7 +61865,7 @@ describeEmbeddedPostgres("chat channel control-plane integration", () => {
},
);
it("orders reversed GitHub edit and delete callbacks behind their durable root", async () => {
it.each([false, true])("orders reversed GitHub edit and delete callbacks behind their durable root (root processed before replay: %s)", async (rootProcessedFirst) => {
const fixture = await seedCompany();
const deferred: Array<() => void | Promise<void>> = [];
const { callbacks, endpoint, service, wakeup, webhookSecret } =
@@ -61968,8 +61968,28 @@ describeEmbeddedPostgres("chat channel control-plane integration", () => {
// One root-conversation drain plus one durable-ingress callback per HTTP
// request is queued. The duplicate delivery callback becomes a no-op.
expect(deferred).toHaveLength(4);
if (rootProcessedFirst) {
await deferred.shift()?.();
await vi.waitFor(async () => {
const [root] = await db
.select({ state: chatDeliveries.state })
.from(chatDeliveries)
.where(eq(chatDeliveries.endpointId, endpoint.id));
expect(root.state).toBe("processed");
});
}
await drainDeferred();
// The scheduler callbacks start background promises. Wait for durable
// replay admission before draining the conversation work it schedules.
await vi.waitFor(async () => {
const deliveries = await db
.select({ id: chatDeliveries.id })
.from(chatDeliveries)
.where(eq(chatDeliveries.endpointId, endpoint.id));
expect(deliveries).toHaveLength(3);
});
await vi.waitFor(async () => {
await drainDeferred();
const deliveries = await db
.select({
eventKind: chatDeliveries.eventKind,
@@ -838,11 +838,13 @@ describe("live remote runner lease reattachment", () => {
mockGetLease.mockResolvedValue(originalLease());
});
it("reattaches the original active ephemeral lease without acquiring or resuming a sandbox", async () => {
const savedLease = originalLease();
mockGetLease.mockResolvedValue(savedLease);
const runtime = makeMockRuntime();
const result = await environmentRunOrchestrator({} as never, { environmentRuntime: runtime }).acquireForRun(input);
expect(mockGetLease).toHaveBeenCalledWith("lease-1");
expect(runtime.acquireRunLease).not.toHaveBeenCalled();
expect(result.lease).toEqual(originalLease());
expect(result.lease).toEqual(savedLease);
expect(result.leaseContext.executionWorkspaceId).toBe("ew-1");
expect(result.environment.config.reuseLease).toBe(false);
});