test: preserve independent tokenizer contexts #47
main fromtaren/highlight-context-lifetimes·merged by tannerlinsley Add four regression cases for independent tokenizer contexts across calls. A tokenizer can use context or method identity when selecting ranges, and it can replace a method for its current invocation. Reusing those values between calls changes the resulting highlighting.
The cases cover context identity, tokenize identity, hasLanguage identity, and a method mutation that must not leak to the next invocation. A depth-pooled prototype passed the broad compatibility corpus but failed all four targeted cases on Node and Bun; that prototype was rejected.
Validation: all 12 local gates pass, including 371 tests. All 214 compiled implementation/declaration files are byte-identical to published v1.2.3. This changes tests only, with an empty changeset and no package implementation, API, dependency or performance change.
Summary by CodeRabbit#
- Tests
- Added coverage verifying that separate highlighting calls receive independent tokenizer contexts. The tests also check that context changes made during one call do not carry over to the next.
- 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:
d3f6f692-2f16-460d-a2b5-c6bf60aa5c50
Commits-
Reviewing files that changed from the base of the PR and between aecee665235f68cfb6cfe67953bc9036b04a41ae and bde1770754456bbf7f42e9397944c05f4e62165b.
Files selected for processing: 2-
.changeset/context-lifetime-coverage.mdtest/core.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 pull request adds a test that checks tokenizer context independence across
highlightcalls. It also adds a changeset file with an empty package map and no description.Changes: Tokenizer context lifetime coverage
Layer / File(s) Summary Context independence regression test
test/core.test.ts,.changeset/context-lifetime-coverage.mdThe test checks fresh context objects and methods across two highlightcalls, including isolation from mutation ofhasLanguage. Each call is expected to produce akeywordtoken forx. The changeset file has an empty package map and no description.Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Other
Merge Risk:
Minimal · up tobde17-
No actionable merge-blocking risk remains.
Pre-merge checks:
5-
Check name Status Explanation Title check The title "test: preserve independent tokenizer contexts" matches the main change. The PR adds four regression tests that check tokenizer context, tokenize, and hasLanguage identity, and a method muta… Description check The description states the purpose of the change: four regression cases for independent tokenizer contexts across calls. It lists the cases covered, reports the rejected depth-pooled prototype, and gi… Docstring Coverage No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… 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 "test: preserve independent tokenizer contexts" matches the main change. The PR adds four regression tests that check tokenizer context, tokenize, and hasLanguage identity, and a method mutation that must not leak across calls. The PR changes tests only. The title uses a conventional prefix, is short, and names the behavior under test.
Full details: Description check
-
Explanation
The description states the purpose of the change: four regression cases for independent tokenizer contexts across calls. It lists the cases covered, reports the rejected depth-pooled prototype, and gives validation results (12 local gates, 371 tests, 214 byte-identical files versus v1.2.3). It also states that the change has no package implementation, API, dependency, or performance impact. The repository template has two sections, Changes and Validation. The description has no headings. Its content maps to both sections, but the Validation content does not include focused fixtures or a size/benchmark result, which the template asks for. The description does not follow the template structure.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. 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 0 functions across 1 files. (1 skipped: 1 unsupported.)
-
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.
-
tannerlinsley merged this8d061b1
tannerlinsley closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: bde1770754456bbf7f42e9397944c05f4e62165b
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 0 packages
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
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