From 18b2053c1a5a076c45cb5f97128dc516fd9002c4 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 14 Sep 2026 12:29:13 +0000 Subject: [PATCH] Synchronize SAVEPOINT replay cancel before mock RPC release Keep the reconstruction SQL barrier closed after cancel() so prepareSQL can only leave via ctx.Done(). Closing releaseSQL immediately raced with cancellation and let reconstruction succeed. Cleanup still unblocks the mock on test failure. Fixes #973 Co-authored-by: apstndb --- internal/mycli/savepoint_replay_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/mycli/savepoint_replay_test.go b/internal/mycli/savepoint_replay_test.go index bd7f5480..ac6883c2 100644 --- a/internal/mycli/savepoint_replay_test.go +++ b/internal/mycli/savepoint_replay_test.go @@ -833,11 +833,10 @@ func TestSavepointReplayCancellationCleansUpWithoutCommit(t *testing.T) { } cancel() - select { - case <-releaseSQL: - default: - close(releaseSQL) - } + // Keep the candidate SQL blocked. prepareSQL already selects on ctx.Done(); + // closing releaseSQL here used to make the successful-response path + // available before cancellation necessarily reached the RPC handler. + // t.Cleanup still unblocks the mock if the test fails or times out. var err error select {