Fix two stack overflows and an ignore token counted twice - #4116
Open
DmitrySharabin wants to merge 1 commit into
Open
DmitrySharabin wants to merge 1 commit into
DmitrySharabin wants to merge 1 commit into
Conversation
DmitrySharabin
added this pull request to stack #4115
September 17, 2026 11:20
✅ Deploy Preview for dev-prismjs-com ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
DmitrySharabin
removed this pull request from stack #4115
September 22, 2026 08:35
DmitrySharabin
changed the base branch from
claude/split-token-stream-perf
to
v2
September 22, 2026 08:48
DmitrySharabin
force-pushed
the
claude/token-stream-overflow
branch
from
September 22, 2026 08:48
7e07d6c to
68439b4
Compare
DmitrySharabin
changed the base branch from
v2
to
claude/inner-spec-detection
September 22, 2026 08:48
DmitrySharabin
added this pull request to stack #4124
September 22, 2026 08:48
DmitrySharabin
removed this pull request from stack #4124
September 22, 2026 08:49
DmitrySharabin
force-pushed
the
claude/token-stream-overflow
branch
from
September 22, 2026 09:06
68439b4 to
fa25cc2
Compare
DmitrySharabin
added this pull request to stack #4126
September 22, 2026 09:06
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.
Fix two stack overflows and a doubled
ignoretoken in$innerembedding, found during a cold review of #4110/#4112/#4114 as one change.embedandinsertTokensboth callsplice(start, n, ...items)with an array as long as the inner token stream — any$innerlanguage overflows the call stack past ~460KB of input, wherev2was fine. Both now go throughreplaceRange()(slice, truncate, push).:textand a root-levelignore*token fed that token's text to the inner language twice, and the second copy changed how the first one parsed. Not reachable from a shipped grammar, butignore*tokens are documented as dissolved into:text.token-stream.js: split halves no longer share the original's alias array,insertTokensthrows instead of silently dropping text on non-ascending offsets, andsplitTokenStream's isolation claim now matches what it actually does.10253 passing / 1 pre-existing pending / 0 failing.
lint:ci,tsc, andtsc -p tests/tsconfig.jsonall clean. Each fix is mutation-pinned — reverting the guard fails exactly one test.tests/core/registry.jstests/core/token-stream.jssrc/util/token-stream.jstests/core/embedding.jssrc/core/tokenize/embed.js🤖 Generated with Claude Code