Update logos to 0.16 - #133
Merged
Merged
Conversation
Update the logos dependency from 0.15 to 0.16.
Add allow_greedy to the comment skip pattern. Logos 0.16 requires
this opt-in for greedy patterns that are equivalent to a dot
repetition. The greedy match to the end of the line is the intended
behavior for GraphQL comments.
Update three test expectations for a change in error recovery.
Logos 0.16 reports one error for a failed match attempt. The error
span covers all consumed bytes. Logos 0.15 reported an error for
only the first byte:
- ".." gives one error with span 0..2, not two errors.
- The inner error for "\u12" in a string covers the full escape
sequence.
- The inner error for "\u{}" in a string covers the full escape
sequence.
Restructure the stack usage tests for the changes in logos 0.16:
- Logos 0.16 lexes large ASCII tokens and large ASCII ignored runs
with bounded stack usage. Logos 0.15 caused a stack overflow for
these inputs in unoptimized builds. Enable the tests for these
inputs to prevent a regression.
- Logos 0.16 uses stack space proportional to the match length for
runs of multi-byte characters, for example emoji in a string.
Logos 0.15 lexed these inputs with bounded stack usage. Optimized
builds are not affected. Narrow the ignored tests to these inputs
and update the documentation.
Benchmark results show no performance change outside the
measurement noise.
Assisted-By: devx/a4890344-dddf-4733-a94e-71230a3953d1
Add comment separators with carriage return and line feed, and with carriage return alone, to the kitchen sink token stream test. The test asserts exact spans for the tokens that follow each comment. This makes sure that a comment ends at each line terminator and does not consume the tokens on the next line. Assisted-By: devx/a4890344-dddf-4733-a94e-71230a3953d1
adampetro
marked this pull request as ready for review
August 12, 2026 20:07
swalkinshaw
approved these changes
Aug 12, 2026
swalkinshaw
left a comment
Contributor
There was a problem hiding this comment.
Error span change is a nice improvement 👍
Thanks for clarying the unoptimized vs optimized build breakdown.
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.
What
Update the
logosdependency from 0.15 to 0.16.Required source change
Logos 0.16 rejects greedy patterns that are equivalent to a dot repetition, unless the pattern opts in. The comment skip pattern needs this opt-in. The greedy match to the end of the line is the intended behavior for GraphQL comments:
Behavior changes
The lexer regression tests from #132 found one change in error recovery. Logos 0.16 reports one error for a failed match attempt, and the error span covers all consumed bytes. Logos 0.15 reported an error for only the first byte:
..0..1and1..20..2"\u12"1..21..5"\u{}"1..21..4The new spans point at the full invalid sequence, so the error messages become more precise. Valid documents lex the same as before. No other test in the workspace changed behavior.
Stack usage changes
Logos 0.15 and 0.16 both generate matcher code that can recurse for each character in unoptimized builds. Optimized builds compile the recursion into loops and are not affected. The affected inputs changed in 0.16:
This PR restructures the stack usage tests for this:
#[ignore]reasons name logos 0.16. Runcargo test -p bluejay-parser -- --ignoredin a debug build after the next logos upgrade. If the tests pass, remove the ignore attributes.The multi-byte problem is a regression in logos 0.16. It only affects unoptimized builds, so it does not block this upgrade. A minimal reproduction is ready for an upstream report: a
[^"]+token overflows a 1 MiB stack at approximately 1,000 multi-byte characters, while 0.15 lexes one million multi-byte characters in the same stack.Performance
The criterion benchmarks (
cargo bench -p bluejay-parser --bench parse) show no change outside the measurement noise. A control run of 0.15 against its own baseline showed the same magnitude of variation (up to ±5%) as the 0.15 to 0.16 comparison.How to verify
The first command matches CI. The second command shows that the ignored tests pass in optimized builds.