Skip to content

Commit 1485a5e

Browse files
Brooooooklynclaude
andcommitted
test(platform): read Sandbox drain audit events in request order
The drain audit test took the last row of an unordered operator_events read. Each audit row is inserted and then updated with its outcome, so on a reused PostgreSQL table its physical position can differ from request order. Read the rows by creation time instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent c742703 commit 1485a5e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎platform/packages/api/test/integration/operator-operations.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PLATFORM_APPLICATION_KEY } from '@void/platform';
2-
import { eq, sql } from 'drizzle-orm';
2+
import { asc, eq, sql } from 'drizzle-orm';
33
import {
44
afterAll,
55
afterEach,
@@ -978,7 +978,12 @@ describe('operator installation-aware system and worker operations', () => {
978978
expect(JSON.parse((await env.ROUTING.get(SANDBOX_DRAIN_STATE_KEY))!)).toMatchObject({
979979
state: 'complete',
980980
});
981-
const events = await env.db.select().from(operatorEvents);
981+
// Each audit row is inserted, then updated with its outcome, so its physical
982+
// position does not follow request order.
983+
const events = await env.db
984+
.select()
985+
.from(operatorEvents)
986+
.orderBy(asc(operatorEvents.created_at), asc(operatorEvents.id));
982987
expect(events).toHaveLength(1 + resumedPages.length);
983988
expect(events.at(-1)).toEqual(
984989
expect.objectContaining({

0 commit comments

Comments
 (0)