Skip to content

Commit b60bcdf

Browse files
committed
Fix flaky import cancellation console capture (#4625)
1 parent f0a1e76 commit b60bcdf

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

TESTING_GUIDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ Use the inventory below before adding or moving a test class:
525525
- SQLite connection-string and command-policy tests are parallel-safe when every in-memory connection and command is instance-owned and disposed; referencing `Microsoft.Data.Sqlite` alone is not a reason to join the SQLite-sensitive collection.
526526
- Cross-platform path matrices can run in parallel when cache seeding is guarded by `PathCasingTestLock` and every filesystem/git fixture owns a unique temporary workspace.
527527
- Exception-formatting contract tests should guard their shared console helper with `TestConsoleLock` and remain parallelizable; their in-memory SQLite retry probes do not mutate the process pool.
528-
- Split pure pre-cancelled import and bounded-stream checks from import-replacement fixtures that mutate test-only hooks, so only the hook-owning class remains serialized.
528+
- Split pure pre-cancelled import and bounded-stream checks from import-replacement fixtures that mutate test-only hooks. Keep the pre-cancelled import fixture in the console-sensitive collection because empty stderr is part of its contract, while the bounded-stream fixture remains parallel-safe and only the hook-owning class needs SQLite-sensitive serialization.
529529
- Release workflow and package-normalizer tests can run outside the SQLite-sensitive collection: xUnit keeps methods in their single class sequential, so its two scoped durability-hook probes cannot overlap each other.
530530
- Database-diff fixtures own independent left/right projects, lock console capture, and keep their sole row-budget override within the same sequential xUnit class; they do not require process-wide SQLite serialization.
531531
- Keep `SuggestionStore` environment-boundary and configured-pruning cases in their small non-parallel fixture; hashing, deduplication, archive, and ordinary persistence cases own isolated directories and should remain parallelizable.
@@ -1230,7 +1230,7 @@ dotnet test --filter "FullyQualifiedName~GitHelperTests"
12301230
- SQLite connection-string / command-policy test は、各 in-memory connection と command を test instance が所有して dispose する限り parallel-safe である。`Microsoft.Data.Sqlite` を参照するだけでは SQLite-sensitive collection に入れる理由にならない。
12311231
- cross-platform path matrix は、cache seed を `PathCasingTestLock` で保護し、各 filesystem / git fixture が一意な temporary workspace を所有する限り parallel 実行できる。
12321232
- exception-formatting contract test は共有 console helper を `TestConsoleLock` で保護して parallel 実行可能に保つ。in-memory SQLite retry probe は process pool を変更しない。
1233-
- pure な事前 cancellation import / bounded-stream check は test-only hook を変更する import replacement fixture から分離し、hook を所有する class だけを直列化する
1233+
- pure な事前 cancellation import / bounded-stream check は test-only hook を変更する import replacement fixture から分離する。空の stderr が契約の一部であるため、事前 cancellation import fixture は console-sensitive collection に保ち、bounded-stream fixture は parallel-safe なままとして、SQLite-sensitive な直列化は hook を所有する class だけに限定する
12341234
- release workflow / package-normalizer test は SQLite-sensitive collection の外で実行できる。xUnit は単一 class 内の method を直列に保つため、scope された2件の durability-hook probe は互いに重ならない。
12351235
- database diff fixture は独立した left / right project を所有し、console capture を lock し、唯一の row-budget override を同じ xUnit class の直列実行内に閉じるため、process-wide な SQLite 直列化は不要である。
12361236
- `SuggestionStore` の environment boundary / configured pruning case は小さな non-parallel fixture に隔離する。hash、deduplication、archive、通常の persistence case は独立 directory を所有し、parallel 実行可能に保つ。
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
category: fixed
3+
issues:
4+
- 4625
5+
affected:
6+
- tests/CodeIndex.Tests/ExportImportCommandRunnerIssue3818Tests.cs
7+
- TESTING_GUIDE.md
8+
---
9+
10+
## English
11+
12+
- **Import cancellation stderr assertions no longer receive concurrent console diagnostics (#4625)** — the pre-cancelled JSON import fixture now runs in the console-sensitive collection, while its pure bounded-stream check remains parallel-safe.
13+
14+
## 日本語
15+
16+
- **import cancellation の stderr assertion に並行実行中の console 診断が混入しなくなりました (#4625)** — 事前 cancellation 済みの JSON import fixture を console-sensitive collection で実行し、pure な bounded-stream check は parallel-safe なままに保ちます。

tests/CodeIndex.Tests/ExportImportCommandRunnerIssue3818Tests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ private static string ExportArchive(string projectRoot, string sourceDbPath)
8282

8383
}
8484

85+
[Collection("Console sensitive")]
8586
public class ExportImportCommandRunnerCancellationTests
8687
{
8788
[Fact]
@@ -103,6 +104,10 @@ public void RunImport_JsonCancellationReturnsInterrupted_Issue3818()
103104
Assert.Equal(CommandErrorCodes.Interrupted, root.GetProperty("error_code").GetString());
104105
}
105106

107+
}
108+
109+
public class ExportImportCommandRunnerCopyCancellationTests
110+
{
106111
[Fact]
107112
public void CopyToWithLimit_CancellationBeforeReadThrowsWithoutWriting_Issue3818()
108113
{

0 commit comments

Comments
 (0)