Skip to content
Snippets Groups Projects

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

Merged Warren Gifford 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

Approval is optional

Merged by avatar (Jul 11, 2025 8:57am UTC)

Merge details

  • Changes merged into main with dee393e5.
  • Deleted the source branch.

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