diff --git a/TESTING_GUIDE.md b/TESTING_GUIDE.md index 90e89b1e7..d919f20fa 100644 --- a/TESTING_GUIDE.md +++ b/TESTING_GUIDE.md @@ -746,7 +746,7 @@ Candidate-ordered parallel-index recovery tests must prove that the fatal result Python graph fixtures cover streamed decorator arguments, annotations, runtime type checks, typing factories, dataclass/framework integrations, and dynamic imports. `BoundedRegexTests.EnumerateMatches_InstanceRegex_StartsAtRequestedOffset` fixes the no-prefix-rescan contract used by decorator arguments, while `EnumerateMatches_InstanceRightToLeftRegex_PreservesDefaultStartAndOrder` preserves instance-regex default direction. Direct instance-enumerator coverage in `BoundedRegexTests` also fixes lazy invalid-`startAt` validation, zero-length progress, `\G` continuation, explicit right-to-left start positions, one terminal timeout diagnostic after a successful prefix, early disposal without suffix work, unsupported `Reset`, and intentional LINQ compatibility. PHP, Ruby, R, and Perl graph fixtures cover streamed attributes/docblocks/types, DSL command targets, namespace/member/resource references, and arrow calls. Keep nested token/type enumeration cap-aware. `ReferenceExtractorTests.Extract_PhpDocblockMethod_ReturnPrecedesParametersAtReferenceLimit` fixes PHP docblock preamble ordering and container state: an `@method` return type consumes the remaining reference slot before its parameter types while retaining the enclosing-class container snapshot. - Secondary-language graph fixtures cover streamed Fortran, Visual Basic, F#, Pascal, Objective-C, Haskell, Elixir, Smalltalk, Lua, Dart, Razor, JSON, JavaScript, GitHub Actions, and C++ compound-requirement matches. `BoundedRegexTests.EnumerateMatches_StaticPatternCustomTimeout_ReturnsEmpty` and `EnumerateMatches_StaticPatternCustomTimeout_StopsAfterConsumerBreak` preserve explicit-timeout failure and early-disposal behavior. + Secondary-language graph fixtures cover streamed Fortran, Visual Basic, F#, Pascal, Objective-C, Haskell, Elixir, Smalltalk, Lua, Dart, Razor, JSON, JavaScript, GitHub Actions, and C++ compound-requirement matches. `BoundedRegexTests.EnumerateMatches_StaticPatternCustomTimeout_ReturnsEmpty` preserves explicit-timeout failure, while `EnumerateMatches_StaticPatternCustomTimeout_StopsAfterConsumerBreak` uses a scheduler-tolerant custom timeout and proves early disposal returns the prefix without recording a timeout. `PerformanceTests.ReferenceExtraction_BoundedDenseFSharpPipeline_StopsAtCapacity` fixes the bounded-list contract across line-phase handoffs and action-based call emitters: a 4,000-stage F# pipeline capped at one reference must not enumerate the unused stages. `PerformanceTests.ReferenceMatchEnumeration_BoundedListDoesNotRequestMatchAfterCapacity` and `ReferenceMatchEnumeration_ConcreteRegexDoesNotRequestSuffixAfterCapacity` prove that generic and concrete wrappers do not call the underlying enumerator's next `MoveNext()` after the cap is filled. `ReferenceMatchEnumeration_BelowCapacity_DoesNotAllocateWrapperEnumerators` keeps 10,000 ordinary generic below-cap scans free of wrapper-enumerator heap allocations. The blocking `net8.0` tests `BoundedRegexEnumeration_DirectNoMatchScansDoNotAllocateEnumerators` and `ReferenceMatchEnumeration_PrefilledCapacityDoesNotAllocateOrLookAhead` each run 10,000 concrete scans with a budget below 1,024 allocated bytes, covering both direct no-match enumeration and the already-full cap path. `PerformanceTests.ReferenceExtraction_PrologCallFreeRules_AvoidsPerLineLists` keeps 8,000 call-free Prolog rules from allocating empty goal lists or copying populated directive lists; its `net8.0` allocation budget is blocking. `PerformanceTests.Utf8LineStarts_DenseInput_AllocatesOnlyFinalOffsetArray` fixes 100,000 UTF-8 line offsets to the single exact-capacity result array used by both JSON symbol and reference extraction; its `net8.0` allocation budget is blocking. @@ -1839,7 +1839,7 @@ dotnet test --filter "FullyQualifiedName~GitHelperTests" Python graph fixture は decorator argument、annotation、runtime type check、typing factory、dataclass / framework integration、dynamic import の逐次走査を検証します。`BoundedRegexTests.EnumerateMatches_InstanceRegex_StartsAtRequestedOffset` は decorator argument が prefix を再走査しない契約を固定し、`EnumerateMatches_InstanceRightToLeftRegex_PreservesDefaultStartAndOrder` は instance regex の既定方向を維持します。 `BoundedRegexTests` の direct instance-enumerator coverage はさらに、invalid `startAt` の遅延検証、zero-length の進行、`\G` continuation、right-to-left の明示開始位置、prefix 成功後に1回だけ記録して終了する timeout、suffix work を行わない早期 Dispose、未対応の `Reset`、意図的な LINQ 互換性を固定します。 PHP、Ruby、R、Perl の graph fixture は attribute / docblock / type、DSL command target、namespace / member / resource reference、arrow call の逐次走査を検証します。nested token / type enumeration も cap-aware のままにしてください。`ReferenceExtractorTests.Extract_PhpDocblockMethod_ReturnPrecedesParametersAtReferenceLimit` は PHP docblock preamble の順序と container state を固定し、`@method` の return type が parameter type より先に残り1枠を消費しつつ、enclosing class の container snapshot を保持することを検証します。 - secondary-language graph fixture は Fortran、Visual Basic、F#、Pascal、Objective-C、Haskell、Elixir、Smalltalk、Lua、Dart、Razor、JSON、JavaScript、GitHub Actions、C++ compound requirement の逐次走査を検証します。`BoundedRegexTests.EnumerateMatches_StaticPatternCustomTimeout_ReturnsEmpty` と `EnumerateMatches_StaticPatternCustomTimeout_StopsAfterConsumerBreak` は、明示 timeout の失敗時挙動と早期破棄を固定します。 + secondary-language graph fixture は Fortran、Visual Basic、F#、Pascal、Objective-C、Haskell、Elixir、Smalltalk、Lua、Dart、Razor、JSON、JavaScript、GitHub Actions、C++ compound requirement の逐次走査を検証します。`BoundedRegexTests.EnumerateMatches_StaticPatternCustomTimeout_ReturnsEmpty` は明示 timeout の失敗時挙動を固定し、`EnumerateMatches_StaticPatternCustomTimeout_StopsAfterConsumerBreak` は scheduler の揺れに耐える custom timeout を使い、timeout を記録せずに prefix を返して早期破棄することを検証します。 `PerformanceTests.ReferenceExtraction_BoundedDenseFSharpPipeline_StopsAtCapacity` は、行 phase の引き継ぎと action-based call emitter をまたぐ bounded-list 契約を固定します。上限1の4,000段 F# pipeline は未使用の段を列挙してはなりません。`PerformanceTests.ReferenceMatchEnumeration_BoundedListDoesNotRequestMatchAfterCapacity` と `ReferenceMatchEnumeration_ConcreteRegexDoesNotRequestSuffixAfterCapacity` は、generic / concrete wrapper が上限到達後に下位 enumerator の次の `MoveNext()` を呼ばないことを固定します。`ReferenceMatchEnumeration_BelowCapacity_DoesNotAllocateWrapperEnumerators` は通常の generic 上限未到達 scan 10,000回で wrapper enumerator の heap allocation がないことを固定します。blocking な `net8.0` test `BoundedRegexEnumeration_DirectNoMatchScansDoNotAllocateEnumerators` と `ReferenceMatchEnumeration_PrefilledCapacityDoesNotAllocateOrLookAhead` は、direct no-match と既に満杯の cap 経路をそれぞれ10,000回走査し、allocation を1,024 bytes未満に固定します。 `PerformanceTests.ReferenceExtraction_PrologCallFreeRules_AvoidsPerLineLists` は8,000件の call-free Prolog rule で empty goal list と populated directive list の copy を防ぎます。`net8.0` の allocation budget は blocking です。 `PerformanceTests.Utf8LineStarts_DenseInput_AllocatesOnlyFinalOffsetArray` は JSON symbol / reference extraction が共有する100,000件の UTF-8 line offset を exact-capacity の結果 array 1つに固定します。`net8.0` の allocation budget は blocking です。 diff --git a/changelog.d/unreleased/5113.fixed.md b/changelog.d/unreleased/5113.fixed.md new file mode 100644 index 000000000..435ccf54f --- /dev/null +++ b/changelog.d/unreleased/5113.fixed.md @@ -0,0 +1,16 @@ +--- +category: fixed +issues: + - 5113 +affected: + - tests/CodeIndex.Tests/BoundedRegexTests.cs + - TESTING_GUIDE.md +--- + +## English + +- **Stabilized the bounded-regex consumer-break regression under parallel test load (#5113)** — the custom-timeout coverage now leaves scheduler headroom, verifies that the prefix match is returned, and confirms that early disposal records no suffix timeout. + +## 日本語 + +- **並列テスト負荷時の bounded-regex consumer-break 回帰テストを安定化しました (#5113)** — custom timeout の検証に scheduler の余裕を持たせ、prefix match が返ることと、早期破棄で suffix timeout が記録されないことを確認します。 diff --git a/tests/CodeIndex.Tests/BoundedRegexTests.cs b/tests/CodeIndex.Tests/BoundedRegexTests.cs index 82f628665..5e698d4ae 100644 --- a/tests/CodeIndex.Tests/BoundedRegexTests.cs +++ b/tests/CodeIndex.Tests/BoundedRegexTests.cs @@ -99,17 +99,21 @@ public void EnumerateMatches_StaticPatternCustomTimeout_ReturnsEmpty() public void EnumerateMatches_StaticPatternCustomTimeout_StopsAfterConsumerBreak() { var input = "token " + new string('a', 10_000) + "!"; + using var capture = BoundedRegex.CaptureTimeouts("csharp", "bounded_regex_test"); - var match = BoundedRegex + var matches = BoundedRegex .EnumerateMatches( input, @"token|(?:a+)+$", RegexOptions.CultureInvariant, - TimeSpan.FromMilliseconds(1)) + // Keep this below the production default while leaving full-suite scheduler + // headroom; the one-millisecond budget used before #5113 could lose the prefix. + TimeSpan.FromSeconds(1)) .Take(1) - .Single(); + .ToArray(); - Assert.Equal("token", match.Value); + Assert.Collection(matches, match => Assert.Equal("token", match.Value)); + Assert.False(capture.HasTimeouts); } [Fact]