Skip to content

Ruby: Use empty DB stats - #21511

Merged
hvitved merged 2 commits into
github:mainfrom
hvitved:ruby/empty-stats
Mar 24, 2026
Merged

Ruby: Use empty DB stats#21511
hvitved merged 2 commits into
github:mainfrom
hvitved:ruby/empty-stats

Conversation

@hvitved

@hvitvedhvitved commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

DCA looks good.

Comment threadruby/ql/lib/codeql/ruby/ast/internal/Scope.qll Fixed
Comment threadruby/ql/lib/codeql/ruby/ast/internal/Scope.qll Fixed
@hvitved
hvitvedforce-pushed the ruby/empty-stats branch 2 times, most recently from 4f6656a to dc8cd62CompareMarch 20, 2026 11:13
@hvitvedhvitved added the no-change-note-required This PR does not need a change note label Mar 20, 2026
@hvitved
hvitved marked this pull request as ready for review March 20, 2026 14:55
@hvitved
hvitved requested a review from a team as a code ownerMarch 20, 2026 14:55
CopilotAI review requested due to automatic review settings March 20, 2026 14:55

CopilotAI 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.

Pull request overview

This PR updates the Ruby CodeQL libraries to improve evaluation behavior (per the referenced DCA check), primarily by adding/adjusting QL pragmas and introducing small wrapper predicates to encourage more predictable/efficient binding and inlining.

Changes:

  • Added/expanded uses of pragma[only_bind_into], pragma[inline], and pragma[inline_late] in several core/framework libraries.
  • Refactored a few predicates/methods into *Impl implementations with thin inline wrappers (notably in AST scope handling and dataflow node scoping).
  • Minor internal factoring in ActiveRecord and dataflow dispatch to isolate sub-conditions into dedicated predicates.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
ruby/ql/lib/codeql/ruby/frameworks/core/Hash.qllAdds only_bind_into to method-call selection for summaries.
ruby/ql/lib/codeql/ruby/frameworks/core/Array.qllAdds only_bind_into to method-call selection for summaries.
ruby/ql/lib/codeql/ruby/frameworks/ActiveRecord.qllAdds nomagic and factors association method-call condition into a helper predicate.
ruby/ql/lib/codeql/ruby/frameworks/actiondispatch/internal/Routing.qllMarks underscore with inline_late.
ruby/ql/lib/codeql/ruby/frameworks/actioncontroller/Filters.qllIntroduces an inline_late wrapper around lookupMethod and uses it for filter callable resolution.
ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qllRefactors getCfgScope into getCfgScopeImpl + inline wrapper; adds a helper predicate for module compatibility.
ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowDispatch.qllFactors private/protected method filtering into inline_late helper predicates.
ruby/ql/lib/codeql/ruby/ast/internal/Scope.qllRefactors cached scope predicates into *Impl and adds inline_late wrappers.
ruby/ql/lib/codeql/ruby/ast/internal/Module.qllAdjusts top-level file restriction logic using a forall-based formulation.
ruby/ql/lib/codeql/ruby/ast/internal/Literal.qllAdds an inline_lategetTokenValue helper and routes token-value reads through it.

@asgerfasgerf 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.

QL changes LGTM

@hvitved
hvitved merged commit cc99867 into github:mainMar 24, 2026
35 checks passed
@hvitved
hvitved deleted the ruby/empty-stats branch March 24, 2026 07:25
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-requiredThis PR does not need a change noteRuby

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@hvitved@asgerf@github-advanced-security