Skip to content

Conversation

@nickrolfe
Copy link
Contributor

@nickrolfe nickrolfe commented Jun 25, 2025

Adding databaseMetadata to ql.dbscheme and rust.dbscheme allows for some simplifications in the shared tree-sitter generator/extractor. Thankfully I was able to do the change in such a way that ruby.dbscheme doesn't get modified.

(Note: Rust will eventually need this relation for overlay support)

Copilot AI review requested due to automatic review settings June 25, 2025 12:55
@nickrolfe nickrolfe requested review from a team as code owners June 25, 2025 12:55
Copy link
Contributor

Copilot AI left a 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 and create_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 to database_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(

@nickrolfe nickrolfe marked this pull request as draft June 25, 2025 14:23
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).
@nickrolfe nickrolfe force-pushed the nickrolfe/ql-overlay branch from 2889410 to 8678264 Compare June 25, 2025 14:37
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jun 25, 2025
@nickrolfe nickrolfe changed the title Ruby/QL: simplify generation of overlay-related tables/predicates Ruby/Rust/QL: simplify generation of overlay-related tables/predicates Jun 25, 2025
@nickrolfe nickrolfe marked this pull request as ready for review June 26, 2025 11:21
@nickrolfe nickrolfe requested a review from a team as a code owner June 26, 2025 11:21
@nickrolfe nickrolfe merged commit 5a176d6 into main Jun 26, 2025
58 checks passed
@nickrolfe nickrolfe deleted the nickrolfe/ql-overlay branch June 26, 2025 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

QL-for-QL Ruby Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants