Skip to content
Snippets Groups Projects

search: predicate plans are optional

Merged Administrator requested to merge backend-integration/rvt/factor-pred-plan into main

Created by: rvantonder

In support of https://github.com/sourcegraph/sourcegraph/pull/31577.

Currently all predicates assume we generate and evaluate a subquery, and substitute results into the original query. This assumption was never meant to be a hard constraint--it only worked out that our goal at the time was to implement this behavior.

Predicate syntax itself has no bearing on the behavior (semantics) of evaluating predicates. For example, if someone wanted to add a predicate like file:licenses(GPL), it should be possible, and simple, to just find whether this licenses predicate exists, and access its value GPL. What our internal logic decides to do with those values is completely up to itself and shouldn't impose that a predicate must generate a plan. This is the case with repo:dependencies(...) -- we simply want to access the values.

This PR updates the interface for predicate Plan to return nil if a predicate does not generate a plan or need evaluation. Values of predicates that don't generate plans can be pulled out with a simple helper function (will add in upcoming PR).

There may be more elegant ways to make the current plan/substitution optional, but this suffices for now, in the interest of repo:dependencies(...) work.

Test plan

Added unit tests.

Merge request reports

Merged by avatar (Jul 5, 2025 3:31pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading