Fix C# listFiles E2E ordering assumption#1261
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a flaky .NET E2E test that incorrectly assumed workspaces.listFiles returns files in a stable/sorted order. The test now validates the supported contract: all created files are present, without asserting enumeration order.
Changes:
- Renamed the E2E test to reflect the intended assertion (all files returned, not order).
- Updated assertions to compare results after ordinal sorting, avoiding filesystem/RPC enumeration-order dependence.
- Updated comments to document that ordering is not guaranteed and to clarify the repeated-call expectation.
Show a summary per file
| File | Description |
|---|---|
| dotnet/test/E2E/RpcAdditionalEdgeCasesE2ETests.cs | Makes the ListFiles E2E test order-independent by sorting filtered results before asserting equality. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <[email protected]>
Cross-SDK Consistency Review ✅This PR fixes both the .NET and Rust E2E tests consistently — the same ordering assumption was present in both, and both are corrected in parallel with equivalent logic. The fix pattern is symmetric:
The other SDKs do not have this specific "sorted or stable order" assertion — their No cross-SDK consistency issues found.
|
The C# and Rust E2E tests assumed
workspaces.listFilesreturns files in sorted or stable order, but the runtime does not guarantee workspace file enumeration order. That made the tests flaky when created files came back in a different filesystem/RPC order.This updates both tests to assert the supported behavior instead: each
listFilescall includes all files created by the test without asserting the returned order. The assertions compare the filtered results after ordinal sorting in C# and use presence checks for each Rust call.Validation:
dotnet test dotnet\test\GitHub.Copilot.SDK.Test.csproj --filter "FullyQualifiedName~Workspaces_CreateFile_Then_ListFiles_Returns_All_Files" --logger "console;verbosity=minimal"cargo +nightly-2026-04-14 fmt --check && cargo test --features test-support --test e2e workspaces_createfile_then_listfiles_returns_all_files -- --nocapture