Ruby/Rust/QL: simplify generation of overlay-related tables/predicates#19878
Merged
Ruby/Rust/QL: simplify generation of overlay-related tables/predicates#19878
Conversation
Contributor
There was a problem hiding this comment.
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
databaseMetadatatable definition to both tree-sitter and QL dbscheme files - Remove
overlay_supportparameter 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
databaseMetadatauses camelCase but other relations follow snake_case (e.g.,yaml_locations). Consider renaming todatabase_metadatafor consistency.
databaseMetadata(
ql/ql/src/ql.dbscheme:112
- No tests were added to verify the presence or correct use of the new
databaseMetadatarelation. 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
hvitved
approved these changes
Jun 26, 2025
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.
Adding
databaseMetadatatoql.dbschemeandrust.dbschemeallows for some simplifications in the shared tree-sitter generator/extractor. Thankfully I was able to do the change in such a way thatruby.dbschemedoesn't get modified.(Note: Rust will eventually need this relation for overlay support)