Skip to content

dependencies: parse transitive:yes in query & pass to service

Administrator requested to merge mrn/deps-preds into main

Created by: mrnugget

This PR extends the repo:deps() predicate to accept an additional parameter: transitive:yes|no|only.

When transitive:yes is given and a full-fidelity dependency graph has been persisted, transitive + direct dependencies of an indexed lockfile are returned. If it's transitive:no then only direct ones will be returned. transitive:only is ignored for now.

The changes in here can be put into two buckets:

  1. Search query changes to parse/validate transitive:yes in repo:deps().

  2. Grunt work to make sure transitive: is applied only to the repo+revspecs for which it was used. i.e.: if the user specified

    repo:deps(^github\.com/org-\w+/repo.*$@main:v4 transitive:yes) \
      repo:deps(^github\.com/org-\w+/repo2.*$@v5:v6 transitive:no)

    Then the the repo+revs yielded in first predicate should have transitive:yes set, but the repo+revs yielded by second one should not.

Point (2) required a lot of busy work in the service layer to pass the repo+revspec pairs from the search backend to the database layer correctly. But I think the end result is actually easier to understand than what we had before.

With all the bits in place now, I can easily add level:1 or lockfile:client/web/yarn.lock as parameters.

Reviewers

@camdencheek tagging you for the search parts, since we paired on this.

@efritz @stefanhengl @eseliger tagging you for the backend parts.

Test plan

  • Existing and newly modified tests
  • Manual testing

Merge request reports

Loading