diff --git a/TESTING_GUIDE.md b/TESTING_GUIDE.md index aaa6e01d9..1c105ca80 100644 --- a/TESTING_GUIDE.md +++ b/TESTING_GUIDE.md @@ -696,7 +696,7 @@ Use `docs/test-doc-maintenance-plan.md` before moving oversized suites or adding - `QueryCommandRunnerBatchIssue4723Tests.cs` CLI batch coverage for structured command objects, configurable input/output budgets, bounded parallel read overlap, input-order result emission, per-item failure isolation, and cancellation/console restoration. The deterministic overlap test blocks the first worker until the second finishes through batch-only test seams; keep those seams reset in `finally` and do not replace the signal with timing assertions. - `QueryCommandRunnerBatchIssue4872Tests.cs` - Parallel batch session-reuse coverage. Keep the exact worker-slot session bound, serial/parallel result and input-order parity, between-item checkpointed-WAL snapshot and direct-session refresh, validation/reader-construction failure cleanup, hot-WAL snapshot fixture, warmup, and the generous 12-item/3-item ratio guard together. The benchmark injects deterministic database-open/schema work through a test seam; its fixed delay models phase cost only, while worker coordination remains signal-driven. + Parallel batch session-reuse coverage. Keep the exact worker-slot session bound, serial/parallel result and input-order parity, between-item checkpointed-WAL snapshot and direct-session refresh, validation/reader-construction failure cleanup, hot-WAL snapshot fixture, warmup, and the generous 12-item/3-item ratio guard together. The checkpointed-WAL snapshot refresh gives each status wave two minutes of headroom for the loaded net9 full suite; keep its completion signals and result/session assertions intact rather than weakening the concurrency contract. The benchmark injects deterministic database-open/schema work through a test seam; its fixed delay models phase cost only, while worker coordination remains signal-driven. - `PropertyBasedParserTests.cs` FsCheck-driven property tests for parser-heavy paths called out in issue #1572: `ArgHelper.WantsHelp` and `ProgramRunner.IsProjectPathArg` never throw on arbitrary inputs; `FileIndexer.NormalizePathSeparators` is idempotent under double application; the literal-safe FTS5 sanitizer (`DbReader.SanitizeFtsQuery`) always emits a query that a real in-memory FTS5 virtual table can parse. They complement, not replace, the example-based tests in `ArgHelperTests.cs` / `QueryCommandRunnerTests.cs`. - `TestProjectHelper.cs`, `TestDeterminism.cs`, `RepositoryTestPaths.cs`, `TestConsoleLock.cs` @@ -1648,7 +1648,7 @@ dotnet test --filter "FullyQualifiedName~GitHelperTests" - `QueryCommandRunnerBatchIssue4723Tests.cs` structured command object、設定可能な input / output budget、上限付き parallel read の重複実行、入力順の result 出力、item ごとの failure isolation、cancellation / console 復元を対象とする CLI batch test です。決定的な overlap test は batch 専用 test seam を通じて第 1 worker を第 2 worker の完了まで block します。seam は `finally` で必ず reset し、signal を timing assertion に置き換えないでください。 - `QueryCommandRunnerBatchIssue4872Tests.cs` - parallel batch の session 再利用を検証します。worker slot 数と一致する厳密な session 上限、serial / parallel の result と入力順 parity、item 間の checkpoint 済み WAL snapshot / direct session 更新、validation / reader 構築失敗時の cleanup、hot-WAL snapshot fixture、warmup、十分に余裕を持たせた 12-item / 3-item ratio guard を一緒に維持してください。benchmark は test seam から決定的な database-open / schema 作業を注入します。固定 delay は phase cost のモデル化だけに使い、worker coordination は引き続き signal で制御します。 + parallel batch の session 再利用を検証します。worker slot 数と一致する厳密な session 上限、serial / parallel の result と入力順 parity、item 間の checkpoint 済み WAL snapshot / direct session 更新、validation / reader 構築失敗時の cleanup、hot-WAL snapshot fixture、warmup、十分に余裕を持たせた 12-item / 3-item ratio guard を一緒に維持してください。checkpoint 済み WAL snapshot の refresh test は、負荷がかかる net9 full suite に備えて各 status wave に 2 分の余裕を持たせます。completion signal と result / session assertion は concurrency 契約を弱めず維持してください。benchmark は test seam から決定的な database-open / schema 作業を注入します。固定 delay は phase cost のモデル化だけに使い、worker coordination は引き続き signal で制御します。 - `PropertyBasedParserTests.cs` issue #1572 で挙げられたパーサー系経路に対する FsCheck 駆動の property テスト: `ArgHelper.WantsHelp` と `ProgramRunner.IsProjectPathArg` が任意入力で例外を投げないこと、`FileIndexer.NormalizePathSeparators` が二重適用で idempotent であること、literal-safe な FTS5 サニタイザ (`DbReader.SanitizeFtsQuery`) が常にインメモリ FTS5 仮想テーブルで parse 可能なクエリを出力すること。`ArgHelperTests.cs` / `QueryCommandRunnerTests.cs` の例ベーステストを置き換えるものではなく補完します。 - `TestProjectHelper.cs`、`TestDeterminism.cs`、`RepositoryTestPaths.cs`、`TestConsoleLock.cs` diff --git a/changelog.d/unreleased/5015.fixed.md b/changelog.d/unreleased/5015.fixed.md new file mode 100644 index 000000000..313d2e857 --- /dev/null +++ b/changelog.d/unreleased/5015.fixed.md @@ -0,0 +1,16 @@ +--- +category: fixed +issues: + - 5015 +affected: + - tests/CodeIndex.Tests/QueryCommandRunnerBatchIssue4872Tests.cs + - TESTING_GUIDE.md +--- + +## English + +- **Parallel batch snapshot refresh coverage now has deterministic net9 full-suite headroom (#5015)** — each signal-gated status wave can run for up to two minutes, while the existing concurrency, refreshed-result, and session-count assertions remain unchanged. + +## 日本語 + +- **parallel batch の snapshot refresh coverage に net9 full suite 向けの決定的な余裕を追加しました (#5015)** — signal で制御する各 status wave を最大 2 分まで実行できるようにしつつ、既存の concurrency、更新後 result、session 数の assertion は維持しています。 diff --git a/tests/CodeIndex.Tests/QueryCommandRunnerBatchIssue4872Tests.cs b/tests/CodeIndex.Tests/QueryCommandRunnerBatchIssue4872Tests.cs index 08ddae46c..0cd2e2974 100644 --- a/tests/CodeIndex.Tests/QueryCommandRunnerBatchIssue4872Tests.cs +++ b/tests/CodeIndex.Tests/QueryCommandRunnerBatchIssue4872Tests.cs @@ -121,6 +121,7 @@ INSERT INTO files(path, lang, size, lines, checksum, modified) using var stderr = new StringWriter(); using var firstWaveCompleted = new CountdownEvent(2); using var cancellation = new CancellationTokenSource(); + var statusWaveTimeout = TimeSpan.FromMinutes(2); Task? runTask = null; var openedSessions = 0; QueryCommandRunner.BatchParallelSessionOpenedForTesting = @@ -144,7 +145,7 @@ INSERT INTO files(path, lang, size, lines, checksum, modified) input.WriteLine("""{"command":"status","args":["--json"]}"""); input.WriteLine("""{"command":"status","args":["--json"]}"""); Assert.True( - firstWaveCompleted.Wait(TimeSpan.FromSeconds(60)), + firstWaveCompleted.Wait(statusWaveTimeout), "The first parallel batch wave did not complete."); using (var update = writer.CreateCommand()) @@ -163,7 +164,7 @@ INSERT INTO files(path, lang, size, lines, checksum, modified) input.WriteLine("""{"command":"status","args":["--json"]}"""); input.Complete(); - var exitCode = await runTask.WaitAsync(TimeSpan.FromSeconds(60)); + var exitCode = await runTask.WaitAsync(statusWaveTimeout); Assert.Equal(CommandExitCodes.Success, exitCode); Assert.Equal(string.Empty, stderr.ToString());