fix: append large embedded markup results without argument limits #52
main fromtaren/highlight-large-embedded-ranges·merged by tannerlinsley Large embedded-language results are expanded into a function argument list before appending. Default JavaScript inside HTML throws RangeError at 70,000 statements on Node. Iterate the already-offset result instead, retaining its mapping, raw range order and context calls.
A default-language witness with 70,000 unique valid declarations now completes with 280,005 tokens and preserves source and escaping. Smaller inputs where both versions finish compare exactly. No speedup is claimed against the failed large baseline.
Measured tradeoffs: longer warmed Node working-input comparisons are neutral for markup docs and 1,000 statements, about 2% slower for 10,000 statements. Bun controls are near neutral/slightly faster. Three allocation pairs are -0.52% to +2.83% on markup docs, -0.14% to +3.44% on larger embedded work, and +1.65% to +4.27% with 1,000 small script regions. Cold and settled retained results show no material regression. This is a robustness fix, not a universal throughput or allocation improvement.
All 12 local production gates pass, including the new 140,000-range regression. Only the final changeset gate initially failed because metadata was missing; it was corrected without changing the tested runtime or weakening the gate. Original size/import/runtime budgets pass, as does the isolated current C composition. Exact public quote/escape parity covers 114,598 cases on each Node/Bun engine and raw range/reentry parity covers 12,216 each. No API, language, dependency, authoring or budget changes.
Summary by CodeRabbit#
- Bug Fixes
- Fixed markup tokenization for large embedded-language blocks that could exceed JavaScript’s argument-count limit. Token ranges remain unchanged.
- Tests
- Added coverage for HTML containing a large JavaScript
<script>block.
- Added coverage for HTML containing a large JavaScript
- 1
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f64101a0-8919-46cf-8f72-f33621120f31
Commits-
Reviewing files that changed from the base of the PR and between a3aef82b0a9d09922ab73eeb6f8cd48795db5127 and 683fdf97d78a4e6585d5b8e9a9f022e203b95811.
Files selected for processing: 3-
.changeset/large-embedded-ranges.mdsrc/internal/markup.tstest/markup-large-embedded.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
-
Walkthrough
-
The markup tokenizer now appends embedded-language token ranges individually instead of spreading them into one
pushcall. A regression test checks range count and boundary positions for a large JavaScript script body.Changes: Embedded markup tokenization
Layer / File(s) Summary Append and validate embedded ranges
src/internal/markup.ts,test/markup-large-embedded.test.ts,.changeset/large-embedded-ranges.mdThe tokenizer appends each offset range individually. The test checks the range count and first and last positions for a 140,000-character script body. The changeset records a patch update for @tanstack/highlight.Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Merge Risk:
Minimal · up to683fd-
No actionable merge-blocking risk is evident; the large embedded-token path is covered by the added regression test.
Pre-merge checks:
4 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Docstring Coverage Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold. Passed checks: 4 passed-
Check name Status Explanation Title check The title names the main change: large embedded-language markup results are now appended without hitting JavaScript argument-count limits. The raw summary confirms the markup.ts change replaces the sp… Description check The description covers the problem (RangeError at 70,000 statements on Node), the fix (iterate the already-offset result instead of spreading), validation (witness with 70,000 declarations, parity cou… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the main change: large embedded-language markup results are now appended without hitting JavaScript argument-count limits. The raw summary confirms the markup.ts change replaces the spread-into-push call with per-range appends, and the test covers a 140,000-character script body. The 'fix:' prefix matches the robustness-fix nature of the change.
Full details: Description check
-
Explanation
The description covers the problem (RangeError at 70,000 statements on Node), the fix (iterate the already-offset result instead of spreading), validation (witness with 70,000 declarations, parity counts, 12 production gates, and the 140,000-range regression), and tradeoffs. It does not follow the repository template headings. The template asks for '## Changes' and '## Validation' sections, and the description has neither heading. Its Changes content is in the first paragraph, but it does not explain why the change belongs in a small docs highlighter. Its Validation content is detailed but includes no focused fixture list or formal size/benchmark table. The content is substantive and mostly complete, so the check passes, but the headings and the highlighter rationale should be added.
Resolution
Restructure the description under the template headings '## Changes' and '## Validation'. In '## Changes', state why the behavior belongs in a small docs highlighter. In '## Validation', list the focused fixtures, including the 140,000-range regression, and give the relevant size or benchmark results in a compact form.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
-
@coderabbitai review
Action performed
-
Review finished.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
-
tannerlinsley merged this48c3f23
tannerlinsley closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 683fdf97d78a4e6585d5b8e9a9f022e203b95811
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR