test(highlight): keep the long-string fixture below the lexer timeout - #340
Merged
Conversation
keep the input above regexp2's old backtracking cap while leaving headroom below Chroma's fixed 250ms rule timeout under the race detector.
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.
TestHighlighter_LongQuotedStringUsesStringColoris flaky on CI. It failed on one run of #338 and passed on a second run of the same commit.cause: chroma sets a fixed 250ms
MatchTimeouton every lexer rule, whichapp/highlight/highlight.goalready documents as a ceiling the backtracking cap cannot lift. The test matched a 40,000-character string against it, so it was really asserting that the machine finishes that match inside 250ms. Measured here: 7.4ms plain but 147.6ms under-race, which is how CI runs it. That is 1.7x headroom on hardware faster than a GitHub runner. When it goes over, the string rule loses and the body is repainted by whichever rule matches next, which is the wrong colour in the failure log.fix: 20,000 characters instead of 40,000. Sweeping sizes with the cap reverted to the pre-fix 100,000 shows 15,000 still passing and 17,000 already failing, which matches the slot arithmetic in that same comment, so 20,000 is comfortably above the old cap and still fails without the fix. It costs about 78ms under
-race, roughly 3x headroom instead of 1.7x.the input is smaller, the test is not weaker: reverting the cap to 100,000 in a scratch tree makes the 20,000 case fail by receiving
chroma.Error, so it pins the same regression it always did. The comment now records both facts, the regression it catches and why the number cannot be raised back.