Skip to content

Fix KQL parser depth and backtracks counter propagation#103528

Draft
yakov-olkhovskiy wants to merge 41 commits intomasterfrom
cursor/kql-parser-depth-backtracks-8f909035-6d84
Draft

Fix KQL parser depth and backtracks counter propagation#103528
yakov-olkhovskiy wants to merge 41 commits intomasterfrom
cursor/kql-parser-depth-backtracks-8f909035-6d84

Conversation

@yakov-olkhovskiy
Copy link
Copy Markdown
Member

This is a dedicated PR created from commit 8f9090355e872a3cea1f1c54df7f030a8b76e9dd.

It fixes KQL parser logic where depth and parser-backtracks counters could be lost while passing through KQL parser components, which could weaken parser-limit accounting and error behavior for complex KQL queries.

Reference PR with related recent parser/CI context: #99740

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Improved KQL parser robustness by preserving parser depth and backtracks counters across KQL parser stages, so parser limits are tracked consistently for complex KQL queries.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)
Open in Web Open in Cursor 

yakov-olkhovskiy and others added 30 commits March 17, 2026 09:16
…x_parser_depth, max_parser_backtracks, max_query_size as options, set max_parser_depth = 100, max_parser_backtracks = 1000
…-workflow-conflicts-7a3b

# Conflicts:
#	.github/workflows/pull_request.yml

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
…-workflow-conflicts-7a3b

# Conflicts:
#	.github/workflows/pull_request.yml

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
…-workflow-conflicts-7a3b

# Conflicts:
#	.github/workflows/pull_request.yml

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
…-workflow-conflicts-7a3b

# Conflicts:
#	.github/workflows/pull_request.yml
#	ci/workflows/pull_request.py

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
…ce stacktrace from runner thread instead main
yakov-olkhovskiy and others added 11 commits April 20, 2026 21:48
…-workflow-conflicts-7a3b

# Conflicts:
#	.github/workflows/pull_request.yml

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
…-workflow-conflicts-7a3b

# Conflicts:
#	.github/workflows/pull_request.yml

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
…-workflow-conflicts-7a3b

# Conflicts:
#	.github/workflows/pull_request.yml

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
Fix two sanitizer findings from CI run #99740:

- Guard `Lexer::nextToken` max-query-size check for null input pointers to avoid UBSan pointer arithmetic exception.

- Return early in `HasSubsequenceImpl::hasSubsequenceUTF8` for empty haystack before first UTF-8 decode to avoid MSan uninitialized read exception.

Also add targeted parser/gtest and stateless SQL regression coverage for the new edge cases.

Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
Co-authored-by: Yakov Olkhovskiy <yakov-olkhovskiy@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 25, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ alexey-milovidov
✅ yakov-olkhovskiy
❌ cursoragent
You have signed the CLA already but the status is still pending? Let us recheck it.

@yakov-olkhovskiy
Copy link
Copy Markdown
Member Author

closing AIs mess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants