Skip to content

Commit 0f16c5e

Browse files
t3dotggclaude
andcommitted
Deflake CursorAdapter interrupt test cross-snapshot assertion
The test asserted the session/cancel request against the log snapshot returned by the *second* waitForJsonLogMatch, but only the first wait guaranteed that line — the two log appends are independent, so under CI load the second snapshot can miss (or tear) the cancel line and the assertion fails spuriously. Each assertion now checks the snapshot its own wait resolved on. This flake predates the branch (zero Cursor files are touched here) but kept failing this PR's Test job. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 3adf756 commit 0f16c5e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎apps/server/src/provider/Layers/CursorAdapter.test.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,9 +1030,15 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
10301030
entry.result.outcome !== null &&
10311031
"outcome" in entry.result.outcome &&
10321032
entry.result.outcome.outcome === "cancelled";
1033-
yield* waitForJsonLogMatch(requestLogPath, (entry) => entry.method === "session/cancel");
1033+
// Assert each condition against the snapshot its own wait resolved on:
1034+
// the two log appends are independent, so a snapshot that satisfies one
1035+
// predicate can miss (or tear) the other line under load.
1036+
const cancelRequests = yield* waitForJsonLogMatch(
1037+
requestLogPath,
1038+
(entry) => entry.method === "session/cancel",
1039+
);
1040+
assert.isTrue(cancelRequests.some((entry) => entry.method === "session/cancel"));
10341041
const requests = yield* waitForJsonLogMatch(requestLogPath, isCancelledApprovalResponse);
1035-
assert.isTrue(requests.some((entry) => entry.method === "session/cancel"));
10361042
assert.isTrue(requests.some(isCancelledApprovalResponse));
10371043

10381044
yield* adapter.stopSession(threadId);

0 commit comments

Comments
 (0)