Repository navigation
fix: a valid value cannot fail a pattern on a slow first match; null-argument contract tests - #43
Merged
Merged
Conversation
… a valid value cannot fail on a slow first match
6 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #16, items 3 and 4.
fix(mapping): a flaky test was a real defect. I ran the whole suite 30 times in a row, and
FieldConstraintTests.APatternMustMatchTheWholeValue("DE", true)failed once. The pattern constraint gave every match a 100 ms clock. The first match in a process builds .NET's non-backtracking engine, and under load that took longer than the budget. .NET then did not throwRegexMatchTimeoutException: it returnedfalsewithout a word, so a valid value failed its rule.This reproduces in a fresh process with a 1 ms budget: the first
IsMatch("DE")returnsfalseand the second returnstrue. The non-backtracking engine is linear in the value and cannot run away, so it now gets no clock at all. Only the backtracking fallback, used for lookarounds and backreferences, keeps its 100 ms budget, because it can run away.JudgesAPatternTheLinearEngineRunsWithoutAClockfailed before the change.docs/KNOWN-ISSUES.mdis updated to match.test: null arguments. Every public entry point that takes a non-nullable reference argument now has a test: 45 of them, run on both targets. Each passes
nulland expects anArgumentExceptionnaming that exact parameter. No test pinned this contract before: removingArgumentNullException.ThrowIfNull(stream)fromCsvCursorleft the whole suite green. Now it fails.On mutation testing: Stryker.NET 5.0 does not work with this suite yet. Its Microsoft.Testing.Platform runner, still a preview, gets no answer to its run-tests call from the xunit v4 test server (
Test run RPC call timed out). So it records every surviving mutant as a timeout, and the score reads 100 % whatever the tests do. Its VSTest runner made the first test run take 26 minutes, and its coverage capture failed. Neither gives results to act on, so no Stryker configuration is committed here.