Repository navigation
test(mobile): de-flake the cold Shiki highlighting test - #233
Merged
Merged
Conversation
"initializes source and snippet highlighting without a warmup" compared the
cold source-file tokens with the snippet tokens exactly. On a loaded CI
runner the first, cold tokenization can exceed Shiki's 500 ms
tokenizeTimeLimit and emit the rest of the line as one token ("42;" rather
than "42" + ";"), which failed validate on several perf PRs (#222 twice,
#231) while passing locally and in a full local mobile run.
The test now checks what it is about: both paths initialise without a
warmup, reproduce the source and apply colours.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
apps/mobile/src/features/review/shikiReviewHighlighter.test.ts› "initializes source and snippet highlighting without a warmup" failedvalidateon #222 twice and on #231. It passes locally, in isolation and in a full local mobile run (181 files, 1,669 tests).The failing assertion compared the cold
highlightSourceFiletokens with thehighlightCodeSnippettokens exactly. Shiki'scodeToTokenshas atokenizeTimeLimitof 500 ms by default (@shikijs/primitive4.2.0). On a loaded runner the first tokenization can exceed it, and Shiki then emits the rest of the line as one token. The CI diff showed exactly that:"42;"as one token instead of"42"+";".Fix
The test now asserts what it's named for: both paths initialise without a warmup, reproduce the source text and apply colours. Token boundaries under a time limit are no longer part of the test. Production code is unchanged.
Evidence
NODE_ENV=test vp test run src/features/review/shikiReviewHighlighter.test.ts: 7 pass.Model/harness: Claude Opus 5.5 via Claude Code in T3 Code.
🤖 Generated with Claude Code