diff --git a/dotnet/test/E2E/RpcAdditionalEdgeCasesE2ETests.cs b/dotnet/test/E2E/RpcAdditionalEdgeCasesE2ETests.cs index d71fa20d8..463fdc96a 100644 --- a/dotnet/test/E2E/RpcAdditionalEdgeCasesE2ETests.cs +++ b/dotnet/test/E2E/RpcAdditionalEdgeCasesE2ETests.cs @@ -188,7 +188,7 @@ public async Task Permissions_SetApproveAll_Toggle_Round_Trips() } [Fact] - public async Task Workspaces_CreateFile_Then_ListFiles_Returns_Sorted_Or_Stable_Order() + public async Task Workspaces_CreateFile_Then_ListFiles_Returns_All_Files() { var session = await CreateSessionAsync(); var prefix = $"order-{Guid.NewGuid():N}-"; @@ -204,15 +204,16 @@ public async Task Workspaces_CreateFile_Then_ListFiles_Returns_Sorted_Or_Stable_ .Where(path => path.StartsWith(prefix, StringComparison.Ordinal)) .ToList(); - // The files this test created should be returned in sorted order. - Assert.Equal(paths, matchingFiles); + // The files this test created should all be returned; the runtime does not guarantee + // that workspace file enumeration is sorted. + Assert.Equal(paths, matchingFiles.OrderBy(path => path, StringComparer.Ordinal)); - // Calling list again immediately must preserve the same order. + // A repeated list should still include the files regardless of returned order. var listed2 = await session.Rpc.Workspaces.ListFilesAsync(); var matchingFiles2 = listed2.Files .Where(path => path.StartsWith(prefix, StringComparison.Ordinal)) .ToList(); - Assert.Equal(matchingFiles, matchingFiles2); + Assert.Equal(paths, matchingFiles2.OrderBy(path => path, StringComparer.Ordinal)); } [Fact] diff --git a/rust/tests/e2e/rpc_additional_edge_cases.rs b/rust/tests/e2e/rpc_additional_edge_cases.rs index bf35a2a87..a85da53f0 100644 --- a/rust/tests/e2e/rpc_additional_edge_cases.rs +++ b/rust/tests/e2e/rpc_additional_edge_cases.rs @@ -428,10 +428,10 @@ async fn permissions_set_approve_all_toggle_round_trips() { } #[tokio::test] -async fn workspaces_createfile_then_listfiles_returns_sorted_or_stable_order() { +async fn workspaces_createfile_then_listfiles_returns_all_files() { with_e2e_context( "rpc_additional_edge_cases", - "workspaces_createfile_then_listfiles_returns_sorted_or_stable_order", + "workspaces_createfile_then_listfiles_returns_all_files", |ctx| { Box::pin(async move { ctx.set_default_copilot_user(); @@ -465,9 +465,10 @@ async fn workspaces_createfile_then_listfiles_returns_sorted_or_stable_order() { .list_files() .await .expect("list files again"); - assert_eq!(first.files, second.files); - for expected in ["a-rust.txt", "b-rust.txt", "c-rust.txt"] { - assert!(first.files.iter().any(|file| file == expected)); + for files in [&first.files, &second.files] { + for expected in ["a-rust.txt", "b-rust.txt", "c-rust.txt"] { + assert!(files.iter().any(|file| file == expected)); + } } session.disconnect().await.expect("disconnect session");