Skip to content

Commit b3b682b

Browse files
cardmagicclaude
andcommitted
test: wait for the oversized record rather than a deadline
The `quality` job failed on a test that passed on the same commit in the sibling run: expected MessageFailed / PayloadTooLarge received SyncTimeout, status "ready", timeoutMilliseconds 402 The test drove an oversized record through a synchronous call with a 500 ms budget. Moving about 1 MB through a Durable Object under CI load takes longer than that, so the caller gave up before the turn reached `encodedRecord` and the assertion read a timeout instead of the rollback it was written for. The budget was never part of what the test asserts. It now sends the message, polls until the message is dead, and reads the stored error through `outcome()`, so no deadline can decide the result. That also exercises `messageOutcome` on the Durable Objects runtime, which this branch added. The test dates from the original Durable Objects backend and the flake predates this branch. Validation: five runs of the Cloudflare suite, four of them concurrent, all 20 tests passing. Raising the record limit to 99_999_000 makes the test fail, so it still reports the defect it names. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ccfdb6c commit b3b682b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎test/cloudflare/recovery.test.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@ describe("Cloudflare recovery and fencing", () => {
6868

6969
it("rolls back a result that exceeds the aggregate SQLite record limit", async () => {
7070
const reference = runtime().ref(Counter, "oversized-record")
71-
await expect(
72-
reference
73-
.with({ authorizationContext, timeoutMilliseconds: 500 })
74-
.echo({ value: "x".repeat(1_010_000) }),
75-
).rejects.toMatchObject({ name: "MessageFailed", details: { name: "PayloadTooLarge" } })
71+
const message = await reference.send
72+
.with({ authorizationContext })
73+
.echo({ value: "x".repeat(1_010_000) })
74+
75+
await expect
76+
.poll(() => message.status({ authorizationContext }), { timeout: 15_000 })
77+
.toBe("dead")
78+
79+
const outcome = await message.outcome({ authorizationContext })
80+
expect(outcome.error?.name).toBe("PayloadTooLarge")
7681
expect((await reference.snapshot({ authorizationContext })).count).toBe(0)
7782
})
7883

0 commit comments

Comments
 (0)