-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Ruby/Rust/QL: simplify generation of overlay-related tables/predicates #19878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR simplifies overlay support by introducing a databaseMetadata
relation and removing the previous overlay_support
flag and helper function. It updates schema, stats, and generator code to always emit overlay predicates based on the new metadata table.
- Add
databaseMetadata
table definition to both tree-sitter and QL dbscheme files - Remove
overlay_support
parameter andcreate_database_metadata()
function from shared generator - Update language-specific generators and QLL modules to use the new metadata-driven overlay predicates
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
shared/tree-sitter-extractor/src/generator/prefix.dbscheme | Define databaseMetadata table schema |
shared/tree-sitter-extractor/src/generator/mod.rs | Drop overlay_support , always emit overlay predicates |
ruby/extractor/src/generator.rs | Adjust call to generate to new signature |
ql/extractor/src/generator.rs | Adjust call to generate to new signature |
ql/ql/src/ql.dbscheme.stats | Add stats entry for databaseMetadata |
ql/ql/src/ql.dbscheme | Declare databaseMetadata relation |
ql/ql/src/ql/codeql_ql/ast/internal/TreeSitter.qll (and Dbscheme, Blame, JSON) | Inject overlay discard predicates in each module |
Comments suppressed due to low confidence (2)
shared/tree-sitter-extractor/src/generator/prefix.dbscheme:109
- [nitpick] The table name
databaseMetadata
uses camelCase but other relations follow snake_case (e.g.,yaml_locations
). Consider renaming todatabase_metadata
for consistency.
databaseMetadata(
ql/ql/src/ql.dbscheme:112
- No tests were added to verify the presence or correct use of the new
databaseMetadata
relation. Consider adding schema or extraction tests to ensure this relation and its metadata-driven overlay behavior work as intended.
databaseMetadata(
This has no effect on ruby.dbscheme, and adds the relation to ql.dbscheme and rust.dbscheme. (The relation will be required for overlay support).
2889410
to
8678264
Compare
Adding
databaseMetadata
toql.dbscheme
andrust.dbscheme
allows for some simplifications in the shared tree-sitter generator/extractor. Thankfully I was able to do the change in such a way thatruby.dbscheme
doesn't get modified.(Note: Rust will eventually need this relation for overlay support)