Skip to content

QL-for-QL: fix parsing of overlay[local?] and overlay[caller?] annotations - #22763

Open
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:ql/update-tree-sitter-ql-optional
Open

owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:ql/update-tree-sitter-ql-optional

Conversation

@owen-mc

@owen-mc owen-mc commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

tree-sitter/tree-sitter-ql#26 updated the tree sitter grammar to allow it to parse these annotations with ? in them. This PR updates the dependency on the tree sitter grammar and updates the QL classes so they work correctly.

owen-mc and others added 2 commits October 6, 2026 16:59
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the anonymous question-mark suffix in annotation arguments so overlay[caller?] and overlay[local?] use their dedicated AST classes. Add regression coverage for optional and non-optional overlay annotations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 16:20
@owen-mc
owen-mc requested a review from a team as a code owner October 6, 2026 16:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The grammar update and AST handling are consistent and covered by focused regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Updates QL-for-QL to recognize optional overlay annotation arguments.

Changes:

  • Updates the tree-sitter QL grammar revision.
  • Preserves trailing ? in annotation argument values.
  • Adds regression coverage for optional overlay annotations.
File Description
ql/​ql/​src/​codeql_ql/​ast/​Ast.qll Handles optional annotation arguments.
ql/​extractor/​Cargo.toml Updates the grammar dependency.
ql/​Cargo.lock Locks the updated dependency revision.
ql/​ql/​test/​queries/​overlay/​InlineOverlayCaller/​OverlayAnnotations.ql Tests overlay annotation classes.
ql/​ql/​test/​queries/​overlay/​InlineOverlayCaller/​OverlayAnnotations.expected Records expected annotation results.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@owen-mc
owen-mc requested a review from kaspersv October 6, 2026 16:25
@owen-mc

owen-mc commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

I believe this will fix failed runs like this, because the related PR introduces one of these annotations. I also think it should get rid of the parse errors in the "Make database and analyze" step of "Run QL for QL" runs like this, which has many lines like this:

[2026-10-01 11:28:58] [build-stdout] [2026-10-01 11:28:58] [build-stdout]  WARN javascript/ql/lib/semmle/javascript/internal/CachedStages.qll:88: A parse error occurred. Check the syntax of the file. If the file is invalid, correct the error or exclude the file from analysis.

(There are some other warnings in json files, which are presumably unrelated.)

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants